Skip to content

Extracting resources from source jars #607

Open
@lavapatch

Description

@lavapatch

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions