You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a TestContracts Java module in my project that has classes which have JUnit / Hamcrest assertions. I'd like to translate these classes and use them in the tests target of my iOS module. 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()
}
The Java to Objective-C translation step of the Gradle build completes but the :iOS:xcodebuild step fails with a linking error. It can't make sense of the JUnit assertions. The problem I've discovered is that the 'junit' library is missing from the podspec files created in the TestContracts/build/j2objcOutputs folder.
So question is: is it possible specify the JUnit and Hamcrest dependencies in a way that they're included in the generated podspec file? And, if so, how?
The text was updated successfully, but these errors were encountered:
adil-hussain-84
changed the title
Problem referencing JUnit in translated classes
Problem referencing JUnit annotations and assertions in translated classes
Feb 23, 2016
I've updated the description of the issue above as I've discovered the root of the problem... but still don't know how to solve the issue so I haven't closed it yet. The best I've come up with right now is to add the following in the "Other linker flags" in Xcode for my tests target:
$(inherited)
-l"junit"
Would be great if I could do this via the build.gradle file instead of hard-coding in my Xcode project.
adil-hussain-84
changed the title
Problem referencing JUnit annotations and assertions in translated classes
Possible to add *junit* to *spec.libraries* in generated podspec?
Mar 3, 2016
I have a
TestContracts
Java module in my project that has classes which have JUnit / Hamcrest assertions. I'd like to translate these classes and use them in the tests target of myiOS
module. Thebuild.gradle
file of myTestContracts
module is as follows:The Java to Objective-C translation step of the Gradle build completes but the
:iOS:xcodebuild
step fails with a linking error. It can't make sense of the JUnit assertions. The problem I've discovered is that the'junit'
library is missing from thepodspec
files created in theTestContracts/build/j2objcOutputs
folder.So question is: is it possible specify the JUnit and Hamcrest dependencies in a way that they're included in the generated
podspec
file? And, if so, how?The text was updated successfully, but these errors were encountered: