forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
142 lines (131 loc) · 5.1 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
<?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>3</Major>
<Minor>0</Minor>
<Build>0</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="Cassette.React" />
<PackageAssemblies Include="React.AspNet" />
<PackageAssemblies Include="React.Core" />
<PackageAssemblies Include="React.MSBuild" />
<PackageAssemblies Include="React.Owin" />
<PackageAssemblies Include="React.Web" />
<PackageAssemblies Include="React.Web.Mvc4" />
<PackageAssemblies Include="System.Web.Optimization.React" />
</ItemGroup>
<Import Project="src/React.tasks.proj" />
<Target Name="RestorePackages" DependsOnTargets="Clean">
<!-- NuGet packages for .xproj projects -->
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet restore"
/>
<!-- NuGet packages for "legacy" projects (eg. React.Samples.Mvc4) -->
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe restore $(SolutionFile)"
/>
<!-- 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'">
<BuildSuffix></BuildSuffix>
<BuildWithSuffix>$(Build)</BuildWithSuffix>
</PropertyGroup>
<PropertyGroup Condition="$(BuildType) != 'Release'">
<BuildSuffix>dev-$(Date)</BuildSuffix>
<BuildWithSuffix>$(Build)-$(BuildSuffix)</BuildWithSuffix>
</PropertyGroup>
<!-- Set version for assemblies -->
<AssemblyInfo
CodeLanguage="CS"
OutputFile="src\SharedAssemblyVersionInfo.cs"
AssemblyVersion="$(Major).$(Minor)"
AssemblyFileVersion="$(Major).$(Minor).$(BuildWithSuffix).$(Revision)"
AssemblyInformationalVersion="$(Major).$(Minor).$(BuildWithSuffix)"
/>
<!-- Ensure version numbers in project.json files are in sync -->
<UpdateAspNetProjectVersion
Files="src/%(PackageAssemblies.Identity)/project.json"
Version="$(Major).$(Minor).$(Build)-*"
/>
</Target>
<Target Name="Clean" BeforeTargets="Build">
<!--
ASP.NET Core 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="src/%(PackageAssemblies.Identity)/bin" />
</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="Test" DependsOnTargets="Build">
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet test --configuration Release --no-build tests/React.Tests"
/>
</Target>
<Target Name="Package" DependsOnTargets="Build">
<!-- Delete old packages -->
<RemoveDir Directories="$(PackageOutputDir)" />
<!-- Create new packages -->
<MakeDir Directories="$(PackageOutputDir)" />
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet pack --output $(PackageOutputDir) --configuration Release --version-suffix $(BuildSuffix) --no-build src/%(PackageAssemblies.Identity)"
/>
</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>