{"id":9511,"date":"2016-06-21T15:31:22","date_gmt":"2016-06-21T13:31:22","guid":{"rendered":"http:\/\/fdt.powerflasher.com\/?p=9511"},"modified":"2016-06-21T15:31:22","modified_gmt":"2016-06-21T13:31:22","slug":"library-project-template","status":"publish","type":"post","link":"https:\/\/fdt.powerflasher.com\/blog\/2016\/06\/library-project-template\/","title":{"rendered":"Library Project Template"},"content":{"rendered":"<p>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:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTemplate.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9512 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTemplate-440x596.png\" alt=\"LibraryProjectTemplate\" width=\"440\" height=\"596\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTemplate-440x596.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTemplate-230x311.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTemplate.png 466w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> This template creates an empty library project containing two source folders:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectEmptyStructure.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9513 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectEmptyStructure-440x313.png\" alt=\"LibraryProjectEmptyStructure\" width=\"440\" height=\"313\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectEmptyStructure-440x313.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectEmptyStructure-230x164.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectEmptyStructure.png 459w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> All compilation units to include into the library should be placed into the source folder <i>src<\/i>. The test source folder <i>testSrc<\/i> should contain all test classes.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Exclude SDK SWCs from export<\/strong><\/p>\n<p>After adding AS3 source files the <i>Evaluator<\/i> example has this structure:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectStructure.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9514 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectStructure-440x592.png\" alt=\"LibraryProjectStructure\" width=\"440\" height=\"592\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectStructure-440x592.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectStructure-230x310.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectStructure.png 459w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> With this new version FDT offers the ability to exclude SDK libraries (marked with <img loading=\"lazy\" class=\"alignnone size-full wp-image-9527\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/over_not_export-3.gif\" alt=\"over_not_export\" width=\"8\" height=\"8\" \/>) 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 <img loading=\"lazy\" class=\"alignnone size-full wp-image-9528\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/over_test_resource.gif\" alt=\"over_test_resource\" width=\"8\" height=\"8\" \/>) \u00a0are 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 <i>testSrc<\/i> are test resources.<\/p>\n<p>This is the SWC launcher to compile the final SWC of the <i>Evaluator<\/i> example:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9515 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher-440x249.png\" alt=\"LibraryProjectLauncher\" width=\"440\" height=\"249\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher-440x249.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher-230x130.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher-768x435.png 768w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectLauncher.png 880w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> Inside the<i> Compiler Arguments<\/i> tab the option <i>Auto add exclude (-externs)<\/i> is active by default. If this option is active the options <i>&#8211;externs<\/i> and <i>&#8211;compiler.external-library-path<\/i> are automatically added as compiler arguments to exclude compilation units or libraries marked with <img loading=\"lazy\" class=\"alignnone size-full wp-image-9526\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/over_not_export-2.gif\" alt=\"over_not_export\" width=\"8\" height=\"8\" \/>. Starting this SWC launcher the compilation includes only the source folder <i>src<\/i>:<\/p>\n<p><a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectResult.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9516 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectResult-440x377.png\" alt=\"LibraryProjectResult\" width=\"440\" height=\"377\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectResult-440x377.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectResult-230x197.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectResult.png 716w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> All libraries are external due to the compiler option <i>&#8211;compiler.external-library-path<\/i> and so the final library output <i>Evaluator.swc<\/i> 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.<\/p>\n<p>&nbsp;<\/p>\n<h2><b>Library Test Run<\/b><\/h2>\n<p>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 <i>Evaluator<\/i> example:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9517 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher-440x254.png\" alt=\"LibraryProjectTestLauncher\" width=\"440\" height=\"254\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher-440x254.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher-230x133.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher-768x443.png 768w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestLauncher.png 878w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> For test launchers the options <i>Force include all test resources<\/i> and <i>Use the project specific compiler arguments<\/i> are active by default.<\/p>\n<p>In the <i>Evaluator<\/i> example the test run also includes the SDK SWCs even if they are all marked with\u00a0<img loading=\"lazy\" class=\"alignnone size-full wp-image-9523\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/over_not_export.gif\" alt=\"over_not_export\" width=\"8\" height=\"8\" \/> to be excluded. This is the case since the project properties have this default:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9518 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions-440x253.png\" alt=\"LibraryProjectCompilerOptions\" width=\"440\" height=\"253\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions-440x253.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions-230x132.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions-768x442.png 768w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectCompilerOptions.png 936w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> Inside the project compiler properties (for SWF files) the option <i>Auto add exclude (-externs)<\/i> 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 <img loading=\"lazy\" class=\"alignnone size-full wp-image-9524\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/over_not_export-1.gif\" alt=\"over_not_export\" width=\"8\" height=\"8\" \/>.<\/p>\n<p>All together this leads to this test run compilation for the <i>Evaluator<\/i> example:<a href=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun.png\" target=\"_blank\"><img loading=\"lazy\" class=\"alignnone wp-image-9519 size-medium\" src=\"http:\/\/fdt.powerflasher.com\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun-440x286.png\" alt=\"LibraryProjectTestRun\" width=\"440\" height=\"286\" srcset=\"https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun-440x286.png 440w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun-230x150.png 230w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun-768x500.png 768w, https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2016\/06\/LibraryProjectTestRun.png 1330w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a> In the end the output SWF <i>TestDepthCounterVisitor.swf <\/i>includes both source folders (<i>src <\/i>and <i>testSrc<\/i>) and all libraries (SDK SWCs and the FlexUnit libraries) defined in the <i>Evaluator<\/i> example. Any test launch starts the test runner (here it is FDT\u2019s default test runner class <i>FdtFlexUnitSpriteRunner<\/i>) using the library <i>FdtFlexUnit.swc <\/i>to connect to FDT. It invokes all tests in a FlexUnit environment and reports back test results to FDT. Since library <i>FdtFlexUnit.swc <\/i>and all test runners are dependent on the FlexUnit libraries they have to be included in all test launch compilations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: This template creates an empty library project containing two source folders: All compilation units to include into the library should be placed [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/9511"}],"collection":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/comments?post=9511"}],"version-history":[{"count":10,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/9511\/revisions"}],"predecessor-version":[{"id":9534,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/9511\/revisions\/9534"}],"wp:attachment":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/media?parent=9511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/categories?post=9511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/tags?post=9511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}