Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How to exclude a file from sencha app build?

  1. #1
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    143

    Default How to exclude a file from sencha app build?

    hi,

    I am trying to make a build, and one file must be excluded from the build processing. It would be better to exclude somehow the file instead of delete before and copy back later. This is not working:
    Code:
    sencha app build exclude -f /my/file.js
    any hints on this?

    thx

  2. #2
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,748

    Default

    There are a couple ways to do this. In both cases you will need to set "build.operations". You can do that in build.xml.

    Option #1 - Exclude the specific file.

    PHP Code:
       <target name="-before-init">
          <
    property name="build.operations">
             
    exclude
               
    -file=/my/file.js
          
    </property>
       </
    target
    Option #2 - Exclude a set of tagged files (in case you need to exclude multiple files).

    PHP Code:
       <target name="-before-init">
          <
    property name="build.operations">
             
    exclude
               
    -tag=cruft
          
    </property>
       </
    target
    Then add this line to any files you want excluded:

    Code:
      // @tag cruft
    I highly recommend reading over .sencha/app/build-impl.xml since that is the build process behind sencha app build. It is very flexible and can be adjusted by properties as well as custom process steps.
    Don Griffin

    "Use the source, Luke!"

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    26

    Default

    Is there a listing of the various flags for exclusion?

    I want to exclude all files with the extension .scc (get permissions errors intermittently), and cannot find any reference doc for this

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    448

    Default

    Is there a way to pass that "build.operations" value at runtime, when running "sencha app build"? I want to exclude different files depending on what I'm building, so I'd rather not have to change the build.xml file each time.

  5. #5

    Default

    @alile:

    You can use the command "sencha help compile exclude" to view the available options. Its output looks like this:
    Code:
    sencha compile exclude
    
    This command removes from the current set any files matching the criteria.
    
    
    Options
      * --all, -a - Select all files in global cache (ignores other options)
      * --class, -c - Selects files according to the specified class names
      * --file, -f - Selects the specified file names (supports glob patterns)
      * --namespace, -na - Selects all files with class definitions in the given namespace(s)
      * --not, -no - Inverts the matching criteria
      * --recursive, -r - Enable traversal of dependency relationships when selecting files
      * --set, -s - Selects files from on a previously saved set (ignores other options)
      * --tag, -t - Selects all files with the specified '//@tag' values
    
    Syntax
    
        sencha compile exclude [options]
    If you want to exclude files by extension, you can use the --file option with a glob:
    Code:
       <target name="-before-init">
          <property name="build.operations">
             exclude
               -file=*.scc
          </property>
       </target>
    @jweber:

    If you use the command "sencha ant build" rather than "sencha app build", you can specify parameters on the command line. If you set up your build file with:
    Code:
       <target name="-before-init">
          <property name="build.operations">
             exclude
               -file=${exclude.files}
          </property>
       </target>
    Then you can run something like sencha ant build -Dexclude.files=some-file.js,other-file.js.

  6. #6
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    26

    Default

    awesome! thank you very much for your very helpful response.

  7. #7
    Sencha User
    Join Date
    Mar 2007
    Posts
    448

    Default

    @burnnat: Interesting idea, thanks. However, it gets tricky if you're trying to exclude files (or namespaces) sometimes, and include everything at other times.

    The problem seems to be that the compiler expects the build.operations string to be newline-delimited, which it can't be for command-line arguments. It would be nice if the format were a little more flexible.

  8. #8

    Default

    Yeah, it certainly gets trickier when you're doing more complex stuff. Are there a certain number of predefined "file sets" you're switching between? Depending on what you need, you could add some extra logic to the Ant buildfile. For example:

    Code:
    <target name="-before-init">
            <if>
                <equals arg1="${exclude.fileset}" arg2="main"/>
                <then>
                    <property name="build.operations">
                        exclude
                            -file=main.js
                    </property>
                </then>
                <elseif>
                    <equals arg1="${exclude.fileset}" arg2="debug"/>
                    <then>
                        <property name="build.operations">
                            exclude
                                -namespace=MyApp.debug
                        </property>
                    </then>
                </elseif>
                <elseif>
                    <equals arg1="${exclude.fileset}" arg2="all"/>
                    <then>
                        <property name="build.operations">
                            exclude
                                -file=main.js,something-else.js
                                -namespace=MyApp.debug
                        </property>
                    </then>
                </elseif>
            </if>
    </target>
    That would allow you to switch between more complex sets via "sencha ant build -Dexclude.fileset=debug", "sencha ant build -Dexclude.fileset=all", etc. If you have even more complex requirements, you could use multiple properties or more flexible logic. Being able to use all the offerings of Ant seems like you should be able to come up with something workable...

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Posts
    448

    Default

    That seems like a workable idea.

    But that leads me to a different question: what's the difference between "sencha app build" and "sencha ant build"? It seems like I'd need to use the latter to pass Ant properties, as in your example.

    Does "app build" just run ant on the project's build.xml file? Using the same embedded version of Ant?

  10. #10

    Default

    Yep, as far as I'm aware "sencha app build" just delegates to the Ant build underneath the hood. It probably does some argument parsing first (i.e. so "sencha app build testing" becomes "sencha ant build -Dargs.environment=testing"), but the meat of both commands should be the same. Maybe Don or somebody else from Sencha can confirm/deny this, and possibly elaborate a bit, but that's my understanding.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •