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

Commit 6c45610

Browse files
authored
Merge pull request #17268 from weshaggard/Fix21OptDataSourceBuild
[release/2.1] Fix opt data for source build
2 parents f284e8f + 50d062a commit 6c45610

11 files changed

+38
-46
lines changed

build.cmd

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

338338
if %__RestoreOptData% EQU 1 if %__BuildTypeRelease% EQU 1 (
339339
echo %__MsgPrefix%Restoring the OptimizationData Package
340-
@call %__ProjectDir%\run.cmd sync -optdata
340+
@call %__ProjectDir%\run.cmd build -optdata %__RunArgs% %__UnprocessedBuildArgs%
341341
if not !errorlevel! == 0 (
342342
echo %__MsgPrefix%Error: Failed to restore the optimization data package.
343343
exit /b 1

build.proj

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

29-
<Target Name="RestoreOptData">
30-
<PropertyGroup>
31-
<OptDataRestoreCommand>"$(DotnetToolCommand)"</OptDataRestoreCommand>
32-
<OptDataRestoreCommand>$(OptDataRestoreCommand) restore</OptDataRestoreCommand>
33-
<OptDataRestoreCommand>$(OptDataRestoreCommand) --packages "$(PackagesDir.TrimEnd('/').TrimEnd('\'))"</OptDataRestoreCommand>
34-
</PropertyGroup>
35-
<Exec Command="$(OptDataRestoreCommand) $(SourceDir).nuget/optdata/optdata.csproj"
36-
StandardOutputImportance="Low" />
37-
</Target>
38-
3929
<!--
4030
BuildTools will conditionally restore additional packages, including IBC tools, using the "RestoreOptionalToolingPackages"
4131
target, which runs automatically before "Sync". Since no "Sync" target actually exists, go ahead and define one now so that
4232
the tools are fetched before "Build".
4333
-->
44-
<Target Name="Sync" BeforeTargets="Build" />
34+
<Target Name="Sync" BeforeTargets="Build"
35+
DependsOnTargets="RestoreOptData;RestoreNETCorePlatforms" />
4536

46-
<Target Name="RestoreNETCorePlatforms" AfterTargets="Build" Condition="'$(RestoreDuringBuild)'=='true'">
37+
<Target Name="RestoreOptData" Condition="'$(RestoreDuringBuild)'=='true' and '$(BuildType)'=='Release'">
38+
<PropertyGroup>
39+
<_OptimizationDataFeed Condition="'$(DotNetBuildOffline)' != 'true'">--source https://dotnet.myget.org/F/dotnet-core-optimization-data/api/v3/index.json</_OptimizationDataFeed>
40+
</PropertyGroup>
41+
42+
<Exec Command="$(DotnetRestoreCommand) $(_OptimizationDataFeed) $(SourceDir).nuget/optdata/optdata.csproj"
43+
StandardOutputImportance="Low" />
44+
</Target>
45+
46+
<Target Name="RestoreNETCorePlatforms" Condition="'$(RestoreDuringBuild)'=='true'">
4747
<Exec Command="$(DotnetRestoreCommand) $(SourceDir).nuget/init/init.csproj"
4848
StandardOutputImportance="Low" />
4949
</Target>
@@ -52,5 +52,5 @@
5252
<Message Condition="Exists($(RootBinDir))" Importance="High" Text="Removing $(RootBinDir)"/>
5353
<RemoveDir Directories="$(RootBinDir)" />
5454
</Target>
55-
55+
5656
</Project>

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
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: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"valueType": "target",
5454
"values": [],
5555
"defaultValue": ""
56-
},
56+
},
5757
"ContainerName": {
5858
"description": "Container name for Azure upload.",
5959
"valueType": "property",
@@ -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,14 @@
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+
"MsBuildEventLogging": " ",
537+
}
530538
}
531539
},
532540
"defaultValues": {
@@ -578,15 +586,7 @@
578586
"settings": {
579587
"Project": "./build.proj",
580588
"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"
589+
"Sync": "default"
590590
}
591591
},
592592
"ab": {
@@ -649,6 +649,12 @@
649649
"settings": {
650650
"BuildNumberMinor": "default"
651651
}
652+
},
653+
"buildType": {
654+
"description": "Sets buildtype.",
655+
"settings": {
656+
"__BuildType": "default"
657+
}
652658
}
653659
},
654660
"defaultValues": {

src/.nuget/optdata/nuget.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)