- JDK 1.8
- Apple Mac OS X system
- Latest version of Xcode
- Apache Maven
- (Recommended but not required) Google Protocol Buffer source
To build from a command-line in a Terminal window, run:
# Build just the translator and libraries
# Build the full distribution (including frameworks)
# Build the protocol buffer compiler and runtime for J2ObjC
# Build everything that is included in the project's distribution bundles
Optional Setup for Protocol Buffers
The J2ObjC Protocol Buffers compiler and runtime require that Protocol Buffers 3.3.0 be installed:
- Download the source code from the Protocol Buffers 3.3.0 release.
- Follow the C++ installation instructions from the README. Pay attention to the
--prefixoption to specify your install location.
- Define the
PROTOBUF_ROOT_DIRenvironment variable to point to your Protocol Buffers install location.
Post Java 8 language features.
See announcement. In addition to the steps in the previous section, a JRE module needs to be built with the JDK 11:
JAVA_HOME=`/usr/libexec/java_home -v 11` \ make -C jre_emul/ -f java.mk emul_module_dist
To test from a command-line in a Terminal window, run:
# Run translator and library unit tests
# Run all unit tests, including for protocol buffers
Cleaning/Resetting a Build
# Remove all files generated by the build
The J2ObjC build supports parallel builds, which are specified using the
-j<n> flag, where n is
the maximum number of concurrent tasks. The maximum depends on how fast/powerful your system is; we
suggest starting with
-j4. Increase the number to shorten build times if your system can handle
it, and decrease it if make fails with system errors.
Building Processor Architectures
As of j2objc release 2.3, 32-bit iOS architectures ("iphone" and "simulator") are not included in the public distribution. You can build j2objc with these by first specifying the J2OBJC_ARCHS environment variable:
$ export J2OBJC_ARCHS="iphone simulator macosx iphone64 watchv7k watch64 watchsimulator simulator64" $ make -j8 all_dist
This can also be used to speed up the build, by only specifying the architectures your app needs.
To only build the 64-bit iOS ("iphone64") and its associated simulator ("simulator64"), for
J2OBJC_ARCHS="iphone64 simulator64" before running make.