Skip to content

Commit

Permalink
WIP: Enable source-build through arcade
Browse files Browse the repository at this point in the history
This enables 'source-build', which makes it easier to build the entire
shipping .NET SDK from source.

This is the first and second step of arcade-powered-source-build:
https://github.com/dotnet/source-build/blob/master/Documentation/planning/arcade-powered-source-build/README.md

See dotnet/sourcelink#692 for a similar PR, that this is based on.

The `LICENSE` to `LICENSE.txt` rename is hack to work around
NuGet/Home#7601 for now.
  • Loading branch information
omajid committed Feb 12, 2021
1 parent 15ab783 commit 899113c
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 2 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion build.cmd
@@ -1,2 +1,2 @@
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -projects """%~dp0illink.sln""" -restore -build %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -13,4 +13,4 @@ while [[ -h $source ]]; do
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/common/build.sh" --projects "$scriptroot/illink.sln" --build --restore $@
"$scriptroot/eng/common/build.sh" --build --restore $@
17 changes: 17 additions & 0 deletions eng/Build.props
@@ -0,0 +1,17 @@
<Project>
<ItemGroup>

<ProjectToBuild Include="$(RepoRoot)src\linker\Mono.Linker.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\ILLink.Tasks\ILLink.Tasks.csproj" />
<ProjectToBuild Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(RepoRoot)test\Mono.Linker.Tests\Mono.Linker.Tests.csproj" />
<ProjectToBuild Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(RepoRoot)test\Mono.Linker.Tests.Cases\Mono.Linker.Tests.Cases.csproj" />
<ProjectToBuild Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(RepoRoot)test\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj" />
<ProjectToBuild Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(RepoRoot)src\analyzer\analyzer.csproj" />
<ProjectToBuild Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(RepoRoot)test\ILLink.Tasks.Tests\ILLink.Tasks.Tests.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\ILLink.RoslynAnalyzer\ILLink.RoslynAnalyzer.csproj" />
<ProjectToBuild Include="$(RepoRoot)test\ILLink.RoslynAnalyzer.Tests\ILLink.RoslynAnalyzer.Tests.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\linker\ref\Mono.Linker.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\tlens\tlens.csproj" />

</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions eng/SourceBuild.props
@@ -0,0 +1,8 @@
<Project>

<PropertyGroup>
<GitHubRepositoryName>linker</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

</Project>
5 changes: 5 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
@@ -0,0 +1,5 @@
<UsageData>
<IgnorePatterns>
<UsagePattern IdentityGlob="*/*" />
</IgnorePatterns>
</UsageData>
5 changes: 5 additions & 0 deletions eng/Version.Details.xml
Expand Up @@ -6,6 +6,7 @@
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21105.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fc83e59329203724d4a63c4f6c843be62983a35e</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.21105.5">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand All @@ -14,6 +15,10 @@
<Dependency Name="Microsoft.NET.Sdk.IL" Version="6.0.0-preview.2.21108.2">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>a66b4e3bf5e3c5ecb2e9fba771f69b177bd3844e</Sha>
<!--
This would introduce a cyclic dependency, so it's explictly not enabled for now
<SourceBuild RepoName="runtime" />
-->
</Dependency>
</ToolsetDependencies>
</Dependencies>
17 changes: 17 additions & 0 deletions eng/azure-pipelines.yml
Expand Up @@ -44,6 +44,8 @@ stages:
testResultsFormat: vstest
enablePublishBuildAssets: true # generate build manifests and publish to BAR in internal builds
enableMicrobuild: true # only affects internal builds
# See https://github.com/dotnet/source-build/issues/2049
# enableSourceBuild: true

jobs:

Expand Down Expand Up @@ -84,6 +86,21 @@ stages:
${{ if eq(variables.officialBuild, 'true') }}:
displayName: Build and publish illink.sln $(_BuildConfig)

- job: SourceBuild_Managed
displayName: Source-Build (Managed)
pool:
vmImage: ubuntu-20.04
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343'
workspace:
clean: all
variables:
- name: _BuildConfig
value: Release
steps:
- checkout: self
submodules: true
- template: /eng/common/templates/steps/source-build.yml

- ${{ if eq(variables.officialBuild, 'false') }}:
- job: Linux
condition: eq(variables.officialBuild, 'false')
Expand Down
2 changes: 2 additions & 0 deletions src/linker/Mono.Linker.csproj
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- This apphost is not necessary for source-build. Remove it to avoid a prebuilt. See https://github.com/dotnet/source-build/issues/1905 -->
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<Nullable>disable</Nullable>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
Expand Down

0 comments on commit 899113c

Please sign in to comment.