Skip to content

Commit 8982c16

Browse files
authored
Add capture and re-build of reference-only packages to eliminate prebuilts (#800)
* Add task to copy reference only packages after source build. Repack reference only packages at tarball build time. * Build newtonsoft-json for net45 target * Build reference assemblies first on tarball build * Copy packages to staging directory, not packages directory * Setup scripts to run ildasm/ilasm on dlls * Rename target and re-order nuget sources * Renames and cleanup * Changes based on PR feedback. * Exclude all dlls from problematic package * Change reference assemblies to build first, before tools restore * Separate dlls and source in the reference-packages output directory * Remove previous change to split src and dll dir and add df commands to check drive space * Shorten path name to reference packages to fix path length issue. * Write IL output to temp file to work around long filename issue with ildasm * Re-order build of leak detection to before removal of reference packages * Fix linker repo usage of old version of Microsoft.NETCore.App * Exclude reference-only packages from prebuilt report * Update prebuilt reports * Updates based on PR comments * Remove newly created temporary directory, not the whole /tmp/ dir.
1 parent a5c9d9d commit 8982c16

14 files changed

+336
-146
lines changed

build-source-tarball.sh

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ mkdir -p $TARBALL_ROOT/prebuilt/source-built
119119
find $SCRIPT_ROOT/packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/prebuilt/nuget-packages/ \;
120120
find $SCRIPT_ROOT/bin/obj/x64/Release/nuget-packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/prebuilt/nuget-packages/ \;
121121

122+
# Copy reference-packages from bin dir to reference-packages directory.
123+
# See corresponding change in dir.props to change ReferencePackagesBasePath conditionally in offline build.
124+
mkdir -p $TARBALL_ROOT/reference-packages
125+
cp -r $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/source $TARBALL_ROOT/reference-packages/source
126+
cp -r $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/staging $TARBALL_ROOT/reference-packages/staging
127+
122128
if [ -e $SCRIPT_ROOT/testing-smoke/smoke-test-packages ]; then
123129
cp -rf $SCRIPT_ROOT/testing-smoke/smoke-test-packages $TARBALL_ROOT/prebuilt
124130
fi
@@ -142,6 +148,21 @@ do
142148
cp $built_package $TARBALL_ROOT/prebuilt/source-built/
143149
done
144150

151+
if [ $INCLUDE_LEAK_DETECTION -eq 1 ]; then
152+
echo 'Building leak detection MSBuild tasks...'
153+
./Tools/dotnetcli/dotnet restore $SCRIPT_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj --source $FULL_TARBALL_ROOT/prebuilt/source-built --source $FULL_TARBALL_ROOT/prebuilt/nuget-packages
154+
./Tools/dotnetcli/dotnet publish -o $FULL_TARBALL_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection $SCRIPT_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj
155+
fi
156+
157+
echo 'Removing reference-only packages from tarball prebuilts...'
158+
159+
for ref_package in $(find $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/packages-to-delete/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]')
160+
do
161+
if [ -e $TARBALL_ROOT/prebuilt/nuget-packages/$(basename $ref_package) ]; then
162+
rm $TARBALL_ROOT/prebuilt/nuget-packages/$(basename $ref_package)
163+
fi
164+
done
165+
145166
echo 'WORKAROUND: Overwriting the source-built roslyn-tools MSBuild files with prebuilt so that roslyn-tools can successfully build in the tarball... (https://github.com/dotnet/source-build/issues/654)'
146167

147168
ROSLYN_TOOLS_PACKAGE='RoslynTools.RepoToolset'
@@ -163,12 +184,6 @@ SOURCE_BUILT_SDK_TOOLS_DIR="$TARBALL_ROOT/Tools/source-built/$ROSLYN_TOOLS_PACKA
163184
cp "$REPO_TOOLSET_PACKAGE_DIR/tools/"*.props "$SOURCE_BUILT_SDK_TOOLS_DIR"
164185
cp "$REPO_TOOLSET_PACKAGE_DIR/tools/"*.targets "$SOURCE_BUILT_SDK_TOOLS_DIR"
165186

166-
if [ $INCLUDE_LEAK_DETECTION -eq 1 ]; then
167-
echo 'Building leak detection MSBuild tasks...'
168-
./Tools/dotnetcli/dotnet restore $SCRIPT_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj --source $FULL_TARBALL_ROOT/prebuilt/source-built --source $FULL_TARBALL_ROOT/prebuilt/nuget-packages
169-
./Tools/dotnetcli/dotnet publish -o $FULL_TARBALL_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection $SCRIPT_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj
170-
fi
171-
172187
echo 'Recording commits for the source-build repo and all submodules, to aid in reproducibility...'
173188

174189
cat >$TARBALL_ROOT/source-build-info.txt << EOF

build.proj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Import Project="dir.props" />
44

55
<UsingTask AssemblyFile="$(LeakDetectionTasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.dll" TaskName="CheckForPoison" />
6+
<UsingTask AssemblyFile="$(TasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.dll" TaskName="CopyReferenceOnlyPackages" />
67

78
<Target Name="Build" DependsOnTargets="PrepareOutput;InitBuild">
89
<Message Text="Build Environment: $(Platform) $(Configuration) $(TargetOS) $(TargetRid)" />
@@ -30,6 +31,62 @@
3031
<RemoveDir Directories="$(BaseOutputPath)" />
3132
</Target>
3233

34+
<Target Name="CopyAndDisassembleReferenceOnlyPackages"
35+
AfterTargets="Build"
36+
Condition="'$(OfflineBuild)' != 'true'">
37+
38+
<CopyReferenceOnlyPackages
39+
PackageCacheDir="$(PackagesDir)"
40+
DllDestinationDir="$(ReferencePackagesSourceDir)"
41+
IdentifiedPackagesDir="$(ReferencePackagesToDeleteDir)"
42+
DestinationDir="$(ReferencePackagesStagingDir)"
43+
/>
44+
45+
<!-- Ildasm has trouble writing to paths that are longer than 260 chars. (see https://github.com/dotnet/coreclr/issues/20397)
46+
Create a temporary path to write il output which will then be copied back to the reference-packages/source dir.
47+
-->
48+
<PropertyGroup>
49+
<TempPath>$([System.IO.Path]::GetTempPath())</TempPath>
50+
<IldasmTempOutputFolderName>$([System.IO.Path]::GetRandomFileName())</IldasmTempOutputFolderName>
51+
<IldasmTempOutputPath>$([System.IO.Path]::Combine($(TempPath),$(IldasmTempOutputFolderName)))/</IldasmTempOutputPath>
52+
</PropertyGroup>
53+
54+
<ItemGroup>
55+
<ReferenceOnlyPackages Include="$(ReferencePackagesToDeleteDir)**/*.nupkg" />
56+
<ReferenceOnlyPackageDlls Include="$(ReferencePackagesSourceDir)**/*.dll" />
57+
</ItemGroup>
58+
59+
<!-- Temporary workaround to exclude dlls that can't be round-tripped. See: https://github.com/dotnet/coreclr/issues/20262
60+
They'll end up in the source directory as dlls for now
61+
-->
62+
<ItemGroup>
63+
<ReferenceOnlyPackageDlls Remove="$(ReferencePackagesSourceDir)**/System.Runtime.dll" />
64+
<ReferenceOnlyPackageDlls Remove="$(ReferencePackagesSourceDir)**/netstandard.dll" />
65+
</ItemGroup>
66+
<!-- End Temporary workaround -->
67+
68+
<Message Importance="High" Text="Reference-only Packages:" />
69+
<Message Importance="High" Text="%(ReferenceOnlyPackages.Identity)" />
70+
71+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Disassembling @(ReferenceOnlyPackageDlls->Count()) dlls" />
72+
<MakeDir Directories="$(IldasmTempOutputPath)%(ReferenceOnlyPackageDlls.RecursiveDir)" />
73+
<Exec Command="$(IldasmPath) %(ReferenceOnlyPackageDlls.Identity) -all -out=$(IldasmTempOutputPath)%(ReferenceOnlyPackageDlls.RecursiveDir)%(ReferenceOnlyPackageDlls.Filename).il" />
74+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Disassembly done." />
75+
76+
<ItemGroup>
77+
<IlSourceFiles Include="$(IldasmTempOutputPath)/**/*.il" />
78+
</ItemGroup>
79+
80+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Copying @(IlSourceFiles->Count()) IL source files" />
81+
<Copy SourceFiles="@(IlSourceFiles)" DestinationFiles="$(ReferencePackagesSourceDir)%(IlSourceFiles.RecursiveDir)%(IlSourceFiles.Filename).il" />
82+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Copying IL source files done." />
83+
84+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Deleting disassembled dlls and temp il source" />
85+
<Delete Files="@(ReferenceOnlyPackageDlls)" />
86+
<RemoveDir Directories="$(IldasmTempOutputPath)" />
87+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Deleting disassembled dlls and temp il source done." />
88+
</Target>
89+
3390
<!-- After building, generate a prebuilt usage report. -->
3491
<Target Name="ReportPrebuiltUsage"
3592
AfterTargets="Build"

dir.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<BaseOutputPath>$(ProjectDir)bin/</BaseOutputPath>
4545
<ToolsDir>$(ProjectDir)Tools/</ToolsDir>
4646
<ToolPackageExtractDir>$(ToolsDir)source-built/</ToolPackageExtractDir>
47+
<IldasmPath>$(ToolsDir)ilasm/ildasm</IldasmPath>
4748
<ToolsLocalDir>$(ProjectDir)tools-local/</ToolsLocalDir>
4849
<TaskDirectory>$(ToolsLocalDir)tasks/</TaskDirectory>
4950
<TasksBinDir>$(TaskDirectory)Microsoft.DotNet.SourceBuild.Tasks/bin/Debug/netstandard1.5/</TasksBinDir>
@@ -80,6 +81,17 @@
8081
<ProdConManifestFile>$(PackageReportDir)prodcon-build.xml</ProdConManifestFile>
8182
<PoisonedReportFile>$(PackageReportDir)poisoned.txt</PoisonedReportFile>
8283
<ConflictingPackageReportDir>$(BaseOutputPath)conflict-report/</ConflictingPackageReportDir>
84+
<ReferencePackagesBaseDir>$(IntermediatePath)reference-packages/</ReferencePackagesBaseDir>
85+
<!--
86+
Change ReferencePackagesBaseDir conditionally in offline build.
87+
See corresponding change in build-source-tarball.sh to copy reference-packages
88+
from source-build bin dir to tarball reference-packages dir.
89+
-->
90+
<ReferencePackagesBaseDir Condition="'$(OfflineBuild)' == 'true'">$(ProjectDir)reference-packages/</ReferencePackagesBaseDir>
91+
<ReferencePackagesStagingDir>$(ReferencePackagesBaseDir)staging/</ReferencePackagesStagingDir>
92+
<ReferencePackagesSourceDir>$(ReferencePackagesBaseDir)source/</ReferencePackagesSourceDir>
93+
<ReferencePackagesDir>$(ReferencePackagesBaseDir)packages/</ReferencePackagesDir>
94+
<ReferencePackagesToDeleteDir>$(ReferencePackagesBaseDir)packages-to-delete/</ReferencePackagesToDeleteDir>
8395
</PropertyGroup>
8496

8597
<!-- Import Build tools common props file where repo-independent properties are found -->
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From c884d2eeacddbb3a09b8b2bac3c132ff3b3b63e4 Mon Sep 17 00:00:00 2001
2+
From: dseefeld <dseefeld@microsoft.com>
3+
Date: Mon, 15 Oct 2018 19:18:18 +0000
4+
Subject: [PATCH] Update linker to use 2.0.0 runtime
5+
6+
This patch changes the RuntimeFrameworkVersion because the beta-001509-00
7+
version causes issues with ildasm/ilasm round trip of reference-only
8+
packages.
9+
---
10+
linker/ILLink.props | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/linker/ILLink.props b/linker/ILLink.props
14+
index db2a8a8..b24b882 100644
15+
--- a/linker/ILLink.props
16+
+++ b/linker/ILLink.props
17+
@@ -3,7 +3,7 @@
18+
<PropertyGroup>
19+
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
20+
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
21+
- <RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
22+
+ <RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
23+
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
24+
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
25+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
26+
--
27+
1.8.3.1
28+

patches/newtonsoft-json/0001-Run-dotnet-migrate-to-generate-Newtonsoft.Json.Dotne.patch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ new file mode 100644
1818
index 0000000..797f637
1919
--- /dev/null
2020
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Dotnet.csproj
21-
@@ -0,0 +1,137 @@
21+
@@ -0,0 +1,138 @@
2222
+<Project Sdk="Microsoft.NET.Sdk">
2323
+
2424
+ <PropertyGroup>
@@ -53,6 +53,7 @@ index 0000000..797f637
5353
+ <Reference Include="System.Xml.Linq" />
5454
+ <Reference Include="System" />
5555
+ <Reference Include="Microsoft.CSharp" />
56+
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-alpha-003" PrivateAssets="all"/>
5657
+ </ItemGroup>
5758
+
5859
+ <ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 6b3d2eed17b5e2e5627f968e6762f9396302144e Mon Sep 17 00:00:00 2001
2+
From: dseefeld <dseefeld@microsoft.com>
3+
Date: Tue, 25 Sep 2018 16:49:22 +0000
4+
Subject: [PATCH] Add roslyn-tools to nuget.config
5+
6+
---
7+
Src/NuGet.Config | 3 ++-
8+
1 file changed, 2 insertions(+), 1 deletion(-)
9+
10+
diff --git a/Src/NuGet.Config b/Src/NuGet.Config
11+
index 3e0a4cf..d12d36f 100644
12+
--- a/Src/NuGet.Config
13+
+++ b/Src/NuGet.Config
14+
@@ -4,7 +4,8 @@
15+
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
16+
<clear />
17+
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
18+
+ <add key="roslyn-tools" value="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json" />
19+
<!--<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />-->
20+
<add key="NuGet.org (v3)" value="https://api.nuget.org/v3/index.json" />
21+
</packageSources>
22+
-</configuration>
23+
\ No newline at end of file
24+
+</configuration>
25+
--
26+
1.8.3.1
27+

repos/cli.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<SourceOverrideRepoApiImplemented>true</SourceOverrideRepoApiImplemented>
4848

4949
<EnvironmentExternalRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentExternalRestoreSources>
50-
<EnvironmentExternalRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentExternalRestoreSources)%3B$(PrebuiltPackagesPath)</EnvironmentExternalRestoreSources>
50+
<EnvironmentExternalRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentExternalRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentExternalRestoreSources>
5151
</PropertyGroup>
5252

5353
<ItemGroup>

repos/dir.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
SourcePath="$(PrebuiltSourceBuiltPackagesPath)"
146146
Condition="'$(OfflineBuild)' == 'true'" />
147147

148+
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
149+
SourceName="reference-packages"
150+
SourcePath="$(ReferencePackagesDir)"
151+
Condition="'$(OfflineBuild)' == 'true'" />
152+
148153
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
149154
SourceName="source-built"
150155
SourcePath="$(SourceBuiltPackagesPath)" />
@@ -215,6 +220,7 @@
215220
BeforeTargets="Build">
216221
<ItemGroup>
217222
<_DotNetRestoreSources Include="$(SourceBuiltPackagesPath)" />
223+
<_DotNetRestoreSources Include="$(ReferencePackagesDir)" Condition="'$(OfflineBuild)' == 'true'"/>
218224
<_DotNetRestoreSources Include="$(PrebuiltPackagesPath)" Condition="'$(OfflineBuild)' == 'true'"/>
219225
<_DotNetRestoreSources Include="$(PrebuiltSourceBuiltPackagesPath)" Condition="'$(OfflineBuild)' == 'true'"/>
220226
</ItemGroup>
@@ -374,6 +380,7 @@
374380
<TarballPrebuiltPackageFiles Include="$(PrebuiltPackagesPath)*.nupkg" />
375381

376382
<SourceBuiltPackageFiles Include="$(SourceBuiltBlobFeedDir)**/*.nupkg" />
383+
<ReferencePackageFiles Condition="'$(OfflineBuild)' == 'true'" Include="$(ReferencePackagesDir)**/*.nupkg" />
377384

378385
<!-- Check all RIDs from all restored Microsoft.NETCore.Platforms packages. -->
379386
<PlatformsRuntimeJsonFiles Include="$(LocalNuGetPackagesRoot)*/microsoft.netcore.platforms/*/runtime.json" />
@@ -389,6 +396,7 @@
389396
RestoredPackageFiles="@(AllRestoredPackageFiles)"
390397
TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFiles)"
391398
SourceBuiltPackageFiles="@(SourceBuiltPackageFiles)"
399+
ReferencePackageFiles="@(ReferencePackageFiles)"
392400
PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFiles)"
393401
TargetRid="$(TargetRid)"
394402
ProjectDirectories="@(ProjectDirectories)"

