SharpYaml/SharpYaml.build

136 строки
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<project name="YamlDotNet" default="package" basedir="." xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<!-- This build file requires .NET 4.0 and nant 0.91 alpha 2 or higher -->
<property name="nant.settings.currentframework" value="net-4.0"/>
<property name="version" value="2.2.0" />
<fileset id="binaries">
<include name="YamlDotNet.Core/bin/Release/YamlDotNet.Core.dll" />
<include name="YamlDotNet.Core/bin/Release/YamlDotNet.Core.pdb" />
<include name="YamlDotNet.RepresentationModel/bin/Release/YamlDotNet.RepresentationModel.dll" />
<include name="YamlDotNet.RepresentationModel/bin/Release/YamlDotNet.RepresentationModel.pdb" />
<include name="YamlDotNet.Converters/bin/Release/YamlDotNet.Converters.dll" />
<include name="YamlDotNet.Converters/bin/Release/YamlDotNet.Converters.pdb" />
</fileset>
<loadtasks assembly="support/nantcontrib/NAnt.Contrib.Tasks.dll" />
<target name="doc">
<msbuild project="YamlDotNet.shfbproj" target="Rebuild">
<property name="Configuration" value="Release" />
</msbuild>
</target>
<target name="build">
<msbuild project="YamlDotNet.sln" target="Rebuild">
<property name="Configuration" value="Release" />
</msbuild>
</target>
<target name="package-bin" depends="build">
<delete dir="tmp" failonerror="false" />
<mkdir dir="tmp" />
<copy todir="tmp" flatten="true">
<fileset refid="binaries" />
</copy>
<zip zipfile="release/${version}/YamlDotNet-bin-${version}.zip">
<fileset basedir="tmp">
<include name="*" />
<include name="../LICENSE" />
<include name="../LICENSE-libyaml" />
</fileset>
</zip>
<delete dir="tmp" />
</target>
<target name="package-src">
<zip zipfile="release/${version}/YamlDotNet-src-${version}.zip">
<fileset>
<exclude name="doc/**/*" />
<exclude name="release/**/*" />
<exclude name="support/**/*" />
<exclude name="**/*.pfx" />
<exclude name="**/*.user" />
<exclude name="**/*.suo" />
<exclude name="**/password.txt" />
<exclude name="**/*_ReSharper*" />
<exclude name="**/*_ReSharper*/**" />
<exclude name="**/bin" />
<exclude name="**/bin/**" />
<include name="**/*" />
</fileset>
</zip>
</target>
<target name="package-doc" depends="doc">
<copy file="Help/YamlDotNet.chm" tofile="release/${version}/YamlDotNet-${string::replace(version, '.', '-')}.chm" overwrite="true" />
</target>
<target name="build-nuget-package">
<echo message="${path::get-file-name(nuspec-file)}" />
<delete dir="tmp" failonerror="false" />
<mkdir dir="tmp" />
<copy file="${nuspec-file}" todir="tmp" />
<xmlpoke file="tmp/${path::get-file-name(nuspec-file)}" xpath="/package/metadata/version" value="${version}" />
<xmlpoke file="tmp/${path::get-file-name(nuspec-file)}" xpath="/package/metadata/dependencies/dependency/@version" value="${version}" />
<exec program="support/nuget/NuGet.exe" workingdir="tmp">
<arg value="pack" />
<arg value="${path::get-file-name(nuspec-file)}" />
</exec>
<copy todir="release/${version}">
<fileset basedir="tmp">
<include name="*.nupkg" />
</fileset>
</copy>
<delete dir="tmp" />
</target>
<target name="publish-nuget" depends="package-nuget" description="Builds NuGet packages and publishes them to the NuGet repository.">
<foreach item="File" property="nuspec-file">
<in>
<items>
<include name="release/${version}/*.nupkg" />
</items>
</in>
<do>
<exec program="support/nuget/NuGet.exe" workingdir="release/${version}">
<arg value="push" />
<arg value="-source" />
<arg value="http://packages.nuget.org/v1/" />
<arg value="${path::get-file-name(nuspec-file)}" />
</exec>
</do>
</foreach>
</target>
<target name="package-nuget" depends="build">
<foreach item="File" property="nuspec-file">
<in>
<items>
<include name="*.nuspec" />
</items>
</in>
<do>
<call target="build-nuget-package" />
</do>
</foreach>
</target>
<target name="package" depends="package-bin, package-src, package-doc">
</target>
</project>