-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Directory.Build.targets
199 lines (180 loc) · 7.46 KB
/
Directory.Build.targets
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- This target is used to compute the inputs and outputs for running the `yarn install`. -->
<Target
Name="ReactNativeYarnInstallInputAndOutputs"
>
<ItemGroup>
<_ReactNativeYarnInstallInputFiles Include="$(MSBuildThisFileDirectory)yarn.lock" />
<_ReactNativeYarnInstallInputFiles Include="$(MSBuildThisFileDirectory)**\package.json" Exclude="$(MSBuildThisFileDirectory)node_modules\**" />
<_ReactNativeYarnInstallOutputFiles Include="@(_ReactNativeYarnInstallInputFiles->'$(ReactNativeYarnIntDir)%(RecursiveDir)%(Filename)%(Extension).dummy')" />
</ItemGroup>
</Target>
<!--
This target runs `yarn install` and then `yarn build` as a post install step in `package.json`.
This is to address build failures by not running `yarn install` after syncing.
We do not run `yarn install` during design time build and in our CI validation runs (detected via AGENT_NAME).
-->
<Target
Name="ReactNativeYarnInstall"
BeforeTargets="BeforeBuild"
DependsOnTargets="ReactNativeYarnInstallInputAndOutputs"
Inputs="@(_ReactNativeYarnInstallInputFiles)"
Outputs="@(_ReactNativeYarnInstallOutputFiles)"
Condition="'$(DesignTimeBuild)'=='' AND '$(AGENT_NAME)' == ''"
>
<Message Text="Running yarn install to fetch latest packages." Importance="High" />
<Message Text="yarn install --frozen-lockfile --mutex file:.yarn-mutex" Importance="High" />
<Exec
ContinueOnError="True"
Command="yarn install --frozen-lockfile --mutex file:.yarn-mutex"
WorkingDirectory="$(MSBuildThisFileDirectory)"
>
<Output TaskParameter="ExitCode" ItemName="_ReactNativeYarnExitCode"/>
</Exec>
<Message Text="yarn install: Succeeded" Condition="'%(_ReactNativeYarnExitCode.Identity)' == '0'" Importance="High" />
<Message Text="yarn install: Failed" Condition="'%(_ReactNativeYarnExitCode.Identity)' != '0'" Importance="High" />
<!-- Fail the build if yarn needs to update yarn.lock file. -->
<Error
Condition="'%(_ReactNativeYarnExitCode.Identity)' != '0'"
Text="Yarn packages are out of date. Please run `yarn install` in the root of the repo to ensure the generated files are up to date"
/>
<!--
Copy the yarn.lock file to prevent this task from running over and over again, and only rerun the check with yarn.lock or any package.json changes.
This will likely miss a few corner cases with local changes to package.json but should catch the most important case after syncing
-->
<MakeDir Directories="$(ReactNativeYarnIntDir)" />
<Copy
Condition="'%(_ReactNativeYarnExitCode.Identity)' == '0'"
SourceFiles="@(_ReactNativeYarnInstallInputFiles)"
DestinationFiles="@(_ReactNativeYarnInstallOutputFiles)"
SkipUnchangedFiles="true"
Retries="5"
RetryDelayMilliseconds="100" />
<!-- We have to touch the outputs to ensure up to date incrementaility works-->
<Touch Files="@(_ReactNativeYarnInstallOutputFiles)" />
</Target>
<!-- For build debugging purposes. -->
<Target Name="Vars">
<ItemGroup>
<_VarsGeneral Include="
ApplicationType;
Configuration;
Platform;
PlatformTarget;
PlatformName;
DefaultPlatformToolset;
PlatformToolset;
SolutionPath;
SolutionDir;
SolutionName;
IntDir;
OutDir;
TargetDir;
TargetPath;
TLogLocation;
LastBuildUnsuccessful;
LastBuildState;
GeneratedFilesDir;
TargetFrameworkMoniker;
MSBuildExtensionsPath;
MSBuildExtensionsPath32;
MSBuildExtensionsPath64;
VCTargetsPath;
UserRootDir;
ProjectHome;
BaseIntermediateOutputPath;
IntermediateOutputPath;
OutputPath;
OS;
" />
<_VarsCustom Include="
RootDir;
RootIntDir;
RootOutDir;
BaseIntDir;
BaseOutDir;
ReactNativeDir;
ReactNativeWindowsDir;
FollyDir;
YogaDir;
WinVer;
" />
<_VarsWinRT Include="
UnmergedWinmdDirectory;
MergedWinmdDirectory;
" />
<_VarsJSEngine Include="
PkgReactNative_Hermes_Windows;
EnableHermesInspectorInReleaseFlavor;
UseHermes;
HermesVersion;
HermesPackage;
HermesArch;
UseFabric;
UseV8;
V8Package;
V8Version;
V8AppPlatform;
" />
<_VarsNuGet Include="
AssetTargetFallback;
IncludeFrameworkReferencesFromNuGet;
NuGetPackageRoot;
NuGetPackagesDirectory;
NuGetRuntimeIdentifier;
ProjectLockFile;
NuGetTargetMoniker;
TargetFramework;
TargetFrameworks;
TargetFrameworkIdentifier;
BaseNuGetRuntimeIdentifier;
TargetPlatformIdentifier;
MSBuildProjectExtensionsPath;
RestoreProjectStyle;
RestoreUseStaticGraphEvaluation;
" />
<_VarsWinUI Include="
UseWinUI3;
WinUI3Version;
WinUI2xVersion;
WinUIPackageName;
WinUIPackageVersion;
IsWinUIAlpha;
" />
</ItemGroup>
<Message Text="General" />
<Message Text="=> @(_VarsGeneral->PadRight(24)) [$(%(_VarsGeneral.Identity))]" />
<Message Text="%0A" />
<Message Text="Custom" />
<Message Text="=> @(_VarsCustom->PadRight(24)) [$(%(_VarsCustom.Identity))]" />
<Message Text="%0A" />
<Message Text="Microsoft.CppBuild.targets/MakeDirsForCl" />
<Message Text="=> PrecompiledHeaderOutputFile [@(CLCompile->Metadata('PrecompiledHeaderOutputFile')->DirectoryName()->Distinct())]" />
<Message Text="=> AssemblerListingLocation [@(CLCompile->Metadata('AssemblerListingLocation')->DirectoryName()->Distinct())]" />
<Message Text="=> ObjectFileName [@(CLCompile->Metadata('ObjectFileName')->DirectoryName()->Distinct())]" />
<Message Text="=> ProgramDataBaseFileName [@(CLCompile->Metadata('ProgramDataBaseFileName')->DirectoryName()->Distinct())]" />
<Message Text="=> XMLDocumentationFileName [@(CLCompile->Metadata('XMLDocumentationFileName')->DirectoryName()->Distinct())]" />
<Message Text="=> BrowseInformationFile [@(CLCompile->Metadata('BrowseInformationFile')->DirectoryName()->Distinct())]" />
<Message Text="=> PreprocessOutputPath [@(CLCompile->Metadata('PreprocessOutputPath')->DirectoryName()->Distinct())]" />
<Message Text="=> PreprocessorDefinitions [@(CLCompile->Metadata('PreprocessorDefinitions')->Distinct())]" />
<Message Text="=> ClDirsToMake [@(ClDirsToMake)]" />
<Message Text="%0A" />
<Message Text="WinRT" />
<Message Text="=> @(_VarsWinRT->PadRight(24)) [$(%(_VarsWinRT.Identity))]" />
<Message Text="%0A" />
<Message Text="JS Engine" />
<Message Text="=> @(_VarsJSEngine->PadRight(40)) [$(%(_VarsJSEngine.Identity))]" />
<Message Text="%0A" />
<Message Text="NuGet" />
<Message Text="=> @(_VarsNuGet->PadRight(40)) [$(%(_VarsNuGet.Identity))]" />
<Message Text="=> PackageReference->Count [@(PackageReference->Count())]" />
<Message Text="%0A" />
<Message Text="WinUI" />
<Message Text="=> @(_VarsWinUI->PadRight(40)) [$(%(_VarsWinUI.Identity))]" />
<Message Text="%0A" />
<Message Text="Items" />
<Message Text="=> ProjectCapability" />
<Message Text=" %(ProjectCapability.Identity)" />
</Target>
</Project>