changes.
| | In QuickBuild, you can use [Ant style file pattern] http://ant.apache.org/manual/dirtasks.html#patterns to including the artifacts/reports. |
| | 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 described using [EBNF|http://en.wikipedia.org/wiki/EBNF]: |
| {code} |
| file patterns::=file pattern,{",",file pattern} |
| file pattern::=[+|-]Ant pattern |
| {code} |
| 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 "-" 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 |
| |
| 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 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. |
| |
| 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* |
| 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 are directly in the workspace directory will be published. The artifacts directory will look like: |
| {code} |
| file0.zip |
| {code} |
| # *\**/*.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/\** |
| 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} |