forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
179 lines (165 loc) · 6.57 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014-Present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
-->
<Project ToolsVersion="4.0" DefaultTargets="Build;Test;Package" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Major>2</Major>
<Minor>3</Minor>
<Build>1</Build>
<Revision>0</Revision>
<DevNuGetServer>http://reactjs.net/packages/</DevNuGetServer>
<MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\tools\MSBuildTasks</MSBuildCommunityTasksPath>
<PackageOutputDir>output</PackageOutputDir>
<BuildType Condition="'$(BuildType)' == ''">Dev</BuildType>
<SolutionFile>src\React.sln</SolutionFile>
</PropertyGroup>
<ItemGroup>
<PackageAssemblies Include="React.Core" />
<PackageAssemblies Include="React.Web" />
<PackageAssemblies Include="React.Web.Mvc4" />
<PackageAssemblies Include="React.Web.Mvc3" />
<PackageAssemblies Include="System.Web.Optimization.React" />
<PackageAssemblies Include="Cassette.React" />
<PackageAssemblies Include="React.MSBuild" />
<PackageAssemblies Include="React.Owin" />
<PackageAssembliesAspNet5 Include="React.AspNet" />
<AspNet5ProjectJson Include="src/React.AspNet/project.json" />
<AspNet5ProjectJson Include="src/React.Sample.Mvc6/project.json" />
<AspNet5ProjectJson Include="src/wrap/**/project.json" />
</ItemGroup>
<Import Project="src/React.tasks.proj" />
<Target Name="RestorePackages" DependsOnTargets="Clean">
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe restore $(SolutionFile)"
/>
<!-- NuGet packages for ASP.NET 5 projects -->
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dnu restore --quiet --parallel src\React.AspNet src\React.Sample.Mvc6"
/>
<!-- npm packages -->
<Exec
WorkingDirectory="src/React.Core"
Command="npm install"
/>
<Exec
WorkingDirectory="src/React.Sample.Webpack"
Command="npm install"
/>
</Target>
<Target Name="UpdateVersion">
<GitVersion LocalPath="$(MSBuildProjectDirectory)">
<Output TaskParameter="CommitHash" PropertyName="Revision" />
</GitVersion>
<Time Format="yyyyMMdd-HHmm">
<Output TaskParameter="FormattedTime" PropertyName="Date" />
</Time>
<!-- Prepend date to build version if a dev build-->
<PropertyGroup Condition="$(BuildType) == 'Release'">
<FullBuild>$(Build)</FullBuild>
</PropertyGroup>
<PropertyGroup Condition="$(BuildType) != 'Release'">
<FullBuild>$(Build)-dev-$(Date)</FullBuild>
</PropertyGroup>
<!-- Set version for .csproj projects -->
<AssemblyInfo
CodeLanguage="CS"
OutputFile="src\SharedAssemblyVersionInfo.cs"
AssemblyVersion="$(Major).$(Minor)"
AssemblyFileVersion="$(Major).$(Minor).$(FullBuild).$(Revision)"
AssemblyInformationalVersion="$(Major).$(Minor).$(FullBuild)"
/>
<!--
Set version for ASP.NET 5 projects. In theory K_BUILD_VERSION should work but it doesn't seem
to be functional yet :(. We work around this by physically writing the build number to the
project.json files. For development builds we write the full version number (including
build date) and reset it later so the dev build number isn't commited to the repo.
-->
<!--SetEnvironmentVariable
Name="K_BUILD_VERSION"
Value="$(Build)"
/-->
<UpdateAspNetProjectVersion
Files="@(AspNet5ProjectJson)"
Version="$(Major).$(Minor).$(FullBuild)"
/>
</Target>
<Target Name="Clean" BeforeTargets="Build">
<!--
ASP.NET 5 projects don't delete generated .nupkg files when cleaned or rebuilt, so we need to
do it here. See https://github.com/aspnet/XRE/issues/1301
-->
<DeleteTree Directories="src/artifacts" />
<DeleteTree Directories="bin/%(PackageAssembliesAspNet5.Identity)/Release" />
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages;UpdateVersion">
<Exec WorkingDirectory="src/React.Core" Command="node_modules/.bin/gulp" />
<MSBuild Projects="$(SolutionFile)" Targets="Rebuild" Properties="Configuration=Release;Platform=Any CPU;NoWarn=1607,7035" />
<Exec WorkingDirectory="src/React.Sample.Webpack" Command="node_modules/.bin/webpack" />
</Target>
<Target Name="ResetAspNetVersion" AfterTargets="Build">
<!-- Resets the version number in ASP.NET project.json files so we don't commit -dev- version numbers -->
<UpdateAspNetProjectVersion
Files="@(AspNet5ProjectJson)"
Version="$(Major).$(Minor).$(Build)-*"
/>
</Target>
<Target Name="Test" DependsOnTargets="Build">
<ItemGroup>
<TestAssemblies Include="bin/ReleaseTests/**/React.Tests*.dll" />
</ItemGroup>
<NUnit
ToolPath="src\packages\NUnit.Runners.2.6.3\tools"
Assemblies="@(TestAssemblies)"
/>
</Target>
<Target Name="GenerateNuSpecs">
<TransformXml
Source="src/template.nuspec"
Transform="src/%(PackageAssemblies.Identity)/%(PackageAssemblies.Identity).nutrans"
Destination="src/%(PackageAssemblies.Identity)/%(PackageAssemblies.Identity).nuspec"
/>
</Target>
<Target Name="Package" DependsOnTargets="Build;GenerateNuSpecs">
<!-- Delete old packages -->
<RemoveDir Directories="$(PackageOutputDir)" />
<!-- Create new packages -->
<MakeDir Directories="$(PackageOutputDir)" />
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe pack src/%(PackageAssemblies.Identity)/%(PackageAssemblies.Identity).csproj -IncludeReferencedProjects -Symbols -Prop Configuration=Release -OutputDirectory output"
/>
</Target>
<Target Name="CopyAspNetPackages" AfterTargets="Package">
<!-- Copy over ASP.NET 5 packages -->
<ItemGroup>
<AspNet5Packages Include="bin/%(PackageAssembliesAspNet5.Identity)/Release/*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(AspNet5Packages)" DestinationFolder="$(PackageOutputDir)" />
</Target>
<Target Name="Push">
<CallTarget Targets="PushDev" Condition="$(BuildType) != 'Release'" />
<CallTarget Targets="PushRelease" Condition="$(BuildType) == 'Release'" />
</Target>
<Target Name="PushRelease">
<ItemGroup>
<PackageFiles Include="$(PackageOutputDir)\*.nupkg" Exclude="$(PackageOutputDir)\*.symbols.nupkg" />
</ItemGroup>
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe push %(PackageFiles.Identity) -NonInteractive"
/>
</Target>
<Target Name="PushDev">
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe push $(PackageOutputDir)\*.symbols.nupkg -Source $(DevNuGetServer) -NonInteractive"
/>
</Target>
</Project>