SPRNET-1437 introduce behavior to generate nuget packages on PACKAGE build task
This commit is contained in:
77
Spring.build
77
Spring.build
@@ -962,6 +962,7 @@ Commandline Examples:
|
||||
|
||||
|
||||
<call target="package-release-files"/>
|
||||
<call target="package-nuget" />
|
||||
|
||||
</target>
|
||||
|
||||
@@ -1895,5 +1896,81 @@ Commandline Examples:
|
||||
</properties>
|
||||
</nant>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="check-nuget-package-dir">
|
||||
<fail message="The NuGet package directory has not been specified."
|
||||
if="${not property::exists('nuget.package.dir')}"/>
|
||||
<mkdir dir="${nuget.package.dir}"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean-nuget-package-dir" depends="check-nuget-package-dir" description="Cleans the NuGet package directory">
|
||||
<echo message="Cleaning the ${nuget.package.dir} NuGet package directory."/>
|
||||
<delete dir="${nuget.package.dir}" if="${directory::exists(nuget.package.dir)}"/>
|
||||
<mkdir dir="${nuget.package.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="package-nuget" depends="update-nuspec-metadata">
|
||||
|
||||
|
||||
<foreach item="File" property="filename">
|
||||
<in>
|
||||
<items basedir="${spring.basedir}/src/spring">
|
||||
<include name="**/*.nuspec" />
|
||||
</items>
|
||||
</in>
|
||||
<do>
|
||||
<echo message="Generating NuGet Package from nuspec file: ${filename}" />
|
||||
|
||||
|
||||
|
||||
<exec program="${tool.dir}\NuGet\NuGet.exe" workingdir="${spring.basedir}" verbose="true" failonerror="false">
|
||||
<arg value="pack" />
|
||||
<arg value="${filename}" />
|
||||
<arg value="-Version" />
|
||||
<arg value="${package.version}" />
|
||||
<arg value="-OutputDirectory" />
|
||||
<arg value="${nuget.package.dir}" />
|
||||
</exec>
|
||||
</do>
|
||||
</foreach>
|
||||
</target>
|
||||
|
||||
<target name="update-nuspec-metadata">
|
||||
|
||||
<property name="nuget.package.dir" value="${spring.basedir}\NuGet-Packages" />
|
||||
|
||||
<call target="clean-nuget-package-dir" />
|
||||
<call target="check-package-version" />
|
||||
<foreach item="File" property="filename">
|
||||
<in>
|
||||
<items basedir="${spring.basedir}/src/spring">
|
||||
<include name="**/*.nuspec" />
|
||||
</items>
|
||||
</in>
|
||||
<do>
|
||||
<echo message="Processing nuspec file: ${filename}" />
|
||||
<!-- update the actual version number for the actual package -->
|
||||
<!-- disabled: NuGet 1.3 introduced passing "-version" command line arg to override this value so no longer need the XMLPOKE call
|
||||
<xmlpoke file="${filename}" xpath="/n:package/n:metadata/n:version" value="${package.version}">
|
||||
<namespaces>
|
||||
<namespace prefix="n" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
|
||||
</namespaces>
|
||||
</xmlpoke>
|
||||
-->
|
||||
|
||||
<!--
|
||||
update the version number of the dependent packages; assumes all Spring.* packages are updated at the same time to the same version
|
||||
NOTE: must set fail-on-errror to false b/c Spring.Core (ex.) has no Spring.* deps and so this XPATH expr. won't find a match in that case
|
||||
-->
|
||||
<xmlpoke file="${filename}" xpath="/n:package/n:metadata/n:dependencies/n:dependency[starts-with(@id, 'Spring.')]/@version" value="${package.version}" failonerror="false" >
|
||||
<namespaces>
|
||||
<namespace prefix="n" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
|
||||
</namespaces>
|
||||
</xmlpoke>
|
||||
</do>
|
||||
</foreach>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user