• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..05-Feb-2019-

.settings/H05-Feb-2019-389387

gradle/H05-Feb-2019-2317

msbuild/H05-Feb-2019-5141

src/H05-Feb-2019-70,33051,534

test/H05-Feb-2019-75,09362,185

.gitignoreH A D05-Feb-201953 87

MakefileH A D05-Feb-2019662 4227

README.mdH A D05-Feb-20197.9 KiB265190

allTests.pyH A D05-Feb-2019228 124

build.gradleH A D05-Feb-20191.9 KiB7763

gradle.propertiesH A D05-Feb-20191.8 KiB8167

gradlewH A D05-Feb-20195.2 KiB173128

gradlew.batH A D05-Feb-20192.2 KiB8561

settings.gradleH A D05-Feb-20191.2 KiB3530

README.md

1# Building Ice for Java Compat
2
3This page describes how to build and install Ice for Java from source. If
4you prefer, you can also download a [binary distribution][1].
5
6* [Build Requirements](#build-requirements)
7  * [Operating Systems](#operating-systems)
8  * [Slice to Java Compiler](#slice-to-java-compiler)
9  * [Java Version](#java-version)
10  * [Gradle](#gradle)
11  * [Bzip2 Compression](#bzip2-compression)
12* [Building Ice for Java Compat](#building-ice-for-java-compat-1)
13* [Installing Ice for Java Compat](#installing-ice-for-java-compat)
14* [Running the Java Compat Tests](#running-the-java-compat-tests)
15* [Building the Ice for Android Tests](#building-the-ice-for-android-tests)
16
17## Build Requirements
18
19### Operating Systems
20
21Ice for Java builds and runs properly on Windows, macOS, and any recent
22Linux distribution, and is fully supported on the platforms listed on the
23[supported platforms][2] page.
24
25### Slice to Java Compiler
26
27You need the Slice to Java compiler to build Ice for Java and also to use
28Ice for Java. The Slice to Java compiler (`slice2java`) is a command-line tool
29written in C++. You can build the Slice to Java compiler from source, or
30alternatively you can install an Ice [binary distribution][1] that includes
31this compiler.
32
33### Java Version
34
35Ice for Java requires J2SE 1.7.0 or later.
36
37Make sure that the `javac` and `java` commands are present in your PATH.
38
39### Gradle
40
41Ice for Java uses the [Gradle][3] build system, and includes the Gradle wrapper
42in the distribution. You cannot build the Ice for Java source distribution without
43an Internet connection. Gradle will download all required packages automatically
44from Maven Central repository located at http://central.maven.org/maven2/
45
46### Bzip2 Compression
47
48Ice for Java supports protocol compression using the bzip2 classes included
49with [Apache Commons Compress][4].
50
51The Maven package id for the commons-compress JAR file is as follows:
52
53```
54groupId=org.apache.commons, version=1.14, artifactId=commons-compress
55```
56
57The demos and tests are automatically setup to enable protocol compression by
58adding the commons-compress JAR to the manifest class path. For your own
59applications you must add the commons-compress JAR to the application CLASSPATH
60to enable protocol compression.
61
62> *These classes are a pure Java implementation of the bzip2 algorithm and
63therefore add significant latency to Ice requests.*
64
65## Building Ice for Java
66
67The build system requires the Slice to Java compiler from Ice for C++. If you
68have not built Ice for C++ in this source distribution, you must set the
69`ICE_HOME` environment variable with the path name of your Ice installation. For
70example, on Linux:
71
72```
73export ICE_HOME=/opt/Ice-3.7.2 (For local build)
74export ICE_HOME=/usr (For RPM installation)
75```
76
77On Windows:
78
79```
80set ICE_HOME=C:\Program Files\ZeroC\Ice-3.7.2 (MSI installation)
81```
82
83On Windows if you are using Ice for C++ from a source distribution, you must set
84the `CPP_PLATFORM` and `CPP_CONFIGURATION` environment variables to match the
85platform and configuration used in your C++ build:
86
87```
88set CPP_PLATFORM=x64
89set CPP_CONFIGURATION=Debug
90```
91
92The supported values for `CPP_PLATFORM` are `Win32` and `x64` and the supported
93values for `CPP_CONFIGURATION` are `Debug` and `Release`.
94
95Before building Ice for Java, review the settings in the file `gradle.properties`
96and edit as necessary.
97
98To build Ice, all services, and tests, run
99
100```
101gradlew build
102```
103
104Upon completion, the Ice JAR and POM files are placed in the `lib` subdirectory.
105
106If at any time you wish to discard the current build and start a new one, use
107these commands:
108
109```
110gradlew clean
111gradlew build
112```
113
114## Installing Ice for Java
115
116To install Ice for Java in the directory specified by the `prefix` variable in
117`gradle.properties` run the following command:
118
119```
120gradlew install
121```
122
123The installation installs the following JAR files to `<prefix>/lib`.
124
125```
126glacier2-compat-3.7.2.jar
127ice-compat-3.7.2.jar
128icebox-compat-3.7.2.jar
129icebt-compat-3.7.2.jar
130icediscovery-compat-3.7.2.jar
131icegrid-compat-3.7.2.jar
132icelocatordiscovery-compat-3.7.2.jar
133icepatch2-compat-3.7.2.jar
134icestorm-compat-3.7.2.jar
135```
136
137POM files are also installed for ease of deployment to a Maven-based
138distribution system.
139
140## Running the Java Tests
141
142Some of the Ice for Java tests employ applications that are part of the Ice for
143C++ distribution. If you have not built Ice for C++ in this source distribution
144then you must set the `ICE_HOME` environment variable with the path name of your
145Ice installation. On Linux or macOS:
146
147```
148export ICE_HOME=/opt/Ice-3.7.2 (For local build)
149export ICE_HOME=/usr (For RPM installation)
150```
151
152On Windows:
153
154```
155set ICE_HOME=C:\Program Files\ZeroC\Ice-3.7.2
156```
157
158Python is required to run the test suite. To run the tests, open a command
159window and change to the top-level directory. At the command prompt, execute:
160
161```
162python allTests.py
163```
164
165If everything worked out, you should see lots of `ok` messages. In case of a
166failure, the tests abort with `failed`.
167
168## Building the Ice for Android Tests
169
170The `test/android/controller` directory contains an Android Studio project
171for the Ice test suite controller.
172
173### Build Requirements
174
175Building any Ice application for Android requires Android Studio and the Android
176SDK build tools. We tested with the following components:
177
178- Android Studio 3.2.1
179- Android SDK 21
180- Android Build Tools 27.0.1
181
182Ice requires at minimum API level 21:
183
184- Android 5 (API21)
185
186If you want to target a later version of the Android API level for the test
187suite, edit `test/android/controller/gradle.properties` and change the
188following variables:
189
190```
191ice_compileSdkVersion
192ice_minSdkVersion
193ice_targetSdkVersion
194```
195
196*NOTE: Do not use Android Studio to modify the project's settings.*
197
198### Building the Android Test Controller
199
200You must first build Ice for Java refer to [Building Ice for Java](#building-ice-for-java-1)
201for instructions, then follow these steps:
202
2031. Start Android Studio
2042. Select "Open an existing Android Studio project"
2053. Navigate to and select the "android" subdirectory
2064. Click OK and wait for the project to open and build
207
208## Running the Android Tests
209
210The Android Studio project contains a `controller` app for the Ice test
211suite. Prior to running the app, you must disable Android Studio's Instant Run
212feature, located in File / Settings / Build, Execution, Deployment /
213Instant Run.
214
215Tests are started from the dev machine using the `allTests.py` script, similar
216to the other language mappings. The script uses Ice for Python to communicate
217with the Android app, therefore you must build the [Python mapping]
218(../../python) before continuing.
219
220You also need to add the `tools\bin`, `platform-tools` and `emulator`
221directories from the Android SDK to your PATH. On macOS, you can use the
222following commands:
223
224```
225export PATH=~/Library/Android/sdk/tools/bin:$PATH
226export PATH=~/Library/Android/sdk/platform-tools:$PATH
227export PATH=~/Library/Android/sdk/emulator:$PATH
228```
229
230On Windows, you can use the following commands:
231
232```
233set PATH=%LOCALAPPDATA%\Android\sdk\tools\bin;%PATH%
234set PATH=%LOCALAPPDATA%\Android\sdk\platform-tools;%PATH%
235set PATH=%LOCALAPPDATA%\Android\sdk\emulator;%PATH%
236```
237
238Run the tests with the Android emulator by running the following command:
239
240```
241python allTests.py --android --controller-app
242```
243
244To run the tests on a Android device connected through USB, you can use
245the `--device=usb` option as shown below:
246
247```
248python allTests.py --android --device=usb --controller-app
249```
250
251To connect to an Android device that is running adb you can use the
252`--device=<ip-address>`
253
254```
255python allTests.py --android --device=<ip-address> --controller-app
256```
257
258To run the tests against a `controller` application started from Android
259Studio you should omit the `--controller-app` option from the commands above.
260
261[1]: https://zeroc.com/distributions/ice
262[2]: https://doc.zeroc.com/display/Rel/Supported+Platforms+for+Ice+3.7.2
263[3]: https://gradle.org
264[4]: https://commons.apache.org/proper/commons-compress/
265