merged dependency doesn't work for swcAir
I'm attempting to migrate an existing Ant build to Gradle, but I'm having difficulty when trying to use swcAir dependencies that I don't experience when using just swc dependencies.
Files involved:
$ find * -type f
build.gradle
proj1/src/main/actionscript/org/gradle/example/simple/HelloWorld1.as
proj2/src/main/actionscript/org/gradle/example/simple/HelloWorld2.as
settings.gradle
Settings file:
include 'proj1', 'proj2'
Build.gradle:
buildscript {
repositories { mavenCentral() }
dependencies { classpath group: 'org.gradlefx', name: 'gradlefx', version: '1.1' }
}
subprojects {
apply plugin: 'gradlefx'
flexHome = "$System.env.AIR_SDK_HOME"
type = 'swc'
}
project(':proj2') {
dependencies {
merged project(':proj1')
}
}
The example source code in question:
$ cat proj?/src/main/actionscript/org/gradle/example/simple/HelloWorld?.as
package org.gradle.example.simple
{
public class HelloWorld1 {
private var _foo : int = 1;
}
}
package org.gradle.example.simple
{
public class HelloWorld2 extends HelloWorld1 {
private var _foo : int = 2;
}
}
OK, let's compile:
$ gradle -i compile
...
Compiling with compc_cli
-load-config+=/tmp/air_16_mac/frameworks/flex-config.xml
-source-path+=/tmp/repro/proj2/src/main/actionscript
-include-sources+=/tmp/repro/proj2/src/main/actionscript
-library-path+=/tmp/repro/proj1/build/proj1.swc
-output=/tmp/repro/proj2/build/proj2.swc
[compc-cli.jar] Loading configuration: /tmp/air_16_mac/frameworks/flex-config.xml
1916 bytes written to /tmp/repro/proj2/build/proj2.swc in 1.252 seconds
...
Ok, that worked as expected, as we can see by the resulting .swc
files:
$ find * -type f -name *.swc
proj1/build/proj1.swc
proj2/build/proj2.swc
Let's clean, and modify the type from 'swc' to 'swcAir':
$ gradle -q clean
$ cat build.gradle | grep type
type = 'swcAir'
Compiling with swcAir:
$ gradle -i compile
...
Compiling with compc_cli
-load-config+=/tmp/air_16_mac/frameworks/air-config.xml
-source-path+=/tmp/repro/proj2/src/main/actionscript
-include-sources+=/tmp/repro/proj2/src/main/actionscript
-output=/tmp/repro/proj2/build/proj2.swc
[ant:java] Java Result: 2
:proj2:compileFlex FAILED
:proj2:compileFlex (Thread[main,5,main]) completed. Took 1.829 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':proj2:compileFlex'.
> java.lang.Exception: compc_cli execution failed: Loading configuration: /tmp/air_16_mac/frameworks/air-config.xml
/tmp/repro/proj2/src/main/actionscript/org/gradle/example/simple/HelloWorld2.as:3
Error: The definition of base class HelloWorld1 was not found.
public class HelloWorld2 extends HelloWorld1 {
^
...
So it seems the dependency was not pulled in.
Any advice? Am I doing something wrong? Thanks for any suggestions!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
1 Posted by wenslayer on 26 Feb, 2015 08:12 PM
For the record, I can manually work around this by replacing the proj1 configuration with:
However, this feels like a hack.
2 Posted by wenslayer on 26 Feb, 2015 11:52 PM
Looking at the code, it appears this problem manifests in
LibraryOptionsInjector.groovy.The function
addLibraries()expects files for its first argument, butaddMergedLibraries()passes inproject.configurations.merged.files, and forswcAirtypes, that translates to/path-to/proj1/build/proj1.swcAir, which doesn't make sense (it should just be/path-to/proj1/build/proj1.swc).So I believe the fix involves correcting how files are constructed for the project when the type is
swcAir, or doing that mapping inLibraryOptionsInjector.groovy(but that doesn't seem like the right place though).I'll investigate the project.configuration.files side of things...
3 Posted by wenslayer on 27 Feb, 2015 12:46 AM
I filed issue #166 in GitHub.
Support Staff 4 Posted by Yennick Trevels on 27 Feb, 2015 08:51 PM
Fixed by wenslayer @ https://github.com/GradleFx/GradleFx/pull/167
Yennick Trevels closed this discussion on 27 Feb, 2015 08:51 PM.