-
Notifications
You must be signed in to change notification settings - Fork 90
j2objc instructions
The hope is that with j2objc we can use the Java model objects in Shared/src/ to generate the Objective-C classes for the experiment definition and the generic algorithms for schedule generation and server communication.
j2objc.org is the home j2objc.
Our current branch for the new iOS development is merge_model20.
It includes the j2objc build rules and search path configs in XCode.
It needs one manual step. Insert a j2objc library in the folder above the root folder. This is a gigantic library and caused us to cross the Github project size limit, so, for now we don't check it in.
Grab the J2Objc release version 1.0.2 at https://github.com/google/j2objc/releases/tag/1.0.2.
We also need to have a transpiled version of the Joda library. Joda is the only dependency in the Shared/src codebase but we use it extensively in schedule generation.
TBD instructions for Joda transpiled library.
There is one test class now in the PacoTest folder of the iOS project that tests the generated classes. It is just a sanity check of some basic constructions. The Java src files are added to the XCode project as sources and the transpiled classes are added to the derived files directory with the other built files (Objective C, etc..).
Configuring transpiled symbol names: In the Shared folder, there is a j2objc configuration file, called j2objprefixes.properties. Here we define the transpilation customizations. For instance, this sets the class prefix for all Java transpiled classes for the package com.pacoapp.paco to be 'PA'.
Ideally, we want to use transpiled classes to keep from having to write Java, Objective-C, and Javascript classes for the model and the scheduling algorithms etc.. However, it is an open question if working in code with the transpiled symbols would be cumbersome or if it will be acceptable. We can configure the naming conventions to some degree, as above, and the j2objc team says that they are still working on naming conventions and are open to comments.
Updated Install Description
- Download J2Objc version 1.1 or fetch latest from version of J2Objc git and build. Instructions can be found on the j2objc getting started page
Place the j2objc at the same level as the poco folder so your directory structure should look as follows
|
- paco |
- J2Objc
-
Download Joda jar version 2.9.2. copy the jar file to paco/shared
-
Download Joda source and transpile to objective-C
$ mkdir joda
$ git clone https://github.com/JodaOrg/joda-time
$ git clone https://github.com/JodaOrg/joda-convert
$ j2objc -d build -classpath $J2OBJC_DIST/lib/j2objc_guava.jar
-sourcepath joda-time/src/main/java:joda-convert/src/main/java
--build-closure
find joda-time/src/main/java -name '*.java'
-
copy generated objective-c files to directory: paco/Paco-iOS/J2ObjcLibrary/JodaCompile/JodaCompile/ by copying the org directory so you preserve the directory structure.
-
XCode verify the variable J2OBJC_HOME is correctly sent in the Config.xcconfig file.
-
clean the paco project
-
build the paco project.
build should be successful and you should be able start the simulator.