htmlWrapper generation fails

thomas.auinger's Avatar

thomas.auinger

04 Nov, 2013 03:49 PM

I cannot get gradlefx to make flashbuilder generate the html-wrapper... Also I find that the example on page
http://doc.gradlefx.org/en/latest/properties_conventions.html#example-usage-build-gradle
contains quite a few mistakes in the htmlWrapper section (missing = operators and bad quote marks around numbers).

My build script contains

htmlWrapper {
title = 'Test'
percentHeight = 80
percentWidth = 80
}

  1. Support Staff 1 Posted by Yennick Trevels on 04 Nov, 2013 05:45 PM

    Yennick Trevels's Avatar

    Thanks for reporting these mistakes, these probably slipped through the cracks when I've changed the way properties are being defined. I'll try to correct them as fast as possible.

    As for generating the html-wrapper in flashbuilder. I couldn't find anything in our source code which applies the htmlWrapper properties to the FlashBuilder project files, so I think it's currently not supported. I also don't know if FlashBuilder has a way to specify this in the project files, maybe @RIAstar knows more about this.

  2. Support Staff 2 Posted by Yennick Trevels on 04 Nov, 2013 07:04 PM

    Yennick Trevels's Avatar

    Documentation has been updated and now contains correct examples.

  3. Support Staff 3 Posted by Maxime Cowez on 04 Nov, 2013 08:42 PM

    Maxime Cowez's Avatar

    @Thomas Which version of the Flex SDK are you using? There was a bug in Flex 4.9 with the htmlWrapper ANT task (see the issue I raised), which is what GradleFx uses under the covers.
    This bug was fixed in 4.10 though.

    @Yennick There is indeed no connection between our FlashBuilder plugin and the htmlWrapper config. An oversight of my part, but if I remember correctly the settings for the htmlWrapper inside FlashBuilder are rather limited (hey, you hooked me on IntelliJ; haven't touched FB ever since and my memory is failing me). I think it's even no more than a simple checkbox ("generate HTML wrapper" or something of the like).

  4. Support Staff 4 Posted by Yennick Trevels on 04 Nov, 2013 09:21 PM

    Yennick Trevels's Avatar

    Indeed, there are only 3 options for the HTML wrapper of which one is "enable HTML wrapper generation", so it's rather limited.

  5. 5 Posted by thomas.auinger on 05 Nov, 2013 08:37 AM

    thomas.auinger's Avatar

    @Maxime -- Flex 3.6A
    @Yennick -- that checkbox enabled would be great! Its all I need

    Thanks everybody!

  6. Support Staff 6 Posted by Yennick Trevels on 05 Nov, 2013 09:57 AM

    Yennick Trevels's Avatar

    I don't think this is something we should sync with the Flash Builder project files, here's why:
    1. Currently there's no htmlWrapper property in GradleFx which we can use to determine whether it should be enabled in Flash Builder.
    2. Always enabling this is probably something we don't want, some people may only want to use their GradleFx settings (which are more specific).
    3. I don't think it's the task of GradleFx to have such a property.

    However, there is another way to accomplish this. After the flashbuilder task has run, you can add a block of code which adds the option to generate the html wrapper (haven't tested this, so it can contain errors):

    flashbuilder.doLast {
        def actionscriptPropertiesFilename = '.actionScriptProperties'
        def xml = new XmlParser().parse project.projectDir.absolutePath + '/' + actionscriptPropertiesFilename 
    
        //add htmlGenerate="true" parameter to xml
        xml.compiler.@htmlGenerate = true
    
    
        project.file(actionscriptPropertiesFilename).withWriter { out ->
            XmlUtil.serialize xml, out
        }
    }
    
  7. 7 Posted by thomas.auinger on 05 Nov, 2013 10:15 AM

    thomas.auinger's Avatar

    Agree to 1 and 3, not sure what you mean with 2, maybe because I dont know what the wrapper is used for anyway (deployment/integration into html-app?)

    What is so bad about enabling it in any case? Currently you always disable the property, which is IMO worse.

    PS Cannot run your hack: Could not find property 'XmlUtil'

    PPS: Also cannot run task createHtmlWrapper for testing:
    Execution failed for task ':createHtmlWrapper'.
    > The <html-wrapper> task doesn't support the "express-install" attribute.

  8. Support Staff 8 Posted by Maxime Cowez on 05 Nov, 2013 10:23 AM

    Maxime Cowez's Avatar

    @Thomas That express-install message smells really hard of the SDK bug I mentioned. Are you really certain you're not compiling with a different SDK than the one you're targeting?

    @Yennick Would a FlashBuilder-specific config node be acceptable? I'm quite reluctant to the idea myself, but I don't want to discard it entirely.

  9. Support Staff 9 Posted by Yennick Trevels on 05 Nov, 2013 10:32 AM

    Yennick Trevels's Avatar

    The wrapper is mostly used when you want to deploy your Flex app as a web application. In that case it has to be contained within an html file.

    If I'm not mistaken, disabling it by default is the same as what Flash Builder does, so it's not that worse. Also, not all projects need this html wrapper, since it's only useful when you want to embed your application in a basic html page.

    As for the XmlUtil property, import the XmlUtil class as follows:

    import groovy.xml.XmlUtil
    

    The express-install problem is because Flex 3.6 didn't have that property, while we started development of GradleFx for Flex 4.x (and therefore mostly targeted versions above 4.0)

  10. Support Staff 10 Posted by Yennick Trevels on 05 Nov, 2013 10:37 AM

    Yennick Trevels's Avatar

    @Maxime personally I always wanted GradleFx to make 90% of the use cases easy, while making the other 10% (more specific ones) possible but a bit harder. This imo falls into the more special ones, and is solvable with some xml manipulation, which isn't a huge code block either. Therefore I'm not in favor of adding this to GradleFx.

  11. 11 Posted by thomas.auinger on 05 Nov, 2013 10:42 AM

    thomas.auinger's Avatar

    Ok, great that works.

    Now: A new project in FB is always created with that property enabled. Hence I would pledge for generating it with value true instead of false.

    I see the risk in people scratching their head (and starting long discussions like this) greater than in having an extra folder you dont really need in your project dir. And how else would you run your app from FB in a browser? Without the FB-wrapper it always starts flash player instead of browser, which is annoying..

  12. Support Staff 12 Posted by Yennick Trevels on 05 Nov, 2013 10:48 AM

    Yennick Trevels's Avatar

    Ok, I thought it was disabled by default when creating a new project. That changes things...

    If it's enabled by default in FlashBuilder, then I can agree that we also enable it when generating the project files. That way it's consistent with the IDE behavior.

  13. Support Staff 13 Posted by Maxime Cowez on 05 Nov, 2013 12:51 PM

    Maxime Cowez's Avatar

    I have to agree (reluctantly) that it should be consistent with IDE behavior.

    Personally I always found that default setting extremely annoying. I find it much more comfortable to debug directly in flash player than to add the additional layer of the browser. That said, since I no longer use FB, my personal preference is no longer at stake here ;)

    Technically it's just a matter of adding that attribute to the template FB project config files.

  14. Support Staff 14 Posted by Yennick Trevels on 06 Nov, 2013 07:03 PM

    Yennick Trevels's Avatar

    An improvement request has been created here: https://github.com/GradleFx/GradleFx/issues/111

  15. Support Staff 15 Posted by Yennick Trevels on 13 Nov, 2013 08:17 PM

    Yennick Trevels's Avatar

    This has now been implemented. A snapshot build (with this fix) of GradleFx 0.7.1 is available on the following maven repo: https://oss.sonatype.org/content/repositories/snapshots/ (version is 0.7.1-SNAPSHOT)

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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