j2objcConfig is used to configure the plugin with the project's build.gradle. All paths are resolved using Gradle's project.file(...) Basic Example: j2objcConfig { xcodeProjectDir '../ios' xcodeTarget 'IOS-APP' finalConfigure() } Complex Example: TODO...
| Modifiers | Name | Description |
|---|---|---|
protected boolean |
finalConfigured |
|
protected NativeCompilation |
nativeCompilation |
|
protected org.gradle.api.Project |
project |
| Constructor and description |
|---|
J2objcConfig
(org.gradle.api.Project project) |
| Type | Name and description |
|---|---|
static void |
appendArgs(java.util.List<java.lang.String> listArgs, java.lang.String nameArgs, java.lang.String... args) |
protected void |
configureNativeCompilation() |
protected void |
configureTaskState() |
protected void |
convertDeps() |
void |
cycleFinderArgs(java.lang.String... cycleFinderArgs)Add command line arguments for j2objc cycle_finder. |
void |
dependsOnJ2objcLib(java.lang.String beforeProjectName)@see #dependsOnJ2objcLib(org.gradle.api.Project) |
void |
dependsOnJ2objcLib(org.gradle.api.Project beforeProject)Uses the generated headers and compiled j2objc libraries of the given project when compiling this project. |
void |
enableBuildClosure()Enables --build-closure, which translates classes referenced from the list of files passed for translation, using the translateSourcepaths. |
void |
extraLinkerArgs(java.lang.String... extraLinkerArgs)Add arguments to pass to the native linker. |
void |
extraNativeLib(java.util.Map spec)Add additional native library to link to. |
void |
extraObjcCompilerArgs(java.lang.String... extraObjcCompilerArgs)Add arguments to pass to the native compiler. |
void |
extraObjcSrcDirs(java.lang.String... extraObjcSrcDirs)Add directories of Objective-C source to compile in addition to the translated source. |
void |
finalConfigure()Configures the j2objc build. |
static J2objcConfig |
from(org.gradle.api.Project project) |
void |
generatedSourceDirs(java.lang.String... generatedSourceDirs)Add generated source files directories, e.g. from dagger annotations. |
java.util.List<java.lang.String> |
getActiveArchs()An architecture is active if it is both supported (supportedArchs) and enabled in the current environment via the comma-separated j2objc.enabledArchs value in local.properties. |
java.io.File |
getDestLibDirFile() |
java.io.File |
getDestSrcDirFile(java.lang.String sourceSetName, java.lang.String fileType) |
boolean |
isFinalConfigured() |
protected void |
resolveDeps() |
void |
testArgs(java.lang.String... testArgs)Add command line arguments for j2objcTest task. |
org.gradle.api.tasks.util.PatternSet |
testPattern(groovy.lang.Closure cl)Configures the testPattern Calling this method repeatedly further modifies the existing testPattern, and will create an empty testPattern if none exists. |
void |
testingOnlyPrepConfigurations() |
void |
translateArgs(java.lang.String... translateArgs)Add command line arguments for j2objc translate. |
void |
translateClasspaths(java.lang.String... translateClasspaths)Local jars for translation e.g.: "lib/json-20140107.jar", "lib/somelib.jar". |
org.gradle.api.tasks.util.PatternSet |
translatePattern(groovy.lang.Closure cl)Configures the translatePattern. |
void |
translateSourceMapping(java.lang.String before, java.lang.String after)Adds a new source mapping. |
void |
translateSourcepaths(java.lang.String... translateSourcepaths)Source jars for translation e.g.: "lib/json-20140107-sources.jar" |
protected void |
validateConfiguration() |
static void |
verifyNoSpaceArgs(java.lang.String nameArgs, java.lang.String... args) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Experimental functionality to automatically configure dependencies. Consider you have dependencies like:
dependencies {
compile project(':peer1') // type (1)
compile 'com.google.code.gson:gson:2.3.1' // type (3)
compile 'com.google.guava:guava:18.0' // type (2)
testCompile 'junit:junit:4.11' // type (2)
}
Project dependencies (1) will be added as a `j2objcLink` dependency.
Libraries already included in j2objc (2) will be ignored.
External libraries in Maven (3) will be added in source JAR form to
`j2objcTranslate`, and translated using `--build-closure`.
Dependencies must be fully specified before you call finalConfigure().
This will become the default when stable in future releases.
Command line arguments for j2objc cycle_finder.
A list of all possible arguments can be found here: http://j2objc.org/docs/cycle_finder.htmlExpected number of cycles, defaults to all those found in JRE.
This is an exact number rather than minimum as any change is significant.Where to assemble generated main libraries.
Defaults to $buildDir/j2objcOutputs/libWhere to assemble generated main source and resources files.
Defaults to $buildDir/j2objcOutputs/src/main/objcWhere to assemble generated test source and resources files.
Can be the same directory as destDir Defaults to $buildDir/j2objcOutputs/src/test/objcAdditional arguments to pass to the native linker.
Additional native libraries to link to.
Additional arguments to pass to the native compiler.
Directories of Objective-C source to compile in addition to the translated source.
Makes sure that the translated filenames don't collide.
Recommended if you choose to use --no-package-directories.Generated source files directories, e.g. from dagger annotations.
The plugin will ignore changes in this directory so they must be limited to files generated solely from files within your main and/or test sourceSets.Additional native libraries that are part of the j2objc distribution.
For example:linkJ2objcLibs = ["guava", "jsr305"]
Which architectures will be built and supported in packed ('fat') libraries.
The three ios_arm* architectures are for iPhone and iPad devices, while ios_i386 and ios_x86_64 are for their simulators. By default, only common modern iOS architectures will be built: ios_arm64, ios_armv7, ios_x86_64. You may choose to add any of the remaining entries from NativeCompilation.ALL_SUPPORTED_ARCHS (ios_i386 and ios_armv7s) to support all possible iOS architectures. Listing any new architectures outside of ALL_SUPPORTED_ARCHS will fail the build. Removing an architecture here will cause that architecture not to be built and corresponding gradle tasks to not be created.supportedArchs = ['ios_arm64'] // Only build libraries for 64-bit iOS devicesThe options are:
Command line arguments for j2objcTest task.
j2objcTest will fail if it runs less than the expected number of tests; set to 0 to disable.
It is a minimum so adding a unit test doesn't break the j2objc build.Filter on files to test. Note this has no effect on which tests are translated, just which tests are executed by the j2objcTest task.
If no pattern is specified, all files within the 'test' sourceSet are translated. This filter is applied on top of all files within the 'main' and 'test' java sourceSets. Use testPattern(groovy.lang.Closure) to configure.Command line arguments for j2objc translate.
A list of all possible arguments can be found here: http://j2objc.org/docs/j2objc.htmlLocal jars for translation e.g.: "lib/json-20140107.jar", "lib/somelib.jar". This will be added to j2objc as a '-classpath' argument.
Additional Java libraries that are part of the j2objc distribution.
For example:translateJ2objcLibs = ["j2objc_junit.jar", "jre_emul.jar"]
True iff only translation (and cycle finding, if applicable) should be attempted, skipping all compilation, linking, and testing tasks.
Sets the filter on files to translate.
If no pattern is specified, all files within the sourceSets are translated. This filter is applied on top of all files within the 'main' and 'test' java sourceSets. Use translatePattern(groovy.lang.Closure) to configure.A mapping from source file names (in the project Java sourcesets) to alternate source files. Both before and after names (keys and values) are evaluated using project.file(...).
Mappings can be used to have completely different implementations in your Java jar vs. your Objective-C library. This can be especially useful when compiling a third-party library and you need to provide non-trivial OCNI implementations in Objective-C.Source jars for translation e.g.: "lib/json-20140107-sources.jar"
Directory of the target Xcode project. Suggested location is '../ios' See J2ObjC Plugin Folder Structure
Xcode app target the generated library should be linked to. This will automatically add linkage for any target that starts with the same name. This should include any Test and Watch targets. For the example of xcodeTarget == 'IOS-APP', it will add targets for 'IOS-APPTests', 'IOS-APP WatchKit App' & 'IOS-APP WatchKit Extension' (if they exist).
Add command line arguments for j2objc cycle_finder.
A list of all possible arguments can be found here: http://j2objc.org/docs/cycle_finder.htmlcycleFinderArgs - add args for 'cycle_finder' toolUses the generated headers and compiled j2objc libraries of the given project when compiling this project.
Generally every cross-project 'compile' dependency should have a corresponding call to dependsOnJ2objcLib. It is safe to use this in conjunction with --build-closure. Do not also include beforeProject's java source or jar in the translateSourcepaths or translateClasspaths, respectively. Calling this method is preferable and sufficient.Enables --build-closure, which translates classes referenced from the list of files passed for translation, using the translateSourcepaths.
Add arguments to pass to the native linker.
extraLinkerArgs - add arguments to pass to the native linker.Add additional native library to link to.
For example, if you built native library 'utils' in project 'common':extraNativeLib project: 'common', library: 'utils', linkage: 'static'
Add arguments to pass to the native compiler.
extraObjcCompilerArgs - add arguments to pass to the native compiler.Add directories of Objective-C source to compile in addition to the translated source.
extraObjcSrcDirs - add directories for Objective-C source to be compiledConfigures the j2objc build. Must be called at the very end of your j2objcConfig block.
Add generated source files directories, e.g. from dagger annotations.
The plugin will ignore changes in this directory so they must be limited to files generated solely from files within your main and/or test sourceSets.generatedSourceDirs - adds generated source directories for j2objc translateAn architecture is active if it is both supported (supportedArchs) and enabled in the current environment via the comma-separated j2objc.enabledArchs value in local.properties.
If no j2objc.enabledArchs value is specified in local.properties, all supported architectures are also active, otherwise the intersection of supportedArchs and j2objc.enabledArchs is used.Add command line arguments for j2objcTest task.
testArgs - add args for the 'j2objcTest' taskConfigures the testPattern
Calling this method repeatedly further modifies the existing testPattern, and will create an empty testPattern if none exists. For example:
translatePattern {
exclude 'CannotTranslateFileTest.java'
exclude '**/CannotTranslateDir/*.java'
include '**/CannotTranslateDir/AnExceptionToIncludeTest.java'
}
Add command line arguments for j2objc translate.
A list of all possible arguments can be found here: http://j2objc.org/docs/j2objc.htmltranslateArgs - add args for the 'j2objc' toolLocal jars for translation e.g.: "lib/json-20140107.jar", "lib/somelib.jar". This will be added to j2objc as a '-classpath' argument.
translateClasspaths - add libraries for -classpath argumentConfigures the translatePattern.
Calling this method repeatedly further modifies the existing translatePattern, and will create an empty translatePattern if none exists. For example:
translatePattern {
exclude 'CannotTranslateFile.java'
exclude '**/CannotTranslateDir/*.java'
include '**/CannotTranslateDir/AnExceptionToInclude.java'
}
Adds a new source mapping.
Source jars for translation e.g.: "lib/json-20140107-sources.jar"
translateSourcepaths - args add source jar for translationGroovy Documentation