Flash swc and settings

Hello, when i run or debug flash project with few not so light .swc libraries ( around 20mb graphics), compile
time takes so long. As i understood by researcing whole day and testing, .swc should be merged ( so it compiles
only used symbols ), and should use "make project", but still it compiles every time from beggining, it takes around
1 min to start debugging. My settings in IntelliJ IDEA 12:

- compiler: use external build checked, rebuild module on dependancy change unchecked,
          - flex compiler : build-in compiler shell

- project structure: modules-dependencies: .swc ( did try include, merged, everything ).

And other options, did try to turn off and on, and got lost.
Maybe theres possibility to add options in compile.xml in .idea folder to exclude .swc from build?

Next i found this solution, http://blog.dannykopping.com/decrease-compile-times-of-intellij-flex-projects
where facets are used, and simply unchecked Use IDE builder option excludes library from build.

But didnt figure out how can i use facets as swc. Im really new to IntelliJ, and trying to solve this
for hours and hours, it must be simple ... Please help!

7 comments

Facets are gone, since IntelliJ IDEA 11.1 there's a new Flash project strcucture based on Flash build configurations. IntelliJ IDEA projects contains one or more modules. Each Flash module contains one or more Flash build configurations (BC). Each BC produces one SWF or SWC. BCs can depend on each other and the most common use case is that BC producing SWF app depends on BCs that produce SWC libs. Leave linkage type Merged unless you know what you are doing and why.

When you press Make button or start Run Configuration - your project is compiled incrementally. That means that if in some module no files were touched since previous compilation then compilation of BCs of this module will be skipped. If at least one file in the module was touched - all BCs of this module are recompiled.
Take a look at the Messages tool window. There you'll get information about what is compiled and what is skipped.
Also each BC has an option 'Skip compilation' (at General tab). If you are sure that you don't need to recompile some output SWF/SWC - check corresponding check box.

If your project is pure AS (i.e. you don't use any Flex classes) - make sure that it is marked as pure AS (General tab) and make sure that Flex/AIR SDK that you use (Dependencies tab) includes ActionScript Compiler 2.0. ASC 2.0 performance is better than of legacy Flex Compiler.

0

Thnx for explaination, it really helps me to understand project structure and build more clearly.

I feel im close to setting up properly, im not just there yet. There is one more thing ... please bare with me.

So you can have multiple modules, and one "main" module wich is compiled due to unchecked "Skip compilation" in General tab,
other Modules contains SWC and can be skipped with checked, but 1st time compiled with unchecked skip compilation option.
Or maybe incremental should ignore untouched stuff, if i put project in more than 1 module.

The part i didnt get is: how to use classes from other Module in "Main" module. Other modules have "entry point" class witch I dont
rly need, but its fine if its possible to use that class to "sculp" swc symbols ( i donno, adding behaviour ), and let "main" module use
that module and its classes.

For start, how to include other Modules in "Main" module, it doesnt show in code completition. Sorry if i missunderstood ... its a battle for me.

0

I'm not sure I got all your questions, but probably my sample will give you all answers. Common project structure looks like this:

  • Project
      • Module 'lib'
        • BC 'lib', type: Flex library for web (type is shown at General tab)
      • Module 'app'
        • BC 'app', type: Flex app for web. BC 'app' depends on BC 'lib', linkage type is 'Merged' (dependencies are configured at Dependencies tab)


    In this case you get code completion/highlighting for classes from 'lib' module when you edit sources of 'app' module. When you make this project, first 'lib' module is compiled into SWC, then main 'app' module is compiled into SWF.

    0

    Yup, that should definitely work, i did setup as you said. In swc i got few images
    for testing published from flash IDE, and is merged into lib module ( LibSlike ).

    Structure:

    • ProjectName
      • app - linkage: BC include Lib
            • src
              • App.as as main
          • Lib - linkage: include slides.swc
            • src
              • test.as
        • External Libraries
          • slides.swc
          • <Flex SDK>

          On Lib compiler options:  generate debuggable SWC off.
          On Lib skip compilation.

          On app compiler options:  generate debuggable SWF on.

          Still 20 sec compile time, (on pure actionscript)

          If i put lib linkaget to merged instead of include, and app on merged Lib BC, i dont get
          autocomplete and main app.as doesnt recognize class types from swc.

          Thank you so much for puttin me on right track ! But not quite there yet, I refuse to belive
          that Flash Develop is faster than IntelliJ (2 sec vs 20 sec). What am I missing here.

          0

          Looks like you don't need the lib module with test.as. For your project it is enough to have only the main app module and at Dependencies tab of the corresponding BC add dependency on slides.swc with Merged linkage type (or may be Included - depends on how you use it, code assistance woill be in any case).

          Probably Flash Develop uses fcsh compiler from the SDK which performs incremental compilation, i.e. recompiles only touched classes and always keeps resources from slides.swc in memory. IntelliJ IDEA does full rebuild even if only one source file updated. IntelliJ performs better that other IDEs on large multi-modular projects because it compiles independent modules in parallel. On small projects with a lot of resources in external SWC unforunately IntelliJ may compile slower.

          0

          Thank you again, got all answers I wanted ( 15 seconds build is fastest i got ), next thing i will try to do is change
          IntelliJ compiler to one Flash Develop uses ... for fast compiling small projects. Who knows maybe it will work.

          0
          change IntelliJ compiler to one Flash Develop uses

          I'm not sure it is possible. All you can do is vote for IDEA-84486.

          0

          Please sign in to leave a comment.