├── .gitignore ├── J2ObjCExample ├── .gitignore ├── J2ObjCExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── J2ObjCExample.xccheckout ├── J2ObjCExample │ ├── AppConfig.xcconfig │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── J2ObjCExampleTests │ ├── Info.plist │ └── J2ObjCExampleTests.m ├── SharedCode │ └── LibConfig.xcconfig └── SharedCodeTests │ └── Info.plist ├── README.md ├── java └── org │ └── j2objc │ └── sample │ └── shared │ └── SampleClass.java └── screenshots ├── 1-add-target.png ├── 2-choose-static-lib.png ├── 3-fix-group-path.png ├── 4-add-xcconfig.png ├── 5-use-xcconfig.png ├── 6-add-java-sources.png ├── 7-add-build-rule.png └── 8-add-dependency.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.un~ 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /J2ObjCExample/.gitignore: -------------------------------------------------------------------------------- 1 | *.xcodeproj/xcuserdata/ 2 | *.xcodeproj/project.xcworkspace/xcuserdata/ 3 | .DS_Store 4 | Generated/ 5 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DC94A2AB1A65B7920039F72C /* AppConfig.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */; }; 11 | DCCFC5711A65A9A80008847D /* libSharedCode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDD536D1A64B9A500C626F1 /* libSharedCode.a */; }; 12 | DCCFC57F1A65AE960008847D /* SampleClass.java in Sources */ = {isa = PBXBuildFile; fileRef = DCCFC57E1A65AE960008847D /* SampleClass.java */; }; 13 | DCDD53461A64B84900C626F1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DCDD53451A64B84900C626F1 /* main.m */; }; 14 | DCDD53491A64B84900C626F1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DCDD53481A64B84900C626F1 /* AppDelegate.m */; }; 15 | DCDD534C1A64B84900C626F1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DCDD534B1A64B84900C626F1 /* ViewController.m */; }; 16 | DCDD534F1A64B84900C626F1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DCDD534D1A64B84900C626F1 /* Main.storyboard */; }; 17 | DCDD53511A64B84900C626F1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCDD53501A64B84900C626F1 /* Images.xcassets */; }; 18 | DCDD53541A64B84900C626F1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCDD53521A64B84900C626F1 /* LaunchScreen.xib */; }; 19 | DCDD53601A64B84900C626F1 /* J2ObjCExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DCDD535F1A64B84900C626F1 /* J2ObjCExampleTests.m */; }; 20 | DCDD53781A64B9A500C626F1 /* libSharedCode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDD536D1A64B9A500C626F1 /* libSharedCode.a */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXBuildRule section */ 24 | DCCFC5601A65A76F0008847D /* PBXBuildRule */ = { 25 | isa = PBXBuildRule; 26 | compilerSpec = com.apple.compilers.proxy.script; 27 | fileType = sourcecode.java; 28 | isEditable = 1; 29 | outputFiles = ( 30 | "${GENERATED_FILES_DIR}/${INPUT_FILE_BASE}.h", 31 | "${GENERATED_FILES_DIR}/${INPUT_FILE_BASE}.m", 32 | ); 33 | script = "if [ ! -f \"${J2OBJC_HOME}/j2objc\" ]; then echo \"J2OBJC_HOME not correctly defined in LibConfig.xcconfig, currently set to '${J2OBJC_HOME}'\"; exit 1; fi;\n\n\"${J2OBJC_HOME}/j2objc\" -d ${GENERATED_FILES_DIR} -sourcepath \"${JAVA_SOURCE_PATH}\" --no-package-directories --no-class-methods -g ${INPUT_FILE_PATH};\n\n# Optionally, you may also set prefix for your java packages by adding --prefix.\n# \"${J2OBJC_HOME}/j2objc\" -d ${GENERATED_FILES_DIR} -sourcepath \"${JAVA_SOURCE_PATH}\" --no-package-directories --prefix org.j2objc.sample.shared=OJSS --no-class-methods -g ${INPUT_FILE_PATH};"; 34 | }; 35 | /* End PBXBuildRule section */ 36 | 37 | /* Begin PBXContainerItemProxy section */ 38 | DCCFC56F1A65A9A60008847D /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = DCDD53381A64B84900C626F1 /* Project object */; 41 | proxyType = 1; 42 | remoteGlobalIDString = DCDD536C1A64B9A500C626F1; 43 | remoteInfo = SharedCode; 44 | }; 45 | DCDD535A1A64B84900C626F1 /* PBXContainerItemProxy */ = { 46 | isa = PBXContainerItemProxy; 47 | containerPortal = DCDD53381A64B84900C626F1 /* Project object */; 48 | proxyType = 1; 49 | remoteGlobalIDString = DCDD533F1A64B84900C626F1; 50 | remoteInfo = J2ObjCExample; 51 | }; 52 | DCDD53791A64B9A500C626F1 /* PBXContainerItemProxy */ = { 53 | isa = PBXContainerItemProxy; 54 | containerPortal = DCDD53381A64B84900C626F1 /* Project object */; 55 | proxyType = 1; 56 | remoteGlobalIDString = DCDD536C1A64B9A500C626F1; 57 | remoteInfo = SharedCode; 58 | }; 59 | /* End PBXContainerItemProxy section */ 60 | 61 | /* Begin PBXCopyFilesBuildPhase section */ 62 | DCDD536B1A64B9A500C626F1 /* CopyFiles */ = { 63 | isa = PBXCopyFilesBuildPhase; 64 | buildActionMask = 2147483647; 65 | dstPath = "include/$(PRODUCT_NAME)"; 66 | dstSubfolderSpec = 16; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXCopyFilesBuildPhase section */ 72 | 73 | /* Begin PBXFileReference section */ 74 | DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = LibConfig.xcconfig; sourceTree = ""; }; 75 | DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = AppConfig.xcconfig; sourceTree = ""; }; 76 | DCCFC57E1A65AE960008847D /* SampleClass.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; path = SampleClass.java; sourceTree = ""; }; 77 | DCDD53401A64B84900C626F1 /* J2ObjCExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = J2ObjCExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | DCDD53441A64B84900C626F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 79 | DCDD53451A64B84900C626F1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 80 | DCDD53471A64B84900C626F1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 81 | DCDD53481A64B84900C626F1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 82 | DCDD534A1A64B84900C626F1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 83 | DCDD534B1A64B84900C626F1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 84 | DCDD534E1A64B84900C626F1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 85 | DCDD53501A64B84900C626F1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 86 | DCDD53531A64B84900C626F1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 87 | DCDD53591A64B84900C626F1 /* J2ObjCExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = J2ObjCExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 88 | DCDD535E1A64B84900C626F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 89 | DCDD535F1A64B84900C626F1 /* J2ObjCExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = J2ObjCExampleTests.m; sourceTree = ""; }; 90 | DCDD536D1A64B9A500C626F1 /* libSharedCode.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSharedCode.a; sourceTree = BUILT_PRODUCTS_DIR; }; 91 | DCDD53771A64B9A500C626F1 /* SharedCodeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SharedCodeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 92 | DCDD537D1A64B9A500C626F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 93 | /* End PBXFileReference section */ 94 | 95 | /* Begin PBXFrameworksBuildPhase section */ 96 | DCDD533D1A64B84900C626F1 /* Frameworks */ = { 97 | isa = PBXFrameworksBuildPhase; 98 | buildActionMask = 2147483647; 99 | files = ( 100 | DCCFC5711A65A9A80008847D /* libSharedCode.a in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | DCDD53561A64B84900C626F1 /* Frameworks */ = { 105 | isa = PBXFrameworksBuildPhase; 106 | buildActionMask = 2147483647; 107 | files = ( 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | DCDD536A1A64B9A500C626F1 /* Frameworks */ = { 112 | isa = PBXFrameworksBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | ); 116 | runOnlyForDeploymentPostprocessing = 0; 117 | }; 118 | DCDD53741A64B9A500C626F1 /* Frameworks */ = { 119 | isa = PBXFrameworksBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | DCDD53781A64B9A500C626F1 /* libSharedCode.a in Frameworks */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXFrameworksBuildPhase section */ 127 | 128 | /* Begin PBXGroup section */ 129 | DCCFC5791A65AE960008847D /* java */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | DCCFC57A1A65AE960008847D /* org */, 133 | ); 134 | name = java; 135 | path = ../../java; 136 | sourceTree = ""; 137 | }; 138 | DCCFC57A1A65AE960008847D /* org */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | DCCFC57B1A65AE960008847D /* j2objc */, 142 | ); 143 | path = org; 144 | sourceTree = ""; 145 | }; 146 | DCCFC57B1A65AE960008847D /* j2objc */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | DCCFC57C1A65AE960008847D /* sample */, 150 | ); 151 | path = j2objc; 152 | sourceTree = ""; 153 | }; 154 | DCCFC57C1A65AE960008847D /* sample */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | DCCFC57D1A65AE960008847D /* shared */, 158 | ); 159 | path = sample; 160 | sourceTree = ""; 161 | }; 162 | DCCFC57D1A65AE960008847D /* shared */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | DCCFC57E1A65AE960008847D /* SampleClass.java */, 166 | ); 167 | path = shared; 168 | sourceTree = ""; 169 | }; 170 | DCDD53371A64B84900C626F1 = { 171 | isa = PBXGroup; 172 | children = ( 173 | DCDD53421A64B84900C626F1 /* J2ObjCExample */, 174 | DCDD535C1A64B84900C626F1 /* J2ObjCExampleTests */, 175 | DCDD536E1A64B9A500C626F1 /* SharedCode */, 176 | DCDD537B1A64B9A500C626F1 /* SharedCodeTests */, 177 | DCDD53411A64B84900C626F1 /* Products */, 178 | ); 179 | sourceTree = ""; 180 | }; 181 | DCDD53411A64B84900C626F1 /* Products */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | DCDD53401A64B84900C626F1 /* J2ObjCExample.app */, 185 | DCDD53591A64B84900C626F1 /* J2ObjCExampleTests.xctest */, 186 | DCDD536D1A64B9A500C626F1 /* libSharedCode.a */, 187 | DCDD53771A64B9A500C626F1 /* SharedCodeTests.xctest */, 188 | ); 189 | name = Products; 190 | sourceTree = ""; 191 | }; 192 | DCDD53421A64B84900C626F1 /* J2ObjCExample */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | DCDD53471A64B84900C626F1 /* AppDelegate.h */, 196 | DCDD53481A64B84900C626F1 /* AppDelegate.m */, 197 | DCDD534A1A64B84900C626F1 /* ViewController.h */, 198 | DCDD534B1A64B84900C626F1 /* ViewController.m */, 199 | DCDD534D1A64B84900C626F1 /* Main.storyboard */, 200 | DCDD53501A64B84900C626F1 /* Images.xcassets */, 201 | DCDD53521A64B84900C626F1 /* LaunchScreen.xib */, 202 | DCDD53431A64B84900C626F1 /* Supporting Files */, 203 | DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */, 204 | ); 205 | path = J2ObjCExample; 206 | sourceTree = ""; 207 | }; 208 | DCDD53431A64B84900C626F1 /* Supporting Files */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | DCDD53441A64B84900C626F1 /* Info.plist */, 212 | DCDD53451A64B84900C626F1 /* main.m */, 213 | ); 214 | name = "Supporting Files"; 215 | sourceTree = ""; 216 | }; 217 | DCDD535C1A64B84900C626F1 /* J2ObjCExampleTests */ = { 218 | isa = PBXGroup; 219 | children = ( 220 | DCDD535F1A64B84900C626F1 /* J2ObjCExampleTests.m */, 221 | DCDD535D1A64B84900C626F1 /* Supporting Files */, 222 | ); 223 | path = J2ObjCExampleTests; 224 | sourceTree = ""; 225 | }; 226 | DCDD535D1A64B84900C626F1 /* Supporting Files */ = { 227 | isa = PBXGroup; 228 | children = ( 229 | DCDD535E1A64B84900C626F1 /* Info.plist */, 230 | ); 231 | name = "Supporting Files"; 232 | sourceTree = ""; 233 | }; 234 | DCDD536E1A64B9A500C626F1 /* SharedCode */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */, 238 | DCCFC5791A65AE960008847D /* java */, 239 | ); 240 | path = SharedCode; 241 | sourceTree = ""; 242 | }; 243 | DCDD537B1A64B9A500C626F1 /* SharedCodeTests */ = { 244 | isa = PBXGroup; 245 | children = ( 246 | DCDD537C1A64B9A500C626F1 /* Supporting Files */, 247 | ); 248 | path = SharedCodeTests; 249 | sourceTree = ""; 250 | }; 251 | DCDD537C1A64B9A500C626F1 /* Supporting Files */ = { 252 | isa = PBXGroup; 253 | children = ( 254 | DCDD537D1A64B9A500C626F1 /* Info.plist */, 255 | ); 256 | name = "Supporting Files"; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXGroup section */ 260 | 261 | /* Begin PBXNativeTarget section */ 262 | DCDD533F1A64B84900C626F1 /* J2ObjCExample */ = { 263 | isa = PBXNativeTarget; 264 | buildConfigurationList = DCDD53631A64B84900C626F1 /* Build configuration list for PBXNativeTarget "J2ObjCExample" */; 265 | buildPhases = ( 266 | DCDD533C1A64B84900C626F1 /* Sources */, 267 | DCDD533D1A64B84900C626F1 /* Frameworks */, 268 | DCDD533E1A64B84900C626F1 /* Resources */, 269 | ); 270 | buildRules = ( 271 | ); 272 | dependencies = ( 273 | DCCFC5701A65A9A60008847D /* PBXTargetDependency */, 274 | ); 275 | name = J2ObjCExample; 276 | productName = J2ObjCExample; 277 | productReference = DCDD53401A64B84900C626F1 /* J2ObjCExample.app */; 278 | productType = "com.apple.product-type.application"; 279 | }; 280 | DCDD53581A64B84900C626F1 /* J2ObjCExampleTests */ = { 281 | isa = PBXNativeTarget; 282 | buildConfigurationList = DCDD53661A64B84900C626F1 /* Build configuration list for PBXNativeTarget "J2ObjCExampleTests" */; 283 | buildPhases = ( 284 | DCDD53551A64B84900C626F1 /* Sources */, 285 | DCDD53561A64B84900C626F1 /* Frameworks */, 286 | DCDD53571A64B84900C626F1 /* Resources */, 287 | ); 288 | buildRules = ( 289 | ); 290 | dependencies = ( 291 | DCDD535B1A64B84900C626F1 /* PBXTargetDependency */, 292 | ); 293 | name = J2ObjCExampleTests; 294 | productName = J2ObjCExampleTests; 295 | productReference = DCDD53591A64B84900C626F1 /* J2ObjCExampleTests.xctest */; 296 | productType = "com.apple.product-type.bundle.unit-test"; 297 | }; 298 | DCDD536C1A64B9A500C626F1 /* SharedCode */ = { 299 | isa = PBXNativeTarget; 300 | buildConfigurationList = DCDD53821A64B9A500C626F1 /* Build configuration list for PBXNativeTarget "SharedCode" */; 301 | buildPhases = ( 302 | DCDD53691A64B9A500C626F1 /* Sources */, 303 | DCDD536A1A64B9A500C626F1 /* Frameworks */, 304 | DCDD536B1A64B9A500C626F1 /* CopyFiles */, 305 | ); 306 | buildRules = ( 307 | DCCFC5601A65A76F0008847D /* PBXBuildRule */, 308 | ); 309 | dependencies = ( 310 | ); 311 | name = SharedCode; 312 | productName = SharedCode; 313 | productReference = DCDD536D1A64B9A500C626F1 /* libSharedCode.a */; 314 | productType = "com.apple.product-type.library.static"; 315 | }; 316 | DCDD53761A64B9A500C626F1 /* SharedCodeTests */ = { 317 | isa = PBXNativeTarget; 318 | buildConfigurationList = DCDD53831A64B9A500C626F1 /* Build configuration list for PBXNativeTarget "SharedCodeTests" */; 319 | buildPhases = ( 320 | DCDD53731A64B9A500C626F1 /* Sources */, 321 | DCDD53741A64B9A500C626F1 /* Frameworks */, 322 | DCDD53751A64B9A500C626F1 /* Resources */, 323 | ); 324 | buildRules = ( 325 | ); 326 | dependencies = ( 327 | DCDD537A1A64B9A500C626F1 /* PBXTargetDependency */, 328 | ); 329 | name = SharedCodeTests; 330 | productName = SharedCodeTests; 331 | productReference = DCDD53771A64B9A500C626F1 /* SharedCodeTests.xctest */; 332 | productType = "com.apple.product-type.bundle.unit-test"; 333 | }; 334 | /* End PBXNativeTarget section */ 335 | 336 | /* Begin PBXProject section */ 337 | DCDD53381A64B84900C626F1 /* Project object */ = { 338 | isa = PBXProject; 339 | attributes = { 340 | LastUpgradeCheck = 0610; 341 | ORGANIZATIONNAME = j2objc; 342 | TargetAttributes = { 343 | DCDD533F1A64B84900C626F1 = { 344 | CreatedOnToolsVersion = 6.1.1; 345 | }; 346 | DCDD53581A64B84900C626F1 = { 347 | CreatedOnToolsVersion = 6.1.1; 348 | TestTargetID = DCDD533F1A64B84900C626F1; 349 | }; 350 | DCDD536C1A64B9A500C626F1 = { 351 | CreatedOnToolsVersion = 6.1.1; 352 | }; 353 | DCDD53761A64B9A500C626F1 = { 354 | CreatedOnToolsVersion = 6.1.1; 355 | }; 356 | }; 357 | }; 358 | buildConfigurationList = DCDD533B1A64B84900C626F1 /* Build configuration list for PBXProject "J2ObjCExample" */; 359 | compatibilityVersion = "Xcode 3.2"; 360 | developmentRegion = English; 361 | hasScannedForEncodings = 0; 362 | knownRegions = ( 363 | en, 364 | Base, 365 | ); 366 | mainGroup = DCDD53371A64B84900C626F1; 367 | productRefGroup = DCDD53411A64B84900C626F1 /* Products */; 368 | projectDirPath = ""; 369 | projectRoot = ""; 370 | targets = ( 371 | DCDD533F1A64B84900C626F1 /* J2ObjCExample */, 372 | DCDD53581A64B84900C626F1 /* J2ObjCExampleTests */, 373 | DCDD536C1A64B9A500C626F1 /* SharedCode */, 374 | DCDD53761A64B9A500C626F1 /* SharedCodeTests */, 375 | ); 376 | }; 377 | /* End PBXProject section */ 378 | 379 | /* Begin PBXResourcesBuildPhase section */ 380 | DCDD533E1A64B84900C626F1 /* Resources */ = { 381 | isa = PBXResourcesBuildPhase; 382 | buildActionMask = 2147483647; 383 | files = ( 384 | DC94A2AB1A65B7920039F72C /* AppConfig.xcconfig in Resources */, 385 | DCDD534F1A64B84900C626F1 /* Main.storyboard in Resources */, 386 | DCDD53541A64B84900C626F1 /* LaunchScreen.xib in Resources */, 387 | DCDD53511A64B84900C626F1 /* Images.xcassets in Resources */, 388 | ); 389 | runOnlyForDeploymentPostprocessing = 0; 390 | }; 391 | DCDD53571A64B84900C626F1 /* Resources */ = { 392 | isa = PBXResourcesBuildPhase; 393 | buildActionMask = 2147483647; 394 | files = ( 395 | ); 396 | runOnlyForDeploymentPostprocessing = 0; 397 | }; 398 | DCDD53751A64B9A500C626F1 /* Resources */ = { 399 | isa = PBXResourcesBuildPhase; 400 | buildActionMask = 2147483647; 401 | files = ( 402 | ); 403 | runOnlyForDeploymentPostprocessing = 0; 404 | }; 405 | /* End PBXResourcesBuildPhase section */ 406 | 407 | /* Begin PBXSourcesBuildPhase section */ 408 | DCDD533C1A64B84900C626F1 /* Sources */ = { 409 | isa = PBXSourcesBuildPhase; 410 | buildActionMask = 2147483647; 411 | files = ( 412 | DCDD534C1A64B84900C626F1 /* ViewController.m in Sources */, 413 | DCDD53491A64B84900C626F1 /* AppDelegate.m in Sources */, 414 | DCDD53461A64B84900C626F1 /* main.m in Sources */, 415 | ); 416 | runOnlyForDeploymentPostprocessing = 0; 417 | }; 418 | DCDD53551A64B84900C626F1 /* Sources */ = { 419 | isa = PBXSourcesBuildPhase; 420 | buildActionMask = 2147483647; 421 | files = ( 422 | DCDD53601A64B84900C626F1 /* J2ObjCExampleTests.m in Sources */, 423 | ); 424 | runOnlyForDeploymentPostprocessing = 0; 425 | }; 426 | DCDD53691A64B9A500C626F1 /* Sources */ = { 427 | isa = PBXSourcesBuildPhase; 428 | buildActionMask = 2147483647; 429 | files = ( 430 | DCCFC57F1A65AE960008847D /* SampleClass.java in Sources */, 431 | ); 432 | runOnlyForDeploymentPostprocessing = 0; 433 | }; 434 | DCDD53731A64B9A500C626F1 /* Sources */ = { 435 | isa = PBXSourcesBuildPhase; 436 | buildActionMask = 2147483647; 437 | files = ( 438 | ); 439 | runOnlyForDeploymentPostprocessing = 0; 440 | }; 441 | /* End PBXSourcesBuildPhase section */ 442 | 443 | /* Begin PBXTargetDependency section */ 444 | DCCFC5701A65A9A60008847D /* PBXTargetDependency */ = { 445 | isa = PBXTargetDependency; 446 | target = DCDD536C1A64B9A500C626F1 /* SharedCode */; 447 | targetProxy = DCCFC56F1A65A9A60008847D /* PBXContainerItemProxy */; 448 | }; 449 | DCDD535B1A64B84900C626F1 /* PBXTargetDependency */ = { 450 | isa = PBXTargetDependency; 451 | target = DCDD533F1A64B84900C626F1 /* J2ObjCExample */; 452 | targetProxy = DCDD535A1A64B84900C626F1 /* PBXContainerItemProxy */; 453 | }; 454 | DCDD537A1A64B9A500C626F1 /* PBXTargetDependency */ = { 455 | isa = PBXTargetDependency; 456 | target = DCDD536C1A64B9A500C626F1 /* SharedCode */; 457 | targetProxy = DCDD53791A64B9A500C626F1 /* PBXContainerItemProxy */; 458 | }; 459 | /* End PBXTargetDependency section */ 460 | 461 | /* Begin PBXVariantGroup section */ 462 | DCDD534D1A64B84900C626F1 /* Main.storyboard */ = { 463 | isa = PBXVariantGroup; 464 | children = ( 465 | DCDD534E1A64B84900C626F1 /* Base */, 466 | ); 467 | name = Main.storyboard; 468 | sourceTree = ""; 469 | }; 470 | DCDD53521A64B84900C626F1 /* LaunchScreen.xib */ = { 471 | isa = PBXVariantGroup; 472 | children = ( 473 | DCDD53531A64B84900C626F1 /* Base */, 474 | ); 475 | name = LaunchScreen.xib; 476 | sourceTree = ""; 477 | }; 478 | /* End PBXVariantGroup section */ 479 | 480 | /* Begin XCBuildConfiguration section */ 481 | DCDD53611A64B84900C626F1 /* Debug */ = { 482 | isa = XCBuildConfiguration; 483 | buildSettings = { 484 | ALWAYS_SEARCH_USER_PATHS = NO; 485 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 486 | CLANG_CXX_LIBRARY = "libc++"; 487 | CLANG_ENABLE_MODULES = YES; 488 | CLANG_ENABLE_OBJC_ARC = YES; 489 | CLANG_WARN_BOOL_CONVERSION = YES; 490 | CLANG_WARN_CONSTANT_CONVERSION = YES; 491 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 492 | CLANG_WARN_EMPTY_BODY = YES; 493 | CLANG_WARN_ENUM_CONVERSION = YES; 494 | CLANG_WARN_INT_CONVERSION = YES; 495 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 496 | CLANG_WARN_UNREACHABLE_CODE = YES; 497 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 498 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 499 | COPY_PHASE_STRIP = NO; 500 | ENABLE_STRICT_OBJC_MSGSEND = YES; 501 | GCC_C_LANGUAGE_STANDARD = gnu99; 502 | GCC_DYNAMIC_NO_PIC = NO; 503 | GCC_OPTIMIZATION_LEVEL = 0; 504 | GCC_PREPROCESSOR_DEFINITIONS = ( 505 | "DEBUG=1", 506 | "$(inherited)", 507 | ); 508 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 509 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 510 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 511 | GCC_WARN_UNDECLARED_SELECTOR = YES; 512 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 513 | GCC_WARN_UNUSED_FUNCTION = YES; 514 | GCC_WARN_UNUSED_VARIABLE = YES; 515 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 516 | MTL_ENABLE_DEBUG_INFO = YES; 517 | ONLY_ACTIVE_ARCH = YES; 518 | SDKROOT = iphoneos; 519 | }; 520 | name = Debug; 521 | }; 522 | DCDD53621A64B84900C626F1 /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | buildSettings = { 525 | ALWAYS_SEARCH_USER_PATHS = NO; 526 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 527 | CLANG_CXX_LIBRARY = "libc++"; 528 | CLANG_ENABLE_MODULES = YES; 529 | CLANG_ENABLE_OBJC_ARC = YES; 530 | CLANG_WARN_BOOL_CONVERSION = YES; 531 | CLANG_WARN_CONSTANT_CONVERSION = YES; 532 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 533 | CLANG_WARN_EMPTY_BODY = YES; 534 | CLANG_WARN_ENUM_CONVERSION = YES; 535 | CLANG_WARN_INT_CONVERSION = YES; 536 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 537 | CLANG_WARN_UNREACHABLE_CODE = YES; 538 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 539 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 540 | COPY_PHASE_STRIP = YES; 541 | ENABLE_NS_ASSERTIONS = NO; 542 | ENABLE_STRICT_OBJC_MSGSEND = YES; 543 | GCC_C_LANGUAGE_STANDARD = gnu99; 544 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 545 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 546 | GCC_WARN_UNDECLARED_SELECTOR = YES; 547 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 548 | GCC_WARN_UNUSED_FUNCTION = YES; 549 | GCC_WARN_UNUSED_VARIABLE = YES; 550 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 551 | MTL_ENABLE_DEBUG_INFO = NO; 552 | SDKROOT = iphoneos; 553 | VALIDATE_PRODUCT = YES; 554 | }; 555 | name = Release; 556 | }; 557 | DCDD53641A64B84900C626F1 /* Debug */ = { 558 | isa = XCBuildConfiguration; 559 | baseConfigurationReference = DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */; 560 | buildSettings = { 561 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 562 | INFOPLIST_FILE = J2ObjCExample/Info.plist; 563 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 564 | PRODUCT_NAME = "$(TARGET_NAME)"; 565 | }; 566 | name = Debug; 567 | }; 568 | DCDD53651A64B84900C626F1 /* Release */ = { 569 | isa = XCBuildConfiguration; 570 | baseConfigurationReference = DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */; 571 | buildSettings = { 572 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 573 | INFOPLIST_FILE = J2ObjCExample/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 575 | PRODUCT_NAME = "$(TARGET_NAME)"; 576 | }; 577 | name = Release; 578 | }; 579 | DCDD53671A64B84900C626F1 /* Debug */ = { 580 | isa = XCBuildConfiguration; 581 | baseConfigurationReference = DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */; 582 | buildSettings = { 583 | BUNDLE_LOADER = "$(TEST_HOST)"; 584 | FRAMEWORK_SEARCH_PATHS = ( 585 | "$(SDKROOT)/Developer/Library/Frameworks", 586 | "$(inherited)", 587 | ); 588 | GCC_PREPROCESSOR_DEFINITIONS = ( 589 | "DEBUG=1", 590 | "$(inherited)", 591 | ); 592 | INFOPLIST_FILE = J2ObjCExampleTests/Info.plist; 593 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 594 | PRODUCT_NAME = "$(TARGET_NAME)"; 595 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/J2ObjCExample.app/J2ObjCExample"; 596 | }; 597 | name = Debug; 598 | }; 599 | DCDD53681A64B84900C626F1 /* Release */ = { 600 | isa = XCBuildConfiguration; 601 | baseConfigurationReference = DC94A2AA1A65B7920039F72C /* AppConfig.xcconfig */; 602 | buildSettings = { 603 | BUNDLE_LOADER = "$(TEST_HOST)"; 604 | FRAMEWORK_SEARCH_PATHS = ( 605 | "$(SDKROOT)/Developer/Library/Frameworks", 606 | "$(inherited)", 607 | ); 608 | INFOPLIST_FILE = J2ObjCExampleTests/Info.plist; 609 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 610 | PRODUCT_NAME = "$(TARGET_NAME)"; 611 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/J2ObjCExample.app/J2ObjCExample"; 612 | }; 613 | name = Release; 614 | }; 615 | DCDD537E1A64B9A500C626F1 /* Debug */ = { 616 | isa = XCBuildConfiguration; 617 | baseConfigurationReference = DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */; 618 | buildSettings = { 619 | GCC_PREPROCESSOR_DEFINITIONS = ( 620 | "DEBUG=1", 621 | "$(inherited)", 622 | ); 623 | OTHER_LDFLAGS = "-ObjC"; 624 | PRODUCT_NAME = "$(TARGET_NAME)"; 625 | SKIP_INSTALL = YES; 626 | }; 627 | name = Debug; 628 | }; 629 | DCDD537F1A64B9A500C626F1 /* Release */ = { 630 | isa = XCBuildConfiguration; 631 | baseConfigurationReference = DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */; 632 | buildSettings = { 633 | OTHER_LDFLAGS = "-ObjC"; 634 | PRODUCT_NAME = "$(TARGET_NAME)"; 635 | SKIP_INSTALL = YES; 636 | }; 637 | name = Release; 638 | }; 639 | DCDD53801A64B9A500C626F1 /* Debug */ = { 640 | isa = XCBuildConfiguration; 641 | baseConfigurationReference = DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */; 642 | buildSettings = { 643 | FRAMEWORK_SEARCH_PATHS = ( 644 | "$(SDKROOT)/Developer/Library/Frameworks", 645 | "$(inherited)", 646 | ); 647 | GCC_PREPROCESSOR_DEFINITIONS = ( 648 | "DEBUG=1", 649 | "$(inherited)", 650 | ); 651 | INFOPLIST_FILE = SharedCodeTests/Info.plist; 652 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 653 | PRODUCT_NAME = "$(TARGET_NAME)"; 654 | }; 655 | name = Debug; 656 | }; 657 | DCDD53811A64B9A500C626F1 /* Release */ = { 658 | isa = XCBuildConfiguration; 659 | baseConfigurationReference = DC94A2A91A65B7730039F72C /* LibConfig.xcconfig */; 660 | buildSettings = { 661 | FRAMEWORK_SEARCH_PATHS = ( 662 | "$(SDKROOT)/Developer/Library/Frameworks", 663 | "$(inherited)", 664 | ); 665 | INFOPLIST_FILE = SharedCodeTests/Info.plist; 666 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 667 | PRODUCT_NAME = "$(TARGET_NAME)"; 668 | }; 669 | name = Release; 670 | }; 671 | /* End XCBuildConfiguration section */ 672 | 673 | /* Begin XCConfigurationList section */ 674 | DCDD533B1A64B84900C626F1 /* Build configuration list for PBXProject "J2ObjCExample" */ = { 675 | isa = XCConfigurationList; 676 | buildConfigurations = ( 677 | DCDD53611A64B84900C626F1 /* Debug */, 678 | DCDD53621A64B84900C626F1 /* Release */, 679 | ); 680 | defaultConfigurationIsVisible = 0; 681 | defaultConfigurationName = Release; 682 | }; 683 | DCDD53631A64B84900C626F1 /* Build configuration list for PBXNativeTarget "J2ObjCExample" */ = { 684 | isa = XCConfigurationList; 685 | buildConfigurations = ( 686 | DCDD53641A64B84900C626F1 /* Debug */, 687 | DCDD53651A64B84900C626F1 /* Release */, 688 | ); 689 | defaultConfigurationIsVisible = 0; 690 | defaultConfigurationName = Release; 691 | }; 692 | DCDD53661A64B84900C626F1 /* Build configuration list for PBXNativeTarget "J2ObjCExampleTests" */ = { 693 | isa = XCConfigurationList; 694 | buildConfigurations = ( 695 | DCDD53671A64B84900C626F1 /* Debug */, 696 | DCDD53681A64B84900C626F1 /* Release */, 697 | ); 698 | defaultConfigurationIsVisible = 0; 699 | defaultConfigurationName = Release; 700 | }; 701 | DCDD53821A64B9A500C626F1 /* Build configuration list for PBXNativeTarget "SharedCode" */ = { 702 | isa = XCConfigurationList; 703 | buildConfigurations = ( 704 | DCDD537E1A64B9A500C626F1 /* Debug */, 705 | DCDD537F1A64B9A500C626F1 /* Release */, 706 | ); 707 | defaultConfigurationIsVisible = 0; 708 | defaultConfigurationName = Release; 709 | }; 710 | DCDD53831A64B9A500C626F1 /* Build configuration list for PBXNativeTarget "SharedCodeTests" */ = { 711 | isa = XCConfigurationList; 712 | buildConfigurations = ( 713 | DCDD53801A64B9A500C626F1 /* Debug */, 714 | DCDD53811A64B9A500C626F1 /* Release */, 715 | ); 716 | defaultConfigurationIsVisible = 0; 717 | defaultConfigurationName = Release; 718 | }; 719 | /* End XCConfigurationList section */ 720 | }; 721 | rootObject = DCDD53381A64B84900C626F1 /* Project object */; 722 | } 723 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample.xcodeproj/project.xcworkspace/xcshareddata/J2ObjCExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 5BF59E25-E5B2-4B4A-A67F-68677C512667 9 | IDESourceControlProjectName 10 | J2ObjCExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | EB5A3F460ACA3C6D5C3BF159D2F6D0D7A63DBFDA 14 | github.com:yixiang/Xcode-J2ObjC-Example.git 15 | 16 | IDESourceControlProjectPath 17 | J2ObjCExample/J2ObjCExample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | EB5A3F460ACA3C6D5C3BF159D2F6D0D7A63DBFDA 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:yixiang/Xcode-J2ObjC-Example.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | EB5A3F460ACA3C6D5C3BF159D2F6D0D7A63DBFDA 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | EB5A3F460ACA3C6D5C3BF159D2F6D0D7A63DBFDA 36 | IDESourceControlWCCName 37 | Xcode-J2ObjC-Example 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/AppConfig.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // AppConfig.xcconfig 3 | // 4 | 5 | // Change J2OBJC_HOME to point to the path of the binaries of the j2objc distribution directory. 6 | // If building j2objc from source, that would be j2objc/dist. 7 | 8 | // You can also leave J2OBJC_HOME as-is and create a symbolic link 9 | // with the name “j2objc-dist” to the parent directory of this project. 10 | 11 | // The path should be written without quotes, when modified use Xcode's Product -> Clean 12 | // Change to your actual J2OBJC_HOME path. 13 | 14 | 15 | J2OBJC_HOME = ${HOME}/bin/j2objc; 16 | 17 | GENERATED_FILES_DIR = ${SRCROOT}/Generated; 18 | 19 | HEADER_SEARCH_PATHS = $(inherited) "${J2OBJC_HOME}/include" "${GENERATED_FILES_DIR}"; 20 | LIBRARY_SEARCH_PATHS = $(inherited) "${J2OBJC_HOME}/lib"; 21 | 22 | OTHER_LDFLAGS = $(inherited) -l"jre_emul" -l"icucore"; -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property (strong, nonatomic) UIWindow *window; 6 | 7 | 8 | @end 9 | 10 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @interface AppDelegate () 4 | 5 | @end 6 | 7 | @implementation AppDelegate 8 | 9 | 10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 11 | // Override point for customization after application launch. 12 | return YES; 13 | } 14 | 15 | - (void)applicationWillResignActive:(UIApplication *)application { 16 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 17 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 18 | } 19 | 20 | - (void)applicationDidEnterBackground:(UIApplication *)application { 21 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 22 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 23 | } 24 | 25 | - (void)applicationWillEnterForeground:(UIApplication *)application { 26 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 27 | } 28 | 29 | - (void)applicationDidBecomeActive:(UIApplication *)application { 30 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 31 | } 32 | 33 | - (void)applicationWillTerminate:(UIApplication *)application { 34 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.j2obc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ViewController : UIViewController 4 | 5 | 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/ViewController.m: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | #import "SampleClass.h" 3 | 4 | @interface ViewController () 5 | 6 | @end 7 | 8 | @implementation ViewController 9 | 10 | - (void)viewDidLoad { 11 | [super viewDidLoad]; 12 | // Do any additional setup after loading the view, typically from a nib. 13 | 14 | int value = OrgJ2objcSampleSharedSampleClass_incrementWithInt_(2); 15 | NSLog(@"%d", value); 16 | } 17 | 18 | - (void)didReceiveMemoryWarning { 19 | [super didReceiveMemoryWarning]; 20 | // Dispose of any resources that can be recreated. 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // J2ObjCExample 4 | // 5 | // Created by Yixiang Lu on 1/12/15. 6 | // Copyright (c) 2015 j2objc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.j2obc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /J2ObjCExample/J2ObjCExampleTests/J2ObjCExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface J2ObjCExampleTests : XCTestCase 5 | 6 | @end 7 | 8 | @implementation J2ObjCExampleTests 9 | 10 | - (void)setUp { 11 | [super setUp]; 12 | // Put setup code here. This method is called before the invocation of each test method in the class. 13 | } 14 | 15 | - (void)tearDown { 16 | // Put teardown code here. This method is called after the invocation of each test method in the class. 17 | [super tearDown]; 18 | } 19 | 20 | - (void)testExample { 21 | // This is an example of a functional test case. 22 | XCTAssert(YES, @"Pass"); 23 | } 24 | 25 | - (void)testPerformanceExample { 26 | // This is an example of a performance test case. 27 | [self measureBlock:^{ 28 | // Put the code you want to measure the time of here. 29 | }]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /J2ObjCExample/SharedCode/LibConfig.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // LibConfig.xcconfig 3 | // 4 | 5 | // Change J2OBJC_HOME to point to the path of the binaries of the j2objc distribution directory. 6 | // If building j2objc from source, that would be j2objc/dist. 7 | 8 | // You can also leave J2OBJC_HOME as-is and create a symbolic link 9 | // with the name “j2objc-dist” to the parent directory of this project. 10 | 11 | // The path should be written without quotes, when modified use Xcode's Product -> Clean 12 | // Change to your actual J2OBJC_HOME path. 13 | 14 | J2OBJC_HOME = ${HOME}/bin/j2objc; 15 | 16 | GENERATED_FILES_DIR = ${SRCROOT}/Generated; 17 | 18 | HEADER_SEARCH_PATHS = $(inherited) "${J2OBJC_HOME}/include" "${GENERATED_FILES_DIR}"; 19 | 20 | // In your own project, change this to your actual path that contains java code. 21 | JAVA_SOURCE_PATH = ${SRCROOT}/../java; 22 | 23 | CLANG_ENABLE_OBJC_ARC = NO -------------------------------------------------------------------------------- /J2ObjCExample/SharedCodeTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.j2obc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | This is a step-by-step guide on how to Setup J2ObjC as static library in Xcode. After completing this guide, you will be able to setup a j2objc in Xcode and be ready to work. The shared java files are added to Xcode for tracking, and they generated code are compiled into a static library with ARC (automatic reference count) turned off. 3 | 4 | # Prerequisite 5 | 6 | The guide assumes the following. 7 | * You J2ObjC already installed somewhere. If you have not, here is [how to](https://github.com/google/j2objc/wiki/Getting-Started]). 8 | * The sample project assumes installation location -- $HOME/bin/j2objc. If you have it installed at a different location, you will need to modify J2OBJC_HOME variable in LibConfig.xcconfig and AppConfig.xcconfig later. 9 | * You have latest Xcode installed (Version 6 or above) 10 | * You already have an iOS Xcode project created. If you are working a on Mac project, you will need to create a static library for Mac instead of iOS. 11 | 12 | # Step-by-Step Guide 13 | 14 | ## Add a new target for the static library 15 | 16 | The reason why we create a separate target for j2objc generated files, it allows us to extra build configuration to the target without affecting the main app target. One particular thing is that we want to turn off ARC for performance gains. With a separate target, we can turn off ARC on the static library target, but keep ARC on for the main app. 17 | 18 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/1-add-target.png) 19 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/2-choose-static-lib.png) 20 | 21 | ## Fix Group Path 22 | 23 | Your target group points to a directory that may not exist. Make sure the folder is created. You will need to put LibConfig.xcconfig into it later. What's more, not having it created will cause problem when you add your java source files later. 24 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/3-fix-group-path.png) 25 | 26 | ## Adding Configuration Settings File 27 | 28 | We now add LibConfig.xcconfig to static lib target and AppConfig.xcconfig to app target. The xcconfig files capture some common build settings associated with j2objc. We are doing it in a Settings bundle because it saves you the trouble to dig into Build Settings and find the entries to modify. 29 | 30 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/4-add-xcconfig.png) 31 | 32 | Once you have the files added, copy the content of xcconfig in the sample project into them. The only things you need to modify are J2OBJC_HOME and JAVA_SOURCE_PATH. Set J2OBJC_HOME to your j2objc/dist path. Set JAVA_SOURCE_PATH to the root folder of your java source path. 33 | 34 | Adding the files to the project doesn't make them effective. To use them, set them in the project settings. 35 | 36 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/5-use-xcconfig.png) 37 | 38 | As mentioned earlier, we need to turn off ARC on the static lib. Having ARC on could cause your program an order of magnitude slower than it would with ARC off. Since j2objc is writing the code for us, turning ARC off is nothing but benefit. The ARC flagged (CLANG_ENABLE_OBJC_ARC) in turned off by LibConfig.xcconfig for you. 39 | 40 | ## Adding Java Source Files 41 | 42 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/6-add-java-sources.png) 43 | 44 | ## Adding Build Rules 45 | 46 | Adding your initial set of java files. 47 | 48 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/7-add-build-rule.png) 49 | 50 | ## Adding Target Dependencies and Linking The Static Lib to App 51 | 52 | Target dependency will make your static library is built before your app target is built. 53 | 54 | ![](https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/master/screenshots/8-add-dependency.png) 55 | 56 | ## Ready to Work 57 | 58 | You can now build and run your project. The j2objc generated files sit in $(SRCROOT)/Generated directory. Put Generated directory into your .gitignore because you generally don't want them tracked. 59 | 60 | You may modify existing java files or add new java files to the project. They will automatically be transpiled. 61 | 62 | # References 63 | https://github.com/google/j2objc/wiki/Xcode-Build-Rules 64 | -------------------------------------------------------------------------------- /java/org/j2objc/sample/shared/SampleClass.java: -------------------------------------------------------------------------------- 1 | package org.j2objc.sample.shared; 2 | 3 | public class SampleClass { 4 | public static int increment(int i) { 5 | return i + 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /screenshots/1-add-target.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/1-add-target.png -------------------------------------------------------------------------------- /screenshots/2-choose-static-lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/2-choose-static-lib.png -------------------------------------------------------------------------------- /screenshots/3-fix-group-path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/3-fix-group-path.png -------------------------------------------------------------------------------- /screenshots/4-add-xcconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/4-add-xcconfig.png -------------------------------------------------------------------------------- /screenshots/5-use-xcconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/5-use-xcconfig.png -------------------------------------------------------------------------------- /screenshots/6-add-java-sources.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/6-add-java-sources.png -------------------------------------------------------------------------------- /screenshots/7-add-build-rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/7-add-build-rule.png -------------------------------------------------------------------------------- /screenshots/8-add-dependency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiang/Xcode-J2ObjC-Example/14ea91be9c73e5cf16f8d86675932d9ed6556b15/screenshots/8-add-dependency.png --------------------------------------------------------------------------------