Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Flash Builder determine which sdk libraries to include?

When creating a new project in Flash Builder, how does it determine which sdk libraries to include in the build path?

If I create a new plain Actionscript project and select Flex 4.1 the following libraries show up in the build path:

  • playerglobal
  • textLayout
  • osmf
  • flash-integration
  • flex
  • utilities

If I go back and switch to Flex 3.5 it only includes:

  • playerglobal
  • flex
  • utilities

If I make a new Flex Web project and select Flex 3.5 it includes:

  • playerglobal
  • framework
  • automation
  • automation_agent
  • automation_dmv
  • automation_flashflexkit
  • datavisualization
  • qtp
  • rpc
  • utilities

Are these values hardcoded in Flash Builder or is it somehow reading them from the SDK config files? I looked through all the xml config files like flex-config.xml and air-config.xml and it doesn't look like this information exists anywhere.

Thanks.

like image 226
takteek Avatar asked Jul 02 '11 00:07

takteek


2 Answers

Yes, it's built into the framework swc's. You can find the references and where they're linked in under the /frameworks/build.xml file in your framework directory.

So you could edit this build file, rebuild the swcs and then use those and they'll link how you like.

For example, (from Flex 4.5.1 build file) :

  <target name="authoringsupport" description="Builds authoringsupport.swc">
<compc static-link-runtime-shared-libraries="true" fork="true" output="${basedir}/libs/authoringsupport.swc" include-classes="AuthoringSupportClasses" locale="" accessible="true">
  <source-path path-element="${authoringsupport.dir}/src"/>
  <library-path dir="${authoringsupport.dir}/libs"><include name="FlexContentHolderThumbnail.swc"/></library-path>
  <external-library-path dir="${basedir}/libs">
      <include name="player/${playerglobal.version}/playerglobal.swc"/>
      <include name="framework.swc"/><include name="mx/mx.swc"/>
      <include name="flash-integration.swc"/>
      <include name="textLayout.swc"/>
  </external-library-path>
  <jvmarg line="${compc.jvm.args}"/>
</compc>

So its not technically hardcoded into flash builder, but in the swc's for that sdk. (but you can change that as noted above). :D

like image 172
Nate Avatar answered Oct 21 '22 07:10

Nate


After a lot of trial and error and some inspection with a decompiler I have the answer:

  1. Flash Builder loads either the flex-config.xml or air-config.xml file (depending on the project type) from the sdk frameworks directory.
  2. It goes through each entry listed in library-path and library-external-path adds it to the classpath if it is a SWC. If the entry is a directory it scans that directory for SWCs and includes them.
  3. Each project type has a hardcoded list of exclusions which tell Flash Builder which SWCs to leave out of the classpath. For a plain actionscript project this list has 17 items. For a Flex Web project the list consists only of flex.swc. This list of exclusions is written to the .actionScriptProperties file.
  4. Any remaining (not excluded) SWCs are automatically added to the classpath. No entry is necessary in the .actionScriptProperties file. (i.e. You can throw any file with a .swc extension in the frameworks/libs directory and Flash Builder will include it.)
like image 43
takteek Avatar answered Oct 21 '22 06:10

takteek