开发者

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 fi开发者_StackOverflow社区les like flex-config.xml and air-config.xml and it doesn't look like this information exists anywhere.

Thanks.


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


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.)


I created a Flex 4.1 project, and checked the flex-config of the Flex 4.1 SDK at the following location. I think this is where the included swc files in the Build Path are coming from - they matched for my project:

C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.1.0\frameworks\flex-config.xml

How does Flash Builder determine which sdk libraries to include?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