0
votes

I am automating a build process using Jenkins and Ant build steps. I have the build operation and post-build source control tagging working fine.

After a number of QT projects have been built, I want to be able to preserve the useful artifacts from the build.

As a vehicle for discussion/consideration, lets say I have the following set of files in a build directory:

MyApp.exe
MyApp.pdb
MyApp_Tests.exe
MyApp_Tests.pdb
SomeLib.lib
SomeLib.pdb
3rdParty.lib
3rdParty.pdb
Utils.dll
Utils.pdb

(In reality there are many more exe's, dll's lib's and their associated pdb files and the files produced by the build change frequently as the project evolves.)

I want to collect the "deliverable" files (non-test exe's and dll's) and their pdb files without the test exe's, lib files and their pdb files.

I believe I can get a fileset of the deliverable files to use in a copy task:

<copy todir="${artifactDestination}" failonerror="true">
    <fileset dir="./build">
        <include name="*.exe" />
        <include name="*.dll" />
        <exclude name="*_Tests*" />
    </fileset>
</copy>

What I am struggling with is how to get a fileset of the pdb files that relate to the exe and dll files, i.e. all the pdb files except MyApp_Tests.pdb, SomeLib.pdb and 3rdParty.pdb.

What I would like to do is use the initial fileset of exe and dll files and create a second fileset from that which has those filenames with a .pdb extension instead of .dll or .exe.

I've been reading up on selectors and such but have not managed to spot a solution to achieve my desired result.

Any suggestions?

1

1 Answers

2
votes

You should be able to achieve what you want with two subsequent copy tasks. The first one is the one you've already figured out. In order to copy the .pdb files that match the files you've copied in the first step you can use a present selector.

<copy todir="${artifactDestination}" failonerror="true">
  <fileset dir="build">
    <or>
      <present targetdir="${artifactDestination}">
        <globmapper from="*.pdb" to="*.exe"/>
      </present>
      <present targetdir="${artifactDestination}">
        <globmapper from="*.pdb" to="*.dll"/>
      </present>
    </or>
  </fileset>
</copy>