Error when trying to generate documentation for a swc using gradel asdoc
Hi
I am getting the following exception every time I execute gradel asdoc on a Flex library project that contains FlexUnitApplication.mxml in the source folder. Everything works fine when I remove FlexUnitApplication.mxml from the source folder. Is there any way to instruct gradle to ignore FlexUnitApplication.mxml or avoid this error?
thanks
:asdoc [ant:java] Java Result: 1
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ':asdoc'.
taskName compilation failed: Loading configuration file /Users/jhon/Desktop/FlexBuildTools/flex/4.6.0/frameworks/flex-config.xml /Users/jhon/Documents/Adobe Flash Builder 4.5/MYlib/src/FlexUnitApplication.mxml(34): Error: Type was not found or was not a compile-time constant: FlexUnitTestRunnerUI.
<flexui:FlexUnitTestRunnerUI id="testRunner">
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
THIS THE BUILD FILE I AM USING
/* * Build File: follow the directions in the README.txt to build * this plug-in from the source. * /
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.5'
}
}
apply plugin: 'gradlefx'
type = 'swc'
srcDirs = ['src/']
resourceDirs = ['assets/']
asdoc.outputDir = 'api' //will create the documentation in the
%projectdir%/documentation folder
fatSwc = true
// Option necessary to embed configuration file to cuePoint class. additionalCompilerOptions = [
'-static-link-runtime-shared-libraries=true'
]
//mainClass = 'myProject.as'
dependencies {
//merged files('lib/as3corelib.swc')
merged fileTree(dir: 'lib/', include: '*.swc')
}
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
Support Staff 1 Posted by Yennick Trevels on 22 Aug, 2012 06:41 AM
Hi John,
Is there a special reason you're using the FlexUnitApplication.mxml? Because since GradleFx 0.5 you don't have to specify this anymore, it will create this internally by searching for all *Test.as classes in your testDirs folders. See the wiki for more information on this: https://github.com/GradleFx/GradleFx/wiki/Flexunit
2 Posted by Jhon on 22 Aug, 2012 01:58 PM
Thanks for your promptly response. Flash builder added that dependency when I created my Test Classes. Some developers on my team prefer using flash builder UI to run the test cases, so that I need keep FlexUnitApplication.mxml around. We are using gradle as an alternative way to build the application but we still use flash building for testing
thanks
Support Staff 3 Posted by Yennick Trevels on 22 Aug, 2012 02:23 PM
You can exclude a certain class from compilation during the asdoc generation by using the -exclude-sources argument. You can specify it like this:
You can find more information on the available asdoc compiler options here: http://help.adobe.com/en_US/flex/using/WSd0ded3821e0d52fe1e63e3d11c...
Support Staff 4 Posted by Maxime Cowez on 22 Aug, 2012 03:47 PM
@yennick Perhaps this is an issue we should address, a lot of developers use FlashBuilder and it automatically generates this file when you run a unit test from within the IDE. You cannot change its name, you cannot change its location (package).
I had similar issues between FlashBuilder's and GradleFx's FlexUnit support with previous versions of GradleFx. I fixed them by adding a line to my build scripts that deletes the
FlexUnitApplication.mxmlfile when building with GradleFx (FB regenerates it anyway). Haven't tested it with v0.5 anymore though.Any ideas? Adding that specific file to the exclusions by default would be the easy solution, but then what if someone for some reason wants to name his unit testing application exactly like that and place it in the root package?
Support Staff 5 Posted by Yennick Trevels on 22 Aug, 2012 04:02 PM
Personally I don't want to make GradleFx too smart, because that brings in other implications (as you mention). In some cases GradleFx is already too smart.
So I wouldn't add this by default, because then you also need a property to turn the default off, which makes it all more complicated then it should be imo :)
Support Staff 6 Posted by Maxime Cowez on 22 Aug, 2012 04:48 PM
I totally agree. However, let's imagine a FlashBuilder user that wants to try out GradleFx on one of his existing projects. Of course it already has the
FlexUnitApplication.mxmlfile in there. First thing he sees when trying out GradleFx is an exception, and not a very pretty one at that.Perhaps we could just catch that specific error and show him a nice message with a way to fix the issue?
Support Staff 7 Posted by Yennick Trevels on 22 Aug, 2012 05:28 PM
Yes, that sounds like a really good solution to me. That's also the kinda smart I do want to build into GradleFx :) So it doesn't cause any side effects but still helps the user with certain compiler options.
8 Posted by Jhon on 22 Aug, 2012 09:07 PM
Hi
Thanks for your help again. I can execute asdoc without getting any exception, but i am still getting the same error when I try compile my swc
I tried to add -exclude- source to my aditionalCompilerOptions but it didn't work
additionalCompilerOptions = [
exception
gradle compile
:asdoc UP-TO-DATE :compile [ant:java] Java Result: 1
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compile'.
<flexui:FlexUnitTestRunnerUI id="testRunner">
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Support Staff 9 Posted by Maxime Cowez on 22 Aug, 2012 10:40 PM
It's looking for a dependency it can't find. Probably the libraries used by FlashBuilder to run its unit tests. However, it shouldn't be looking at
FlexUnitApplication.mxmlanymore.For compiling the unit test application mxmlc will be used instead of compc (which is used to compile the swc). I just took a look at the mxmlc compiler options and it looks like
externsis the one you want instead ofexclude-sources.Also, there is this option you can set in GradleFx:
flexUnit.excludes = ['**/*FlexUnitApplication.mxml']. Have you tried that? (I'm just asking because Yennick knows a lot more about this part and I'm just guessing a bit :-/ )Support Staff 10 Posted by Yennick Trevels on 23 Aug, 2012 06:35 AM
But in this case he's doing a standard swc compile, so it won't use the FlexUnit compiler. The FlexUnit compiler only looks in the 'testDirs', while FlexUnitApplication.mxml is generated in the default source path.
So since there's no compiler option to exclude a certain class from a source path, I think the only option is to do the same as Maxime did and add some code to delete the FlexUnitApplication.mxml file before compilation, like this:
11 Posted by Jhon on 24 Aug, 2012 04:13 PM
Thanks Yennick your solution works.
Yennick Trevels closed this discussion on 25 Aug, 2012 08:03 AM.