Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit af6715e

Browse files
committed
Merge various restore tasks into one Sync target
There were various restore targets happening independently when they should all be combined so the sync step can be independent from the build step. This change merges them together under the Sync target. In particular this moves RestoreOptData and RestoreNETCorePlatforms to be part of the sync step instead of being individually ran. Pass BuildType to sync commands so optdata gets restored correctly
1 parent b5f4d2d commit af6715e

9 files changed

+33
-33
lines changed

build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ REM ============================================================================
320320

321321
if %__RestoreOptData% EQU 1 if %__BuildTypeRelease% EQU 1 (
322322
echo %__MsgPrefix%Restoring the OptimizationData Package
323-
@call %__ProjectDir%\run.cmd sync -optdata %__UnprocessedBuildArgs%
323+
@call %__ProjectDir%\run.cmd build -optdata %__RunArgs% %__UnprocessedBuildArgs%
324324
if not !errorlevel! == 0 (
325325
echo %__MsgPrefix%Error: Failed to restore the optimization data package.
326326
exit /b 1

build.proj

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626
<Delete Files="$(BinDir)System.Private.CoreLib.*" />
2727
</Target>
2828

29-
<Target Name="RestoreOptData">
29+
<!--
30+
BuildTools will conditionally restore additional packages, including IBC tools, using the "RestoreOptionalToolingPackages"
31+
target, which runs automatically before "Sync". Since no "Sync" target actually exists, go ahead and define one now so that
32+
the tools are fetched before "Build".
33+
-->
34+
<Target Name="Sync" BeforeTargets="Build"
35+
DependsOnTargets="RestoreOptData;RestoreNETCorePlatforms" />
36+
37+
<Target Name="RestoreOptData" Condition="'$(RestoreDuringBuild)'=='true' and '$(BuildType)'=='Release'">
3038
<PropertyGroup>
3139
<_OptimizationDataFeed Condition="'$(DotNetBuildOffline)' != 'true'">--source https://dotnet.myget.org/F/dotnet-core-optimization-data/api/v3/index.json</_OptimizationDataFeed>
3240
</PropertyGroup>
@@ -35,14 +43,7 @@
3543
StandardOutputImportance="Low" />
3644
</Target>
3745

38-
<!--
39-
BuildTools will conditionally restore additional packages, including IBC tools, using the "RestoreOptionalToolingPackages"
40-
target, which runs automatically before "Sync". Since no "Sync" target actually exists, go ahead and define one now so that
41-
the tools are fetched before "Build".
42-
-->
43-
<Target Name="Sync" BeforeTargets="Build" />
44-
45-
<Target Name="RestoreNETCorePlatforms" AfterTargets="Build" Condition="'$(RestoreDuringBuild)'=='true'">
46+
<Target Name="RestoreNETCorePlatforms" Condition="'$(RestoreDuringBuild)'=='true'">
4647
<Exec Command="$(DotnetRestoreCommand) $(SourceDir).nuget/init/init.csproj"
4748
StandardOutputImportance="Low" />
4849
</Target>

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ restore_optdata()
164164

165165
if [[ ( $__SkipRestoreOptData == 0 ) && ( $__isMSBuildOnNETCoreSupported == 1 ) ]]; then
166166
echo "Restoring the OptimizationData package"
167-
"$__ProjectRoot/run.sh" sync -optdata $__UnprocessedBuildArgs
167+
"$__ProjectRoot/run.sh" build -optdata $__RunArgs $__UnprocessedBuildArgs
168168
if [ $? != 0 ]; then
169169
echo "Failed to restore the optimization data package."
170170
exit 1

buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
},
116116
"inputs": {
117117
"filename": "docker",
118-
"arguments": "run --rm $(DockerCommonRunArgs) ./sync.sh",
118+
"arguments": "run --rm $(DockerCommonRunArgs) ./sync.sh -- /p:BuildType=$(PB_BuildType)",
119119
"workingFolder": "",
120120
"failOnStandardError": "false"
121121
}

buildpipeline/DotNet-CoreClr-Trusted-Linux.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
},
116116
"inputs": {
117117
"filename": "docker",
118-
"arguments": "run --rm $(DockerCommonRunArgs) ./sync.sh",
118+
"arguments": "run --rm $(DockerCommonRunArgs) ./sync.sh -- /p:BuildType=$(PB_BuildType)",
119119
"workingFolder": "",
120120
"failOnStandardError": "false"
121121
}

buildpipeline/DotNet-CoreClr-Trusted-Mac.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"inputs": {
3737
"filename": "$(Agent.BuildDirectory)/s/sync.sh",
38-
"arguments": "",
38+
"arguments": " -- /p:BuildType=$(PB_BuildType)",
3939
"workingFolder": "",
4040
"failOnStandardError": "false"
4141
}

buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
},
7878
"inputs": {
7979
"filename": "sync.cmd",
80-
"arguments": "-p",
80+
"arguments": "-p -- /p:BuildType=$(PB_BuildType)",
8181
"workingFolder": "",
8282
"failOnStandardError": "false"
8383
}

buildpipeline/DotNet-CoreClr-Trusted-Windows.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
},
7878
"inputs": {
7979
"filename": "sync.cmd",
80-
"arguments": "-p",
80+
"arguments": "-p -- /p:BuildType=$(PB_BuildType)",
8181
"workingFolder": "",
8282
"failOnStandardError": "false"
8383
}

config.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"values": [ "Windows_NT", "Linux", "Unix", "OSX", "Android" ],
8585
"defaultValue": "${OSName}"
8686
},
87-
"RestoreNETCorePlatforms": {
88-
"description": "MsBuild target that restores the NETCore packages.",
87+
"Sync": {
88+
"description": "MsBuild target that restores the packages.",
8989
"valueType": "target",
9090
"values": [],
9191
"defaultValue": ""
@@ -527,6 +527,13 @@
527527
"settings": {
528528
"Build": "default"
529529
}
530+
},
531+
"optdata": {
532+
"description": "Restores optimization profile data for the repository.",
533+
"settings": {
534+
"Project": "./build.proj",
535+
"RestoreOptData": "default"
536+
}
530537
}
531538
},
532539
"defaultValues": {
@@ -578,21 +585,7 @@
578585
"settings": {
579586
"Project": "./build.proj",
580587
"RestoreDuringBuild": true,
581-
"RestoreNETCorePlatforms": "default"
582-
}
583-
},
584-
"optdata": {
585-
"description": "Restores optimization profile data for the repository.",
586-
"settings": {
587-
"Project": "./build.proj",
588-
"RestoreDuringBuild": true,
589-
"RestoreOptData": "default"
590-
}
591-
},
592-
"priority": {
593-
"description": "Sets CLRTestPriorityToBuild property.",
594-
"settings": {
595-
"CLRTestPriorityToBuild": "default"
588+
"Sync": "default"
596589
}
597590
},
598591
"ab": {
@@ -655,6 +648,12 @@
655648
"settings": {
656649
"BuildNumberMinor": "default"
657650
}
651+
},
652+
"buildType": {
653+
"description": "Sets buildtype.",
654+
"settings": {
655+
"__BuildType": "default"
656+
}
658657
}
659658
},
660659
"defaultValues": {

0 commit comments

Comments
 (0)