File Pattern Reference

You are viewing an old version (v. 5) of this page.
The latest version is v. 6, last edited on Aug 18, 2008 (view differences | )
<< View previous version | view page history | view next version >>

Definition

File patterns are widely used in QuickBuild to specify a set of directories or files. For example, the artifact publishing step has a property File Patterns which is used to specify files and directories to be published as artifacts.

File patterns are described using EBNF as below:

file patterns::=file pattern,{",",file pattern}
file pattern::=[+|-]Ant pattern

Here:

  1. Ant pattern refers to Ant based path patterns
  2. File pattern can be constructed by prefixing "+" or "-" before a Ant pattern:
    • if prefixed with "+", the file pattern will be used to include files or directories
    • if prefixed with "-", the file pattern will be used to exclude files or directories
    • if not prefixed, the file pattern is considered to be a include pattern (that is, have the same effect as prefixing a "+" character)
  3. file patterns are a series of file pattern connecting together through the comma character

Examples

Here we will use the artifact publishing step to give examples of file patterns in QuickBuild. Let's suppose that:

  1. the configuration workspace locates at /opt/quickbuild2/configurations/1/workspace, and it contains below directories and files:
    file0.zip
    file0.doc
    dir1/
      file1.zip
      file1.doc
    dir2/
      file2.zip
      file2.doc
      dir3/
        file3.zip
        file3.doc
    
  2. the build artifacts directory locates at /opt/quickbuild2/builds/1/artifacts
  3. The property From Directory of artifact publishing step is left empty, which means that the workspace directory will be used as the base of file pattern matching.
  4. The property Destination Directory of artifact publishing step is left empty, which means matched files and directories will be copied over to the artifacts directory.

Now we will examine several file patterns to see what the artifacts directory will like after the publishing:

  1. **/*
    All files and directories will be published from workspace directory to artifacts directory recursively. The artifacts directory will look just the same as the workspace directory:
    file0.zip
    file0.doc
    dir1/
      file1.zip
      file1.doc
    dir2/
      file2.zip
      file2.doc
      dir3/
        file3.zip
        file3.doc
    
  2. **/*.zip
    All zip files will be published recursively. The artifacts direcory will look like:
    file0.zip
    dir1/
      file1.zip
    dir2/
      file2.zip
      dir3/
        file3.zip
    
  3. *.zip
    All zip files that is directly under the workspace will be published. The artifacts directory will look like:
    file0.zip
    
  4. **/*.zip,-dir2/**/*
    Publish all zip files recursively, but exclude all files under the dir2 directory recursively. The artifacts
    directory will look like:
    file0.zip
    dir1/
      file1.zip
    
  5. **/*.zip,-dir2/*
    Publish all zip files recursively, but exclude all files that is directly under the dir2 directory. The artifacts
    directory will look like:
    file0.zip
    dir1/
      file1.zip
    dir2/
      dir3/
        file3.zip
    
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.