This new FDT release contains features to support a more fluent development of SWC libraries. The primary starting point to develop a library is the new Library Project Template for AIR or Web:LibraryProjectTemplate This template creates an empty library project containing two source folders:LibraryProjectEmptyStructure All compilation units to include into the library should be placed into the source folder src. The test source folder testSrc should contain all test classes.

 

Exclude SDK SWCs from export

After adding AS3 source files the Evaluator example has this structure:LibraryProjectStructure With this new version FDT offers the ability to exclude SDK libraries (marked with over_not_export) from export. In this example the new ability is used since the final SWC should not contain any SDK SWC. The test resources (marked with over_test_resource)  are disregarded during normal compilation. They are only added to compilations for test runs whereas in other compilations they are fully disregarded. In this example the FlexUnit libraries and the source folder testSrc are test resources.

This is the SWC launcher to compile the final SWC of the Evaluator example:LibraryProjectLauncher Inside the Compiler Arguments tab the option Auto add exclude (-externs) is active by default. If this option is active the options –externs and –compiler.external-library-path are automatically added as compiler arguments to exclude compilation units or libraries marked with over_not_export. Starting this SWC launcher the compilation includes only the source folder src:

LibraryProjectResult All libraries are external due to the compiler option –compiler.external-library-path and so the final library output Evaluator.swc is kept small. All test resources are skipped and they are not even available as externals. This is why SDK SWCs are not marked as test resources in this example since they are required as externals to compile against them.

 

Library Test Run

Compilations for test runs can be forced to include all test resources like the FlexUnit libraries and the test classes as you can see in the following FlexUnit test launcher of the Evaluator example:LibraryProjectTestLauncher For test launchers the options Force include all test resources and Use the project specific compiler arguments are active by default.

In the Evaluator example the test run also includes the SDK SWCs even if they are all marked with over_not_export to be excluded. This is the case since the project properties have this default:LibraryProjectCompilerOptions Inside the project compiler properties (for SWF files) the option Auto add exclude (-externs) is inactive by default. As consequence the compilations for applications and test runs (both output SWFs) ignore the exclusion by default and instead will also include resources marked with over_not_export.

All together this leads to this test run compilation for the Evaluator example:LibraryProjectTestRun In the end the output SWF TestDepthCounterVisitor.swf includes both source folders (src and testSrc) and all libraries (SDK SWCs and the FlexUnit libraries) defined in the Evaluator example. Any test launch starts the test runner (here it is FDT’s default test runner class FdtFlexUnitSpriteRunner) using the library FdtFlexUnit.swc to connect to FDT. It invokes all tests in a FlexUnit environment and reports back test results to FDT. Since library FdtFlexUnit.swc and all test runners are dependent on the FlexUnit libraries they have to be included in all test launch compilations.