-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefer versions from android-platform-support
Context: 51151d7 Commit 51151d7 laid out a conundrum: dotnet/android builds against one set of versioned dependencies, but we want the "Xamarin Manifest" to *actually* dictate the preferred package versions, as this makes it easier to keep versions in sync with the VS installer/etc. The problem is that commits prior to this point ignored the `Xamarin.Installer.Common.props` described in 51151d7. Additionally, many of the MSBuild properties are (1) "conditional" -- only setting a value if not overridden -- and (2) have the same names as the properties within `Xamarin.Installer.Common.props`. Square this circle by doing two things: 1. Add `tools/workload-dependencies/WorkloadDependencies.proj` alongside `tools/workload-dependencies/Directory.Build.props`, which allows for an "isolated" environment, one in which *only* `Xamarin.Installer.Common.props` and `Xamarin.Android.Common.props` are imported. This allows us to cleanly ensure that `Xamarin.Installer.Common.props` controls things. 2. Update `Microsoft.NET.Sdk.Android.proj` to use the `<MSBuild/>` task to invoke `WorkloadDependencies.proj`, providing all MSBuild properties required for things to work. This should ensure that package versions are consistent. Additionally, update `Program.cs` so that the `platform-tools` package contains a `requestedRevision` property. The `platform-tools` package is *unversioned*, so this is the only way to get some semblance of versioning involved.
- Loading branch information
Showing
4 changed files
with
119 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project> | ||
<!-- | ||
This file exists so that we do NOT import top-level Configuration.props/etc. | ||
This is so that we can cleanly import Xamarin.Installer.Common.props and | ||
Xamarin.Android.Common.props from WorkloadDependencies.proj. | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<Project Sdk="Microsoft.Build.NoTargets"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ImportGroup Condition=" '$(MicrosoftAndroidSdkOutDir)' != '' "> | ||
<Import | ||
Condition="Exists('$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.props')" | ||
Project="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.props" | ||
/> | ||
<Import Project="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.props" /> | ||
</ImportGroup> | ||
|
||
<Target Name="_CheckDeps"> | ||
<Error | ||
Condition=" '$(MicrosoftAndroidSdkOutDir)' == '' " | ||
Text="MicrosoftAndroidSdkOutDir property must be set." | ||
/> | ||
<Error | ||
Condition=" !HasTrailingSlash('$(MicrosoftAndroidSdkOutDir)') " | ||
Text="MicrosoftAndroidSdkOutDir property must end with directory separator char." | ||
/> | ||
<Error | ||
Condition=" !Exists('$(MicrosoftAndroidSdkOutDir)') " | ||
Text="MicrosoftAndroidSdkOutDir property must exist." | ||
/> | ||
<Error | ||
Condition=" '$(WorkloadDependenciesPath)' == '' " | ||
Text="WorkloadDependenciesPath property must be set." | ||
/> | ||
<Error | ||
Condition=" '$(AndroidLatestStablePlatformId)' == '' " | ||
Text="AndroidLatestStablePlatformId property must be set." | ||
/> | ||
<Error | ||
Condition=" '$(AndroidLatestUnstablePlatformId)' == '' " | ||
Text="AndroidLatestUnstablePlatformId property must be set." | ||
/> | ||
<Error | ||
Condition=" '$(WorkloadVersion)' == '' " | ||
Text="WorkloadVersion property must be set." | ||
/> | ||
</Target> | ||
|
||
<Target Name="GenerateWorkloadDependencies" | ||
DependsOnTargets="_CheckDeps"> | ||
|
||
<PropertyGroup> | ||
<_AndroidPlatformSupportFeed>$(MSBuildThisFileDirectory)/../../external/android-platform-support/Feeds/AndroidManifestFeed_d17.12.xml</_AndroidPlatformSupportFeed> | ||
<_Feed Condition=" Exists($(_AndroidPlatformSupportFeed)) ">$(_AndroidPlatformSupportFeed)</_Feed> | ||
<_Feed Condition=" '$(_Feed)' == '' ">https://aka.ms/AndroidManifestFeed/d17-12</_Feed> | ||
<_Project>$(MSBuildThisFileDirectory)workload-dependencies.csproj</_Project> | ||
<WorkloadDependenciesPath Condition=" '$(WorkloadDependenciesPath)' == '' ">$(OutputPath)workload-manifest\WorkloadDependencies.json</WorkloadDependenciesPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<_WorkloadDeps Include="--project "$(_Project)"" /> | ||
<_WorkloadDeps Include="-p:MonoOptionsVersion=$(MonoOptionsVersion)" /> | ||
<_WorkloadDeps Include="-p:NewtonsoftJsonPackageVersion=$(NewtonsoftJsonPackageVersion)" /> | ||
<_WorkloadDeps Include="--" /> | ||
<_WorkloadDeps Include=""--feed=$(_Feed)"" /> | ||
<_WorkloadDeps Include="-o "$(WorkloadDependenciesPath)"" /> | ||
<_WorkloadDeps Include="--build-tools-version=$(AndroidSdkBuildToolsVersion)" /> | ||
<_WorkloadDeps Include="--cmdline-tools-version=$(AndroidCommandLineToolsVersion)" /> | ||
<_WorkloadDeps Include="--jdk-version=$(JavaSdkVersion)" /> | ||
<_WorkloadDeps Include="--ndk-version=$(AndroidNdkVersion)" /> | ||
<_WorkloadDeps Include="--platform-tools-version=$(AndroidSdkPlatformToolsVersion)" /> | ||
<_WorkloadDeps Include="--platform-version=$(AndroidSdkPlatformVersion)" /> | ||
<_WorkloadDeps | ||
Condition=" '$(AndroidLatestUnstablePlatformId)' != '$(AndroidLatestStablePlatformId)' " | ||
Include="--preview-platform-version=$(AndroidLatestUnstablePlatformId)" | ||
/> | ||
<_WorkloadDeps Include="--workload-version=$(WorkloadVersion)" /> | ||
<!-- $(AndroidSdkEmulatorVersion) is unversioned, so skip --> | ||
</ItemGroup> | ||
|
||
<Exec Command="dotnet run @(_WorkloadDeps, ' ')" /> | ||
</Target> | ||
|
||
</Project> |