forked from kzu/Schematron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
83 lines (70 loc) · 3.81 KB
/
build.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Package" InitialTargets="Configure" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IntermediateOutputPath>build\</IntermediateOutputPath>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Out Condition=" '$(Out)' == '' ">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), 'out'))</Out>
<GitInfoReportImportance>high</GitInfoReportImportance>
<GitVersionFile>VERSION</GitVersionFile>
</PropertyGroup>
<Target Name="Clean">
<Exec Command="rmdir $(Out) /S /Q" ContinueOnError="true" />
<Exec Command="rmdir build\packages /S /Q" ContinueOnError="true" />
<Exec Command="rmdir src\packages /S /Q" ContinueOnError="true" />
</Target>
<Target Name="Build" DependsOnTargets="GitVersion">
<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</Version>
</PropertyGroup>
<ItemGroup>
<Solution Include="src\*.sln"/>
<Solution>
<NuSpec>%(RootDir)%(Directory)%(Filename).nuspec</NuSpec>
<Id>%(Filename)</Id>
<Version>$(Version)</Version>
</Solution>
</ItemGroup>
<MSBuild Projects="@(Solution)" Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="Package" DependsOnTargets="Build">
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
<Exec Command='"$(NuGet)" Pack "%(Solution.NuSpec)" -Version %(Solution.Version) -NoPackageAnalysis -NonInteractive -Properties Id=%(Solution.Id);Configuration=$(Configuration)'
Condition=" Exists('%(Solution.NuSpec)') " />
</Target>
<Target Name="Publish" DependsOnTargets="Package">
<Exec Command='$(NuGet) Push "$(Out)\%(Solution.Id).%(Solution.Version).nupkg" $(NuGetPushArgs)'
StandardErrorImportance="high"
StandardOutputImportance="normal" />
<Message Text="Published new package: Id=%(Solution.Id), Version=%(Solution.Version)"
Importance="high" />
</Target>
<Target Name="Test" DependsOnTargets="Build">
<ItemGroup>
<TestAssemblies Include="src/**/*Tests.dll" />
</ItemGroup>
<xunit Assemblies="@(TestAssemblies)"
Html="$(Out)\tests.html"
Xml="$(Out)\tests.xml"
ContinueOnError="ErrorAndContinue"/>
</Target>
<Import Project="src\NuGet.Restore.targets" />
<!-- Setup/Configure/Restore -->
<PropertyGroup>
<PackagesDir>build\packages\</PackagesDir>
<XunitBuildDir>$(PackagesDir)xunit.runner.msbuild\build</XunitBuildDir>
<!-- Xunit evolves by adding/tweaking platforms, so this makes it resilient to that -->
<XunitPlatformDir Condition=" Exists('$(XunitBuildDir)') ">$([System.IO.Directory]::GetDirectories($(XunitBuildDir))[0])</XunitPlatformDir>
<!-- This file is used to detect whether the restore has been performed or not -->
<XunitProps>$([System.IO.Path]::Combine($(XunitPlatformDir), 'xunit.runner.msbuild.props'))</XunitProps>
<GitInfoTargets>$(PackagesDir)GitInfo\build\GitInfo.targets</GitInfoTargets>
<PendingRestore Condition=" !Exists('$(XunitProps)') ">true</PendingRestore>
</PropertyGroup>
<Import Project="$(XunitProps)" Condition="Exists('$(XunitProps)')"/>
<Import Project="$(GitInfoTargets)" Condition="Exists('$(GitInfoTargets)')"/>
<Target Name="Configure" DependsOnTargets="_GetNuGet" Condition=" '$(PendingRestore)' == 'true' ">
<!-- We always run NuGet Install since it already checks for already-installed packages and skips them -->
<Exec Command='"$(NuGet)" Install "build\packages.config" -OutputDirectory "build\packages" -ExcludeVersion' />
<!-- The Wrench build script will pass the Target property as Configure on the configure step, and therefore will properly skip the error -->
<Error Text="Build-time packages were missing and were just restored. Please run the build again." Condition=" '$(Target)' != 'Configure' " />
</Target>
</Project>