problems with flex-config.xml

Andreas's Avatar

Andreas

23 Jul, 2013 10:38 AM

Hello gradlefx-support team,

in the default config gradlefx is unable to find my playerglobal.swc (I use the flex-dependency to get flex from scratch):
.gradle/gradleFx/sdks/298215ddd2158f06b32305aec5cef3547b56b788/frameworks/flex-config.xml(85): Error: unable to open '{playerglobalHome}/11.1'

But there is such a file in the frameworks/libs/player/11.1/-directory:
.gradle/gradleFx/sdks/298215ddd2158f06b32305aec5cef3547b56b788/frameworks/libs/player/11.1/playerglobal.swc

I tried to set the swc as parameter in additionalCompilerOptions, but mxml always also searches for the one specified in the flex-config.xml and exits with an error that the file from the flex-config.xml can not be found.

So my solution is to write my own flex-config.xml and use

afterEvaluate {
       additionalCompilerOptions = ["-load-config=$project.projectDir/flex-config.xml"]
}
in my build.gradle-file to override the <external-library-path> for the playerglobal.swc-file.
This way I am able to build my flex project, but I have to hardcode the path for the playerglobal.swc.
  1. Is there a better way to override the playerglobal.swc-path?
  2. (if 1. is not possible) How can I template my flex-config.xml using gradlefx to set the path for the playerglobal.swc-file to the currently used flex directory?
  1. Support Staff 1 Posted by Yennick Trevels on 23 Jul, 2013 12:00 PM

    Yennick Trevels's Avatar

    Hi,

    It looks like you're using an Apache Flex version, so maybe {playerglobalHome} has been added in their latest release.
    I'll see if I can reproduce this and let you know a possible solution.

  2. 2 Posted by Andreas on 23 Jul, 2013 02:51 PM

    Andreas's Avatar

    Hi Yennick,

    yes, I use

    repositories {
        add(new org.apache.ivy.plugins.resolver.URLResolver()) {
            name = 'Apache'
            addArtifactPattern 'http://apache.cu.be/flex/[revision]/binaries/[module]-[revision]-bin.[ext]'
        }
    }
    dependencies {
        flexSDK group: 'org.apache', name: 'apache-flex-sdk', version: '4.9.0', ext: 'tar.gz'
    }
    sdkAutoInstall {
        showPrompts = false
    }
    additionalCompilerOptions = [
      '-target-player=11.1',
    ]
    

    Thank you!

  3. Support Staff 3 Posted by Yennick Trevels on 23 Jul, 2013 05:10 PM

    Yennick Trevels's Avatar

    Hi,

    I'm not immediately able to reproduce the problem. I tried it with Flex 4.9 on a swc, swf and air project, but they all seem to work it player 11.1.

    Can you verify these things for me:

    • Are you using GradleFx 0.6.4?
    • What have you defined as the type of your project ('swc', 'swf' or 'air')?

    Greetz

  4. 4 Posted by Andreas on 23 Jul, 2013 07:50 PM

    Andreas's Avatar

    OK, here is everything you need to reproduce this (I am using fedora 18, downloaded the gradlefx 1.6 binaries from the website, because the gradle-packages in fedora are really old):

    $ /opt/gradle/gradle-1.6/bin/gradle -v
    Gradle 1.6
    Gradle build time: Tuesday, May 7, 2013 9:12:14 AM UTC
    Groovy: 1.8.6
    Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
    Ivy: 2.2.0
    JVM: 1.7.0_25 (Oracle Corporation 23.7-b01)
    OS: Linux 3.9.9-201.fc18.x86_64 amd64
    
    $ /opt/gradle/gradle-1.6/bin/gradle build
    The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
    The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
    :copyresources
    :compileFlex
    Calling TaskInputs.dir(Object) after task execution has started has been deprecated and is scheduled to be removed in Gradle 2.0. Check the configuration of task ':compileFlex'.
    Calling TaskOutputs.dir(Object) after task execution has started has been deprecated and is scheduled to be removed in Gradle 2.0. Check the configuration of task ':compileFlex'.
    Compiling with mxmlc
        +configname=flex
        -external-library-path+=/home/andreas/.gradle/gradleFx/sdks/298215ddd2158f06b32305aec5cef3547b56b788/frameworks/libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc
        -source-path+=/home/andreas/coding/gradlefx-test/src
        -target-player=11.1
        -output=/home/andreas/coding/gradlefx-test/bin/gradlefx-test.swf
        /home/andreas/coding/gradlefx-test/src/MyTest.mxml
    [ant:java] Java Result: 1
    :compileFlex FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':compileFlex'.
    > mxmlc execution failed: Loading configuration file /home/andreas/.gradle/gradleFx/sdks/298215ddd2158f06b32305aec5cef3547b56b788/frameworks/flex-config.xml
      Apache Flex Compiler (mxmlc)
      Version 4.9.0 build 1425567
      Copyright 2012 The Apache Software Foundation./home/andreas/.gradle/gradleFx/sdks/298215ddd2158f06b32305aec5cef3547b56b788/frameworks/flex-config.xml(65): Error: unable to open '{playerglobalHome}/11.1/playerglobal.swc'
      
            </external-library-path>
      
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    
    Total time: 3.613 secs
    

    i created a small git repo for testing, see: https://github.com/brean/gradlefx-test

  5. Support Staff 5 Posted by Yennick Trevels on 24 Jul, 2013 06:25 AM

    Yennick Trevels's Avatar

    Hi, I was able to test your example project on Windows, and it compiles fine. I will have access to a linux machine this evening, and I'll try it again on that one.

    In the meantime, can you try to use GradleFx 0.6.4 (the latest release) since there have been made some changes in the latest releases on this topic. I see you're using Gradle 1.6 (the build framework) and GradleFx 0.6 (the Gradle plugin). So you should replace this:

    classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.6'
    

    with this

    classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.6.4'
    

    What I also find strange is that it's referencing '{playerglobalHome}' at line 65 of flex-config.xml. But when I look at the flex-config.xml file of the Apache Flex 4.9.0 release it doesn't contain that variable, this variable only started appearing in the flex-config.xml file since Apache Flex 4.9.1.

  6. 6 Posted by Andreas on 24 Jul, 2013 07:34 AM

    Andreas's Avatar

    Hi Yennick,

    thank you for your efforts!

    I tried the flollowing:
    1. deleted my local .gradle-directory to let gradle re-download and install the sdk
    2. switching to flex 4.9.1
    3. changed gradlefx to 0.6.4 (as you suggested)

    unfortunately, none of that worked, I always get the same error:

    mxmlc execution failed: Loading configuration file /home/andreas/.gradle/gradleFx/sdks/a1c1e0f621936d94bdff14e1598d2fce3141850e/frameworks/flex-config.xml
    
  7. 7 Posted by Andreas on 24 Jul, 2013 07:52 AM

    Andreas's Avatar

    HA! GOT IT!

    I changed my dependency from .tar.gz to .zip and it is working:

    dependencies {
        flexSDK group: 'org.apache', name: 'apache-flex-sdk', version: '4.9.1', ext: 'zip'
    }
    
    so the .zip for the SDK seems to be the linux & windows version and the .tar.gz is the one only for the mac or is this a real bug behind this that we should file to apache?
  8. Support Staff 8 Posted by Yennick Trevels on 24 Jul, 2013 11:11 AM

    Yennick Trevels's Avatar

    Nice find! Didn't notice that myself.

    It doesn't seem to be a bug, they also indicate it on their download page: http://flex.apache.org/download-binaries.html

  9. Yennick Trevels closed this discussion on 24 Jul, 2013 04:21 PM.

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