Coder Social home page Coder Social logo

gradlefx's Introduction


GradleFx: A Gradle plugin for building Flex projects

GradleFx is a Gradle plugin which adds some common targets used in almost every Flex/Actionscript project.
It can create both SWC, SWF and AIR files. The plugin uses the compc and mxmlc java tasks under the hood.
All compiler arguments are supported. Some are automatically filled in by the plugin (like source directory,
dependencies) and other more specific arguments can be provided to the plugin by adding them on the
additionalCompilerOptions convention property.

Features:

  • convention-over-configuration
  • dependency management
  • multi-project support
  • source file change detection
  • SWC, SWF and AIR project support
  • FlexUnit support
  • AsDoc support
  • Adobe Flash Builder & Intellij project generation
  • project scaffolding
  • Automatic Flex/AIR SDK installation
  • Mobile (Android & iOS) support

Useful links

gradlefx's People

Contributors

alebianco avatar bjoernlilleike avatar chaos-adept avatar georgiou avatar honzabrecka avatar jlopez avatar matyasatfp avatar matyasf avatar nestradaobs avatar phillipgreenii avatar pmowrer avatar riastar avatar rvt avatar shawn11zx avatar slevinbe avatar stevendick avatar wenslayer avatar yannliepallotools avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradlefx's Issues

Adding additional RSL dependencies overwrites use of Flex RSLs

If you add additional RSL dependencies to a SWF project, these will overwrite the Flex RSLs meaning your application won't run. I confirmed this behaviour by dumping the XML configuration used for the compilation. The problem appears to be because the MXMLC compilation task uses = instead of += when adding the extra RSL dependencies.

Third party swc in swf

First of all, I am a Flex beginner and I have problems with including third party swc:s to my project.

I have a sub project that looks like this:

flex
├── build.gradle
└── test_oauth
    ├── build.gradle
    └── src
        └── main
            ├── actionscript
            │   └── IFrameDemo.mxml
            └── resources
                ├── FacebookGraphAPI.swc
                └── index.html


The top build.gradle looks like this:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.5'
    }
}

subprojects {
    apply plugin: 'gradlefx'
    flexHome = '/Users/eoscnor/opt/flex'
}

The test_oauth build.gradle looks like this:

type = 'swf'
mainClass = 'IFrameDemo.mxml'

However when I build i get these errors:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flex:test_oauth:compile'.
> taskName compilation failed: Loading configuration file /Users/eoscnor/opt/flex/frameworks/flex-config.xml
  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(47):  Error: Definition com.adobe.serialization.json:JSON could not be found.

            import com.adobe.serialization.json.JSON;

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(48):  Error: Definition com.facebook.graph:Facebook could not be found.

            import com.facebook.graph.Facebook;

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(49):  Error: Definition com.facebook.graph.data:FacebookSession could not be found.

            import com.facebook.graph.data.FacebookSession;

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(50):  Error: Definition com.facebook.graph.net:FacebookRequest could not be found.

            import com.facebook.graph.net.FacebookRequest;

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(62):  Error: Access of undefined property Facebook.

                Facebook.init(APP_ID, handleInit);

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(78):  Error: Access of undefined property Facebook.

                if (Facebook.getAuthResponse().accessToken == null) {

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(80):  Error: Access of undefined property Facebook.

                    Facebook.login(handleLogin, {scope:"user_photos, publish_stream"});

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(82):  Error: Access of undefined property Facebook.

                    resultTxt.appendText('\nLOG OUT:' + String(Facebook.getAuthResponse()));

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(83):  Error: Access of undefined property Facebook.

                    Facebook.logout(handleLogout);

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(125):  Error: Access of undefined property Facebook.

                            fbml:'<fb:header icon="false" decoration="add_border">Hello World!</fb:header><fb:profile-pic uid="'+Facebook.getAuthResponse().uid+'"></fb:profile-pic>',

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(161):  Error: Access of undefined property Facebook.

                Facebook.ui(uiCmb.selectedItem.label, uiCmb.selectedItem.data, null, uiDialog.selected?'popup':null);

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(165):  Error: Access of undefined property Facebook.

                Facebook.api(requestIdTxt.text + '/' +apiConnectionType.selectedItem.label, handleAPIComplete);

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(170):  Error: Call to a possibly undefined method encode through a reference with static type Class.

                    resultTxt.appendText('\nResult:\n' + JSON.encode(response));                    

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(172):  Error: Call to a possibly undefined method encode through a reference with static type Class.

                    resultTxt.appendText('\nFail:\n' + JSON.encode(fail));

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(196):  Error: Access of undefined property Facebook.

                Facebook.api('me/photos', handleImageUploadComplete, params);

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(206):  Error: Access of undefined property Facebook.

                Facebook.api(requestIdTxt.text, handleConnectionsLoad, {metadata:true});

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(231):  Error: Access of undefined property Facebook.

                Facebook.mobileLogin("http://dev.gskinner.com/facebook/", "touch");

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(235):  Error: Access of undefined property Facebook.

                Facebook.setCanvasSize(Number(widthTxt.text), Number(heightTxt.text));

  /Users/eoscnor/Documents/psisite/flex/test_oauth/src/main/actionscript/IFrameDemo.mxml(240):  Error: Access of undefined property Facebook.

                Facebook.setCanvasAutoResize(autoSizeChk.selected, 250);



* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

It does not look like FacebookGraphAPI.swc is available during compile time even if it is included to the build directory:

├── flex
│   ├── build.gradle
│   └── test_oauth
│       ├── build
│       │   ├── FacebookGraphAPI.swc
│       │   ├── advancedgrids_4.6.0.23201.swf
│       │   ├── charts_4.6.0.23201.swf
│       │   ├── framework_4.6.0.23201.swf
│       │   ├── index.html
│       │   ├── mx_4.6.0.23201.swf
│       │   ├── osmf_1.0.0.16316.swf
│       │   ├── rpc_4.6.0.23201.swf
│       │   ├── spark_4.6.0.23201.swf
│       │   ├── spark_dmv_4.6.0.23201.swf
│       │   ├── sparkskins_4.6.0.23201.swf
│       │   └── textLayout_2.0.0.232.swf

I have probably done something wrong. Could anyone please give me some hints about what I should do.

'mobile' FlexType

I think we need to add a mobile FlexType. I've been running into this a lot while implementing feature #39:

  • FlashBuilder (or other IDE if applicable) project type
  • Flex dependencies
  • generating the main class (Application, WindowedApplication or ViewNavigatorApplication)
  • generating the descriptor file
  • ...

It may probably come in handy in some other places too:

  • reading the right config file (flex-config, air-config or airmobile-config)
  • ...

I will add it as I go with feature #39.
For other tasks a mobile project will be treated as an air project for now.

Mxmlc additionalCompilerOptions optimize=false generates error.

Hi again.

I just downloaded and built the latest 0.2.3 version of GradleFx. Many thanks for being so responsive to my earlier ideas.

My issue this time is that I have a sub-project for some unit tests, and I am setting the following in its build.gradle file:

additionalCompilerOptions += [
'-static-link-runtime-shared-libraries=true',
'-debug=true',
'optimize=false'
]

This is now giving me the error:

Execution failed for task ':framework:OSMFTest:compile'.
Cause: swc compilation failed: command line: Error: default arguments may not be interspersed with other options

Use 'mxmlc -help' for information about using the command line.

The key problem seems to be the 'optimize=false' line, as if I remove that then the compilation works. And yes the type is 'swf' and does produce that even though the message says 'swc'. Other additionalCompilerOptions are set in the parent, but those don't seem to be a problem as commenting them all out doesn't change anything.

Anyway, I swear I had this working, although a quick search through the GradleFx code can't seem to find where this would be.

I will probably keep picking at this issue, but if anyone else has a chance to take a look that would be great.

AIR: Specifying icons in the descriptor makes packaging fail

An error like this appears when trying to package an AIR application which has icons specified in its application descriptor:
Packaging failed: D:\path\to\my project\src\XXX_AIR-app.xml: error 303: Icon com/XXX/ assets/images/appIcons/icon_PP.png is missing from package

Possible solution: add a convention property to GradleFx to which those icons can be specified (or find them automatically)

External linkage on MXMLC not supported

The MXMLC task doesn't currently support the external linkage when compiling. This is a problem if someone is creating modules and they expect the main application shell to load all RSLs - this is a typical scenario where you would use the external linkage on the module.

Add more descriptive warning messages

More descriptive warning/error messages would be usefull, especially for these cases:

  • User hasn't specified the flex sdk location
  • User overrides/uses a compiler option in the additionalCompilerOptions property which is being autofilled by GradleFx
  • Running "gradle test" and forgetting to add the testClass then the test just gets "SKIPPED". It should notify why it skips the code.

IDE project generation

I have seen this one on a wishlist somewhere, but not in the official feature requests. I thought I might pick it up (since it shouldn't be too hard; I'm not a Groovy or Gradle Jedi). Or at least get started with the framework and a concrete implementation for Eclipse, since that's the only IDE I know quite well.

Description

Mimic the behavior of the 'eclipse', 'idea', etc. Gradle plugins for Flex projects:
type gradle eclipse at the command line and GradleFx will generate the necessary Eclipse/FlashBuilder configuration files and put the dependencies from the Gradle/Maven cache on the IDE's build path.

Targeted IDE's

The ones I can think of right now:

  • Eclipse / FlashBuilder
  • IntelliJ IDEA
  • FDT
  • FlashDevelop

Add a localization convention

Add convention properties for localization. Something like the following:

Example with conventions:

locales = ['nl_BE', 'fr_BE']

Example without conventions:

localeDir = 'path/to/my/locale'
locales = ['en_US']

Incompatibility between GradleFx and Gradle 1.0 m8

Updating Gradle from milestone 7 to milestone 8 results in the following error message on some - but not all - library projects:

Execution failed for task ':fx-components:compile'.
> Could not find matching constructor for:
org.gradle.api.internal.file.BaseDirFileResolver(java.io.File)

Below is the full stacktrace:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':fx-components:compile'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34) at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34) at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:111) at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83) at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:250) at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192) at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177) at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31) at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103) at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79) at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78) at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42) at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28) at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32) at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21) at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:238) at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:222) at org.gradle.launcher.Main.doAction(Main.java:48) at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53) at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51) at org.gradle.launcher.exec.Execution.execute(Execution.java:28) at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39) at org.gradle.launcher.Main.main(Main.java:39) at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51) at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33) at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.gradle.api.internal.file.BaseDirFileResolver(java.io.File) at org.gradlefx.tasks.compile.Compc$_addResources_closure3_closure10.doCall(Compc.groovy:88) at org.gradlefx.tasks.compile.Compc$_addResources_closure3.doCall(Compc.groovy:86) at org.gradlefx.tasks.compile.Compc.addResources(Compc.groovy:82) at org.gradlefx.tasks.compile.Compc.this$5$addResources(Compc.groovy) at org.gradlefx.tasks.compile.Compc$this$5$addResources.callCurrent(Unknown Source) at org.gradlefx.tasks.compile.Compc.createCompilerArguments(Compc.groovy:65) at org.gradlefx.tasks.compile.Compc.this$5$createCompilerArguments(Compc.groovy) at org.gradlefx.tasks.compile.Compc$this$5$createCompilerArguments.callCurrent(Unknown Source) at org.gradlefx.tasks.compile.Compc.compileFlex(Compc.groovy:37) at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196) at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102) at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93) at org.gradlefx.tasks.compile.Compc_Decorated.invokeMethod(Unknown Source) at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:150) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:145) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:495) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:484) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60) ... 54 more

