File Pattern Reference

Version 5 by Robin Shen
on Jun 22, 2008 20:53.


compared with
Current by Lubos Pochman
on Aug 18, 2008 20:05.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 11 changes. View first change.

 h3. 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 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|http://en.wikipedia.org/wiki/EBNF] as below:
  File patterns are described using [EBNF|http://en.wikipedia.org/wiki/EBNF]:
 {code}
 file patterns::=file pattern,{",",file pattern}
 file pattern::=[+|-]Ant pattern
 {code}
Here:
  where:
 # _Ant pattern_ refers to [Ant based path patterns|http://ant.apache.org/manual/dirtasks.html#patterns]
# 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)
 # file patterns are a series of file pattern connecting together through the comma character
  # File pattern can be constructed by prefixing"+" or "-" character before an Ant pattern:
 #* if prefixed with "+", the file pattern will include files or directories specified in the Ant pattern (default)
 #* if prefixed with "-", the file pattern will exclude files or directories specified in the Ant pattern
 #* if not prefixed, the file pattern will include files or directories specified in the Ant pattern (it has the same effect as prefixing a "+" character)
 # File patterns are a series of file pattern connected with the comma character
  
 h3. Examples
  
Here we will use the artifact publishing step to give examples of file patterns in QuickBuild. Let's suppose that:
 # the configuration workspace locates at _/opt/quickbuild2/configurations/1/workspace_, and it contains below directories and files:
  We will use the artifact publishing step to give examples of the file patterns in QuickBuild. Let's suppose that:
 # The configuration workspace is located in _/opt/quickbuild2/configurations/1/workspace_, and it contains the following directories and files:
 {code}
 file0.zip
 file0.doc
 dir1/
  file1.zip
  file1.doc
 dir2/
  file2.zip
  file2.doc
  dir3/
  file3.zip
  file3.doc
 {code}
# the build artifacts directory locates at _/opt/quickbuild2/builds/1/artifacts_
 # 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.
 # 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.
  # The build artifacts directory is located in _/opt/quickbuild2/builds/1/artifacts_
 # The property _From Directory_ of the artifact publishing step is left empty, which means that the workspace directory will be used as the base directory of the file pattern matching.
 # The property _Destination Directory_ of the 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:
 # *\*\*/\**
 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:
  Let's examine several file patterns to see what the artifacts directory will look like after the publishing step:
 # *\**/\**
 All files and directories will be published from the workspace directory to the artifacts directory recursively. The artifacts directory will look just the same as the workspace directory:
 {code}
 file0.zip
 file0.doc
 dir1/
  file1.zip
  file1.doc
 dir2/
  file2.zip
  file2.doc
  dir3/
  file3.zip
  file3.doc
{code}
 # *\*\*/\*.zip*
  {code}
 # *\**/*.zip*
 All zip files will be published recursively. The artifacts direcory will look like:
 {code}
 file0.zip
 dir1/
  file1.zip
 dir2/
  file2.zip
  dir3/
  file3.zip
 {code}
 # *\*.zip*
All zip files that is directly under the workspace will be published. The artifacts directory will look like:
  All zip files that are directly in the workspace directory will be published. The artifacts directory will look like:
 {code}
 file0.zip
 {code}
# *\*\*/\*.zip,-dir2/\*\*/\**
 Publish all zip files recursively, but exclude all files under the dir2 directory recursively. The artifacts
  # *\**/*.zip,-dir2/**/\**
 Publishes all zip files recursively, but excludes all the files under the dir2 directory recursively. The artifacts
 directory will look like:
 {code}
 file0.zip
 dir1/
  file1.zip
 {code}
 # *\*\*/\*.zip,-dir2/\**
 Publish all zip files recursively, but exclude all files that is directly under the dir2 directory. The artifacts
  # *\**/*.zip,-dir2/\**
 Publishes all zip files recursively, but excludes all the files that are directly in the dir2 directory. The artifacts
 directory will look like:
 {code}
 file0.zip
 dir1/
  file1.zip
 dir2/
  dir3/
  file3.zip
 {code}