3 Replies Latest reply on Aug 8, 2008 8:46 PM by P1NEC0NE

    'compc' Clarification, please

    P1NEC0NE
      I am a little confused about syntax for the command-line component compiler, compc. Let's say I would like to build a .swc library from the following packages:

      components/directory1/package1.as
      components/directory1/package2.as
      components/directory2/package3.as
      components/package4.as

      What necessary compiler options should I include? Could someone give me an example compc command based on the above package tree?

      Thanks

      Edit: I apologize: I should post this in an ActionScript forum.
        • 1. Re: 'compc' Clarification, please
          Gregory Lafrance Level 6
          See this FB help topic:

          Using compc, the component compiler

          particularly these cmd line options:

          include-classes
          include-sources

          The classes are in packages, so ensure that you use dot-notation rather than slashes to separate package levels.
          • 2. 'compc' Clarification, please
            Hi -

            I have read all the instructions and followed all the examples.. I was able to read all the classes in my classes and component directory. However, I keep getting '[compc] Error: could not find source for class src.classes:ArrowSeperatorSkin'.. errors..

            following is the build file I have. Please help..thx

            <?xml version="1.0"?>
            <!-- Required Environment Variables:
            FLEX_HOME: must point to the root of your flex sdk (probably in flex builder directory)
            -->
            <project name="Test" default="compile" basedir=".">
            <!-- Make the Flex Ant Tasks Available -->


            <taskdef resource="flexTasks.tasks" classpath="libs/flexTasks.jar"/>

            <!-- Module properties -->
            <property environment="env"/>
            <property name="build.dir" value="build"/>
            <property name="swf.name" value="NProject.swf" />
            <property name="root.mxml" value="main.mxml"/>
            <property name="locale" value="en_US"/>
            <property name="FLEX_HOME" value="${env.FLEX_HOME}"/>

            <!-- Clears out the build directory -->
            <target name="clean">
            <echo message="%%%%%%%%%%%%%% Removing build directory contents %%%%%%%%%%%%%%%%%"/>
            <delete includeemptydirs="true">
            <fileset dir="${build.dir}" includes="**/*"/>
            </delete>
            </target>

            <!-- standard compile w/o debug -->
            <target name="compile">
            <antcall target="perform-compile">
            <param name="debugMode" value="true"/>
            </antcall>
            </target>

            <target name="perform-compile">
            <!-- Make sure the build directory exists -->
            <mkdir dir="${build.dir}"/>
            <mxmlc
            file="src/${root.mxml}"
            output="${build.dir}/${swf.name}"
            incremental="true"
            debug="${debugMode}"
            >

            <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>



            <!-- directories outside of your 'main' source directory -->
            <source-path path-element="${FLEX_HOME}/frameworks"/>

            <!-- list any swcs in your lib directory to include -->
            <!-- library-path dir="lib" append="true">
            <include name="a.swc"/>
            <include name="b.swc"/>
            </library-path -->

            <!-- flex sdk core libraries -->
            <library-path dir="${FLEX_HOME}/frameworks" append="true">
            <include name="libs"/>
            <include name="locale/${locale}"/>
            </library-path>
            </mxmlc>

            <!-- copy over the etc directory contents -->
            <antcall target="copy-files"/>
            </target>
            <!-- Copies contents of /etc to /build -->
            <target name="copy-files">
            <copy todir="${build.dir}">
            <fileset dir="." includes="etc/**/*"/>
            </copy>

            <antcall target="swc">
            <param name="debugMode" value="true"/>
            </antcall>
            </target>

            <target name="swc">

            <mkdir dir="swc" />

            <pathconvert property="flex.classes" pathsep=" ">

            <fileset dir="${basedir}/src">
            <include name="**/*.as"/>
            <include name="**/*.mxml"/>
            </fileset>

            <compositemapper>
            <packagemapper from="${basedir}\*.as" to="*"/>
            <packagemapper from="${basedir}\*.mxml" to="*"/>
            <packagemapper from="${basedir}/*.as" to="*"/>
            <packagemapper from="${basedir}/*.mxml" to="*"/>

            </compositemapper>

            </pathconvert>

            <echo>********* ActionScript classes: [${flex.classes}] ***********</echo>
            <compc output="src/Your.swc" include-classes="${flex.classes}" debug="true" directory="false">
            <source-path path-element="${basedir}/src"/>
            <include-file name="data.xml" path="${basedir}/src/data/data.xml"/>
            <include-file name="extension.css" path="${basedir}/src/css/extension.css"/>
            </compc>



            </target>
            </project>
            • 3. 'compc' Clarification, please
              P1NEC0NE Level 1
              quote:

              Originally posted by: Greg Lafrance
              See this FB help topic:

              Using compc, the component compiler

              particularly these cmd line options:

              include-classes
              include-sources

              The classes are in packages, so ensure that you use dot-notation rather than slashes to separate package levels.


              Thank you for your reply. I have read the above help topic, yet I am still confused about the syntax. Please excuse my denseness

              Here is an example of my input:
              compc -source-path . /example/source/path/components/
              -output /path/to/example.swc
              -include-classes components.directory1.package1 components.directory1.package2
              components.directory2.package3 components.package4

              This halts and returns:
              Error: could not find source for class components.directory1:package1

              The livedocs states that I do not need to add the -include-sources option because I am only compiling classes, if I read it correctly. However, I added the option anyway, just to test:
              compc -source-path . /example/source/path/components/
              -output /path/to/example.swc
              -include-classes components.directory1.package1 components.directory1.package2
              components.directory2.package3 components.package4
              -include-sources components/directory1/package1.as components/directory1/package2.as
              components/directory2/package3.as components/package4.as

              This halts and returns:
              Error: unable to open 'components/directory1/package1.as'

              I'm assuming that because I specified the source directory, I only had to include a partial path to the classes. Removing the root component directory 'components' from each class path name resulted in the same error. However when I used the full path name to each class:
              compc -source-path . /example/source/path/components/
              -output /path/to/example.swc
              -include-classes components.directory1.package1 components.directory1.package2
              components.directory2.package3 components.package4
              -include-sources /path/to/components/directory1/package1.as
              /path/to/components/directory1/package2.as
              /path/to/components/directory2/package3.as /path/to/components/package4.as

              the compiler did not output any errors for the -include-sources option, but returned again the very first error in this example:
              Error: could not find source for class components.directory1:package1

              Obviously I'm doing something wrong, but I can't seem to figure out what it is!

              Thanks for your help.

              EDIT: Silly, me... my mistake has been sitting in the very first compc option, '-source-path.' I am overlapping the directory 'components' with the classes. I was right in that I did not need the '-include-sources' option because I am only compiling classes.

              Here is the full correct example, for reference:

              Classes:
              /example/source/path/components/directory1/package1.as
              /example/source/path/components/directory1/package2.as
              /example/source/path/components/directory2/package3.as
              /example/source/path/components/package4.as

              To compile these files into a .swc library, use this shell command:
              compc -source-path . /example/source/path/ -output /path/to/example.swc -include-classes components.directory1.package1 components.directory1.package2 components.directory2.package3 components.package4