Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podfile generation doesn't reproduce dependency tree #599

Open
adil-hussain-84 opened this issue Feb 23, 2016 · 3 comments
Open

Podfile generation doesn't reproduce dependency tree #599

adil-hussain-84 opened this issue Feb 23, 2016 · 3 comments

Comments

@adil-hussain-84
Copy link

I have two Java modules in my project that I'm running through the Gradle J2ObjC translation task. One is my SharedCode module that I want to be translated and made available to both the RetailSDK and RetailSDKTests targets in my iOS workspace. The other is a TestContracts module that I want to be translated and made available to the RetailSDKTests target in my iOS workspace only. Additionally, the TestContracts module has a dependency on the SharedCode module.

In order to achieve the above, the build.gradle file of my SharedCode module is as follows:

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

dependencies {
    compile 'com.google.guava:guava:18.0'
    testCompile 'junit:junit:4.12'
    testCompile 'org.hamcrest:hamcrest-core:1.3'
}

j2objcConfig {
    autoConfigureDeps true
    minVersionIos '8.4'
    supportedArchs += ['ios_i386']
    translateArgs '--no-package-directories'
    translateArgs '--prefixes', 'prefixes.properties'
    xcodeProjectDir '../iOS'
    xcodeTargetsIos 'RetailSDK', 'RetailSDKTests'
    finalConfigure()
}

And the build.gradle file of my TestContracts module is as follows:

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

dependencies {
    compile project(':SharedCode')
    compile 'junit:junit:4.12' // this is compile scope deliberately
    compile 'org.hamcrest:hamcrest-core:1.3' // this is compile scope deliberately
}

j2objcConfig {
    autoConfigureDeps true
    minVersionIos '8.4'
    supportedArchs += ['ios_i386']
    translateArgs '--no-package-directories'
    translateArgs '--prefixes', 'prefixes.properties'
    xcodeProjectDir '../iOS'
    xcodeTargetsIos 'RetailSDKTests'
    finalConfigure()
}

Based on the above, on building my project I would expect the contents of my Podfile to be the following:

target 'RetailSDK' do
    platform :ios, '8.4'
    j2objc_SharedCode
    import_other_pods
end

target 'RetailSDKTests' do
    platform :ios, '8.4'
    j2objc_TestContracts
    j2objc_SharedCode
    import_other_pods
end

However, what I see is this:

target 'RetailSDK' do
    import_other_pods
end

target 'RetailSDKTests' do
    platform :ios, '8.4'
    j2objc_TestContracts
    j2objc_SharedCode
    import_other_pods    
end

Can anyone see what I'm doing wrong in my build.gradle files which makes the output of the J2ObjC translation not be added to the RetailSDK target?

@brunobowden
Copy link
Contributor

This could well be a bug in the Podfile output. I don't have time to look at it right now, though I'll happily review a proposed change. As a temporary workaround, you can take manual control of the Podfile:

https://github.com/j2objc-contrib/j2objc-gradle/blob/master/FAQ.md#how-do-i-manually-configure-the-cocoapods-podfile

@brunobowden brunobowden changed the title Confused by the output to *Podfile* for a project that has two Java modules Podfile generation doesn't reproduce dependency tree Feb 23, 2016
@adil-hussain-84
Copy link
Author

@brunobowden... thanks for the response and the link. So the way I've specified the project dependency (i.e. TestContract dependency on SharedCode) and the xcodeTargetsIos values in the build.gradle files is in principle correct and the way the J2ObjC Gradle plugin expects?

@brunobowden
Copy link
Contributor

The challenge is having the J2ObjC Gradle Plugin take the entire dependency from Java and recreate it within the Xcode build. That's incredibly difficult to do. There will likely be limitations in that area for some time to come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants