Skip to content

Commit

Permalink
[build] Use arcade dependency management (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcollins authored Apr 15, 2021
1 parent 032a50d commit 45dd0ed
Show file tree
Hide file tree
Showing 16 changed files with 103 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
]
}
}
}
}
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="eng\Version.props" />
<Import Project="eng\Versions.props" />
<PropertyGroup>
<BuildForWinUI Condition="'$(SolutionFileName)' == 'Microsoft.Maui.WinUI.sln'">true</BuildForWinUI>
<BuildForNet6 Condition="'$(SolutionFileName)' == 'Microsoft.Maui-net6.sln' or '$(BuildForWinUI)' == 'true'">true</BuildForNet6>
Expand Down Expand Up @@ -35,7 +35,7 @@
<PackageVersion>0.0.1-alpha1</PackageVersion>
<PackageOutputPath>$(MSBuildThisFileDirectory)artifacts</PackageOutputPath>
</PropertyGroup>
<!-- This target is replaced by GitInfo when restored. Allows Version.targets to rely on it before restore. -->
<!-- This target is replaced by GitInfo when restored. Allows Versions.targets to rely on it before restore. -->
<Target Name="GitVersion" />
<Target Name="GitInfo" />
<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="$(MSBuildThisFileDirectory)eng\Environment.Build.props" />
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true'" Project="eng\Git.Build.targets" />
<Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true' " Project="eng\Version.targets" />
<Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true' " Project="eng\Versions.targets" />
<Import Project="eng\AndroidX.targets" />
<Import Project="eng\Microsoft.Extensions.targets" />
</Project>
3 changes: 2 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
Expand All @@ -10,4 +10,5 @@
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<disabledPackageSources />
</configuration>
57 changes: 57 additions & 0 deletions eng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
The `eng` folder contains and is used by parts of the https://github.com/dotnet/arcade SDK.

## Dependency Management
The Arcade SDK contains a tool known as [`darc`][0], which can be used to manage
and query the relationships between repositories in the dotnet ecosystem.

The `eng/Version.Details.xml` and `eng/Versions.props` files contain information
about the products and tooling that this repository depends on.

Many dotnet repositories use a publishing workflow that will push build artifact data
to a central location known as the "Build Asset Registry". This data includes
a "channel" association, which is used to determine when an update for a particular
product or tool is available. Local updates and automatic update "subscriptions"
compare the version files in the repository against the versions avalable in the
channel that you are interested in. The `darc` tool is used facilitate these updates.

To work with `darc` locally, see the [setting up your darc client docs][1].
You'll need to run a script in the dotnet/arcade repo to install the dotnet global
tool, join the `arcade-contrib` GitHub team, and run the [`darc authenticate`][2]
command to add the PATs required by the tool.

The GitHub PAT that you add must have the full `repo` scope enabled if you want to
work with any of the `subcription` commands. Subscriptions control the automated
creation of dependency update pull requests.


To add a new dependency, run the [`darc add-dependency`][3] command at the root
of the repository:
```
darc add-dependency -n Microsoft.Dotnet.Sdk.Internal -t product -v 6.0.0-preview.2.21154.6 -r https://github.com/dotnet/installer
```

To update all dependencies, use the [`darc update-dependencies`][4] command:
```
darc update-dependencies --channel ".NET 6"
```

To configure automatic updates, use the [`darc add-subscription`][5] command
to enroll a target repo/branch into updates from a particular channel:
```
darc add-subscription --channel ".NET 6" --source-repo https://github.com/dotnet/installer --target-repo https://github.com/dotnet/maui --target-branch main --update-frequency everyWeek --standard-automerge
```

Once a subscription is configured, pull requests will be created automatically
by the dotnet Maestro bot whenever dependency updates are available.

Subscriptions need to be manually managed at this time. For example, when a
release branch is created, someone with `darc` installed locally will need to
run the `add-subscription` command to configure updates against that new branch.


[0]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md
[1]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md#setting-up-your-darc-client
[2]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md#authenticate
[3]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md#add-dependency
[4]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md#update-dependencies
[5]: https://github.com/dotnet/arcade/blob/ea609b8e036359934332480de9336d98fcbb3f91/Documentation/Darc.md#add-subscription
20 changes: 20 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-preview.3.21202.5" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>aee38a6dd446b512b1ae510d80d2ed1c1f24e79a</Sha>
</Dependency>
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="11.0.200-preview.3.196">
<Uri>https://github.com/xamarin/xamarin-android</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.MacCatalyst.Sdk" Version="14.3.100-preview.3.471">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.iOS.Sdk" Version="14.4.100-preview.3.1326">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha />
</Dependency>
</ProductDependencies>
</Dependencies>
6 changes: 3 additions & 3 deletions eng/Version.props → eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETSdkPackageVersion>6.0.100-preview.3.21202.5</MicrosoftNETSdkPackageVersion>
<MicrosoftAndroidSdkPackageVersion>11.0.200-preview.3.196</MicrosoftAndroidSdkPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>6.0.100-preview.3.21202.5</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftAndroidSdkWindowsPackageVersion>11.0.200-preview.3.196</MicrosoftAndroidSdkWindowsPackageVersion>
<MicrosoftMacCatalystSdkPackageVersion>14.3.100-preview.3.471</MicrosoftMacCatalystSdkPackageVersion>
<MicrosoftiOSSdkPackageVersion>14.4.100-preview.3.1326</MicrosoftiOSSdkPackageVersion>
</PropertyGroup>
</Project>
</Project>
File renamed without changes.
4 changes: 2 additions & 2 deletions eng/dogfood.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ if (-Not $sln) {

# Modify global.json, so the IDE can load
$globaljson = Join-Path $PSScriptRoot ../global.json
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Version.props)
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Versions.props)
$json = Get-Content $globaljson | ConvertFrom-Json
$json | Add-Member sdk (New-Object -TypeName PSObject) -Force
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftNETSdkPackageVersion -Force
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftDotnetSdkInternalPackageVersion -Force
$json | ConvertTo-Json | Set-Content $globaljson

# NOTE: I've not found a better way to do this
Expand Down
4 changes: 2 additions & 2 deletions eng/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ if ($IsWindows)
{
# Modify global.json, so the IDE can load
$globaljson = Join-Path $PSScriptRoot ../global.json
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Version.props)
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Versions.props)
$json = Get-Content $globaljson | ConvertFrom-Json
$json | Add-Member sdk (New-Object -TypeName PSObject) -Force
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftNETSdkPackageVersion -Force
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftDotnetSdkInternalPackageVersion -Force
$json | ConvertTo-Json | Set-Content $globaljson

