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

Commit

Permalink
Split managed build and sharedFramework publish
Browse files Browse the repository at this point in the history
Previously the managed build and shared frameworkPublishing were
happening as part of the same phase.

Split this up so that managed assemblies can be built in parallel with
other binaries and signed at the same time.
  • Loading branch information
ericstj committed May 1, 2017
1 parent 232c08e commit 5faff9a
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 224 deletions.
35 changes: 4 additions & 31 deletions buildpipeline/Core-Setup-Signing-Windows-BT.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Build corehost",
"displayName": "Build binaries",
"timeoutInMinutes": 0,
"task": {
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
Expand All @@ -160,7 +160,7 @@
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Sign HostFxr HostPolicy",
"displayName": "Sign binaries",
"timeoutInMinutes": 0,
"task": {
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
Expand Down Expand Up @@ -214,15 +214,15 @@
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Build managed / publish sharedframework",
"displayName": "Build sharedframework layout",
"timeoutInMinutes": 0,
"task": {
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
"versionSpec": "1.*",
"definitionType": "task"
},
"inputs": {
"solution": "$(PB_SourcesDirectory)\\src\\managed\\dir.proj",
"solution": "$(PB_SourcesDirectory)\\src\\managed\\sharedFramework.proj",
"platform": "$(PB_TargetArchitecture)",
"configuration": "$(BuildConfiguration)",
"msbuildArguments": "$(PB_CommonMSBuildArgs) /flp:v=detailed;LogFile=$(PB_SourcesDirectory)\\sharedframework.log",
Expand Down Expand Up @@ -256,33 +256,6 @@
"failOnStandardError": "false"
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Sign Assemblies: *.dll",
"timeoutInMinutes": 0,
"task": {
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
"versionSpec": "1.*",
"definitionType": "task"
},
"inputs": {
"solution": "$(PB_SourcesDirectory)\\sign.proj",
"platform": "$(PB_TargetArchitecture)",
"configuration": "$(BuildConfiguration)",
"msbuildArguments": "/t:SignAssemblies $(PB_CommonMSBuildArgs) $(MsbuildSigningArguments)",
"clean": "false",
"maximumCpuCount": "false",
"restoreNugetPackages": "false",
"logProjectEvents": "false",
"createLogFile": "false",
"msbuildLocationMethod": "version",
"msbuildVersion": "latest",
"msbuildArchitecture": "x64",
"msbuildLocation": ""
}
},
{
"enabled": true,
"continueOnError": false,
Expand Down
6 changes: 0 additions & 6 deletions sign.proj
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@
<Authenticode>$(CertificateId)</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

<Target Name="SignAssemblies" DependsOnTargets="GetSignAssembliesFiles">
<CallTarget Targets="SignFiles" />
</Target>

<Target Name="GetSignAssembliesFiles">
<ItemGroup>
<FilesToSign Include="$(IntermediateOutputPath)forPackaging/**/*.dll">
<Authenticode>$(CertificateId)</Authenticode>
Expand Down
2 changes: 1 addition & 1 deletion src/dir.proj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<Project Include="$(MSBuildThisFileDirectory)src.builds" />
<Project Include="$(MSBuildThisFileDirectory)pkg/dir.proj" />
<Project Include="$(MSBuildThisFileDirectory)managed/dir.proj" />
<Project Include="$(MSBuildThisFileDirectory)managed/sharedFramework.proj" />
</ItemGroup>

<!-- Tasks from buildtools for easy project.json dependency updates -->
Expand Down
187 changes: 1 addition & 186 deletions src/managed/dir.proj
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

<UsingTask TaskName="ChangeEntryPointLibraryName" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
<UsingTask TaskName="GetBuildArgsByFrameworks" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>

<PropertyGroup>
<BuildTargets>
BuildProjectsForNuGetPackages;
PublishSharedFrameworkAndSharedHost;
GenerateRuntimeGraph;
CopyHostArtifactsToSharedFramework;
GenerateVersionFile;
</BuildTargets>
</PropertyGroup>

<Target Name="Build" DependsOnTargets="$(BuildTargets)" />

<Target Name="BuildProjectsForNuGetPackages">
<Target Name="Build">

<MakeDir Condition="!Exists('$(pOutDir)')" Directories="$(pOutDir)" />

Expand All @@ -41,175 +27,4 @@
<Exec Command="$(DotnetToolCommand) build $(Args) %(buildCmdArgs.Identity)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />
</Target>

<Target Name="PublishSharedFrameworkAndSharedHost"
DependsOnTargets="RestoreLockedCoreHost;GenerateSharedFrameworkProject">

<PropertyGroup>
<RestoreArgs>--fallbacksource $(PackagesOutDir) --packages "$(PackagesDir.TrimEnd('/\'.ToCharArray()))"</RestoreArgs>
</PropertyGroup>

<RemoveDir Directories="$(SharedFrameworkNameAndVersionRoot)" />

<Exec Command="$(DotnetToolCommand) restore --verbosity verbose --disable-parallel --infer-runtimes $(RestoreArgs)"
WorkingDirectory="$(SharedFrameworkSourceRoot)" />

<!-- We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier. -->
<Exec Command="$(DotnetToolCommand) publish --output $(SharedFrameworkNameAndVersionRoot) -r $(TargetRid) $(SharedFrameworkSourceRoot)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />

<!-- Clean deps.json -->
<ChangeEntryPointLibraryName DepsFile="$(SharedFrameworkNameAndVersionRoot)/framework.deps.json" />

<!-- Clean up artifacts that dotnet-publish generates which we don't need -->
<ItemGroup>
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\framework" />
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\framework.exe" />
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\framework.dll" />
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\framework.pdb" />
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\framework.runtimeconfig.json" />
<ToDelete Include="$(SharedFrameworkNameAndVersionRoot)\apphost$(ExeSuffix)" />
</ItemGroup>

<Message Text="To delete: @(ToDelete)" />
<Delete Files="@(ToDelete)" />

<!-- Rename deps file -->
<Move SourceFiles="$(SharedFrameworkNameAndVersionRoot)\framework.deps.json"
DestinationFiles="$(SharedFrameworkNameAndVersionRoot)\$(SharedFrameworkName).deps.json" />

<!-- Copy Muxer -->
<Copy SourceFiles="$(CoreHostLockedDir)dotnet$(ExeSuffix)" DestinationFolder="$(SharedFrameworkPublishDir)" />

<!-- CopyHostFxrToVersionedDirectory -->
<Copy SourceFiles="$(CoreHostLockedDir)$(LibPrefix)hostfxr$(LibSuffix)" DestinationFolder="$(SharedFrameworkPublishDir)\host\fxr\$(HostVersion)" />

<!-- Copy symbols to publish folder -->
<ItemGroup>
<SharedFrameworkSymbols Include="$(PackageSymbolsBinDir)Microsoft.NETCore.App/**/*.pdb" />
<SharedFrameworkSymbols Include="$(PackageSymbolsBinDir)Microsoft.NETCore.App/**/*$(SymbolFileExtension)" />
</ItemGroup>
<RemoveDir Directories="$(SharedFrameworkPublishSymbolsDir)"
Condition="Exists('$(SharedFrameworkPublishSymbolsDir)')" />
<MakeDir Directories="$(SharedFrameworkPublishSymbolsDir)" />
<Copy SourceFiles="@(SharedFrameworkSymbols)" DestinationFolder="$(SharedFrameworkPublishSymbolsDir)" />
</Target>

<Target Name="GenerateVersionFile"
DependsOnTargets="GetLatestCommitHash">

<!-- Generate .version file -->
<ItemGroup>
<VersionLines Include="$(LatestCommit)" />
<VersionLines Include="$(HostFullVersion)" />
</ItemGroup>

<WriteLinesToFile
File="$(SharedFrameworkNameAndVersionRoot)\.version"
Lines="@(VersionLines)"
Overwrite="true" />
</Target>

<Target Name="CopyHostArtifactsToSharedFramework">
<ItemGroup>
<HostArtifacts Include="$(CoreHostLockedDir)dotnet$(ExeSuffix)" />
<HostArtifacts Include="$(CoreHostLockedDir)$(DotnetHostFxrBaseName)" />
<!-- Hostpolicy should be the latest and not the locked version as it is supposed to evolve for -->
<!-- the framework and has a tight coupling with coreclr's API in the framework. -->
<HostArtifacts Include="$(CoreHostOutputDir)\$(HostPolicyBaseName)" />
</ItemGroup>
<Copy SourceFiles="@(HostArtifacts)" DestinationFolder="$(SharedFrameworkNameAndVersionRoot)" />
</Target>

<Target Name="GenerateRuntimeGraph">
<PropertyGroup>
<runtimeGraphGeneratorName>DepsProcessor</runtimeGraphGeneratorName>
<runtimeGraphGeneratorProject>$(ProjectDir)tools-local/setuptools/independent/$(runtimeGraphGeneratorName)</runtimeGraphGeneratorProject>
<runtimeGraphGeneratorOutput>$(IntermediateOutputRootPath)setuptools/independent/$(runtimeGraphGeneratorName)</runtimeGraphGeneratorOutput>
<runtimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='Windows_NT'">win</runtimeGraphGeneratorRuntime>
<runtimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='OSX'">osx</runtimeGraphGeneratorRuntime>
<runtimeGraphGeneratorRuntime Condition="'$(runtimeGraphGeneratorRuntime)'==''">linux</runtimeGraphGeneratorRuntime>
</PropertyGroup>

<Exec Command="$(DotnetToolCommand) publish --output $(runtimeGraphGeneratorOutput) $(runtimeGraphGeneratorProject) "
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />

<PropertyGroup>
<RuntimeGraphGeneratorExe>$(runtimeGraphGeneratorOutput)/$(runtimeGraphGeneratorName)$(ExeSuffix)</RuntimeGraphGeneratorExe>
<DepsJson>$(SharedFrameworkNameAndVersionRoot)\$(SharedFrameworkName).deps.json</DepsJson>

</PropertyGroup>

<Exec Command="$(RuntimeGraphGeneratorExe) --project $(SharedFrameworkSourceRoot) --deps $(DepsJson) $(runtimeGraphGeneratorRuntime)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />
</Target>

<Target Name="RestoreLockedCoreHost">
<ItemGroup>
<ProjJsonLines Include='{' />
<ProjJsonLines Include=' "dependencies": {' />
<ProjJsonLines Include=' "Microsoft.NETCore.DotNetHostResolver" : "$(HostFullVersion)",' />
<ProjJsonLines Include=' "Microsoft.NETCore.DotNetHost" : "$(HostFullVersion)"' />
<ProjJsonLines Include=' },' />
<ProjJsonLines Include=' "frameworks": {' />
<ProjJsonLines Include=' "$(Framework)": {}' />
<ProjJsonLines Include=' },' />
<ProjJsonLines Include=' "runtimes": {' />
<ProjJsonLines Include=' "$(PackageTargetRid)": {}' />
<ProjJsonLines Include=' }' />
<ProjJsonLines Include='}' />
</ItemGroup>

<PropertyGroup>
<JsonDir>$(IntermediateOutputRootPath)lockedHostTemp</JsonDir>
</PropertyGroup>

<MakeDir Condition="!Exists('$(JsonDir)')" Directories="$(JsonDir)" />

<WriteLinesToFile
File="$(JsonDir)\project.json"
Lines="@(ProjJsonLines)"
Overwrite="true" />

<PropertyGroup>
<RestoreArgs>--source https:%2F%2Fdotnet.myget.org/F/dotnet-core/api/v3/index.json --fallbacksource $(PackagesOutDir) --packages "$(PackagesDir.TrimEnd('/\'.ToCharArray()))"</RestoreArgs>
</PropertyGroup>

<Exec Command="$(DotnetToolCommand) restore --verbosity verbose $(RestoreArgs)"
WorkingDirectory="$(JsonDir)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />

<PropertyGroup>
<PublishArgs>--output $(CoreHostLockedDir) --no-build -r $(PackageTargetRid)</PublishArgs>
</PropertyGroup>

<RemoveDir Directories="$(CoreHostLockedDir)" />

<Exec Command="$(DotnetToolCommand) publish $(PublishArgs)"
WorkingDirectory="$(JsonDir)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />
</Target>

<Target Name="GenerateSharedFrameworkProject">

<MakeDir Condition="!Exists('$(IntermediateOutputRootPath)sharedFramework')"
Directories="$(IntermediateOutputRootPath)sharedFramework;$(SharedFrameworkSourceRoot)" />

<ItemGroup>
<SharedFrameworkFiles Include="$(MSBuildThisFileDirectory)sharedframework\**\*.cs" />
</ItemGroup>
<PropertyGroup>
<SharedFrameworkTemplate>$(MSBuildThisFileDirectory)sharedframework\framework\project.json.template</SharedFrameworkTemplate>
</PropertyGroup>

<Copy SourceFiles="@(SharedFrameworkFiles)" DestinationFolder="$(SharedFrameworkSourceRoot)"/>

<ReplaceFileContents
InputFile="$(SharedFrameworkTemplate)"
DestinationFile="$(SharedFrameworkSourceRoot)\project.json"
ReplacementPatterns="%24(NetCoreAppVersion);%24(RID);%24(TargetFramework)"
ReplacementStrings="$(HostFullVersion);$(TargetRid);$(Framework)" />

</Target>

</Project>
Loading

0 comments on commit 5faff9a

Please sign in to comment.