├── .gitignore
├── .idea
└── codeStyleSettings.xml
├── AUTHORS
├── CHANGELOG.md
├── CONTRIBUTING.md
├── FAQ.md
├── LICENSE
├── NOTICE
├── README.md
├── build.gradle
├── dependencies.md
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── install-osx-jdk7.sh
├── src
├── main
│ ├── groovy
│ │ └── com
│ │ │ └── github
│ │ │ └── j2objccontrib
│ │ │ └── j2objcgradle
│ │ │ ├── DependencyConverter.groovy
│ │ │ ├── DependencyResolver.groovy
│ │ │ ├── J2objcConfig.groovy
│ │ │ ├── J2objcPlugin.groovy
│ │ │ ├── NativeCompilation.groovy
│ │ │ └── tasks
│ │ │ ├── AssembleLibrariesTask.groovy
│ │ │ ├── AssembleResourcesTask.groovy
│ │ │ ├── AssembleSourceTask.groovy
│ │ │ ├── CycleFinderTask.groovy
│ │ │ ├── PackLibrariesTask.groovy
│ │ │ ├── PodspecTask.groovy
│ │ │ ├── TestTask.groovy
│ │ │ ├── TranslateTask.groovy
│ │ │ ├── Utils.groovy
│ │ │ └── XcodeTask.groovy
│ └── resources
│ │ ├── AUTHORS
│ │ ├── CHANGELOG.md
│ │ ├── FAQ.md
│ │ ├── LICENSE
│ │ ├── META-INF
│ │ └── gradle-plugins
│ │ │ └── com.github.j2objccontrib.j2objcgradle.properties
│ │ ├── NOTICE
│ │ ├── README.md
│ │ └── dependencies.md
└── test
│ ├── groovy
│ └── com
│ │ └── github
│ │ └── j2objccontrib
│ │ └── j2objcgradle
│ │ ├── J2objcConfigTest.groovy
│ │ ├── MultiProjectTest.groovy
│ │ └── tasks
│ │ ├── AssembleLibrariesTaskTest.groovy
│ │ ├── AssembleResourcesTaskTest.groovy
│ │ ├── AssembleSourceTaskTest.groovy
│ │ ├── CycleFinderTaskTest.groovy
│ │ ├── MockProjectExec.groovy
│ │ ├── PackLibrariesTaskTest.groovy
│ │ ├── PodspecTaskTest.groovy
│ │ ├── TestTaskTest.groovy
│ │ ├── TestingUtils.groovy
│ │ ├── TranslateTaskTest.groovy
│ │ ├── UtilsTest.groovy
│ │ └── XcodeTaskTest.groovy
│ └── resources
│ └── com
│ └── github
│ └── j2objccontrib
│ └── j2objcgradle
│ └── tasks
│ └── prefixes.properties
└── systemTests
├── .gitignore
├── allPlatforms
├── .idea
│ ├── .name
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── gradle.xml
│ ├── modules.xml
│ └── vcs.xml
├── app
│ ├── build.gradle
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── j2objc_contrib
│ │ │ └── android_app
│ │ │ └── ApplicationTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── j2objc_contrib
│ │ │ │ └── android_app
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── menu
│ │ │ └── menu_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── j2objc_contrib
│ │ └── android_app
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradlew
├── ios
│ ├── ALL-PLATFORMS-Bridging-Header.h
│ ├── ALL-PLATFORMS.xcodeproj
│ │ ├── project.pbxproj
│ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ ├── ALL-PLATFORMS.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── IOS-APP
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── IOS-APPTests
│ │ ├── IOS_APPTests.swift
│ │ └── Info.plist
│ ├── OSX-APP
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── OSX-APPTests
│ │ ├── Info.plist
│ │ └── OSX_APPTests.swift
│ ├── Podfile
│ ├── Podfile.lock
│ ├── WATCH-APP Extension
│ │ ├── Assets.xcassets
│ │ │ └── README__ignoredByTemplate__
│ │ ├── ExtensionDelegate.swift
│ │ ├── Info.plist
│ │ ├── InterfaceController.swift
│ │ ├── NotificationController.swift
│ │ └── PushNotificationPayload.apns
│ └── WATCH-APP
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ └── Interface.storyboard
│ │ └── Info.plist
├── local.properties
├── settings.gradle
└── shared
│ ├── build.gradle
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── example
│ │ └── Shared.java
│ └── test
│ └── java
│ └── com
│ └── example
│ └── SharedTest.java
├── externalLibrary1
├── base
│ ├── build.gradle
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── Cube.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── CubeTest.java
├── build.gradle
├── extended
│ ├── build.gradle
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── ExtendedCube.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── ExtendedCubeTest.java
├── gradlew
├── local.properties
├── settings.gradle
├── third_party_gson
│ └── build.gradle
└── third_party_guava
│ └── build.gradle
├── install.sh
├── multiProject1
├── base
│ ├── build.gradle
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── Cube.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── CubeTest.java
├── build.gradle
├── extended
│ ├── build.gradle
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── ExtendedCube.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── ExtendedCubeTest.java
├── gradlew
├── ios
│ ├── IOS-APP.xcodeproj
│ │ └── project.pbxproj
│ ├── IOS-APP.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── IOS-APP
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── IOS-APP-Bridging-Header.h
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── IOS-APPTests
│ │ ├── IOS_APPTests.swift
│ │ └── Info.plist
│ ├── Podfile
│ ├── Podfile.lock
│ └── WORKSPACE.xcworkspace
│ │ └── contents.xcworkspacedata
├── local.properties
├── settings.gradle
└── testLib
│ ├── build.gradle
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── example
│ │ └── CubeTester.java
│ └── test
│ └── java
│ └── com
│ └── example
│ └── CubeTesterTest.java
├── run-all.sh
├── run-test.sh
└── simple1
├── build.gradle
├── gradlew
├── ios
├── IOS-SIMPLE1
│ ├── IOS-SIMPLE1.xcodeproj
│ │ ├── project.pbxproj
│ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ ├── IOS-SIMPLE1.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── IOS-SIMPLE1
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── IOS-SIMPLE1-Bridging-Header.h
│ │ ├── Info.plist
│ │ └── ViewController.swift
│ ├── IOS-SIMPLE1Tests
│ │ ├── IOS_SIMPLE1Tests.swift
│ │ └── Info.plist
│ ├── Podfile
│ └── Podfile.lock
└── SIMPLE1.xcworkspace
│ └── contents.xcworkspacedata
├── local.properties
└── src
├── main
└── java
│ └── com
│ └── example
│ └── HelloWorld.java
└── test
└── java
└── com
└── example
└── HelloWorldTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # Temp files
2 | *~
3 | .gradle
4 |
5 | # Don't save away IntelliJ config, except code-style which all commits must follow.
6 | .idea/*
7 | !.idea/codeStyleSettings.xml
8 | j2objc-gradle.iml
9 |
10 | local.properties
11 |
12 |
13 | ## Build generated
14 | build
15 | DerivedData
16 |
17 |
18 | # Android Studio
19 | # Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067)
20 | # Note: Android Studio is a modified version of IntelliJ
21 | *.iml
22 | *.iws
23 | **/.idea/workspace.xml
24 | **/.idea/tasks.xml
25 | **/.idea/datasources.xml
26 | **/.idea/dataSources.ids
27 | **/.idea/libraries/
28 | **/.idea/misc.xml
29 | **/.idea/runConfigurations.xml
30 |
31 |
32 | # COCOAPODS
33 | Pods
34 |
35 | # Xcode
36 | # https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
37 |
38 | ## Various settings
39 | *.pbxuser
40 | !default.pbxuser
41 | *.mode1v3
42 | !default.mode1v3
43 | *.mode2v3
44 | !default.mode2v3
45 | *.perspectivev3
46 | !default.perspectivev3
47 | xcuserdata
48 |
49 | ## Other
50 | *.xccheckout
51 | *.moved-aside
52 | *.xcuserstate
53 |
--------------------------------------------------------------------------------
/.idea/codeStyleSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | NOTICE
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | The following link can be adapted to see the differences between two versions.
2 | Example is given for differences between `v0.5.0-alpha` and `v0.6.0-alpha`:
3 |
4 | https://github.com/j2objc-contrib/j2objc-gradle/compare/v0.5.0-alpha...v0.6.0-alpha
5 |
6 |
7 | The list of releases with working links is most easily viewed here:
8 |
9 | https://github.com/j2objc-contrib/j2objc-gradle/releases
10 |
11 |
12 | Change numbers below are github.com pull requests; peruse #NNN at:
13 |
14 | https://github.com/j2objc-contrib/j2objc-gradle/pull/NNN
15 |
16 |
17 | # Prerelease Alphas
18 |
19 | ## vNext
20 | New functionality:
21 | * TBD
22 |
23 | Breaking changes/functionality:
24 | * TBD
25 |
26 | Code quality:
27 | * TBD
28 |
29 |
30 | ## v0.6.0-alpha
31 | New functionality:
32 | * Support for arbitrary count of files that otherwise exceeds command line max args #574
33 | * Podfile manual configure of targets using xcodeTargetsManualConfig #561 #562
34 | * Podspec output to build/j2objcOutputs #558
35 | * Default minVersionIos => 8.3, minVersionWatchos => 2.0 #584
36 |
37 | Fixes:
38 | * Allow spaces in Xcode target names #564
39 | * Gradle 2.8 compatibility #567
40 | * Gradle 2.9 unsupported message #581
41 | * Gradle unsupport version causes deadlock #585
42 | * Several broken links from plugin #563
43 |
44 | Code quality:
45 | * Guava 19.0 system test (updated from Guava 18.0) #434
46 |
47 |
48 | ## v0.5.0-alpha
49 | New functionality:
50 | * Support for Xcode 7 and j2objc 0.9.8.2.1 #483
51 | * Validate version of j2objc and provide install instructions #515
52 | * Wilcard package prefix matching #481
53 | * Dependencies
54 | * `J2objcConfig.minVersion{Ios,Osx,Watchos}` controls minimum versions of associated target #483 #512
55 | * Test-only dependencies on other libraries and projects #489
56 | * Translate and run standalone test source Jar files (such as unit tests associated with third-party libraries) #489
57 | * Source files generated during compilation (ex. by Dagger2) included in translation #527
58 | * CocoaPods
59 | * iOS and OS X applications can be setup using CocoaPods #506
60 | * Automatically configure CocoaPods and Xcode projects, when present, as part of build #524
61 | * CocoaPods supports multi-project applications #504
62 | * `J2objcConfig.xcodeTargets{Ios,Osx,Watchos}` Xcode targets to link to generated libraries #522
63 |
64 | Breaking changes/functionality:
65 | * No longer supports Xcode 6 and lower or j2objc 0.9.8.2 and lower #483
66 | * Minimum versions of platforms have been configured as iOS 6.0, OS X 10.6, and WatchOS 1.0 #512
67 | * NOTE: watchOS is not yet supported due to lack of full bitcode support by J2ObjC 0.9.8.2.1.
68 | * Default auto-generated source dir `build/source/apt` replaced by `build/classes/main` #527
69 | * Extracted Jar source dir `build/translationExtraction` replaced by `build/mainTranslationExtraction` #489
70 | * j2objcXcode now a dependency of j2objcAssemble{Debug|Release} and not a separate task #532
71 |
72 | Code quality:
73 | * Multi-project integration tests disabled temporarily (system tests are used instead) #483
74 | * System tests include Xcode and Android Studio project examples #508 #523
75 | * Podspecs distinguish project libraries versus J2ObjC libraries #512
76 |
77 |
78 | ## v0.4.3-alpha
79 | New functionality:
80 | * Automatic dependency resolution for Maven jars and Gradle projects #420
81 | * Build external Java libraries (with source) into standalone native libraries #431
82 | * Proper limitation of functionality on non-Mac platforms #396
83 | * Embedded docs and versioning info for easier debugging #395
84 | * Specify a subset of J2ObjC libraries to link to #433
85 | * Map individual Java files to a separate version used only for J2ObjC translation #455
86 | * Projects no longer need to guarantee the Java plugin is applied before the J2ObjC Gradle plugin #453
87 |
88 | Breaking changes/functionality:
89 | * Default supported architectures reduced to modern devices only (arm64, armv7, x86_64) #448
90 | * Production (main sourceSet) and test code are now translated and built separately #474
91 | * `J2objcConfig.filenameCollisionCheck` is now named `forceFilenameCollisionCheck`,
92 | and defaults true only when using `--no-package-directories` #470
93 |
94 | Code quality:
95 | * A small number of [common open-source Java libraries](https://github.com/j2objc-contrib/j2objc-common-libs-e2e-test) are being built end-to-end with the J2ObjC Gradle plugin
96 | * Continuous integration on Mac #406 and on Windows #401
97 | * Added end to end tests on OSX (running j2objc) #409 #411 etc.
98 | * Unit tests pass on Windows #404
99 | * Prevent publishing of bad releases #395 #398
100 | * Docs updates (various)
101 |
102 |
103 | ## v0.4.2-alpha
104 | Functionality:
105 | * Translation-only mode (skips building Objective-C libraries) #349
106 | * Support for Windows/Linux (in translation-only mode) #349
107 | * Cycle finding moved from assembly phase to test phase #338
108 | * Automatic linking with related Xcode projects, like tests and WatchKit apps #353
109 | * Per-environment configuration of iOS architectures to build #358
110 | * Environment-specific config can be provided via environment variables in addition to local.properties #361
111 |
112 | Code quality:
113 | * Travis Continuous Integration #365
114 | * Additional test coverage (various)
115 | * Documentation fixes (various)
116 | * Updating package prefixes will now correctly cause retranslation/recompile
117 |
118 |
119 | ## 0.4.1-alpha
120 | (Ignore - use v0.4.2 instead).
121 |
122 |
123 | ## v0.4.0-alpha
124 | Functionality:
125 | - Resources copied for unit tests and Xcode build
126 | - Xcode debug and release targets now load distinct generated libraries
127 | - j2objcConfig syntax standardized for translateClasspaths and translateSourcepaths
128 | - Helpful error message upon failure with full command line, stdout and sterr
129 |
130 | Code Quality:
131 | - @CompileStatic for plugin build type checking
132 | - Expanded unit test coverage now comprises 81 tests
133 | - Numerous bug fixes
134 |
135 |
136 | ## v0.3.0-alpha
137 | Functionality:
138 | - Args groovy style syntax for config closure
139 | - Multiple projects with dependencies
140 | - Incremental compile using Gradle's native clang compiler
141 | - Fix Plugins {...} syntax
142 |
143 | Code Quality:
144 | - Added unit test framework
145 |
146 |
147 | ## v0.2.2-alpha
148 | - Requires buildscript syntax as a workaround to the plugins {} syntax not working
149 | - Lots of fixes and improvements through the system
150 |
151 | Upgrading in-place from v0.1.0-alpha is not supported: please read README.md and
152 | J2objcPluginExtension.groovy for instructions on using and configuring the new version.
153 |
154 |
155 | ## v0.1.0-alpha
156 | Initial working version.
157 | There will be significant reworking of this before a beta and 1.0 release
158 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | j2objc-gradle - Gradle plugin for j2objc (Java to Objective-C transpiler)
2 | https://github.com/j2objc-contrib/j2objc-gradle
3 |
4 | Copyright (c) 2015-2016 the authors of j2objc-gradle
5 |
6 | Main Contributors:
7 | Advay Mengle @advayDev1
8 | Bruno Bowden @brunobowden
9 | Michael Gorski @confile
10 |
11 | Thanks:
12 | Peter Niederweiser @pniederw
13 | Sterling Greene @big-guy
14 |
15 | Licensed under the Apache License, Version 2.0 (the "License");
16 | you may not use this software except in compliance with the License.
17 | You may obtain a copy of the License at
18 |
19 | http://www.apache.org/licenses/LICENSE-2.0
20 |
21 | Unless required by applicable law or agreed to in writing, software
22 | distributed under the License is distributed on an "AS IS" BASIS,
23 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 | See the License for the specific language governing permissions and
25 | limitations under the License.
26 |
27 | This serves as the NOTICE under Section 4 d of the License.
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Hey! We are looking for new developers to maintain the plugin. Let us know on [j2objc-discuss](https://groups.google.com/forum/#!topic/j2objc-discuss/jQ_eyW9nxmQ) if you are interested. Active development on this plugin is otherwise currently suspended.
2 |
3 | # J2ObjC Gradle Plugin
4 |
5 | The __J2ObjC Gradle plugin__ enables Java source to be part of an iOS application's build
6 | so you can write an app's non-UI code (such as application logic and data models) in Java,
7 | which is then shared by Android apps (natively Java) and iOS apps (using J2ObjC).
8 |
9 | The plugin:
10 | * Translates your Java source code to Objective-C for iOS (iPhone/iPad) using [__J2ObjC__](https://github.com/google/j2objc), an open-source tool from Google
11 | * Builds Objective-C static libraries and headers ready-to-use in Xcode
12 | * Runs translated versions of your JUnit tests to ensure your code works in Objective-C form
13 | * Handles multiple Java projects, external Java libraries \[1\], and existing Objective-C code you'd like to link in
14 | * Configures Xcode projects to use your translated libraries, using CocoaPods (optionally)
15 |
16 | The plugin is not affiliated with Google but was developed by former Google Engineers and others.
17 | Note that the plugin is currently in alpha; we may need to make breaking API changes
18 | before the 1.0 release.
19 |
20 | [](https://github.com/j2objc-contrib/j2objc-gradle/blob/master/LICENSE)
21 | [](https://travis-ci.org/j2objc-contrib/j2objc-gradle)
22 | [](https://ci.appveyor.com/project/madvayApiAccess/j2objc-gradle/branch/master)
23 |
24 | Home Page: https://github.com/j2objc-contrib/j2objc-gradle
25 |
26 | ### Quick Start Guide
27 |
28 | You should start with a clean Java only project without any Android dependencies.
29 | It is suggested that the project is named `shared`. It must be buildable using the standard
30 | [Gradle Java plugin](https://docs.gradle.org/current/userguide/java_plugin.html).
31 | Starting with an empty project allows you to gradually shift over code from an existing
32 | Android application. This is beneficial for separation between the application model
33 | and user interface. It also allows the shared project to be easily used server-side as well.
34 |
35 | The Android app, shared Java project and Xcode project should be sibling directories, i.e children
36 | of the same root level folder. Suggested folder names are `'android', 'shared' and 'ios'`
37 | respectively. See the FAQ section on [recommended folder structure](FAQ.md#what-is-the-recommended-folder-structure-for-my-app).
38 |
39 | Configure `shared/build.gradle` for your Java-only project:
40 |
41 | ```gradle
42 | // File: shared/build.gradle
43 | plugins {
44 | id 'java'
45 | id 'com.github.j2objccontrib.j2objcgradle' version '0.5.0-alpha'
46 | }
47 |
48 | dependencies {
49 | // Any libraries you depend on, like Guava or JUnit
50 | compile 'com.google.guava:guava:18.0'
51 | testCompile 'junit:junit:4.11'
52 | }
53 |
54 | // Plugin settings; put these at the bottom of the file.
55 | j2objcConfig {
56 | // Sets up libraries you depend on
57 | autoConfigureDeps true
58 |
59 | // Omit these two lines if you don't configure your Xcode project with CocoaPods
60 | xcodeProjectDir '../ios' // suggested directory name
61 | xcodeTargetsIos 'IOS-APP', 'IOS-APPTests' // replace with your iOS targets
62 |
63 | finalConfigure() // Must be last call to configuration
64 | }
65 | ```
66 |
67 | Finally, make the Android application's `android/build.gradle` depend on the `shared` project:
68 |
69 | ```gradle
70 | // File: android/build.gradle
71 | dependencies {
72 | compile project(':shared')
73 | }
74 | ```
75 |
76 | For more complex situations like:
77 | * building for OS X and ([soon](https://github.com/j2objc-contrib/j2objc-gradle/issues/525)) watchOS
78 | * [multiple Java projects and third-party libraries](FAQ.md#how-do-i-setup-dependencies-with-j2objc)
79 | * customizing the translation and compilation steps
80 | * mixing Objective-C and Java implementations
81 |
82 | , check the [FAQ table of contents](FAQ.md) or see all of the `j2objcConfig` settings in
83 | [J2objcConfig.groovy](https://github.com/j2objc-contrib/j2objc-gradle/blob/master/src/main/groovy/com/github/j2objccontrib/j2objcgradle/J2objcConfig.groovy#L30).
84 |
85 |
86 | ### Minimum Requirements
87 |
88 | The plugin requries modern versions of Gradle and J2ObjC, and assumes the
89 | [J2ObjC Requirements](http://j2objc.org/#requirements):
90 |
91 | * Gradle 2.4
92 | * J2ObjC 0.9.8.2.1 or higher
93 | * JDK 1.7 or higher
94 | * Mac workstation or laptop
95 | * Mac OS X 10.9 or higher
96 | * Xcode 7 or higher
97 |
98 | Applications built with the plugin may target
99 |
100 | * iOS 6.0 or higher
101 | * OS X 10.6 or higher
102 |
103 |
104 | ### J2ObjC Installation
105 |
106 | If J2ObjC is not detected when the plugin is first run, on-screen instructons will guide
107 | you through installation from your Terminal.
108 |
109 | Alternatively:
110 | Download the latest version from the [J2ObjC Releases](https://github.com/google/j2objc/releases).
111 | Find (or add) the local.properties in your root folder and add the path to the unzipped folder:
112 |
113 | ```properties
114 | # File: local.properties
115 | j2objc.home=/J2OBJC_HOME
116 | ```
117 |
118 |
119 | ### Build Commands
120 |
121 | The plugin will output the generated source and libaries to the `build/j2objcOutputs`
122 | directory, run all unit tests, and configure your Xcode project (if you specified one).
123 |
124 | It is integrated with Gradle's Java build plugin and may
125 | be run as follows:
126 |
127 | ./gradlew shared:build
128 |
129 |
130 | ### Problems
131 |
132 | Having issues with the plugin?
133 | Please first check the [Frequently Asked Questions](FAQ.md).
134 |
135 | Next, search the [Issues](https://github.com/j2objc-contrib/j2objc-gradle/issues) for a similar
136 | problem. If your issue is not addressed, please file a new Issue, including the following
137 | details:
138 | - build.gradle file(s)
139 | - contents of Gradle build errors if any
140 | - version of J2ObjC you have installed
141 |
142 | If you are not comfortable sharing these, the community may not be able to help as much.
143 | Please note your bug reports will be treated as "Contribution(s)" per the [LICENSE](LICENSE).
144 |
145 | Mozilla's [Bug writing guidelines](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines)
146 | may be helpful. Having public, focused, and actionable Issues
147 | helps the maximum number of users and also lets the maximum number of people help you.
148 | Please do not email the authors directly.
149 |
150 |
151 | ### FAQ
152 |
153 | Please see [FAQ.md](FAQ.md).
154 |
155 |
156 | ### Contributing
157 |
158 | See [CONTRIBUTING.md](CONTRIBUTING.md#quick-start).
159 |
160 |
161 | ### License
162 |
163 | This library is distributed under the Apache 2.0 license found in the [LICENSE](./LICENSE) file.
164 | J2ObjC and libraries distributed with J2ObjC are under their own licenses.
165 |
166 |
167 | ### Footnotes
168 |
169 | [1] where source is appropriately licensed and available
170 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | // Based on https://plugins.gradle.org/docs/publish-plugin
17 |
18 | plugins {
19 | id "com.gradle.plugin-publish" version "0.9.0"
20 | // Outputs a BuildInfo.java file with information about the git repo;
21 | // also fails plugin publishing if your git working directory is unclean.
22 | // Note this only enforces that the code you are publishing is committed
23 | // to your local repo; you have to make sure to push it upstream.
24 | id "com.madvay.tools.build.gitbuildinfo" version "0.1.2-alpha"
25 | }
26 | apply plugin: 'groovy'
27 |
28 | dependencies {
29 | compile gradleApi()
30 | }
31 |
32 |
33 | task wrapper(type: Wrapper) {
34 | gradleVersion = '2.4'
35 | distributionUrl = 'https://services.gradle.org/distributions/gradle-2.4-all.zip'
36 | }
37 |
38 | group = 'com.github.j2objccontrib.j2objcgradle'
39 |
40 | // A suffix of -SNAPSHOT means this is not an official release of the
41 | // system, but built from an intermediate source tree. Instructions:
42 | // https://github.com/j2objc-contrib/j2objc-gradle/blob/master/CONTRIBUTING.md#publishing-and-versioning
43 | version = '0.6.1-alpha-SNAPSHOT'
44 |
45 | test {
46 | testLogging {
47 | // Provide full exception info on failure, instead
48 | // of just pointing to an HTML file.
49 | exceptionFormat = 'full'
50 | }
51 | }
52 |
53 | pluginBundle {
54 | website = 'https://www.github.com/j2objc-contrib/j2objc-gradle/'
55 | vcsUrl = 'https://github.com/j2objc-contrib/j2objc-gradle'
56 | description =
57 | "Gradle Plugin for J2ObjC, which is an open-source tool from Google that translates " +
58 | "Java source code to Objective-C for the iOS (iPhone/iPad) platform. The plugin is " +
59 | "not affiliated with Google but was developed by former Google Engineers and others. " +
60 | "J2ObjC enables Java source to be part of an iOS application's build, no editing " +
61 | "of the generated files is necessary. The goal is to write an app's non-UI code " +
62 | "(such as application logic and data models) in Java, which is then shared by " +
63 | "Android apps, web apps (using GWT), and iOS apps (using J2ObjC)."
64 | tags = ['android', 'java', 'j2objc', 'ios', 'iphone', 'objective-c', 'xcode']
65 |
66 | plugins {
67 | j2objcPlugin {
68 | id = 'com.github.j2objccontrib.j2objcgradle'
69 | displayName = 'J2ObjC Gradle Plugin'
70 | }
71 | }
72 | }
73 |
74 | project.tasks.all {
75 | if (it.name == 'publishPluginGroovyDocsJar' || it.name == 'publishPluginJavaDocsJar') {
76 | it.from(project.file('src/main/resources/'))
77 | }
78 | }
79 |
80 | buildStamp {
81 | repoBaseUrl "https://github.com/j2objc-contrib/j2objc-gradle/tree/"
82 | packageName "com.github.j2objccontrib.j2objcgradle"
83 | }
84 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Aug 23 17:53:01 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%"^
76 | -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
77 |
78 | :end
79 | @rem End local scope for the variables with windows NT shell
80 | if "%ERRORLEVEL%"=="0" goto mainEnd
81 |
82 | :fail
83 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
84 | rem the _cmd.exe /c_ return code!
85 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
86 | exit /b 1
87 |
88 | :mainEnd
89 | if "%OS%"=="Windows_NT" endlocal
90 |
91 | :omega
92 |
--------------------------------------------------------------------------------
/install-osx-jdk7.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | set -euv
18 |
19 | # What Java versions do we have?
20 | /usr/libexec/java_home -V
21 |
22 | # Prep brew itself
23 | brew update
24 | brew outdated caskroom/cask/brew-cask || brew upgrade caskroom/cask/brew-cask
25 |
26 | # We must be able to get older Java versions than the latest.
27 | brew tap caskroom/versions
28 | sudo rm -rf /Library/Java/JavaVirtualMachines
29 | brew cask install caskroom/versions/java7
30 |
31 | # Fail unless we installed JDK 7 correctly.
32 | /usr/libexec/java_home --failfast --version 1.7
33 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/DependencyConverter.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle
18 |
19 | import groovy.transform.CompileStatic
20 | import groovy.transform.PackageScope
21 | import org.gradle.api.InvalidUserDataException
22 | import org.gradle.api.Project
23 | import org.gradle.api.artifacts.Dependency
24 | import org.gradle.api.artifacts.ExternalModuleDependency
25 | import org.gradle.api.artifacts.ProjectDependency
26 | import org.gradle.api.artifacts.SelfResolvingDependency
27 |
28 | /**
29 | * Converts `[test]compile` dependencies to their
30 | * `j2objcTranslationClosure` and/or `j2objc[Test]Linkage` equivalents, depending on the type
31 | * of dependency and whether or not they are already provided in native code:
32 | *
33 | * External classfile .jar libraries you depend on via `compile` will be
34 | * converted to `j2objcTranslationClosure` dependencies of the corresponding source .jar libraries.
35 | * Gradle projects you depend on via `compile` or `testCompile` will be converted to
36 | * `j2objcLinkage` or `j2objcTestLinkage` dependencies of the corresponding generated Objective C include headers
37 | * and static library. See {@link DependencyResolver} for details on the differences
38 | * between these configurations.
39 | *
40 | * They will be resolved to appropriate `j2objc` constructs using DependencyResolver.
41 | */
42 | @PackageScope
43 | @CompileStatic
44 | class DependencyConverter {
45 |
46 | final Project project
47 | final J2objcConfig j2objcConfig
48 |
49 | // List of `group:name`
50 | // TODO: Handle versioning.
51 | static final List J2OBJC_DEFAULT_LIBS = [
52 | 'com.google.guava:guava',
53 | 'junit:junit',
54 | 'org.mockito:mockito-core',
55 | 'com.google.j2objc:j2objc-annotations',
56 | 'org.hamcrest:hamcrest-core',
57 | 'com.google.protobuf:protobuf-java']
58 |
59 | DependencyConverter(Project project, J2objcConfig j2objcConfig) {
60 | this.project = project
61 | this.j2objcConfig = j2objcConfig
62 | }
63 |
64 | void configureAll() {
65 | project.configurations.getByName('compile').dependencies.each {
66 | visit(it, false)
67 | }
68 | project.configurations.getByName('testCompile').dependencies.each {
69 | visit(it, true)
70 | }
71 | }
72 |
73 | protected void visit(Dependency dep, boolean isTest) {
74 | if (dep instanceof ProjectDependency) {
75 | // ex. `compile project(':peer1')`
76 | visitProjectDependency(dep as ProjectDependency, isTest)
77 | } else if (dep instanceof SelfResolvingDependency) {
78 | // ex. `compile fileTree(dir: 'libs', include: ['*.jar'])`
79 | visitSelfResolvingDependency(dep as SelfResolvingDependency, isTest)
80 | } else if (dep instanceof ExternalModuleDependency) {
81 | // ex. `compile "com.google.code.gson:gson:2.3.1"`
82 | visitExternalModuleDependency(dep as ExternalModuleDependency, isTest)
83 | } else {
84 | // Everything else
85 | visitGenericDependency(dep, isTest)
86 | }
87 | }
88 |
89 | protected void failOnBuildClosureForTests(Dependency dep, boolean isTest) {
90 | if (isTest) {
91 | String msg = "Cannot translate testCompile dependency $dep using --build-closure; " +
92 | "please build this as a separate Gradle project, and then add a testCompile " +
93 | "dependency to that project.\n" +
94 | "https://github.com/j2objc-contrib/j2objc-gradle/blob/master/dependencies.md#build-standalone-third-party-library"
95 | throw new InvalidUserDataException(msg)
96 | }
97 | }
98 |
99 | protected void visitSelfResolvingDependency(
100 | SelfResolvingDependency dep, boolean isTest) {
101 | failOnBuildClosureForTests(dep, isTest)
102 | project.logger.debug("j2objc dependency converter: Translating file dep: $dep")
103 | project.configurations.getByName('j2objcTranslationClosure').dependencies.add(
104 | dep.copy())
105 | }
106 |
107 | protected void visitProjectDependency(ProjectDependency dep, boolean isTest) {
108 | project.logger.debug("j2objc dependency converter: Linking Project: $dep")
109 | project.configurations.getByName(isTest ? 'j2objcTestLinkage' : 'j2objcLinkage').dependencies.add(
110 | dep.copy())
111 | }
112 |
113 | protected void visitExternalModuleDependency(ExternalModuleDependency dep, boolean isTest) {
114 | project.logger.debug("j2objc dependency converter: External module dep: $dep")
115 | // If the dep is already in the j2objc dist, ignore it.
116 | if (J2OBJC_DEFAULT_LIBS.contains("${dep.group}:${dep.name}".toString())) {
117 | // TODO: A more correct method might be converting these into our own
118 | // form of SelfResolvingDependency that specifies which j2objc dist lib
119 | // to use.
120 | project.logger.debug("-- Skipped J2OBJC_DEFAULT_LIB: $dep")
121 | return
122 | }
123 | failOnBuildClosureForTests(dep, isTest)
124 | project.logger.debug("-- Copied as source: $dep")
125 | String group = dep.group == null ? '' : dep.group
126 | String version = dep.version == null ? '' : dep.version
127 | // TODO: Make this less fragile. What if sources don't exist for this artifact?
128 | project.dependencies.add('j2objcTranslationClosure', "${group}:${dep.name}:${version}:sources")
129 | }
130 |
131 | protected void visitGenericDependency(Dependency dep, boolean isTest) {
132 | failOnBuildClosureForTests(dep, isTest)
133 | project.logger.warn("j2objc dependency converter: Unknown dependency type: $dep; copying naively")
134 | project.configurations.getByName('j2objcTranslationClosure').dependencies.add(
135 | dep.copy())
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleLibrariesTask.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import groovy.transform.CompileStatic
21 | import org.gradle.api.DefaultTask
22 | import org.gradle.api.file.FileTree
23 | import org.gradle.api.tasks.Input
24 | import org.gradle.api.tasks.InputFiles
25 | import org.gradle.api.tasks.OutputDirectories
26 | import org.gradle.api.tasks.TaskAction
27 |
28 | /**
29 | * Assemble Libraries Task copies generated libraries to assembly directories for
30 | * use by an iOS application.
31 | */
32 | @CompileStatic
33 | class AssembleLibrariesTask extends DefaultTask {
34 |
35 | // Generated ObjC libraries
36 | File srcLibDir
37 | File srcPackedLibDir
38 |
39 | // Only treat as inputs the files of relevant buildType.
40 | @InputFiles
41 | FileTree getSrcLibs() {
42 | return project.fileTree(dir: srcLibDir, include: getLibraryPattern()) +
43 | project.fileTree(dir: srcPackedLibDir, include: getLibraryPattern())
44 | }
45 |
46 | // Debug or Release
47 | @Input
48 | String buildType
49 |
50 | String getLibraryPattern() { return "*$buildType/*.a" }
51 |
52 | File getDestLibDirFile() { return J2objcConfig.from(project).getDestLibDirFile() }
53 |
54 | // Only treat as outputs the directories of relevant buildType.
55 | @SuppressWarnings('unused')
56 | @OutputDirectories
57 | List getDestLibSubdirs() {
58 | List inputDirs = []
59 | FileFilter filter = new FileFilter() {
60 | @Override boolean accept(File pathname) {
61 | // We care only about architecture directories (other files could be in here,
62 | // like .DS_Store)
63 | return pathname.isDirectory() && pathname.name.endsWith(buildType)
64 | }
65 | }
66 | File[] filtered = srcLibDir.listFiles(filter)
67 | // Can legitimately be null when the parent directory doesn't exist.
68 | // If the prior tasks are disabled, it would be correct for this task to pack nothing.
69 | // When testing we don't actually create all these directories either.
70 | if (filtered != null) {
71 | inputDirs.addAll(filtered)
72 | }
73 | filtered = srcPackedLibDir.listFiles(filter)
74 | if (filtered != null) {
75 | inputDirs.addAll(filtered)
76 | }
77 | return inputDirs.collect({ project.file("${getDestLibDirFile().absolutePath}/${it.name}") })
78 | }
79 |
80 | @TaskAction
81 | void assembleLibraries() {
82 | // We don't need to clear out the library path, our libraries can co-exist
83 | // with other libraries if the user wishes them to.
84 |
85 | assert buildType in ['Debug', 'Release']
86 |
87 | Utils.projectCopy(project, {
88 | includeEmptyDirs = true
89 | from srcLibDir
90 | from srcPackedLibDir
91 | into getDestLibDirFile()
92 | include getLibraryPattern()
93 | })
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleResourcesTask.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import groovy.transform.CompileStatic
21 | import org.gradle.api.DefaultTask
22 | import org.gradle.api.file.FileTree
23 | import org.gradle.api.tasks.InputFiles
24 | import org.gradle.api.tasks.OutputDirectory
25 | import org.gradle.api.tasks.TaskAction
26 |
27 | /**
28 | * Assemble Resources Task copies main and test resources to separate
29 | * assembly directories for use by an iOS application.
30 | */
31 | @CompileStatic
32 | class AssembleResourcesTask extends DefaultTask {
33 |
34 | @InputFiles
35 | FileTree getMainTestResourcesFiles() {
36 | FileTree allFiles = Utils.srcSet(project, 'main', 'resources')
37 | allFiles = allFiles.plus(Utils.srcSet(project, 'test', 'resources'))
38 | return allFiles
39 | }
40 |
41 |
42 | @OutputDirectory
43 | File getDestSrcMainResDirFile() {
44 | return J2objcConfig.from(project).getDestSrcDirFile('main', 'resources')
45 | }
46 | @OutputDirectory
47 | File getDestSrcTestResDirFile() {
48 | return J2objcConfig.from(project).getDestSrcDirFile('test', 'resources')
49 | }
50 |
51 |
52 | @TaskAction
53 | void assembleResources() {
54 | assert getDestSrcMainResDirFile().absolutePath !=
55 | getDestSrcTestResDirFile().absolutePath
56 | Utils.syncResourcesTo(project, ['main'], getDestSrcMainResDirFile())
57 | Utils.syncResourcesTo(project, ['test'], getDestSrcTestResDirFile())
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleSourceTask.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import groovy.transform.CompileStatic
21 | import org.gradle.api.DefaultTask
22 | import org.gradle.api.InvalidUserDataException
23 | import org.gradle.api.file.ConfigurableFileCollection
24 | import org.gradle.api.tasks.InputDirectory
25 | import org.gradle.api.tasks.OutputDirectory
26 | import org.gradle.api.tasks.TaskAction
27 |
28 | /**
29 | * Assemble Source Task copies generated source to assembly directories for
30 | * use by an iOS application.
31 | */
32 | @CompileStatic
33 | class AssembleSourceTask extends DefaultTask {
34 |
35 | // Generated ObjC source files
36 | @InputDirectory
37 | File srcGenMainDir
38 | @InputDirectory
39 | File srcGenTestDir
40 |
41 |
42 | @OutputDirectory
43 | File getDestSrcMainObjcDirFile() {
44 | return J2objcConfig.from(project).getDestSrcDirFile('main', 'objc')
45 | }
46 | @OutputDirectory
47 | File getDestSrcTestObjcDirFile() {
48 | return J2objcConfig.from(project).getDestSrcDirFile('test', 'objc')
49 | }
50 |
51 |
52 | @TaskAction
53 | void assembleSource() {
54 | clearDestSrcDirWithChecks(getDestSrcMainObjcDirFile(), 'getDestSrcMainObjcDirFile')
55 | copyMainSource()
56 |
57 | if (getDestSrcTestObjcDirFile().absolutePath != getDestSrcMainObjcDirFile().absolutePath) {
58 | // If we want main source and test source in one directory, then don't
59 | // re-delete the main directory where we just put files!
60 | clearDestSrcDirWithChecks(getDestSrcTestObjcDirFile(), 'getDestSrcTestObjcDirFile')
61 | }
62 | copyTestSource()
63 | }
64 |
65 | private void clearDestSrcDirWithChecks(File destDir, String name) {
66 | ConfigurableFileCollection nonObjcDestFiles = project.files(project.fileTree(
67 | dir: destDir, excludes: ["**/*.h", "**/*.m"]))
68 | // Warn if deleting non-generated objc files from destDir
69 | nonObjcDestFiles.each { File file ->
70 | String message =
71 | "Unexpected files in $name - this folder should contain ONLY J2ObjC\n" +
72 | "generated Objective-C files. The folder contents are deleted to remove\n" +
73 | "files that are nolonger generated. Please check the directory and remove\n" +
74 | "any files that don't end with Objective-C extensions '.h' and '.m'.\n" +
75 | "$name: ${destDir.path}\n" +
76 | "Unexpected file for deletion: ${file.path}"
77 | throw new InvalidUserDataException(message)
78 | }
79 | // TODO: better if this was a sync operation as it does deletes automatically
80 | logger.debug("Deleting $name to fill with generated objc files... " + destDir.path)
81 | Utils.projectDelete(project, destDir)
82 | }
83 |
84 | void copyMainSource() {
85 | Utils.projectCopy(project, {
86 | includeEmptyDirs = false
87 | from srcGenMainDir
88 | into getDestSrcMainObjcDirFile()
89 | })
90 | }
91 |
92 | void copyTestSource() {
93 | Utils.projectCopy(project, {
94 | includeEmptyDirs = false
95 | from srcGenTestDir
96 | into getDestSrcTestObjcDirFile()
97 | })
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/tasks/CycleFinderTask.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import groovy.transform.CompileStatic
21 | import org.gradle.api.DefaultTask
22 | import org.gradle.api.InvalidUserDataException
23 | import org.gradle.api.file.FileCollection
24 | import org.gradle.api.file.FileTree
25 | import org.gradle.api.internal.file.UnionFileCollection
26 | import org.gradle.api.tasks.Input
27 | import org.gradle.api.tasks.InputFile
28 | import org.gradle.api.tasks.InputFiles
29 | import org.gradle.api.tasks.OutputFile
30 | import org.gradle.api.tasks.TaskAction
31 |
32 | /**
33 | * CycleFinder task checks for memory cycles that can cause memory leaks
34 | * since iOS doesn't have garbage collection.
35 | */
36 | @CompileStatic
37 | class CycleFinderTask extends DefaultTask {
38 |
39 | // If the j2objc distribution changes, we want to rerun the task completely.
40 | // As an InputFile, if the content changes, the task will re-run in non-incremental mode.
41 | @InputFile
42 | File getCycleFinderJar() {
43 | return Utils.cycleFinderJar(project)
44 | }
45 |
46 | @SuppressWarnings("GroovyUnusedDeclaration")
47 | @Input String getJ2objcVersion() {
48 | return J2objcConfig.from(project).j2objcVersion
49 | }
50 |
51 | @InputFiles
52 | FileCollection getSrcInputFiles() {
53 | // Note that translatePattern does not need to be an @Input because it is
54 | // solely an input to this method, which is already an input (via @InputFiles).
55 | FileTree allFiles = Utils.srcSet(project, 'main', 'java')
56 | allFiles = allFiles.plus(Utils.srcSet(project, 'test', 'java'))
57 | FileTree ret = allFiles.plus(Utils.javaTrees(project, getGeneratedSourceDirs()))
58 | if (J2objcConfig.from(project).translatePattern != null) {
59 | ret = allFiles.matching(J2objcConfig.from(project).translatePattern)
60 | }
61 | return Utils.mapSourceFiles(project, ret, getTranslateSourceMapping())
62 | }
63 |
64 | // All input files that could affect translation output, except those in j2objc itself.
65 | @InputFiles
66 | UnionFileCollection getAllInputFiles() {
67 | return new UnionFileCollection([
68 | getSrcInputFiles(),
69 | project.files(getTranslateClasspaths()),
70 | project.files(getTranslateSourcepaths())
71 | ])
72 | }
73 |
74 | @Input
75 | int getCycleFinderExpectedCycles() { return J2objcConfig.from(project).cycleFinderExpectedCycles }
76 |
77 | @Input
78 | String getJ2objcHome() { return Utils.j2objcHome(project) }
79 |
80 | @Input
81 | List getCycleFinderArgs() { return J2objcConfig.from(project).cycleFinderArgs }
82 |
83 | @Input
84 | List getTranslateClasspaths() { return J2objcConfig.from(project).translateClasspaths }
85 |
86 | @Input
87 | List getTranslateSourcepaths() { return J2objcConfig.from(project).translateSourcepaths }
88 |
89 | @Input
90 | List getGeneratedSourceDirs() { return J2objcConfig.from(project).generatedSourceDirs }
91 |
92 | @Input
93 | List getTranslateJ2objcLibs() { return J2objcConfig.from(project).translateJ2objcLibs }
94 |
95 | @Input
96 | Map getTranslateSourceMapping() { return J2objcConfig.from(project).translateSourceMapping }
97 |
98 | @Input
99 | boolean getFilenameCollisionCheck() { return J2objcConfig.from(project).getFilenameCollisionCheck() }
100 |
101 |
102 | // Output required for task up-to-date checks
103 | @OutputFile
104 | File getReportFile() { project.file("${project.buildDir}/reports/${name}.out") }
105 |
106 |
107 | @TaskAction
108 | void cycleFinder() {
109 | String cycleFinderExec = getJ2objcHome() + Utils.fileSeparator() + 'cycle_finder'
110 | List windowsOnlyArgs = new ArrayList()
111 | if (Utils.isWindows()) {
112 | cycleFinderExec = 'java'
113 | windowsOnlyArgs.add('-jar')
114 | windowsOnlyArgs.add(getCycleFinderJar().absolutePath)
115 | }
116 |
117 | FileCollection fullSrcFiles = getSrcInputFiles()
118 | // TODO: extract common methods of Translate and Cycle Finder
119 | // TODO: Need to understand why generated source dirs are treated differently by CycleFinder
120 | // vs. translate task. Here they are directly passed to the binary, but in translate
121 | // they are only on the translate source path (meaning they will only be translated with --build-closure).
122 |
123 | UnionFileCollection sourcepathDirs = new UnionFileCollection([
124 | project.files(Utils.srcSet(project, 'main', 'java').getSrcDirs()),
125 | project.files(Utils.srcSet(project, 'test', 'java').getSrcDirs()),
126 | project.files(getTranslateSourcepaths()),
127 | project.files(getGeneratedSourceDirs())
128 | ])
129 | String sourcepathArg = Utils.joinedPathArg(sourcepathDirs)
130 |
131 | UnionFileCollection classpathFiles = new UnionFileCollection([
132 | project.files(getTranslateClasspaths()),
133 | project.files(Utils.j2objcLibs(getJ2objcHome(), getTranslateJ2objcLibs()))
134 | ])
135 | // TODO: comment explaining ${project.buildDir}/classes
136 | String classpathArg = Utils.joinedPathArg(classpathFiles) +
137 | Utils.pathSeparator() + "${project.buildDir}/classes"
138 |
139 | ByteArrayOutputStream stdout = new ByteArrayOutputStream()
140 | ByteArrayOutputStream stderr = new ByteArrayOutputStream()
141 |
142 | // Capturing group is the cycle count, i.e. '\d+'
143 | String cyclesFoundRegex = /(\d+) CYCLES FOUND/
144 |
145 | try {
146 | logger.debug('CycleFinderTask - projectExec:')
147 | Utils.projectExec(project, stdout, stderr, cyclesFoundRegex, {
148 | executable cycleFinderExec
149 | windowsOnlyArgs.each { String windowsOnlyArg ->
150 | args windowsOnlyArg
151 | }
152 |
153 | // Arguments
154 | args "-sourcepath", sourcepathArg
155 | args "-classpath", classpathArg
156 | getCycleFinderArgs().each { String cycleFinderArg ->
157 | args cycleFinderArg
158 | }
159 |
160 | // File Inputs
161 | fullSrcFiles.each { File file ->
162 | args file.path
163 | }
164 |
165 | setStandardOutput stdout
166 | setErrorOutput stderr
167 | })
168 |
169 | logger.debug("CycleFinder found 0 cycles")
170 | assert 0 == getCycleFinderExpectedCycles()
171 |
172 | } catch (Exception exception) { // NOSONAR
173 | // ExecException is converted to InvalidUserDataException in Utils.projectExec(...)
174 |
175 | if (!Utils.isProjectExecNonZeroExit(exception)) {
176 | throw exception
177 | }
178 |
179 | String cyclesFoundStr = Utils.matchRegexOutputs(stdout, stderr, cyclesFoundRegex)
180 | if (!cyclesFoundStr?.isInteger()) {
181 | String message =
182 | exception.toString() + '\n' +
183 | 'CycleFinder completed could not find expected output.\n' +
184 | 'Failed Regex Match cyclesFoundRegex: ' +
185 | Utils.escapeSlashyString(cyclesFoundRegex) + '\n' +
186 | 'Found: ' + cyclesFoundStr
187 | throw new InvalidUserDataException(message, exception)
188 | }
189 |
190 | // Matched (XX CYCLES FOUND), so assert on cyclesFound
191 | int cyclesFound = cyclesFoundStr.toInteger()
192 | if (cyclesFound != getCycleFinderExpectedCycles()) {
193 | String message =
194 | "Unexpected number of cycles found:\n" +
195 | "Expected Cycles: ${getCycleFinderExpectedCycles()}\n" +
196 | "Actual Cycles: $cyclesFound\n" +
197 | "\n" +
198 | "You should investigate the change and if ok, modify build.gradle:\n" +
199 | "\n" +
200 | "j2objcConfig {\n" +
201 | " cycleFinderExpectedCycles $cyclesFound\n" +
202 | "}\n"
203 | throw new InvalidUserDataException(message)
204 | }
205 | // Suppress exception when cycles found == cycleFinderExpectedCycles
206 | } finally {
207 | // Write output always.
208 | getReportFile().write(Utils.stdOutAndErrToLogString(stdout, stderr))
209 | logger.debug("CycleFinder Output: ${getReportFile().path}")
210 | }
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/src/main/groovy/com/github/j2objccontrib/j2objcgradle/tasks/PackLibrariesTask.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import groovy.transform.CompileStatic
21 | import org.gradle.api.DefaultTask
22 | import org.gradle.api.file.ConfigurableFileCollection
23 | import org.gradle.api.tasks.Input
24 | import org.gradle.api.tasks.InputFiles
25 | import org.gradle.api.tasks.OutputDirectory
26 | import org.gradle.api.tasks.TaskAction
27 |
28 | /**
29 | * Uses 'lipo' binary to combine multiple architecture flavors of a library into a
30 | * single 'fat' library.
31 | */
32 | @CompileStatic
33 | class PackLibrariesTask extends DefaultTask {
34 |
35 | // Generated ObjC binaries
36 | @InputFiles
37 | ConfigurableFileCollection getLibrariesFiles() {
38 | String staticLibraryPath = "${project.buildDir}/binaries/${project.name}-j2objcStaticLibrary"
39 | return project.files(getActiveArchs().collect { String arch ->
40 | "$staticLibraryPath/$arch$buildType/lib${project.name}-j2objc.a"
41 | })
42 | }
43 |
44 | // Debug or Release
45 | @Input
46 | String buildType
47 |
48 | @Input
49 | List getActiveArchs() { return J2objcConfig.from(project).activeArchs }
50 |
51 |
52 | @OutputDirectory
53 | File getOutputLibDirFile() {
54 | return project.file("${project.buildDir}/packedBinaries/${project.name}-j2objcStaticLibrary/ios$buildType")
55 | }
56 |
57 |
58 | @TaskAction
59 | void packLibraries() {
60 | Utils.requireMacOSX('j2objcPackLibraries task')
61 | assert buildType in ['Debug', 'Release']
62 |
63 | Utils.projectDelete(project, getOutputLibDirFile())
64 | getOutputLibDirFile().mkdirs()
65 |
66 | ByteArrayOutputStream stdout = new ByteArrayOutputStream()
67 | ByteArrayOutputStream stderr = new ByteArrayOutputStream()
68 |
69 | try {
70 | Utils.projectExec(project, stdout, stderr, null, {
71 | executable 'xcrun'
72 | args 'lipo'
73 |
74 | args '-create'
75 | args '-output', project.file("${outputLibDirFile}/lib${project.name}-j2objc.a").absolutePath
76 |
77 | getLibrariesFiles().each { File libFile ->
78 | args libFile.absolutePath
79 | }
80 |
81 | setErrorOutput stdout
82 | setStandardOutput stderr
83 | })
84 |
85 | } catch (Exception exception) { // NOSONAR
86 | // TODO: match on common failures and provide useful help
87 | throw exception
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/resources/AUTHORS:
--------------------------------------------------------------------------------
1 | ../../../AUTHORS
--------------------------------------------------------------------------------
/src/main/resources/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ../../../CHANGELOG.md
--------------------------------------------------------------------------------
/src/main/resources/FAQ.md:
--------------------------------------------------------------------------------
1 | ../../../FAQ.md
--------------------------------------------------------------------------------
/src/main/resources/LICENSE:
--------------------------------------------------------------------------------
1 | ../../../LICENSE
--------------------------------------------------------------------------------
/src/main/resources/META-INF/gradle-plugins/com.github.j2objccontrib.j2objcgradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # This line wires up the plugin short-name 'j2objc' in the line:
18 | # apply plugin: 'j2objc'
19 | # to the following Plugin implementation.
20 | implementation-class=com.github.j2objccontrib.j2objcgradle.J2objcPlugin
21 |
22 |
--------------------------------------------------------------------------------
/src/main/resources/NOTICE:
--------------------------------------------------------------------------------
1 | ../../../NOTICE
--------------------------------------------------------------------------------
/src/main/resources/README.md:
--------------------------------------------------------------------------------
1 | ../../../README.md
--------------------------------------------------------------------------------
/src/main/resources/dependencies.md:
--------------------------------------------------------------------------------
1 | ../../../dependencies.md
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/MultiProjectTest.groovy:
--------------------------------------------------------------------------------
1 | package com.github.j2objccontrib.j2objcgradle
2 |
3 | import com.github.j2objccontrib.j2objcgradle.tasks.TestingUtils
4 | import com.github.j2objccontrib.j2objcgradle.tasks.Utils
5 | import groovy.util.logging.Slf4j
6 | import org.gradle.api.InvalidUserDataException
7 | import org.gradle.api.Project
8 | import org.gradle.nativeplatform.NativeBinarySpec
9 | import org.gradle.nativeplatform.NativeLibraryBinary
10 | import org.gradle.platform.base.BinarySpec
11 | import org.junit.After
12 | import org.junit.Before
13 | import org.junit.Ignore
14 | import org.junit.Test
15 |
16 | /**
17 | * Integration tests with multiple projects.
18 | */
19 | @Slf4j
20 | class MultiProjectTest {
21 |
22 | private Project rootProj, proj1, proj2
23 | private J2objcConfig j2objcConfig1, j2objcConfig2
24 |
25 | @Before
26 | void setUp() {
27 | Utils.setFakeOSMacOSX()
28 | // We can't use _ for unused slots because the other variables have already been declared above.
29 | Object unused
30 |
31 | // The root needs a local.properties, but nothing else.
32 | (rootProj, unused, unused) = TestingUtils.setupProject(new TestingUtils.ProjectConfig())
33 |
34 | // Project 1 will have its J2objcPlugin applied dynamically if needed.
35 | (proj1, unused, j2objcConfig1) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
36 | applyJavaPlugin: true,
37 | createReportsDir: true,
38 | rootProject: rootProj
39 | ))
40 | (proj2, unused, j2objcConfig2) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
41 | applyJ2objcPlugin: true,
42 | createReportsDir: true,
43 | rootProject: rootProj
44 | ))
45 | }
46 |
47 | @After
48 | void tearDown() {
49 | Utils.setFakeOSNone()
50 | }
51 |
52 | @Test(expected = InvalidUserDataException)
53 | void twoProjectsWithDependsOnJ2objcLib_MissingPluginOnProject1() {
54 | j2objcConfig2.dependsOnJ2objcLib(proj1)
55 | j2objcConfig2.finalConfigure()
56 | }
57 |
58 | @Ignore('https://github.com/j2objc-contrib/j2objc-gradle/issues/374')
59 | @Test
60 | void twoProjectsWithDependsOnJ2objcLib_Works() {
61 | proj1.pluginManager.apply(J2objcPlugin)
62 | j2objcConfig1 = J2objcConfig.from(proj1)
63 | j2objcConfig1.finalConfigure()
64 |
65 | // Will force evaluation of proj1.
66 | j2objcConfig2.dependsOnJ2objcLib(proj1)
67 | j2objcConfig2.finalConfigure()
68 |
69 | boolean evaluated = false
70 | proj2.afterEvaluate { Project project ->
71 | evaluated = true
72 | // This forces the native plugin to convert the model rules to actual binaries.
73 | project.tasks.realize()
74 | project.bindAllModelRules()
75 | }
76 |
77 | // Should force evaluation of proj2.
78 | rootProj.evaluationDependsOnChildren()
79 | assert evaluated
80 |
81 | // proj2 should build after proj1
82 | assert TestingUtils.getTaskDependencies(proj2, 'j2objcPreBuild').contains(proj1.tasks.getByName('jar'))
83 | assert TestingUtils.getTaskDependencies(proj2, 'j2objcPreBuild').contains(proj1.tasks.getByName('j2objcBuild'))
84 |
85 | // proj2's Objective C libraries should link to proj1's Objective C libraries
86 | proj2.binaries.each { BinarySpec binary ->
87 | // Some of the binaries are Java classes, don't test those.
88 | if (binary instanceof NativeBinarySpec) {
89 | NativeBinarySpec nativeBinary = (NativeBinarySpec) binary
90 | // Some of the binaries may be the user's custom native binaries, don't test those.
91 | if (nativeBinary.name.contains('j2objc')) {
92 | // There may be other dependencies, so we use 'any'.
93 | assert nativeBinary.libs.any {
94 | NativeLibraryBinary bin = it.binary
95 | // The rest of the name indicates debug/release, architecture, etc.
96 | return bin.displayName.startsWith("static library '${proj1.name}-j2objc:")
97 | }
98 | }
99 | }
100 | }
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleLibrariesTaskTest.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import org.gradle.api.Project
21 | import org.junit.Before
22 | import org.junit.Test
23 |
24 | /**
25 | * TestTask tests.
26 | */
27 | class AssembleLibrariesTaskTest {
28 |
29 | private Project proj
30 | private String j2objcHome
31 | private J2objcConfig j2objcConfig
32 |
33 | @Before
34 | void setUp() {
35 | (proj, j2objcHome, j2objcConfig) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
36 | applyJavaPlugin: true,
37 | createJ2objcConfig: true
38 | ))
39 | }
40 |
41 | @Test
42 | void testAssembleLibraries() {
43 | // Expected Activity
44 | MockProjectExec mockProjectExec = new MockProjectExec(proj, '/J2OBJC_HOME')
45 | mockProjectExec.demandCopyAndReturn({
46 | includeEmptyDirs = true
47 | from proj.file("build/binaries/$proj.name-j2objcStaticLibrary").absolutePath
48 | from proj.file("build/packedBinaries/$proj.name-j2objcStaticLibrary").absolutePath
49 | into proj.file('build/j2objcOutputs/lib').absolutePath
50 | include '*Debug/*.a'
51 | })
52 |
53 | AssembleLibrariesTask j2objcAssembleLibraries = (AssembleLibrariesTask) proj.tasks.create(
54 | name: 'j2objcAssembleLibraries', type: AssembleLibrariesTask) {
55 | buildType = 'Debug'
56 | srcLibDir = new File(proj.buildDir, "binaries/$proj.name-j2objcStaticLibrary".toString())
57 | srcPackedLibDir = new File(proj.buildDir, "packedBinaries/$proj.name-j2objcStaticLibrary".toString())
58 | }
59 |
60 | j2objcAssembleLibraries.assembleLibraries()
61 |
62 | mockProjectExec.verify()
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleResourcesTaskTest.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import org.gradle.api.Project
21 | import org.junit.Before
22 | import org.junit.Test
23 |
24 | /**
25 | * TestTask tests.
26 | */
27 | class AssembleResourcesTaskTest {
28 |
29 | private Project proj
30 | private String j2objcHome
31 | private J2objcConfig j2objcConfig
32 |
33 | @Before
34 | void setUp() {
35 | (proj, j2objcHome, j2objcConfig) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
36 | applyJavaPlugin: true,
37 | createJ2objcConfig: true
38 | ))
39 | }
40 |
41 | @Test
42 | void testAssembleResources_Basic() {
43 | // Expected Activity
44 | MockProjectExec mockProjectExec = new MockProjectExec(proj, '/J2OBJC_HOME')
45 |
46 | // Main
47 | mockProjectExec.demandDeleteAndReturn(
48 | proj.file('build/j2objcOutputs/src/main/resources').absolutePath)
49 | mockProjectExec.demandMkDirAndReturn(
50 | proj.file('build/j2objcOutputs/src/main/resources').absolutePath)
51 | mockProjectExec.demandCopyAndReturn(
52 | proj.file('build/j2objcOutputs/src/main/resources').absolutePath,
53 | proj.file('src/main/resources').absolutePath)
54 |
55 | // Test
56 | mockProjectExec.demandDeleteAndReturn(
57 | proj.file('build/j2objcOutputs/src/test/resources').absolutePath)
58 | mockProjectExec.demandMkDirAndReturn(
59 | proj.file('build/j2objcOutputs/src/test/resources').absolutePath)
60 | mockProjectExec.demandCopyAndReturn(
61 | proj.file('build/j2objcOutputs/src/test/resources').absolutePath,
62 | proj.file('src/test/resources').absolutePath)
63 |
64 | AssembleResourcesTask j2objcAssembleResources =
65 | (AssembleResourcesTask) proj.tasks.create(name: 'j2objcAR', type: AssembleResourcesTask)
66 |
67 | j2objcAssembleResources.assembleResources()
68 |
69 | mockProjectExec.verify()
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/AssembleSourceTaskTest.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import org.gradle.api.Project
21 | import org.junit.Before
22 | import org.junit.Test
23 |
24 | /**
25 | * TestTask tests.
26 | */
27 | class AssembleSourceTaskTest {
28 |
29 | private Project proj
30 | private String j2objcHome
31 | private J2objcConfig j2objcConfig
32 |
33 | @Before
34 | void setUp() {
35 | (proj, j2objcHome, j2objcConfig) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
36 | applyJavaPlugin: true,
37 | createJ2objcConfig: true
38 | ))
39 | }
40 |
41 | @Test
42 | void testAssembleSource() {
43 | // Expected Activity
44 | MockProjectExec mockProjectExec = new MockProjectExec(proj, '/J2OBJC_HOME')
45 | mockProjectExec.demandDeleteAndReturn(
46 | proj.file('build/j2objcOutputs/src/main/objc').absolutePath)
47 | mockProjectExec.demandCopyAndReturn({
48 | includeEmptyDirs = false
49 | from proj.file('build/j2objcSrcGenMain').absolutePath
50 | into proj.file('build/j2objcOutputs/src/main/objc').absolutePath
51 | })
52 | mockProjectExec.demandDeleteAndReturn(
53 | proj.file('build/j2objcOutputs/src/test/objc').absolutePath)
54 | mockProjectExec.demandCopyAndReturn({
55 | includeEmptyDirs = false
56 | from proj.file('build/j2objcSrcGenTest').absolutePath
57 | into proj.file('build/j2objcOutputs/src/test/objc').absolutePath
58 | })
59 |
60 | AssembleSourceTask j2objcAssembleSource =
61 | (AssembleSourceTask) proj.tasks.create(name: 'j2objcAS', type: AssembleSourceTask) {
62 | srcGenMainDir proj.file('build/j2objcSrcGenMain')
63 | srcGenTestDir proj.file('build/j2objcSrcGenTest')
64 | }
65 |
66 | j2objcAssembleSource.assembleSource()
67 |
68 | mockProjectExec.verify()
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/PackLibrariesTaskTest.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
19 | import org.gradle.api.InvalidUserDataException
20 | import org.gradle.api.Project
21 | import org.junit.After
22 | import org.junit.Before
23 | import org.junit.Rule
24 | import org.junit.Test
25 | import org.junit.rules.ExpectedException
26 | /**
27 | * TestTask tests.
28 | */
29 | class PackLibrariesTaskTest {
30 |
31 | private Project proj
32 | private String j2objcHome
33 | private J2objcConfig j2objcConfig
34 |
35 | @Rule
36 | public ExpectedException expectedException = ExpectedException.none();
37 |
38 | @Before
39 | void setUp() {
40 | // Mac OS X is the only OS that can run this task
41 | Utils.setFakeOSMacOSX()
42 | (proj, j2objcHome, j2objcConfig) = TestingUtils.setupProject(new TestingUtils.ProjectConfig(
43 | applyJavaPlugin: true,
44 | createJ2objcConfig: true
45 | ))
46 | }
47 |
48 | @After
49 | void tearDown() {
50 | Utils.setFakeOSNone()
51 | }
52 |
53 | @Test
54 | void testPackLibraries_Windows() {
55 | Utils.setFakeOSWindows()
56 |
57 | PackLibrariesTask j2objcPackLibraries =
58 | (PackLibrariesTask) proj.tasks.create(name: 'j2objcPackLibraries', type: PackLibrariesTask) {
59 | buildType = 'Debug'
60 | }
61 |
62 | expectedException.expect(InvalidUserDataException.class)
63 | expectedException.expectMessage('Mac OS X is required for j2objcPackLibraries task')
64 |
65 | j2objcPackLibraries.packLibraries()
66 | }
67 |
68 | @Test
69 | void testPackLibraries() {
70 | // Expected Activity
71 | MockProjectExec mockProjectExec = new MockProjectExec(proj, '/J2OBJC_HOME')
72 | mockProjectExec.demandDeleteAndReturn(
73 | proj.file("build/packedBinaries/$proj.name-j2objcStaticLibrary/iosDebug").absolutePath)
74 | mockProjectExec.demandExecAndReturn(
75 | [
76 | 'xcrun',
77 | 'lipo',
78 |
79 | '-create',
80 | '-output', "/PROJECT_DIR/build/packedBinaries/$proj.name-j2objcStaticLibrary/iosDebug/lib$proj.name-j2objc.a",
81 |
82 | "/PROJECT_DIR/build/binaries/$proj.name-j2objcStaticLibrary/${j2objcConfig.supportedArchs[0]}Debug/lib$proj.name-j2objc.a",
83 | "/PROJECT_DIR/build/binaries/$proj.name-j2objcStaticLibrary/${j2objcConfig.supportedArchs[1]}Debug/lib$proj.name-j2objc.a",
84 | "/PROJECT_DIR/build/binaries/$proj.name-j2objcStaticLibrary/${j2objcConfig.supportedArchs[2]}Debug/lib$proj.name-j2objc.a"
85 | ])
86 | assert j2objcConfig.supportedArchs.size() == 3, 'Need to update list of arguments above'
87 |
88 | PackLibrariesTask j2objcPackLibraries =
89 | (PackLibrariesTask) proj.tasks.create(name: 'j2objcPackLibraries', type: PackLibrariesTask) {
90 | buildType = 'Debug'
91 | }
92 |
93 | j2objcPackLibraries.packLibraries()
94 |
95 | mockProjectExec.verify()
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/TestingUtils.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objccontrib.j2objcgradle.tasks
18 |
19 | import com.github.j2objccontrib.j2objcgradle.J2objcConfig
20 | import com.github.j2objccontrib.j2objcgradle.J2objcPlugin
21 | import groovy.util.logging.Slf4j
22 | import org.gradle.api.Project
23 | import org.gradle.api.Task
24 | import org.gradle.api.plugins.JavaPlugin
25 | import org.gradle.testfixtures.ProjectBuilder
26 |
27 | import java.util.concurrent.atomic.AtomicInteger
28 |
29 | /**
30 | * Util methods for testing projects.
31 | */
32 |
33 | // Without access to the project, logging is performed using the
34 | // static 'log' variable added during decoration with this annotation.
35 | @Slf4j
36 | class TestingUtils {
37 |
38 | static final String windowsAbsolutePathPrefix = 'C:'
39 | static AtomicInteger projectIndex = new AtomicInteger()
40 |
41 | static final class ProjectConfig {
42 | /** to apply the J2objcPlugin */
43 | boolean applyJ2objcPlugin = false
44 | /** to apply the JavaPlugin (forced true if applyJ2objcPlugin = true) */
45 | boolean applyJavaPlugin = false
46 | /** to create the j2objcConfig extension (forced true if applyJ2objcPlugin = true) */
47 | boolean createJ2objcConfig = false
48 | /** to create projectDir/build/reports for writing output */
49 | boolean createReportsDir = false
50 | /** the parent project for this project, if any */
51 | Project rootProject = null
52 | /** lines to add to the local.properties file (in addition to j2objc.home) */
53 | List extraLocalProperties = []
54 | }
55 |
56 | /**
57 | * Setup the project for testing purposes
58 | *
59 | * Configuration in setup() or individual test:
60 | * (proj, j2objcHome, j2objcConfig) = TestingUtils.setupProject(new ProjectConfig(...))
61 | *
62 | * @return [Project proj, String j2objcHome, J2objcConfig j2objcConfig] multiple assignment
63 | */
64 | static Object[] setupProject(ProjectConfig config) {
65 | // Builds temporary project
66 | Project proj = ProjectBuilder.builder()
67 | .withParent(config.rootProject)
68 | .withName("testProject${projectIndex.getAndIncrement()}")
69 | .build()
70 | if (config.rootProject != null) {
71 | // When using a child project, the project's directory (a subdirectory of the root)
72 | // is not created automatically.
73 | assert proj.projectDir.mkdir()
74 | }
75 |
76 | if (config.applyJavaPlugin || config.applyJ2objcPlugin) {
77 | // To satisfy Utils.throwIfNoJavaPlugin()
78 | proj.pluginManager.apply(JavaPlugin)
79 | }
80 |
81 | String j2objcHome = createLocalPropertiesAndJ2objcHome(proj, config.extraLocalProperties)
82 |
83 | J2objcConfig j2objcConfig = null
84 | if (config.applyJ2objcPlugin) {
85 | proj.pluginManager.apply(J2objcPlugin)
86 | j2objcConfig = (J2objcConfig) proj.extensions.getByName('j2objcConfig')
87 | } else if (config.createJ2objcConfig) {
88 | // can't use the config from the J2objcPlugin:
89 | j2objcConfig = proj.extensions.create('j2objcConfig', J2objcConfig, proj)
90 | }
91 |
92 | if (config.createReportsDir) {
93 | // Can't write @OutputFile in "projectDir/build/reports" unless directory exists
94 | File reportsDir = new File(proj.buildDir, "reports")
95 | assert reportsDir.mkdirs()
96 | }
97 |
98 | return [proj, j2objcHome, j2objcConfig]
99 | }
100 |
101 | private static String createLocalPropertiesAndJ2objcHome(
102 | Project proj, List extraLocalProperties) {
103 |
104 | // Create fake folder for J2OBJC_HOME
105 | String j2objcHome = File.createTempDir('J2OBJC_HOME', '').absolutePath
106 | // Backslashes on Windows are silently dropped when loading properties:
107 | // http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)
108 | j2objcHome = j2objcHome.replace('\\', '/')
109 |
110 | // Utils.J2objcHome() finds the path through local.properties
111 | File localProperties = proj.file('local.properties')
112 | List localPropertiesLines = new ArrayList<>()
113 | localPropertiesLines.add("j2objc.home=" + j2objcHome)
114 | localPropertiesLines.addAll(extraLocalProperties)
115 | localProperties.write(localPropertiesLines.join('\n'))
116 |
117 | return j2objcHome
118 | }
119 |
120 | static J2objcConfig setupProjectJ2objcConfig(ProjectConfig config) {
121 | return setupProject(config)[2] as J2objcConfig
122 | }
123 |
124 | static Set extends Task> getTaskDependencies(Project proj, String name) {
125 | // Strange API requires passing the task as a parameter to getDependencies.
126 | Task task = proj.tasks.getByName(name)
127 | return task.taskDependencies.getDependencies(task)
128 | }
129 |
130 | // Windows accepts both back and forward slashes
131 | // This means it's ok to canonicalize both actual and expected paths before comparison
132 | static String windowsToForwardSlash(String arg) {
133 | if (Utils.isWindows() || Utils.isWindowsNoFake()) {
134 | // Convert to Unix / Mac standard of forward slashes
135 | return arg.replace('\\', '/')
136 | }
137 | return arg
138 | }
139 |
140 | // Needed to trick Gradle methods that require an absolute path
141 | // E.g. proj.files(...) or proj.exec workingDir
142 | static String windowsNoFakeAbsolutePath(String path) {
143 | if (Utils.isWindowsNoFake()) {
144 | assert path.startsWith('/') || path.startsWith('\\')
145 | return windowsAbsolutePathPrefix + path
146 | }
147 | return path
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/src/test/resources/com/github/j2objccontrib/j2objcgradle/tasks/prefixes.properties:
--------------------------------------------------------------------------------
1 | com.example.parent: ParentPrefixesFile
2 | com.example.parent.subdir: SubdirPrefixesFile
3 | com.example.other: OtherPrefixesFile
4 |
--------------------------------------------------------------------------------
/systemTests/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore all the wrappers below.
2 | gradle/
3 | gradlew.bat
4 |
5 | # Under this directory, we do in fact need to preserve local.properties!
6 | !local.properties
7 |
8 | # Generated by install.sh
9 | common/local.properties
10 | localJ2objcDist/
11 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/.name:
--------------------------------------------------------------------------------
1 | allPlatforms
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.application'
18 |
19 | android {
20 | compileSdkVersion 21
21 | buildToolsVersion "21.1.2"
22 |
23 | defaultConfig {
24 | applicationId "com.github.j2objc_contrib.android_app"
25 | minSdkVersion 15
26 | targetSdkVersion 21
27 | versionCode 1
28 | versionName "1.0"
29 | }
30 | buildTypes {
31 | release {
32 | minifyEnabled false
33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34 | }
35 | }
36 | }
37 |
38 | dependencies {
39 | compile project(':shared')
40 |
41 | compile fileTree(dir: 'libs', include: ['*.jar'])
42 | compile 'com.android.support:appcompat-v7:21.0.3'
43 |
44 | testCompile 'junit:junit:4.12'
45 | }
46 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/androidTest/java/com/github/j2objc_contrib/android_app/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objc_contrib.android_app;
18 |
19 | import android.app.Application;
20 | import android.test.ApplicationTestCase;
21 |
22 | /**
23 | * Testing Fundamentals
24 | */
25 | public class ApplicationTest extends ApplicationTestCase {
26 | public ApplicationTest() {
27 | super(Application.class);
28 | }
29 |
30 | // TODO: add test case for sharedString() method
31 | }
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/java/com/github/j2objc_contrib/android_app/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objc_contrib.android_app;
18 |
19 | import android.os.Bundle;
20 | import android.support.v7.app.ActionBarActivity;
21 | import android.util.Log;
22 | import android.view.Menu;
23 | import android.view.MenuItem;
24 |
25 | import com.example.Shared;
26 |
27 | public class MainActivity extends ActionBarActivity {
28 |
29 | private final String TAG = "MainActivity";
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_main);
35 | Log.d(TAG, sharedString());
36 | }
37 |
38 | @Override
39 | public boolean onCreateOptionsMenu(Menu menu) {
40 | // Inflate the menu; this adds items to the action bar if it is present.
41 | getMenuInflater().inflate(R.menu.menu_main, menu);
42 | return true;
43 | }
44 |
45 | @Override
46 | public boolean onOptionsItemSelected(MenuItem item) {
47 | // Handle action bar item clicks here. The action bar will
48 | // automatically handle clicks on the Home/Up button, so long
49 | // as you specify a parent activity in AndroidManifest.xml.
50 | int id = item.getItemId();
51 |
52 | //noinspection SimplifiableIfStatement
53 | if (id == R.id.action_settings) {
54 | return true;
55 | }
56 |
57 | return super.onOptionsItemSelected(item);
58 | }
59 |
60 | public static String sharedString() {
61 | Shared shared = new Shared();
62 | return shared.toString();
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
11 |
12 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/systemTests/allPlatforms/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/systemTests/allPlatforms/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/systemTests/allPlatforms/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/systemTests/allPlatforms/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/j2objc-contrib/j2objc-gradle/eb1df89a11d58abeec22f80be37a6dac5f7dbf6a/systemTests/allPlatforms/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ANDROID-APP
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/app/src/test/java/com/github/j2objc_contrib/android_app/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.github.j2objc_contrib.android_app;
18 |
19 | import org.junit.Test;
20 |
21 | import static org.junit.Assert.*;
22 |
23 | /**
24 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
25 | */
26 | public class ExampleUnitTest {
27 | @Test
28 | public void addition_isCorrect() throws Exception {
29 | assertEquals(4, 2 + 2);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | buildscript {
18 | repositories {
19 | jcenter()
20 | }
21 | dependencies {
22 | classpath 'com.android.tools.build:gradle:1.3.0'
23 | // NOTE: Do not place your application dependencies here; they belong
24 | // in the individual module build.gradle files
25 | }
26 | dependencies {
27 | // This is the build output of the plugin itself.
28 | classpath fileTree(dir: '../../build/libs', include: ['*.jar'])
29 | }
30 | }
31 |
32 |
33 | allprojects {
34 | repositories {
35 | jcenter()
36 | }
37 | }
38 |
39 | task clean(type: Delete) {
40 | delete rootProject.buildDir
41 | }
42 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/gradlew:
--------------------------------------------------------------------------------
1 | ../../gradlew
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/ALL-PLATFORMS-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef IOS_APP_Bridging_Header_h
18 | #define IOS_APP_Bridging_Header_h
19 |
20 | #import "com/example/Shared.h"
21 |
22 | #endif /* IOS_APP_Bridging_Header_h */
23 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/ALL-PLATFORMS.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/ALL-PLATFORMS.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | @UIApplicationMain
20 | class AppDelegate: UIResponder, UIApplicationDelegate {
21 |
22 | var window: UIWindow?
23 |
24 |
25 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
26 | // Override point for customization after application launch.
27 | return true
28 | }
29 |
30 | func applicationWillResignActive(application: UIApplication) {
31 | // 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.
32 | // 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.
33 | }
34 |
35 | func applicationDidEnterBackground(application: UIApplication) {
36 | // 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.
37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
38 | }
39 |
40 | func applicationWillEnterForeground(application: UIApplication) {
41 | // 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.
42 | }
43 |
44 | func applicationDidBecomeActive(application: UIApplication) {
45 | // 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.
46 | }
47 |
48 | func applicationWillTerminate(application: UIApplication) {
49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
50 | }
51 |
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/Assets.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 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/Base.lproj/LaunchScreen.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 |
27 |
28 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/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 |
27 |
28 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APP/ViewController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | class ViewController: UIViewController {
20 |
21 | override func viewDidLoad() {
22 | super.viewDidLoad()
23 |
24 | // Do any additional setup after loading the view, typically from a nib.
25 | sharedToString()
26 | }
27 |
28 | override func didReceiveMemoryWarning() {
29 | super.didReceiveMemoryWarning()
30 | // Dispose of any resources that can be recreated.
31 | }
32 |
33 | func sharedToString() -> String {
34 | let shared = ComExampleShared()
35 | let result = "\(shared)"
36 | NSLog(result)
37 | return result
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APPTests/IOS_APPTests.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import XCTest
18 | @testable import IOS_APP
19 |
20 | class IOS_APPTests: XCTestCase {
21 |
22 | override func setUp() {
23 | super.setUp()
24 | // Put setup code here. This method is called before the invocation of each test method in the class.
25 | }
26 |
27 | override func tearDown() {
28 | // Put teardown code here. This method is called after the invocation of each test method in the class.
29 | super.tearDown()
30 | }
31 |
32 | func testSharedToString() {
33 | let viewController = ViewController()
34 | XCTAssertEqual("'Shared' Java Class OK", viewController.sharedToString())
35 | }
36 |
37 | func testPerformanceExample() {
38 | // This is an example of a performance test case.
39 | self.measureBlock {
40 | // Put the code you want to measure the time of here.
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/IOS-APPTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APP/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Cocoa
18 |
19 | @NSApplicationMain
20 | class AppDelegate: NSObject, NSApplicationDelegate {
21 |
22 |
23 |
24 | func applicationDidFinishLaunching(aNotification: NSNotification) {
25 | // Insert code here to initialize your application
26 | }
27 |
28 | func applicationWillTerminate(aNotification: NSNotification) {
29 | // Insert code here to tear down your application
30 | }
31 |
32 |
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APP/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APP/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | $(MACOSX_DEPLOYMENT_TARGET)
27 | NSHumanReadableCopyright
28 | Copyright © 2015 J2ObjC Contrib. All rights reserved.
29 | NSMainStoryboardFile
30 | Main
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APP/ViewController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Cocoa
18 |
19 | class ViewController: NSViewController {
20 |
21 | override func viewDidLoad() {
22 | super.viewDidLoad()
23 |
24 | // Do any additional setup after loading the view.
25 | sharedToString()
26 | }
27 |
28 | override var representedObject: AnyObject? {
29 | didSet {
30 | // Update the view, if already loaded.
31 | }
32 | }
33 |
34 | func sharedToString() -> String {
35 | let shared = ComExampleShared()
36 | let result = "\(shared)"
37 | NSLog(result)
38 | return result
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APPTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/OSX-APPTests/OSX_APPTests.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import XCTest
18 | @testable import OSX_APP
19 |
20 | class OSX_APPTests: XCTestCase {
21 |
22 | override func setUp() {
23 | super.setUp()
24 | // Put setup code here. This method is called before the invocation of each test method in the class.
25 | }
26 |
27 | override func tearDown() {
28 | // Put teardown code here. This method is called after the invocation of each test method in the class.
29 | super.tearDown()
30 | }
31 |
32 | func testExample() {
33 | let viewController = ViewController()
34 | XCTAssertEqual("'Shared' Java Class OK", viewController.sharedToString())
35 | }
36 |
37 | func testPerformanceExample() {
38 | // This is an example of a performance test case.
39 | self.measureBlock {
40 | // Put the code you want to measure the time of here.
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '8.0'
3 | # Uncomment this line if you're using Swift
4 | # use_frameworks!
5 |
6 | # J2ObjC Gradle Plugin - DO NOT MODIFY from here to the first target
7 | def j2objc_shared
8 | pod 'j2objc-shared-debug', :configuration => ['Debug'], :path => '../shared/build'
9 | pod 'j2objc-shared-release', :configuration => ['Release'], :path => '../shared/build'
10 | end
11 |
12 | target 'IOS-APP' do
13 | platform :ios, '6.0'
14 | j2objc_shared
15 | end
16 |
17 | target 'IOS-APPTests' do
18 | platform :ios, '6.0'
19 | j2objc_shared
20 | end
21 |
22 | target 'WATCH-APP' do
23 | end
24 |
25 | target 'WATCH-APP Extension' do
26 | end
27 |
28 | target 'OSX-APP' do
29 | platform :osx, '10.6'
30 | j2objc_shared
31 | end
32 |
33 | target 'OSX-APPTests' do
34 | platform :osx, '10.6'
35 | j2objc_shared
36 | end
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - j2objc-shared-debug (1.0)
3 | - j2objc-shared-release (1.0)
4 |
5 | DEPENDENCIES:
6 | - j2objc-shared-debug (from `../shared/build`)
7 | - j2objc-shared-release (from `../shared/build`)
8 |
9 | EXTERNAL SOURCES:
10 | j2objc-shared-debug:
11 | :path: ../shared/build
12 | j2objc-shared-release:
13 | :path: ../shared/build
14 |
15 | SPEC CHECKSUMS:
16 | j2objc-shared-debug: e776b0c5a7d9b23e45eca69113f37fbdc3b75f02
17 | j2objc-shared-release: fd135fd22c5c47cb204b7fecf2794f6f6532e1bf
18 |
19 | COCOAPODS: 0.39.0
20 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/Assets.xcassets/README__ignoredByTemplate__:
--------------------------------------------------------------------------------
1 | Did you know that git does not support storing empty directories?
2 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/ExtensionDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 |
19 | class ExtensionDelegate: NSObject, WKExtensionDelegate {
20 |
21 | func applicationDidFinishLaunching() {
22 | // Perform any final initialization of your application.
23 | }
24 |
25 | func applicationDidBecomeActive() {
26 | // 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.
27 | }
28 |
29 | func applicationWillResignActive() {
30 | // 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.
31 | // Use this method to pause ongoing tasks, disable timers, etc.
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | WATCH-APP Extension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | WKAppBundleIdentifier
30 | com.github.j2objc-contrib.j2objc-gradle.IOS-APP.watchkitapp
31 |
32 | NSExtensionPointIdentifier
33 | com.apple.watchkit
34 |
35 | RemoteInterfacePrincipalClass
36 | $(PRODUCT_MODULE_NAME).InterfaceController
37 | WKExtensionDelegateClassName
38 | $(PRODUCT_MODULE_NAME).ExtensionDelegate
39 |
40 |
41 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/InterfaceController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 | import Foundation
19 |
20 |
21 | class InterfaceController: WKInterfaceController {
22 |
23 | override func awakeWithContext(context: AnyObject?) {
24 | super.awakeWithContext(context)
25 |
26 | // Configure interface objects here.
27 | }
28 |
29 | override func willActivate() {
30 | // This method is called when watch view controller is about to be visible to user
31 | super.willActivate()
32 | }
33 |
34 | override func didDeactivate() {
35 | // This method is called when watch view controller is no longer visible
36 | super.didDeactivate()
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/NotificationController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 | import Foundation
19 |
20 |
21 | class NotificationController: WKUserNotificationInterfaceController {
22 |
23 | override init() {
24 | // Initialize variables here.
25 | super.init()
26 |
27 | // Configure interface objects here.
28 | }
29 |
30 | override func willActivate() {
31 | // This method is called when watch view controller is about to be visible to user
32 | super.willActivate()
33 | }
34 |
35 | override func didDeactivate() {
36 | // This method is called when watch view controller is no longer visible
37 | super.didDeactivate()
38 | }
39 |
40 | /*
41 | override func didReceiveLocalNotification(localNotification: UILocalNotification, withCompletion completionHandler: ((WKUserNotificationInterfaceType) -> Void)) {
42 | // This method is called when a local notification needs to be presented.
43 | // Implement it if you use a dynamic notification interface.
44 | // Populate your dynamic notification interface as quickly as possible.
45 | //
46 | // After populating your dynamic notification interface call the completion block.
47 | completionHandler(.Custom)
48 | }
49 | */
50 |
51 | /*
52 | override func didReceiveRemoteNotification(remoteNotification: [NSObject : AnyObject], withCompletion completionHandler: ((WKUserNotificationInterfaceType) -> Void)) {
53 | // This method is called when a remote notification needs to be presented.
54 | // Implement it if you use a dynamic notification interface.
55 | // Populate your dynamic notification interface as quickly as possible.
56 | //
57 | // After populating your dynamic notification interface call the completion block.
58 | completionHandler(.Custom)
59 | }
60 | */
61 | }
62 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP Extension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title"
6 | },
7 | "category": "myCategory"
8 | },
9 |
10 | "WatchKit Simulator Actions": [
11 | {
12 | "title": "First Button",
13 | "identifier": "firstButtonAction"
14 | }
15 | ],
16 |
17 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
18 | }
19 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "44x44",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "longLook",
41 | "subtype" : "42mm"
42 | },
43 | {
44 | "size" : "86x86",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "quickLook",
48 | "subtype" : "38mm"
49 | },
50 | {
51 | "size" : "98x98",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "quickLook",
55 | "subtype" : "42mm"
56 | }
57 | ],
58 | "info" : {
59 | "version" : 1,
60 | "author" : "xcode"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP/Base.lproj/Interface.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 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/ios/WATCH-APP/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | IOS-APP
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | UISupportedInterfaceOrientations
26 |
27 | UIInterfaceOrientationPortrait
28 | UIInterfaceOrientationPortraitUpsideDown
29 |
30 | WKCompanionAppBundleIdentifier
31 | com.github.j2objc-contrib.j2objc-gradle.IOS-APP
32 | WKWatchKitApp
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/local.properties:
--------------------------------------------------------------------------------
1 | ../common/local.properties
--------------------------------------------------------------------------------
/systemTests/allPlatforms/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':shared'
2 |
3 | // Travis CI doesn't support Android on OS X
4 | if (!System.getenv('ANDROID_BUILD_DISABLED').equals('true')) {
5 | include ':app'
6 | }
7 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/shared/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
18 | apply plugin: 'java'
19 |
20 | dependencies {
21 | testCompile 'junit:junit:4.10'
22 | }
23 |
24 | j2objcConfig {
25 | // This should eventually become the default but doesn't have any use within this example
26 | autoConfigureDeps true
27 |
28 | // Xcode
29 | xcodeProjectDir '../ios'
30 | xcodeTargetsIos 'IOS-APP', 'IOS-APPTests'
31 | xcodeTargetsOsx 'OSX-APP', 'OSX-APPTests'
32 | // TODO: xcodeTargetsWatchos 'WATCH-APP', 'WATCH-APPTests'
33 |
34 | // For testing on the iPhone 5 simulator
35 | supportedArchs += ['ios_i386']
36 |
37 | finalConfigure()
38 | }
39 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/shared/src/main/java/com/example/Shared.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | public class Shared {
20 | @Override
21 | public String toString() {
22 | return "'Shared' Java Class OK";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/systemTests/allPlatforms/shared/src/test/java/com/example/SharedTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Test;
20 |
21 | import static org.junit.Assert.*;
22 |
23 | public class SharedTest {
24 | @Test
25 | public void testToString() throws Exception {
26 | Shared shared = new Shared();
27 | assertEquals("'Shared' Java Class OK", shared.toString());
28 | }
29 |
30 | // TODO: add mockito example
31 | }
32 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/base/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | // Intentionally testing e2e use of a built-in j2objc library, Guava.
26 | compile project(':third_party_guava')
27 | // Normally we would reference this as compile "com.google.code.gson:gson:2.3.1"
28 | compile project(':third_party_gson')
29 | testCompile 'junit:junit:4.12'
30 | }
31 |
32 | j2objcConfig {
33 | // For now, default config links in prebuilt Guava; that defeats the point.
34 | translateJ2objcLibs.remove("j2objc_guava.jar")
35 | linkJ2objcLibs.remove("guava")
36 |
37 | autoConfigureDeps true
38 |
39 | finalConfigure()
40 | }
41 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/base/src/main/java/com/example/Cube.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import com.google.common.base.Joiner;
20 | import com.google.gson.Gson;
21 | import com.google.gson.GsonBuilder;
22 |
23 | public class Cube {
24 |
25 | protected final int dimension;
26 |
27 | public Cube(int dimension) {
28 | this.dimension = dimension;
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return String.format("[Cube %d]", dimension);
34 | }
35 |
36 | public String exerciseGuava() {
37 | return Joiner.on(' ').join('a', 'b', 'c');
38 | }
39 |
40 | public String exerciseGson() {
41 | Gson gson = new GsonBuilder().create();
42 | return gson.toJson(new String[]{"a", "b", "c"});
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/base/src/test/java/com/example/CubeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class CubeTest {
23 |
24 | @Test
25 | public void testToString() {
26 | Assert.assertEquals("[Cube 7]", new Cube(7).toString());
27 | }
28 |
29 | @Test
30 | public void testExerciseGuava() {
31 | Assert.assertEquals("a b c", new Cube(7).exerciseGuava());
32 | }
33 |
34 | @Test
35 | public void testExerciseGson() {
36 | Assert.assertEquals("[\"a\",\"b\",\"c\"]", new Cube(7).exerciseGson());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | buildscript {
18 | repositories {
19 | jcenter()
20 | }
21 | dependencies {
22 | // This is the build output of the plugin itself.
23 | classpath fileTree(dir: '../../build/libs', include: ['*.jar'])
24 | }
25 | }
26 |
27 | allprojects {
28 | apply plugin: 'java'
29 | test {
30 | testLogging {
31 | // Provide full exception info on failure, instead
32 | // of just pointing to an HTML file.
33 | exceptionFormat = 'full'
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/extended/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | compile project(':base')
26 | // Intentionally testing e2e use of a built-in j2objc library, Guava.
27 | compile project(':third_party_guava')
28 | // Normally we would reference this as compile "com.google.code.gson:gson:2.3.1"
29 | compile project(':third_party_gson')
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
33 | j2objcConfig {
34 | // For now, default config links in prebuilt Guava; that defeats the point.
35 | translateJ2objcLibs.remove("j2objc_guava.jar")
36 | linkJ2objcLibs.remove("guava")
37 |
38 | autoConfigureDeps true
39 |
40 | finalConfigure()
41 | }
42 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/extended/src/main/java/com/example/ExtendedCube.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import java.lang.Override;
20 |
21 | import com.google.gson.Gson;
22 | import com.google.gson.GsonBuilder;
23 |
24 | import com.google.common.base.Joiner;
25 |
26 | public class ExtendedCube extends Cube {
27 |
28 | public ExtendedCube(int dimension) {
29 | super(dimension);
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | Gson gson = new GsonBuilder().create();
35 | return gson.toJson(this);
36 | }
37 |
38 | @Override
39 | public String exerciseGuava() {
40 | return Joiner.on(';').join('a', 'b', 'c');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/extended/src/test/java/com/example/ExtendedCubeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class ExtendedCubeTest {
23 |
24 | @Test
25 | public void testToString() {
26 | Assert.assertEquals("{\"dimension\":7}", new ExtendedCube(7).toString());
27 | }
28 |
29 | @Test
30 | public void testExerciseGuava() {
31 | Assert.assertEquals("a;b;c", new ExtendedCube(7).exerciseGuava());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/gradlew:
--------------------------------------------------------------------------------
1 | ../../gradlew
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/local.properties:
--------------------------------------------------------------------------------
1 | ../common/local.properties
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | include ':third_party_gson', ':third_party_guava', ':base', ':extended'
17 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/third_party_gson/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | // j2objcTranslation causes the entire specified library
26 | // to be translated and built into a standalone Objective C library.
27 | // j2objcTranslation must always be passed a *source* jar,
28 | // therefore, note the ':sources' classifier.
29 | j2objcTranslation 'com.google.code.gson:gson:2.3.1:sources'
30 | }
31 |
32 | j2objcConfig {
33 | forceFilenameCollisionCheck false
34 | // For now, default config links in prebuilt Guava; that defeats the point.
35 | translateJ2objcLibs.remove("j2objc_guava.jar")
36 | linkJ2objcLibs.remove("guava")
37 |
38 | // Almost always there are no tests provided in an external source jar.
39 | testMinExpectedTests 0
40 | finalConfigure()
41 | }
42 |
--------------------------------------------------------------------------------
/systemTests/externalLibrary1/third_party_guava/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | // Most recent versions of Guava's dependencies, as inferred from Guava 18's POM file
26 | // (which does not specify version at all).
27 | // They are all annotations only.
28 | compile 'com.google.j2objc:j2objc-annotations:0.9.8'
29 | compile 'com.google.code.findbugs:jsr305:3.0.0'
30 | compile 'com.google.errorprone:error_prone_annotations:2.0.4'
31 | compile 'org.codehaus.mojo:animal-sniffer-annotations:1.14'
32 |
33 | // j2objcTranslation causes the entire specified library
34 | // to be translated and built into a standalone Objective C library.
35 | // j2objcTranslation must always be passed a *source* jar,
36 | // therefore, note the ':sources' classifier.
37 | j2objcTranslation 'com.google.guava:guava:19.0:sources'
38 | }
39 |
40 | j2objcConfig {
41 | // For now, default config links in prebuilt Guava; that defeats the point.
42 | translateJ2objcLibs.remove("j2objc_guava.jar")
43 | linkJ2objcLibs.remove("guava")
44 |
45 | // Approximation of https://github.com/google/j2objc/blob/0.9.8.1/guava/Makefile
46 | translateArgs "--segmented-headers",
47 | "--extract-unsequenced",
48 | "--batch-translate-max=300",
49 | "--hide-private-members",
50 | "--final-methods-as-functions",
51 | "-q"
52 |
53 | autoConfigureDeps true
54 | // Almost always there are no tests provided in an external source jar.
55 | testMinExpectedTests 0
56 | finalConfigure()
57 | }
58 |
--------------------------------------------------------------------------------
/systemTests/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | # Fail if any command fails
19 | set -euv
20 |
21 | if [[ "$PWD" =~ systemTests ]]; then
22 | echo "Should be run from project root and not systemTests directory"
23 | exit 1
24 | fi
25 |
26 | pushd systemTests
27 |
28 | # Suppress error if directories already exist
29 | mkdir -p localJ2objcDist
30 | mkdir -p common
31 |
32 | pushd localJ2objcDist
33 |
34 | # Specific version can be configured from command line:
35 | # export J2OBJC_VERSION=X.Y.Z
36 | # Default is version number listed on following line:
37 | J2OBJC_VERSION=${J2OBJC_VERSION:=0.9.8.2.1}
38 |
39 | # Specific version can be configured from command line:
40 | # export ANDROID_HOME=DIR
41 | # Default is for Travis default location, listed on following line:
42 | ANDROID_HOME=${ANDROID_HOME:=/usr/local/android-sdk}
43 |
44 | echo "J2OBJC Version: $J2OBJC_VERSION"
45 |
46 | DIST_DIR=j2objc-$J2OBJC_VERSION
47 | DIST_FILE=$DIST_DIR.zip
48 |
49 | # For developer local testing, don't keep redownloading the zip file.
50 | if [ ! -e $DIST_FILE ]; then
51 | curl -L https://github.com/google/j2objc/releases/download/$J2OBJC_VERSION/j2objc-$J2OBJC_VERSION.zip > $DIST_FILE
52 | unzip -q $DIST_FILE
53 |
54 | # systemTests/common/local.properties
55 | echo j2objc.home=$PWD/$DIST_DIR > ../common/local.properties
56 | if [ "${ANDROID_BUILD_DISABLED:=false}" != "true" ]; then
57 | echo sdk.dir=$ANDROID_HOME >> ../common/local.properties
58 | fi
59 | if [ "${J2OBJC_TRANSLATE_ONLY:=false}" == "true" ]; then
60 | echo j2objc.translateOnlyMode=true >> ../common/local.properties
61 | fi
62 | echo "systemTests/common/local.properties configured:"
63 | cat ../common/local.properties
64 | fi
65 |
66 | # pop localJ2objcDist
67 | popd
68 |
69 | # pop systemTests
70 | popd
71 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/base/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | // Intentionally testing e2e use of a built-in j2objc library, Guava.
26 | compile 'com.google.guava:guava:17.0'
27 | testCompile 'junit:junit:4.12'
28 | testCompile project(':testLib')
29 | }
30 |
31 | j2objcConfig {
32 | autoConfigureDeps true
33 |
34 | finalConfigure()
35 | }
36 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/base/src/main/java/com/example/Cube.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import com.google.common.base.Joiner;
20 |
21 | public class Cube {
22 |
23 | protected final int dimension;
24 |
25 | public Cube(int dimension) {
26 | this.dimension = dimension;
27 | }
28 |
29 | @Override
30 | public String toString() {
31 | return String.format("[Cube %d]", dimension);
32 | }
33 |
34 | public String exerciseGuava() {
35 | return Joiner.on("BASE").join('a', 'b', 'c');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/base/src/test/java/com/example/CubeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class CubeTest {
23 |
24 | @Test
25 | public void testToString() {
26 | Assert.assertEquals("[Cube 7]", new Cube(7).toString());
27 | }
28 |
29 | @Test
30 | public void testExerciseGuava() {
31 | Assert.assertEquals(CubeTester.exerciseGuava("BASE"), new Cube(7).exerciseGuava());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | buildscript {
18 | repositories {
19 | jcenter()
20 | }
21 | dependencies {
22 | // This is the build output of the plugin itself.
23 | classpath fileTree(dir: '../../build/libs', include: ['*.jar'])
24 | }
25 | }
26 |
27 | allprojects {
28 | apply plugin: 'java'
29 | test {
30 | testLogging {
31 | // Provide full exception info on failure, instead
32 | // of just pointing to an HTML file.
33 | exceptionFormat = 'full'
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/extended/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | compile project(':base')
26 | // Intentionally testing e2e use of a built-in j2objc library, Guava.
27 | compile 'com.google.guava:guava:17.0'
28 | // NOTE: this is an external dependency. The plugin automatically downloads the source,
29 | // translates and links it in to the compiled library. No further configuration is required.
30 | compile 'com.google.code.gson:gson:2.3.1'
31 | testCompile 'junit:junit:4.12'
32 | testCompile project(':testLib')
33 | }
34 |
35 | j2objcConfig {
36 | xcodeProjectDir '../ios'
37 | xcodeTargetsIos 'IOS-APP', 'IOS-APPTests'
38 |
39 | autoConfigureDeps true
40 |
41 | finalConfigure()
42 | }
43 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/extended/src/main/java/com/example/ExtendedCube.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import java.lang.Override;
20 |
21 | import com.google.gson.Gson;
22 | import com.google.gson.GsonBuilder;
23 |
24 | import com.google.common.base.Joiner;
25 |
26 | public class ExtendedCube extends Cube {
27 |
28 | public ExtendedCube(int dimension) {
29 | super(dimension);
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | Gson gson = new GsonBuilder().create();
35 | return gson.toJson(this);
36 | }
37 |
38 | @Override
39 | public String exerciseGuava() {
40 | return Joiner.on("EXT").join('a', 'b', 'c');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/extended/src/test/java/com/example/ExtendedCubeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class ExtendedCubeTest {
23 |
24 | @Test
25 | public void testToString() {
26 | Assert.assertEquals("{\"dimension\":7}", new ExtendedCube(7).toString());
27 | }
28 |
29 | @Test
30 | public void testExerciseGuava() {
31 | Assert.assertEquals(CubeTester.exerciseGuava("EXT"), new ExtendedCube(7).exerciseGuava());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/gradlew:
--------------------------------------------------------------------------------
1 | ../../gradlew
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | //
17 | // AppDelegate.swift
18 | // IOS-APP
19 | //
20 | // Created by Bruno Bowden on 10/7/15.
21 | // Copyright © 2015 J2ObjC Contrib. All rights reserved.
22 | //
23 |
24 | import UIKit
25 |
26 | @UIApplicationMain
27 | class AppDelegate: UIResponder, UIApplicationDelegate {
28 |
29 | var window: UIWindow?
30 |
31 |
32 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
33 | // Override point for customization after application launch.
34 | return true
35 | }
36 |
37 | func applicationWillResignActive(application: UIApplication) {
38 | // 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.
39 | // 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.
40 | }
41 |
42 | func applicationDidEnterBackground(application: UIApplication) {
43 | // 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.
44 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
45 | }
46 |
47 | func applicationWillEnterForeground(application: UIApplication) {
48 | // 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.
49 | }
50 |
51 | func applicationDidBecomeActive(application: UIApplication) {
52 | // 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.
53 | }
54 |
55 | func applicationWillTerminate(application: UIApplication) {
56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
57 | }
58 |
59 |
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/Assets.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 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/Base.lproj/LaunchScreen.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 |
27 |
28 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/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 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/IOS-APP-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | //
17 | // IOS-APP-Bridging-Header.h
18 | // IOS-APP
19 | //
20 | // Created by Bruno Bowden on 10/8/15.
21 | // Copyright © 2015 J2ObjC Contrib. All rights reserved.
22 | //
23 |
24 | // Needed for Swift initialization of Java objects
25 | #import "JreEmulation.h"
26 | #import "IOSClass.h" // appears to be nolonger needed
27 |
28 | #import "com/example/Cube.h"
29 | #import "com/example/ExtendedCube.h"
30 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APP/ViewController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | //
17 | // ViewController.swift
18 | // IOS-APP
19 | //
20 | // Created by Bruno Bowden on 10/7/15.
21 | // Copyright © 2015 J2ObjC Contrib. All rights reserved.
22 | //
23 |
24 | import UIKit
25 |
26 | class ViewController: UIViewController {
27 |
28 | override func viewDidLoad() {
29 | super.viewDidLoad()
30 | // Do any additional setup after loading the view, typically from a nib.
31 |
32 | let base = ComExampleCube()
33 | let extended = ComExampleExtendedCube.init(int: 7)
34 |
35 | NSLog("base.exerciseGuava(): \(base.exerciseGuava())")
36 | assert ("aBASEbBASEc" == base.exerciseGuava())
37 |
38 | NSLog("extended.exerciseGuava(): \(extended.exerciseGuava())")
39 | assert ("aEXTbEXTc" == extended.exerciseGuava())
40 | }
41 |
42 | override func didReceiveMemoryWarning() {
43 | super.didReceiveMemoryWarning()
44 | // Dispose of any resources that can be recreated.
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APPTests/IOS_APPTests.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | //
17 | // IOS_APPTests.swift
18 | // IOS-APPTests
19 | //
20 | // Created by Bruno Bowden on 10/7/15.
21 | // Copyright © 2015 J2ObjC Contrib. All rights reserved.
22 | //
23 |
24 | import XCTest
25 | @testable import IOS_APP
26 |
27 | class IOS_APPTests: XCTestCase {
28 |
29 | override func setUp() {
30 | super.setUp()
31 | // Put setup code here. This method is called before the invocation of each test method in the class.
32 | }
33 |
34 | override func tearDown() {
35 | // Put teardown code here. This method is called after the invocation of each test method in the class.
36 | super.tearDown()
37 | }
38 |
39 | func testExample() {
40 | // This is an example of a functional test case.
41 | // Use XCTAssert and related functions to verify your tests produce the correct results.
42 | }
43 |
44 | func testPerformanceExample() {
45 | // This is an example of a performance test case.
46 | self.measureBlock {
47 | // Put the code you want to measure the time of here.
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/IOS-APPTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '6.0'
3 |
4 | def j2objc_extended
5 | pod 'j2objc-extended-debug', :configuration => ['Debug'], :path => '../extended/build'
6 | pod 'j2objc-extended-release', :configuration => ['Release'], :path => '../extended/build'
7 | end
8 |
9 | def j2objc_base
10 | pod 'j2objc-base-debug', :configuration => ['Debug'], :path => '../base/build'
11 | pod 'j2objc-base-release', :configuration => ['Release'], :path => '../base/build'
12 | end
13 |
14 | target 'IOS-APP' do
15 | j2objc_base
16 | j2objc_extended
17 | end
18 |
19 | target 'IOS-APPTests' do
20 | j2objc_base
21 | j2objc_extended
22 | end
23 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - j2objc-base-debug (1.0)
3 | - j2objc-base-release (1.0)
4 | - j2objc-extended-debug (1.0)
5 | - j2objc-extended-release (1.0)
6 |
7 | DEPENDENCIES:
8 | - j2objc-base-debug (from `../base/build`)
9 | - j2objc-base-release (from `../base/build`)
10 | - j2objc-extended-debug (from `../extended/build`)
11 | - j2objc-extended-release (from `../extended/build`)
12 |
13 | EXTERNAL SOURCES:
14 | j2objc-base-debug:
15 | :path: ../base/build
16 | j2objc-base-release:
17 | :path: ../base/build
18 | j2objc-extended-debug:
19 | :path: ../extended/build
20 | j2objc-extended-release:
21 | :path: ../extended/build
22 |
23 | SPEC CHECKSUMS:
24 | j2objc-base-debug: 478bb2f19db54654adc8cc3e606914adaacaef5c
25 | j2objc-base-release: 65381df5900d9be5b05afd7d41580d1e98ce1dee
26 | j2objc-extended-debug: ea5b498adb5bfe52c3126b90d16a1dfcbc9f2af4
27 | j2objc-extended-release: 9c2696a59c8e50aeed6d40bb661574cd1b833c52
28 |
29 | COCOAPODS: 0.38.2
30 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/ios/WORKSPACE.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/local.properties:
--------------------------------------------------------------------------------
1 | ../common/local.properties
--------------------------------------------------------------------------------
/systemTests/multiProject1/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | include ':testLib', ':base', ':extended'
17 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/testLib/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
19 |
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | // Intentionally testing e2e use of a built-in j2objc library, Guava.
26 | compile 'com.google.guava:guava:17.0'
27 | testCompile 'junit:junit:4.12'
28 | }
29 |
30 | j2objcConfig {
31 | autoConfigureDeps true
32 |
33 | finalConfigure()
34 | }
35 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/testLib/src/main/java/com/example/CubeTester.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import com.google.common.base.Joiner;
20 |
21 | public class CubeTester {
22 |
23 | public static String exerciseGuava(String space) {
24 | return Joiner.on(space).join('a', 'b', 'c');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/systemTests/multiProject1/testLib/src/test/java/com/example/CubeTesterTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class CubeTesterTest {
23 |
24 | @Test
25 | public void testExerciseGuava() {
26 | Assert.assertEquals("a_b_c", CubeTester.exerciseGuava("_"));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/systemTests/run-all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # Fail if anything fails.
18 | set -uev
19 |
20 | # Add new tests to whichever set takes the least time to run on Travis.
21 | # If any test set is nearing ~45 minutes to build, you must make a new
22 | # test set and also update .travis.yml.
23 |
24 | # Defaults to "12", which runs both tests
25 | # Run specific test by script parameter, e.g. 'systemTests/run-all.sh 1'
26 | TEST_SET=${1:-12}
27 |
28 | J2OBJC_VERSION=${J2OBJC_VERSION:=0.9.8.2.1}
29 |
30 | if [[ "$PWD" =~ systemTests ]]; then
31 | echo "Should be run from project root and not systemTests directory"
32 | exit 1
33 | fi
34 |
35 | if [[ $TEST_SET == *"1"* ]] ; then
36 | echo Running test set 1
37 |
38 | # Simplest possible set-up. A single project with no dependencies.
39 | systemTests/run-test.sh systemTests/simple1
40 |
41 | # Two main gradle projects, `extended` depends on `base`. They also both test
42 | # dependency on built-in j2objc libraries, like Guava, and build-closure
43 | # based translation of an external library, Gson. They also both depend
44 | # depend on a third test-only gradle project, `testLib`.
45 | systemTests/run-test.sh systemTests/multiProject1
46 |
47 | # Platform specific app build: Android, iOS, OS X and some day watchOS
48 | systemTests/run-test.sh systemTests/allPlatforms
49 | fi
50 |
51 | if [[ $TEST_SET == *"2"* ]] ; then
52 | echo Running test set 2
53 |
54 | # Two gradle projects, `extended` depends on `base`. Both of them depend
55 | # on project `third_party_gson`, which fully translates and compiles an
56 | # external library (Google's Gson); and also `third_party_guava` which
57 | # does the same for Guava. These libraries are used in both `extended` and `base`.
58 | # We must rename the include directory while this test runs, otherwise the
59 | # code builds against the translated Guava headers provided in the j2objc dist.
60 | mv systemTests/localJ2objcDist/j2objc-$J2OBJC_VERSION/include/com/google/common systemTests/localJ2objcDist/j2objc-$J2OBJC_VERSION/include/com/google/common-bak
61 | systemTests/run-test.sh systemTests/externalLibrary1
62 | mv systemTests/localJ2objcDist/j2objc-$J2OBJC_VERSION/include/com/google/common-bak systemTests/localJ2objcDist/j2objc-$J2OBJC_VERSION/include/com/google/common
63 | fi
64 |
--------------------------------------------------------------------------------
/systemTests/run-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | # Fail if anything fails.
19 | set -euv
20 |
21 | if [[ "$PWD" =~ systemTests ]]; then
22 | echo "Should be run from project root and not systemTests directory"
23 | exit 1
24 | fi
25 |
26 |
27 | TEST_DIR=$1
28 | echo Running test $TEST_DIR
29 |
30 | pushd $TEST_DIR
31 | ./gradlew wrapper
32 | ./gradlew clean
33 | # If we fail, try again with lots of logging.
34 | ./gradlew build
35 |
36 | # Dump out listings of the files generated for manual debugging/verification.
37 | ls -R1c build/j2objcOutputs || echo No such outputs
38 | ls -R1c */build/j2objcOutputs || echo No such outputs
39 |
40 | # pop $TEST_DIR
41 | popd
42 |
--------------------------------------------------------------------------------
/systemTests/simple1/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'java'
18 |
19 | task wrapper(type: Wrapper) {
20 | gradleVersion = '2.4'
21 | distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
22 | }
23 |
24 | buildscript {
25 | repositories {
26 | jcenter()
27 | }
28 | dependencies {
29 | classpath fileTree(dir: '../../build/libs', include: ['*.jar'])
30 | }
31 | }
32 |
33 | apply plugin: 'com.github.j2objccontrib.j2objcgradle'
34 |
35 | repositories {
36 | jcenter()
37 | }
38 |
39 | dependencies {
40 | testCompile 'junit:junit:4.12'
41 | testCompile "org.mockito:mockito-core:1.9.5"
42 | }
43 |
44 | j2objcConfig {
45 | xcodeProjectDir 'ios/IOS-SIMPLE1'
46 | xcodeTargetsIos 'IOS-SIMPLE1', 'IOS-SIMPLE1Tests'
47 | finalConfigure()
48 | }
49 |
--------------------------------------------------------------------------------
/systemTests/simple1/gradlew:
--------------------------------------------------------------------------------
1 | ../../gradlew
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | @UIApplicationMain
20 | class AppDelegate: UIResponder, UIApplicationDelegate {
21 |
22 | var window: UIWindow?
23 |
24 |
25 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
26 | // Override point for customization after application launch.
27 | return true
28 | }
29 |
30 | func applicationWillResignActive(application: UIApplication) {
31 | // 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.
32 | // 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.
33 | }
34 |
35 | func applicationDidEnterBackground(application: UIApplication) {
36 | // 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.
37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
38 | }
39 |
40 | func applicationWillEnterForeground(application: UIApplication) {
41 | // 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.
42 | }
43 |
44 | func applicationDidBecomeActive(application: UIApplication) {
45 | // 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.
46 | }
47 |
48 | func applicationWillTerminate(application: UIApplication) {
49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
50 | }
51 |
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/Assets.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 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/Base.lproj/LaunchScreen.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 |
27 |
28 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/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 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/IOS-SIMPLE1-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef IOS_SIMPLE1_Bridging_Header_h
18 | #define IOS_SIMPLE1_Bridging_Header_h
19 |
20 | #import "com/example/HelloWorld.h"
21 |
22 | #endif /* IOS_SIMPLE1_Bridging_Header_h */
23 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1/ViewController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | class ViewController: UIViewController {
20 |
21 | override func viewDidLoad() {
22 | super.viewDidLoad()
23 | // Do any additional setup after loading the view, typically from a nib.
24 | ViewController.helloWorldLog()
25 | }
26 |
27 | override func didReceiveMemoryWarning() {
28 | super.didReceiveMemoryWarning()
29 | // Dispose of any resources that can be recreated.
30 | }
31 |
32 | static func helloWorldLog() -> String {
33 | let helloWorld = ComExampleHelloWorld(NSString: "World")
34 | let helloWorldStr = "\(helloWorld)"
35 | assert (helloWorldStr == "Hello World - Java")
36 | NSLog("J2Objc: \(helloWorldStr) - All OK!")
37 | return helloWorldStr
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1Tests/IOS_SIMPLE1Tests.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import XCTest
18 | @testable import IOS_SIMPLE1
19 |
20 | class IOS_SIMPLE1Tests: XCTestCase {
21 |
22 | override func setUp() {
23 | super.setUp()
24 | // Put setup code here. This method is called before the invocation of each test method in the class.
25 | }
26 |
27 | override func tearDown() {
28 | // Put teardown code here. This method is called after the invocation of each test method in the class.
29 | super.tearDown()
30 | }
31 |
32 | func testHelloWorldLog() {
33 | let helloWorldStr = ViewController.helloWorldLog()
34 | assert (helloWorldStr == "Hello World - Java")
35 | }
36 |
37 | func testPerformanceExample() {
38 | // This is an example of a performance test case.
39 | self.measureBlock {
40 | // Put the code you want to measure the time of here.
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/IOS-SIMPLE1Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '6.0'
3 |
4 | # J2ObjC Gradle Plugin - DO NOT MODIFY from here to the first target
5 | def j2objc_simple1
6 | pod 'j2objc-simple1-debug', :configuration => ['Debug'], :path => '../../build'
7 | pod 'j2objc-simple1-release', :configuration => ['Release'], :path => '../../build'
8 | end
9 |
10 | target 'IOS-SIMPLE1' do
11 | platform :ios, '6.0'
12 | j2objc_simple1
13 | end
14 |
15 | target 'IOS-SIMPLE1Tests' do
16 | platform :ios, '6.0'
17 | j2objc_simple1
18 | end
19 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/IOS-SIMPLE1/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - j2objc-simple1-debug (1.0)
3 | - j2objc-simple1-release (1.0)
4 |
5 | DEPENDENCIES:
6 | - j2objc-simple1-debug (from `../../build`)
7 | - j2objc-simple1-release (from `../../build`)
8 |
9 | EXTERNAL SOURCES:
10 | j2objc-simple1-debug:
11 | :path: ../../build
12 | j2objc-simple1-release:
13 | :path: ../../build
14 |
15 | SPEC CHECKSUMS:
16 | j2objc-simple1-debug: 6dc48a1eca05203db6c088f2aa69b0460feb6f4d
17 | j2objc-simple1-release: aba723f10e1f2350395df7d3d52ed6345a716100
18 |
19 | COCOAPODS: 0.39.0
20 |
--------------------------------------------------------------------------------
/systemTests/simple1/ios/SIMPLE1.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/systemTests/simple1/local.properties:
--------------------------------------------------------------------------------
1 | ../common/local.properties
--------------------------------------------------------------------------------
/systemTests/simple1/src/main/java/com/example/HelloWorld.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | public class HelloWorld {
20 |
21 | private final String nameOfWorld;
22 |
23 | public HelloWorld() {
24 | this.nameOfWorld = "Simple";
25 | }
26 | public HelloWorld(String nameOfWorld) {
27 | this.nameOfWorld = nameOfWorld;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "Hello " + nameOfWorld + " - Java";
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/systemTests/simple1/src/test/java/com/example/HelloWorldTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | import org.junit.Assert;
20 | import org.junit.Test;
21 |
22 | public class HelloWorldTest {
23 |
24 | @Test
25 | public void testToString() {
26 | Assert.assertEquals("Hello World - Java", new HelloWorld("World").toString());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------