The "package" task should probably be renamed not to use a reserved word

I'm new to Gradle/Groovy/GradleFx, so this might be a misdirected issue based on my ignorance. :)

I was trying to override the "package" task in one of my air projects, but was getting lots of errors because the word "package" is a reserved word. I've customized the plugin to use the name "packageAir" now instead.

so instead of:

project.afterEvaluate{

    package.doFirst {
        println "This happens before the package task"
    }
}

I now do:

project.afterEvaluate{

    packageAir.doFirst  {
        println "This happens before the packageAir task"
    }
}

Incidentally, if anyone else is trying to override that task in an air project, you HAVE to put it in afterEvaluate, because that package task doesn't get added to your project unless you have an AIR project. Man, that took me HOURS to figure out. That's probably worth a documentation bug. ;)

flexHome convention is not transferred to GradleFxConvention

When the FLEX_HOME environment variable is not set and you try to use the 'flexHome' convention, the variable is null in the GradleFxConvention instance. However the value of project.flexHome is correct.

This seems to happen only to flexHome. I've tried to trigger the issue with a few other convention properties, but couldn't.

I will commit a quick fix shortly, but this should be replaced with cleaner code.

Also the unit tests may have to be adjusted to catch this issue. Right now they don't because the flexHome value is set directly on the GradleFxConvention instance.

