Dave MacLachlan | 2f4d1c2 | 2016-02-03 22:29:27 +0000 | [diff] [blame] | 1 | # J2ObjC Examples |
Michael Thvedt | 583c356 | 2015-08-12 18:09:52 +0000 | [diff] [blame] | 2 | |
| 3 | J2ObjC is an open-source tool that can transpile Java code to Objective-C code, |
Dave MacLachlan | 2f4d1c2 | 2016-02-03 22:29:27 +0000 | [diff] [blame] | 4 | which can then be used by dependent Objective-C code. The J2ObjC repository can |
| 5 | be found at <https://github.com/google/j2objc>. |
Michael Thvedt | 583c356 | 2015-08-12 18:09:52 +0000 | [diff] [blame] | 6 | |
Dave MacLachlan | 2f4d1c2 | 2016-02-03 22:29:27 +0000 | [diff] [blame] | 7 | The example in this directory shows a simple use of J2Objc with a Java library |
| 8 | and an iOS app. |
Michael Thvedt | 583c356 | 2015-08-12 18:09:52 +0000 | [diff] [blame] | 9 | Because it builds an iOS application it can only be run on Mac OSX. |
| 10 | Here, a java_library is transpiled to Objective-C via j2objc_library. |
| 11 | We can then have an objc_library call upon this library. |
| 12 | |
| 13 | Build the top-level application with |
| 14 | `bazel build examples/j2objc:J2ObjcExample`, which when finished emits the |
| 15 | path to a generated .ipa which you can then install to your test device. The |
| 16 | same build will also emits the path to an Xcode project directory which you can |
Dave MacLachlan | 2f4d1c2 | 2016-02-03 22:29:27 +0000 | [diff] [blame] | 17 | open to continue working with the application in Xcode. |