support/tarball/build.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ export NUGET_PACKAGES="$SCRIPT_ROOT/packages/"
1313

1414
MSBUILD_ARGUMENTS=("/p:OfflineBuild=true" "/flp:v=detailed" "/clp:v=detailed")
1515

16+
echo "Rebuild reference assemblies"
17+
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$CLI_VERSION/MSBuild.dll $SCRIPT_ROOT/tools-local/init-build.proj /t:BuildReferenceAssemblies ${MSBUILD_ARGUMENTS[@]} "$@"
18+
1619
echo "Expanding BuildTools dependencies into packages directory..."
1720
# init-tools tries to copy from its script directory to Tools, which in this case is a copy to
1821
# itself. This is an error. To avoid the error, use a temp dir that we immediately delete.
1922
TEMP_TOOLS_DIR="$SCRIPT_ROOT/ToolsTemp"
2023
PREBUILT_PACKAGE_SOURCE="$SCRIPT_ROOT/prebuilt/nuget-packages"
24+
REF_PACKAGE_SOURCE="$SCRIPT_ROOT/reference-packages/packages"
2125
(
2226
# Log the commands that run.
2327
set -x
2428

25-
"$CLI_ROOT/dotnet" restore "$SCRIPT_ROOT/init-tools.msbuild" --no-cache --packages "$SCRIPT_ROOT/packages" --source "$PREBUILT_PACKAGE_SOURCE" || exit $?
29+
"$CLI_ROOT/dotnet" restore "$SCRIPT_ROOT/init-tools.msbuild" --no-cache --packages "$SCRIPT_ROOT/packages" --source "$PREBUILT_PACKAGE_SOURCE" --source "$REF_PACKAGE_SOURCE" || exit $?
2630

27-
export __INIT_TOOLS_RESTORE_ARGS="--source $PREBUILT_PACKAGE_SOURCE" || exit $?
31+
export __INIT_TOOLS_RESTORE_ARGS="--source $PREBUILT_PACKAGE_SOURCE --source $REF_PACKAGE_SOURCE" || exit $?
2832
"$SCRIPT_ROOT/Tools/init-tools.sh" "$SCRIPT_ROOT" "$SCRIPT_ROOT/Tools/dotnetcli/dotnet" "$TEMP_TOOLS_DIR" "$SCRIPT_ROOT/packages" || exit $?
2933

3034
rm -rf "$TEMP_TOOLS_DIR" || exit $?

tools-local/init-build.proj

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<GeneratingStaticPropertiesFile>true</GeneratingStaticPropertiesFile>
66
</PropertyGroup>
77
<Import Project="..\dir.props" />
8+
<Import Project="$(ToolsDir)Packaging.targets" />
9+
<Import Project="$(ToolsDir)IL.targets" />
810

911
<UsingTask AssemblyFile="$(TasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.dll" TaskName="GetHostInformation" />
1012
<UsingTask AssemblyFile="$(LeakDetectionTasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.dll" TaskName="MarkAndCatalogPackages" />
@@ -33,9 +35,9 @@
3335

3436
<Target Name="BuildTasks">
3537
<PropertyGroup Condition="'$(OfflineBuild)' == 'true'">
36-
<OfflineSources>$(PrebuiltPackagesPath)</OfflineSources>
38+
<OfflineSources>$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</OfflineSources>
3739
</PropertyGroup>
38-
<Exec Command="$(DotNetCliToolDir)dotnet build tasks\Microsoft.DotNet.SourceBuild.Tasks\Microsoft.DotNet.SourceBuild.Tasks.csproj /p:RestoreSources=$(OfflineSources)" />
40+
<Exec Command="$(DotNetCliToolDir)dotnet build tasks\Microsoft.DotNet.SourceBuild.Tasks\Microsoft.DotNet.SourceBuild.Tasks.csproj /p:RestoreSources='$(OfflineSources)'" />
3941
</Target>
4042

4143
<Target Name="GetRepoProjects">
@@ -67,6 +69,35 @@
6769
<Exec Condition="'$(Platform)' == 'armel'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/armel/tizen-build-rootfs.sh" />
6870
</Target>
6971

72+
<Target Name="BuildReferenceAssemblies" Condition="'$(OfflineBuild)' == 'true'">
73+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building reference-only assemblies." />
74+
<ItemGroup>
75+
<IlSource Include="$(ReferencePackagesSourceDir)**/*.il" />
76+
<ReferenceAssemblyDirectories Include ="$(ReferencePackagesStagingDir)/**/*.nuspec" />
77+
</ItemGroup>
78+
79+
<MakeDir Directories="$(ReferencePackagesStagingDir)%(IlSource.RecursiveDir)" />
80+
<Exec Command="$(IlasmToolPath) %(IlSource.Identity) -dll -quiet -nologo -output=$(ReferencePackagesStagingDir)%(IlSource.RecursiveDir)%(IlSource.Filename).dll" />
81+
82+
<!-- Temporary workaround to copy dlls that can't be round-tripped
83+
They just get copied from the source to the package staging area
84+
-->
85+
<ItemGroup>
86+
<DllsInSource Include="$(ReferencePackagesSourceDir)**/*.dll" />
87+
</ItemGroup>
88+
<Copy SourceFiles="%(DllsInSource.Identity)" DestinationFiles="$(ReferencePackagesStagingDir)%(DllsInSource.RecursiveDir)%(DllsInSource.Filename).dll" />
89+
90+
<!-- End Temporary workaround -->
91+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done building reference-only assemblies." />
92+
93+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packing reference-only packages." />
94+
<NugetPack Nuspecs="%(ReferenceAssemblyDirectories.Identity)"
95+
OutputDirectory="$(ReferencePackagesDir)"
96+
ExcludeEmptyDirectories="false"
97+
CreateSymbolPackage="false" />
98+
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done packing reference-only packages." />
99+
</Target>
100+
70101
<Target Name="WriteDynamicPropsToStaticPropsFiles">
71102
<GetHostInformation Condition="'$(TargetRid)' == ''">
72103
<Output PropertyName="TargetRid" TaskParameter="Rid" />

0 commit comments

Comments
 (0)