开发者

Use nant to build an archive and display it in cruisecontrol.net package list

I'm not sure if this is possible, but currently I am using a CruiseControl.net build server with a nAnt s开发者_JAVA技巧cript to handle all of the building, testing, and packaging. I have nAnt manipulate some files and archive them. Is there a way to display that zip file that the nAnt script generated in the CruiseControl.net Package List? I am using ccnet 1.5 and nAnt 0.91 alpha2.

Thanks.


After much research, I have come to this conclusion:

  1. Packages only show the files related to that build not all.
  2. You can only build these packages within the CCNet.config
  3. If you make a package by hand, it will be corrupted within the build server

It might be possible to create the package and drop the required files in the folder, but you will have to modify a couple of the statistic files and what not, but i gave up and no one has responded to this.


I did this because I was not happy with ccnet's package publisher. First you need to trick ccnet into creating a dummy package; the package will be created in [ArtifactDirectory]\[CCNetLabel]. Then run a nant script which replaces the package and updates the package xml.

ccnet config:

<publishers>
  <package>
    <name>Build-$[$CCNetLabel]</name>
    <compression>0</compression>
    <packageList />
  </package>
  <nant>
    <buildArgs>-D:PackageName="Build-$[$CCNetLabel]"</buildArgs>
    <buildFile>script.build</buildFile>
    <targetList>
      <target>PackagePublisher</target>
    </targetList>
  </nant>
</publishers>

nant:

<target name="PackagePublisher">
  <property name="PackageDirectory" value="${CCNetArtifactDirectory}\${CCNetLabel}" />
  <property name="PackageFullPath" value="${PackageDirectory}\${PackageName}.zip" />
  <delete file="${PackageFullPath}" />
  <zip zipfile="${PackageFullPath}">
    <fileset>
       <!-- include everything you need to package -->
    </fileset>
  </zip>

  <!-- find package.xml; it is the only xml file in the PackageDirectory -->
  <foreach item="File" property="PackageXml">
    <in>
      <items basedir="${PackageDirectory}">
         <include>*.xml</include>
      </items>
    </in>
    <do>
      <xmlpoke file="${PackageXml}" xpath="//package[@name='${PackageName}']/@size" value="${file::get-length(PackageFullPath)}" />
    </do>
  </foreach>
</target>

The last part ensures the package size is displayed properly in the PackageList web page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