j2objc-contrib / j2objc-gradle

This plugin is no longer actively maintained. J2ObjC Gradle Plugin: enables Java source to be part of an iOS application's build so you can write an app's non-UI code (such as application logic and data models) in Java, which is then shared by Android apps (natively Java) and iOS apps (using J2ObjC), all as part of your usual Android Gradle build.
https://github.com/j2objc-contrib/j2objc-gradle
Apache License 2.0
139 stars 43 forks source link

Extracting resources from source jars #607

Open lavapatch opened 8 years ago

lavapatch commented 8 years ago

My gradle project publishes both sources.jar and test-sources.jar to a maven repo alongside my shared library. However, j2objc-gradle ignores data files required to run some of the unit tests.

I've verified that the resources are packaged in the test-sources.jar file but the testTranslationExtraction folder only contains .java files and the resources subfolders but not the data files themselves ( which happen to be .json files)

I've noticed that the visitTranslationSourceJar method only extracts *.java files. Is this the reason?

See below for the build.gradle file. If the j2objcTestTranslation 'com.sample.demo:processor:0.1.2:test-sources' line is commented out the translation runs successfully but I dont get the assurance of the tests.

Am I missing something?

plugins {
    id 'java'
    id 'com.github.j2objccontrib.j2objcgradle' version '0.6.0-alpha'
}

sourceCompatibility = 1.7
targetCompatibility = 1.7

repositories {
    mavenLocal()
    jcenter()
}

dependencies {
    compile 'com.google.guava:guava:18.0'
    compile 'org.slf4j:slf4j-api:1.7.13'
    testCompile 'junit:junit:4.11'
    testCompile project(':third-party-gson')

    // j2objcTranslation causes the entire specified library
    // to be translated and built into a standalone Objective C library.
    // j2objcTranslation must always be passed a *source* jar,
    // therefore, note the ':sources' classifier.
    j2objcTranslation 'com.sample.demo:processor:0.1.2:sources'

    j2objcTestTranslation 'com.sample.demo:processor:0.1.2:test-sources'
}

j2objcConfig {
    // Sets up libraries you depend on
    autoConfigureDeps true

    testMinExpectedTests 0

    // Omit these two lines if you don't configure your Xcode project with CocoaPods
    xcodeProjectDir '../ios'  //  suggested directory name
    xcodeTargetsIos 'SampleProj', 'SampleProjTests'  // replace with your iOS targets

    finalConfigure()          // Must be last call to configuration
}
manishval commented 8 years ago

+1