# NOTE: I've not found a better way to do this
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"MSBuild.Sdk.Extras": "3.0.23",
"Microsoft.Build.NoTargets": "2.0.1"
}
}
}
2 changes: 1 addition & 1 deletion src/DotNet/Dependencies/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Project>
<Import Project="../../../eng/Version.props" />
<Import Project="../../../eng/Versions.props" />
</Project>
8 changes: 4 additions & 4 deletions src/DotNet/Dependencies/Packs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.Android.Ref" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.Android.Sdk.Windows" Version="[$(MicrosoftAndroidSdkPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('windows'))" />
<PackageDownload Include="Microsoft.Android.Sdk.Darwin" Version="[$(MicrosoftAndroidSdkPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('osx'))" />
<PackageDownload Include="Microsoft.Android.Sdk.BundleTool" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.Android.Ref" Version="[$(MicrosoftAndroidSdkWindowsPackageVersion)]" />
<PackageDownload Include="Microsoft.Android.Sdk.Windows" Version="[$(MicrosoftAndroidSdkWindowsPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('windows'))" />
<PackageDownload Include="Microsoft.Android.Sdk.Darwin" Version="[$(MicrosoftAndroidSdkWindowsPackageVersion)]" Condition="$([MSBuild]::IsOSPlatform('osx'))" />
<PackageDownload Include="Microsoft.Android.Sdk.BundleTool" Version="[$(MicrosoftAndroidSdkWindowsPackageVersion)]" />
<PackageDownload Include="Microsoft.MacCatalyst.Ref" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.MacCatalyst.Sdk" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.iOS.Ref" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
Expand Down
2 changes: 1 addition & 1 deletion src/DotNet/Dependencies/Workloads.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.NET.Workload.Android" Version="[$(MicrosoftAndroidSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.Android" Version="[$(MicrosoftAndroidSdkWindowsPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.MacCatalyst" Version="[$(MicrosoftMacCatalystSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.iOS" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
</ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/DotNet/DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
<DotNetDirectory>$(MauiOutputPath)dotnet/</DotNetDirectory>
<DotNetToolPath>$(DotNetDirectory)dotnet</DotNetToolPath>
<DotNetPacksDirectory>$(DotNetDirectory)packs/</DotNetPacksDirectory>
<DotNetSdkManifestsDirectory>$(DotNetDirectory)sdk-manifests/$(MicrosoftNETSdkPackageVersion.Split('-')[0])/</DotNetSdkManifestsDirectory>
<DotNetSentinelPath>$(DotNetDirectory)sdk/$(MicrosoftNETSdkPackageVersion)/EnableWorkloadResolver.sentinel</DotNetSentinelPath>
<DotNetSdkManifestsDirectory>$(DotNetDirectory)sdk-manifests/$(MicrosoftDotnetSdkInternalPackageVersion.Split('-')[0])/</DotNetSdkManifestsDirectory>
<DotNetSentinelPath>$(DotNetDirectory)sdk/$(MicrosoftDotnetSdkInternalPackageVersion)/EnableWorkloadResolver.sentinel</DotNetSentinelPath>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
<DotNetInstallScriptUrl>https://dot.net/v1/dotnet-install.ps1</DotNetInstallScriptUrl>
<DotNetInstallScriptName>dotnet-install.ps1</DotNetInstallScriptName>
<DotNetInstallScriptPath>$(MauiOutputPath)$(DotNetInstallScriptName)</DotNetInstallScriptPath>
<DotNetInstallCommand>&amp; '$(DotNetInstallScriptPath)' -Version $(MicrosoftNETSdkPackageVersion) -InstallDir '$(DotNetDirectory)' -Verbose</DotNetInstallCommand>
<DotNetInstallCommand>&amp; '$(DotNetInstallScriptPath)' -Version $(MicrosoftDotnetSdkInternalPackageVersion) -InstallDir '$(DotNetDirectory)' -Verbose</DotNetInstallCommand>
<DotNetInstallCommand>powershell -Command &quot;$(DotNetInstallCommand)&quot;</DotNetInstallCommand>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('osx'))">
<DotNetInstallScriptUrl>https://dot.net/v1/dotnet-install.sh</DotNetInstallScriptUrl>
<DotNetInstallScriptName>dotnet-install.sh</DotNetInstallScriptName>
<DotNetInstallScriptPath>$(MauiOutputPath)$(DotNetInstallScriptName)</DotNetInstallScriptPath>
<DotNetInstallCommand>sh '$(DotNetInstallScriptPath)' --version $(MicrosoftNETSdkPackageVersion) --install-dir '$(DotNetDirectory)' --verbose</DotNetInstallCommand>
<DotNetInstallCommand>sh '$(DotNetInstallScriptPath)' --version $(MicrosoftDotnetSdkInternalPackageVersion) --install-dir '$(DotNetDirectory)' --verbose</DotNetInstallCommand>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -38,7 +38,7 @@
<!-- These files should invalidate ./bin/dotnet completely -->
<_Inputs>
$(MSBuildThisFile);
../../eng/Version.props;
../../eng/Versions.props;
</_Inputs>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Templates/src/Microsoft.Maui.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<Compile Remove="**/*" />
</ItemGroup>

<!-- Eventually replaced by eng/Version.targets -->
<!-- Eventually replaced by eng/Versions.targets -->
<Target Name="SetVersions" />

<Target Name="_GenerateTemplateFile"
Expand Down

0 comments on commit 45dd0ed

Please sign in to comment.