Documentation: Add a note to folks who want to modify the GradleFx tasks

There are certain GradleFx tasks (like "package") that get added to the project after it is evaluated. Thus, if you are trying to do anything with that task in build.gradle, you HAVE to wrap it in afterEvaluate. It took me a long time to figure out why "gradle tasks" listed that task, but I didn't have access to it in build.gradle! A note like this would have saved me a lot of time. :)

Generate reports

We could generate all kinds of reports about the project:

  • built-in reports like what's generated through the -link-report compiler option
  • reports generated from standard output (e.g. a list of warnings from the compiler)
  • reports generated by third-party tools (FlexPMD, etc.)

Just a general idea for the time being.

air versioning

A minor improvement I just thought of (jotting it down here so I don't forget):

Link an air / mobile application's version number (the one in the versionNumber tag of the descriptor file) to the Project's version, so it gets automatically bumped when deploying.

Some thougths:

  • versionNumber must be of format <0-999>.<0-999>.<0-999>; we'll have to translate non-numeric version properties
  • we can use versionLabel for the non-translated version, if needed
  • in what task will we include this? (build perhaps?)

Proper error message for issue with FlexUnitApplication.mxml

FlexUnitApplication.mxml is a file that gets automatically created by FlashBuilder when you run unit tests from within the IDE.
This file can cause trouble with GradleFX and the resulting exceptions are too mysterious to the user.

We should catch errors generated by the presence of this file and throw one with more sensible information and possibly a suggestion on how to fix the issue.

cf. https://gradlefx.tenderapp.com/discussions/problems/34-error-when-trying-to-generate-documentation-for-a-swc-using-gradel-asdoc

package notation support for 'mainClass' convention

Make it so that org/gradlefx/MyApp.mxml and org.gradlefx.MyApp are both valid values for the mainClass convenience property.

Thoughts:

  • This can be completely backwards compatible
  • I think it's a more natural way of declaring your main class
  • It's language-agnostic: MXML or ActionScript
  • Pure ActionScript projects (frameworkLinkage='none') would assume an .as file is the main file; other projects assume it's an .mxml file; if the need be, one can override the default behaviour by using the path notation
  • The default value should change to language-agnostic Main; this would make the generation of the appropriate application file in feature #39 easier

Since I need this for #39 I'll implement it along the way

Generate templates (projects and classes)

A feature similar to https://launchpad.net/gradle-templates that can generate default directory structures and/or classes.

  • directory structure and application class generation is already being implemented through feature #39
  • some possible class generation tasks:
    • createApplication
    • createClass
    • createDTO
    • createService
    • createItemRenderer
    • createSkin
    • createComponent
    • createView
    • createEvent
    • ...

User should be able to override default templates with custom ones.
We might introduce a mainPackage convention.

Build fails under gradle 1.0-milestone-9

Builds fail under with the following error:

  • Where:
    Build file '/Users/#####/projects/samples/GradleFx-Examples/flex-java-war/flex/build.gradle' line: 12

  • What went wrong:
    A problem occurred evaluating project ':flex'.

    Could not find property 'buildDirName' on project ':flex:swc'.

As shown above, the code being built is the flex-java-war example.

Looks like there are some places where project.buildDirName needs to be changed to project.buildDir

Complex convention property rework

Rework the complex conventions so that they can be specified as a closure instead of as a list. That way it uses the same mechanism as the java plugin an others.

e.g. instead of:
air [
storepass: 'myStorePass'
]

it should become this:
air {
storepass 'myStorePass'
}

copyresources task is broken. needs a slash between projectDir & resourceDir

Running the copyresources task with --debug shows the following:

//
12:08:57.634 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':copyresources'.
12:08:57.643 [INFO] [org.gradle.api.Task] from /Projects/zero/zerojs-ace-demosrc/main/resources to /Projects/zero/zerojs-ace-demo/build
//

Notice that there needs to be a slash between the projectDir and the resourceDir.

The workaround is to manually set the resourceDirs manually with a slash at the front:

resourceDirs = ['/src/main/resources'];

resources aren't added correctly to the swc

Compc#addResources() contains this line:
compilerArguments.add("/" + new BaseDirFileResolver(new GenericFileSystem(), resourceDir).resolveAsRelativePath(it.path).replace('', '/'))

leading "/" creates a nameless folder in the swc which will contain the resources, without the "/" everything works fine

GradleFx should support adding folders as dependencies

I was trying to do the following in my swc library compilations:

dependencies{
        external files("$flexHome/frameworks/libs") 
        external files("$flexHome/frameworks/libs/mx") 
}

That's because I wanted to use external linking with the Flex libs when compiling my swcs. It's not until I build my main air project that I use "merged" linking.

However, I was not allowed to add dependencies that were directories, and that was because of AbstractCompileTask.groovy::addLibraries.

Below are the changes I made:

protected void addLibraries(Set libraryFiles, Configuration configuration, String compilerArgument, List compilerArguments) {
         libraryFiles.each { dependency ->
             //only add swc dependencies, no use in adding pom dependencies

//I removed this line:
//            if (dependency.name.endsWith(FlexType.swc.toString())) {
//And I replaced it with this line:
           if (dependency.name.endsWith(FlexType.swc.toString()) || dependency.isDirectory()) {
                 if (!dependency.exists()) {
                     String errorMessage = "Couldn't find the ${dependency.name} file - are you sure the path is correct? "
                     errorMessage += "Dependency path: " + dependency.path
                     throw new ResolveException(configuration, new Throwable(errorMessage))
                 }

                 compilerArguments.add(compilerArgument + "+=" + dependency.path);
             }
         }
     }

It has worked quite well for me in my build.

Project property for framework linkage

Add a Project property with which the developer can choose the Flex framework linkage (like you can do in FlashBuilder). Something along the lines of:

frameworkLinkage = 'external'
//or
frameworkLinkage = 'rsl'
//or
frameworkLinkage = 'merged'

Note that in FlashBuilder the default setting for this is 'external' for library projects and 'RSL' for application projects. The current situation in GradleFx is that it is always 'merged' by default.

A workaround for external linkage would be to use file based dependencies on the framework swcs, like this:

dependencies {
    external fileTree(
        dir: "${flexHome}frameworks/libs", 
        includes: ['*.swc']
    )
}

Allow passing tokens to the srcDirs parameters of compc

I was having some issue doing the following (which seemed like a reasonable thing to do)

    srcDirs = [
        'src/',
        'src/resources/{locale}'
    ]

The "src/resources/{locale}" was being stripped out.
That was because in addSourcePaths of compc.groovy, it strips out source paths that don't exist. So, I made the following modification:

     private def addSourcePaths(List compilerArguments) {
         project.srcDirs.each { sourcePath ->
             File sourcePathDir = project.file(sourcePath)

//Removed this line:
//            if(sourcePathDir.exists()) {
//Replaced with:
            if(sourcePathDir.exists() || sourcePath.contains('{')) {
                 compilerArguments.add("-source-path+=" + project.file(sourcePath).path)
             }
         }
     }

Not sure if it's the best way to handle it, but it fixed my issue and seemed reasonable to me.

(I have been meaning to learn to fork and submit a pull request, but I am short on time and don't want to go any longer without reporting a couple of minor code issues I ran into last week)

Add compiler memory option

Add an option to define the compiler memory. Something like this:
myArgs = '-Xmx1024m -Xms512m'

ant.java(jvmargs: myArgs,
jar: project.flexHome + '/lib/compc.jar',
dir: project.flexHome + '/frameworks',

Add theme support

[Feature request]
Add 'theme' to the list of dependency scopes, so we can pull a theme library artifact from a repository and apply it as the theme of an application. Only applicable to the 'swf' project type.

As an example:

dependencies {
    theme 'my.repo.group:fx-theme:1.0-SNAPSHOT@swc'
}

would be way more elegant than constructs like this one:

repositories {
    flatDir {
        name 'flatRepo'
        dirs flatRepoDir //path/to/my/artifacts in gradle.properties file
    }
}

additionalCompilerOptions = [
    "-theme+=${flatRepo}/fx-theme-1.0-SNAPSHOT.swc"
]

Add support for executing FlexUnit tests

Support for executing unit tests as part of the build is an essential feature of any modern platform and build system. As FlexUnit is the chosen framework from Adobe for Flash Builder, we should implement this first.

using a FlexSDK defined as a dependency instead of FLEX_HOME

different projects use different version of flex-sdks, so env().FLEX_HOME is not an option
and the build.gradle is in the svn, so a hard coded path to the flex-sdk is no option because it wouldn't work on any pc or mac of another dev on the project.

So I just thought wouldn't it be possible to declare a dependency to a flex-sdk with a specific version, and use that for compiling etc?

If there is a better way to configure this or I can be of any help, please tell me/ ask.

Applying Maven plugin isn't possible

Applying the maven plugin causes the following error:

A problem occurred evaluating root project 'client'.
Cause: Cannot add a configuration with name 'default' as a configuration with that name already exists.

FlexUnit: reduce required configuration

Try to reduce the required configuration by:

  • specifying the FlexUnit dependency as a repository-based dependency
  • automatically creating the testRunner.mxml (or some equivalent of it)

Update FlexUnit wiki page

Hi!

Currently I've tried to setup unit-testing in my project with Gradle according to FlexUnit page. But there is some problems for beginers:

  1. FlexUnit dependencies with version 4.1.0-8 could not be resolved.
  2. There is no any mention that for tests running need to execute gradle test (it's may be non-obvious for beginners).

add more info logging

Add some more information logging about the build, like which compiler options are being used etc.

Add support for creating an HTML wrapper

A HTML wrapper can be generated for a Flex project that supports checking for the availability of the Flash plug-in (as well as some Javascript for browser history stuff). We should add this to GradleFx.

Incompatibility between compc and mxmlc compiler arguments when unit testing a library

compc and mxmlc have a lot of compiler arguments in common, but some are not shared. If one wants to build and unit test a library and uses an argument that is not shared, one will get an error.

For example: suppose we're building a component library, then we want to define a namespace and include a manifest file:

additionalCompilerOptions.addAll([
    "-namespace=${namespace},${nsPath}manifest.xml",
    "-include-namespaces=${namespace}",
    "-include-file=design.xml,${nsPath}design.xml"
])

The library itself will compile just fine since compc knows all of these arguments, but the :testCompile task fails because mxmlc doesn't know 'include-namespaces'.

Execution failed for task ':fx-components:testCompile'.
> taskName compilation failed: command line: Error: 
  unknown configuration variable 'include-namespaces'

flexunit-single-project example build fails.

When I try to build your sample flexunit project, the build fails with the exception below. I do see a TestRunner.swf in the build directory. Notice the null at the end of the command path. What should be there?

11:43:29.372 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: : The provided command path [/Projects/scratch/GradleFx-Examples/flexunit-single-project/null] does not exist.
11:43:29.372 [ERROR] [org.gradle.BuildExceptionReporter] at org.flexunit.ant.tasks.configuration.TestRunConfiguration.validate(Unknown Source)
11:43:29.373 [ERROR] [org.gradle.BuildExceptionReporter] at org.flexunit.ant.tasks.configuration.TaskConfiguration.verify(Unknown Source)
11:43:29.374 [ERROR] [org.gradle.BuildExceptionReporter] at org.flexunit.ant.tasks.FlexUnitTask.execute(Unknown Source)
11:43:29.374 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
11:43:29.375 [ERROR] [org.gradle.BuildExceptionReporter] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
11:43:29.376 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
11:43:29.376 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
11:43:29.377 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultAntBuilder.super$3$invokeMethod(DefaultAntBuilder.groovy)
11:43:29.378 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultAntBuilder.invokeMethod(DefaultAntBuilder.groovy:37)
11:43:29.378 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradlefx.tasks.Test.runFlexUnit(Test.groovy:41)
11:43:29.379 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
11:43:29.379 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
11:43:29.380 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradlefx.tasks.Test_Decorated.invokeMethod(Unknown Source)
11:43:29.381 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
11:43:29.381 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)
11:43:29.382 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)
11:43:29.382 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
11:43:29.383 [ERROR] [org.gradle.BuildExceptionReporter] ... 37 more
11:43:29.383 [ERROR] [org.gradle.BuildExceptionReporter]
11:43:29.384 [LIFECYCLE] [org.gradle.BuildResultLogger]
11:43:29.384 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

Apparat plugin

One more for the wishlist: create a plugin that uses Joa's Apparat (https://github.com/joa/apparat) to optimize the swf's and swc's generated by the compilers.

Projected usage

apply the plugin:

apply plugin: 'apparat'

use it directly:

gradle optimize

This 'optimize' task should at least depend on 'compile' (there has to be something to optimize, right)

use it indirectly:

gradle build

When the plugin is applied, the 'build' task should automatically depend on 'optimize'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.