Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<AndroidLatestStableApiLevel2 Condition="'$(AndroidLatestStableApiLevel2)' == ''">38.1</AndroidLatestStableApiLevel2>
-->
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">37.1</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">37.1</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v17.1</AndroidLatestUnstableFrameworkVersion>
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">37.2</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">37.2</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v17.2</AndroidLatestUnstableFrameworkVersion>
<!-- The default API level used for $(TargetPlatformVersion) -->
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidDefaultTargetDotnetApiLevel>
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
Expand All @@ -43,6 +43,23 @@
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<AndroidBuildApiLevel Include="37">
<PlatformId>37.0</PlatformId>
<FrameworkVersion>v17.0</FrameworkVersion>
<Unstable>false</Unstable>
</AndroidBuildApiLevel>
<AndroidBuildApiLevel Include="37.1">
<PlatformId>37.1</PlatformId>
<FrameworkVersion>v17.1</FrameworkVersion>
<Unstable>true</Unstable>
</AndroidBuildApiLevel>
<AndroidBuildApiLevel Include="37.2">
<PlatformId>37.2</PlatformId>
<FrameworkVersion>v17.2</FrameworkVersion>
<Unstable>true</Unstable>
</AndroidBuildApiLevel>
</ItemGroup>
<PropertyGroup Condition=" '$(HostOS)' == '' ">
<HostOS Condition="$([MSBuild]::IsOSPlatform('windows'))">Windows</HostOS>
<HostOS Condition="$([MSBuild]::IsOSPlatform('linux'))">Linux</HostOS>
Expand Down
37 changes: 26 additions & 11 deletions Documentation/workflow/HowToAddNewApiLevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,29 @@ Then update the following files:
<Level>36</Level>
<VersionCodeFull>36.1</VersionCodeFull>
<Id>36.1</Id>
<Stable>True</Stable>
<Stable>False</Stable>
</AndroidApiInfo>
```

`Include` is the binding framework version (e.g. `v16.1`). `Level` is the
integer API level (`Major` of `VersionCodeFull`). `Id` is the platform ID
used to locate `android-$(Id)` directories under the Android SDK. `Stable`
should be `True`; every entry currently in the projitems uses `True`,
including preview codenames like CANARY. (Setting it to `False` would
exclude the entry from being picked as the default stable framework
version by some build-time selection logic.)
should be `False` for preview API levels and `True` once the API level is
stable.

TODO: what should be done for the "mid-year" updates, as is the case for API-CANARY?

- Add a new `<_PlatformPackage>` entry to the platform catalog in
[`/src/androidsdk/androidsdk.targets`](../../src/androidsdk/androidsdk.targets):

```xml
<_PlatformPackage Include="platform-36.0-CANARY_r03"> <ApiLevel>CANARY</ApiLevel> <Hash>...</Hash></_PlatformPackage>
<_PlatformPackage Include="platform-36.0-CANARY_r03"> <ApiLevel>CANARY</ApiLevel> <IsLatestStable>true</IsLatestStable> <Hash>...</Hash></_PlatformPackage>
```

The `Include` value is the *base filename* of the package to download; the
build automatically appends `.zip`. Provide the package's SHA-256 hash in
the `<Hash>` metadata.
the `%(Hash)` metadata. `%(IsLatestStable)` should be `true` so that it
will be downloaded and installed.

At this point, you can run `Xamarin.Android.slnx -t:Prepare` using your usual mechanism.
However, it might not download the new platform into your local Android SDK.
Expand Down Expand Up @@ -219,15 +218,31 @@ You should search-and-replace instances of your local directory name with `..\..
- Add level to `/build-tools/api-xml-adjuster/Makefile`
[TODO: remove? `$(API_LEVELS)` was last touched for API-34!]
- Add level to `DefaultTestSdkPlatforms` in `/build-tools/automation/yaml-templates/variables.yaml`
- Update `WorkloadManifest.in.json` to generate .NET SDK Workload Packs for the new API level.
- Update `DotNetInstallAndRunPreviewAPILevels` in `InstallAndRunTests.cs` to try to access a member added in the new API level.
- If (when) the new API level is unstable, update `Configuration.props` and modify the `*Unstable*` MSBuild properties to match the new unstable API level:
- Update `WorkloadManifest.in.json` with the `Microsoft.Android.Ref.*` and
`Microsoft.Android.Runtime.*.android` packs for the new API level.
- Update `DotNetInstallAndRunPreviewAPILevels` in `InstallAndRunTests.cs` to
retain the existing preview API levels and try to access a member added in
each one.
- Add the API level to `@(AndroidBuildApiLevel)` in `Configuration.props`.
This list drives binding builds, targeting-pack selection, pack creation,
local workload setup, and workload dependency installation:
```xml
<AndroidBuildApiLevel Include="36.1">
<PlatformId>CANARY</PlatformId>
<FrameworkVersion>v16.1</FrameworkVersion>
<Unstable>true</Unstable>
</AndroidBuildApiLevel>
```
- If the new API level is the latest unstable API level, also update the
`*LatestUnstable*` pointers. Keep earlier supported preview API levels in
`@(AndroidBuildApiLevel)`:
```xml
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">36.1</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">CANARY</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v16.1</AndroidLatestUnstableFrameworkVersion>
```
- LOCAL ONLY: Update `Configuration.props` or `Configuration.Override.props` to specify building the new level:
- LOCAL ONLY: To build only the new level, update `Configuration.Override.props`
or pass these properties on the command line:
- `<AndroidApiLevel>31</AndroidApiLevel>`
- `<AndroidPlatformId>S</AndroidPlatformId>`
- `<AndroidFrameworkVersion>v11.0.99</AndroidFrameworkVersion>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public sealed class CheckApiCompatibility : Task
{ "v16.1", "v16.0" },
{ "v17.0", "v16.1" },
{ "v17.1", "v17.0" },
{ "v17.2", "v17.1" },
};

static readonly string assemblyToValidate = "Mono.Android.dll";
Expand Down
3 changes: 2 additions & 1 deletion build-tools/api-merge/merge-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
<File Path="api-36.1.xml.in" Level="36.1" />
<File Path="api-37.0.xml.in" Level="37" />
<File Path="api-37.1.xml.in" Level="37.1" />
<File Path="api-37.2.xml.in" Level="37.2" />
</Inputs>
<Outputs>
<File Path="api-37.1.xml" LastLevel="37.1" />
<File Path="api-37.2.xml" LastLevel="37.2" />
</Outputs>
</Configuration>
2 changes: 1 addition & 1 deletion build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ variables:
- name: IsRelOrTargetingRel
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/'))]
- name: DefaultTestSdkPlatforms # Comma-separated SDK Platform(s) to install on test agents (no spaces)
value: 35,36,36.1,37.0,37.1
value: 35,36,36.1,37.0,37.1,37.2
- name: DefaultJavaSdkMajorVersion
value: 17
- name: LatestJavaSdkMajorVersion
Expand Down
62 changes: 43 additions & 19 deletions build-tools/create-packs/ConfigureLocalWorkload.targets
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
<Project>

<ItemGroup>
<_FrameworkListInputs Include="$(MicrosoftAndroidRefPackDir)**" />
<_FrameworkListInputs Include="$(MicrosoftAndroidSdkAnalysisOutDir)Microsoft.Android.Sdk.Analysis.dll" />
<_FrameworkListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidDefaultTargetDotnetApiLevel)\$(AndroidPackVersion)\data\FrameworkList.xml" />
<_FrameworkListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidLatestStableApiLevel)\$(AndroidPackVersion)\data\FrameworkList.xml" />
<_FrameworkListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidLatestUnstableApiLevel)\$(AndroidPackVersion)\data\FrameworkList.xml" />
<_TemplatesInputs Include="$(XamarinAndroidSourcePath)src\Microsoft.Android.Templates\**" />
<_TemplatesOutputs Include="$(BuildOutputDirectory)lib\template-packs\microsoft.android.templates.$(AndroidPackVersion).nupkg" />
</ItemGroup>

<Target Name="_CreateLocalRuntimeListsInputs">
<!-- https://stackoverflow.com/questions/15914145/cross-join-itemgroups-in-msbuild -->
<Target Name="_CreateAndroidBuildInfo">
<ItemGroup>
<_RuntimeListInputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(AndroidAbiAndRuntimeFlavor.AndroidRuntime).$(AndroidApiLevel).%(AndroidAbiAndRuntimeFlavor.AndroidRID)\$(AndroidPackVersion)\runtimes\%(AndroidAbiAndRuntimeFlavor.AndroidRID)\**" AndroidRID="%(AndroidAbiAndRuntimeFlavor.AndroidRID)" AndroidRuntime="%(AndroidAbiAndRuntimeFlavor.AndroidRuntime)" />
<_RuntimeListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(AndroidAbiAndRuntimeFlavor.AndroidRuntime).$(AndroidDefaultTargetDotnetApiLevel).%(AndroidAbiAndRuntimeFlavor.AndroidRID)\$(AndroidPackVersion)\data\RuntimeList.xml" AndroidRID="%(AndroidAbiAndRuntimeFlavor.AndroidRID)" AndroidRuntime="%(AndroidAbiAndRuntimeFlavor.AndroidRuntime)" />
<_RuntimeListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(AndroidAbiAndRuntimeFlavor.AndroidRuntime).$(AndroidLatestStableApiLevel).%(AndroidAbiAndRuntimeFlavor.AndroidRID)\$(AndroidPackVersion)\data\RuntimeList.xml" AndroidRID="%(AndroidAbiAndRuntimeFlavor.AndroidRID)" AndroidRuntime="%(AndroidAbiAndRuntimeFlavor.AndroidRuntime)" />
<_RuntimeListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(AndroidAbiAndRuntimeFlavor.AndroidRuntime).$(AndroidLatestUnstableApiLevel).%(AndroidAbiAndRuntimeFlavor.AndroidRID)\$(AndroidPackVersion)\data\RuntimeList.xml" AndroidRID="%(AndroidAbiAndRuntimeFlavor.AndroidRID)" AndroidRuntime="%(AndroidAbiAndRuntimeFlavor.AndroidRuntime)" />
<_ManagedRuntimeListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.$(AndroidApiLevel).android\$(AndroidPackVersion)\data\RuntimeList.xml" />
<_AndroidBuildInfo Include="@(AndroidBuildApiLevel)">
<AndroidRuntime>%(AndroidAbiAndRuntimeFlavor.AndroidRuntime)</AndroidRuntime>
<AndroidRID>%(AndroidAbiAndRuntimeFlavor.AndroidRID)</AndroidRID>
</_AndroidBuildInfo>
</ItemGroup>
</Target>

<Target Name="_CreateLocalFrameworkLists">
<ItemGroup>
<_FrameworkListInputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.%(AndroidBuildApiLevel.Identity)\$(AndroidPackVersion)\ref\**" />
<_FrameworkListInputs Include="$(MicrosoftAndroidSdkAnalysisOutDir)Microsoft.Android.Sdk.Analysis.dll" />
<_FrameworkListOutputs Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.%(AndroidBuildApiLevel.Identity)\$(AndroidPackVersion)\data\FrameworkList.xml">
<AndroidApiLevel>%(AndroidBuildApiLevel.Identity)</AndroidApiLevel>
</_FrameworkListOutputs>
<_TemplatesInputs Include="$(XamarinAndroidSourcePath)src\Microsoft.Android.Templates\**" />
<_TemplatesOutputs Include="$(BuildOutputDirectory)lib\template-packs\microsoft.android.templates.$(AndroidPackVersion).nupkg" />
</ItemGroup>
</Target>

<Target Name="_CreateLocalRuntimeListsInputs"
DependsOnTargets="_CreateLocalFrameworkLists;_CreateAndroidBuildInfo">
<ItemGroup>
<_RuntimeListInputs
Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(_AndroidBuildInfo.AndroidRuntime).%(_AndroidBuildInfo.Identity).%(_AndroidBuildInfo.AndroidRID)\$(AndroidPackVersion)\runtimes\%(_AndroidBuildInfo.AndroidRID)\**"
AndroidApiLevel="%(_AndroidBuildInfo.Identity)"
AndroidRID="%(_AndroidBuildInfo.AndroidRID)"
AndroidRuntime="%(_AndroidBuildInfo.AndroidRuntime)" />
<_RuntimeListOutputs
Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(_AndroidBuildInfo.AndroidRuntime).%(_AndroidBuildInfo.Identity).%(_AndroidBuildInfo.AndroidRID)\$(AndroidPackVersion)\data\RuntimeList.xml"
AndroidApiLevel="%(_AndroidBuildInfo.Identity)"
AndroidRID="%(_AndroidBuildInfo.AndroidRID)"
AndroidRuntime="%(_AndroidBuildInfo.AndroidRuntime)"
/>
<_ManagedRuntimeListOutputs
Include="$(BuildOutputDirectory)lib\packs\Microsoft.Android.Runtime.%(AndroidBuildApiLevel.Identity).android\$(AndroidPackVersion)\data\RuntimeList.xml"
AndroidApiLevel="%(AndroidBuildApiLevel.Identity)"
/>
</ItemGroup>
</Target>

<Target Name="CreateLocalRuntimeLists"
DependsOnTargets="_CreateLocalRuntimeListsInputs"
Inputs="$(MSBuildAllProjects);@(_RuntimeListInputs)"
Outputs="@(_RuntimeListOutputs);@(_ManagedRuntimeListOutputs)">
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_RuntimeListOutputs.RelativeDir) -p:AndroidRID=%(_RuntimeListOutputs.AndroidRID) -p:AndroidRuntime=%(_RuntimeListOutputs.AndroidRuntime) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_ManagedRuntimeListOutputs.RelativeDir) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.Managed.proj&quot;" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_RuntimeListOutputs.RelativeDir) -p:AndroidApiLevel=%(_RuntimeListOutputs.AndroidApiLevel) -p:AndroidRID=%(_RuntimeListOutputs.AndroidRID) -p:AndroidRuntime=%(_RuntimeListOutputs.AndroidRuntime) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_ManagedRuntimeListOutputs.RelativeDir) -p:AndroidApiLevel=%(_ManagedRuntimeListOutputs.AndroidApiLevel) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.Managed.proj&quot;" />
</Target>

<Target Name="CreateLocalFrameworkLists"
DependsOnTargets="_CreateLocalFrameworkLists"
Inputs="$(MSBuildAllProjects);@(_FrameworkListInputs)"
Outputs="@(_FrameworkListOutputs)">
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_FrameworkListOutputs.RelativeDir) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; build -t:_GenerateFrameworkList -p:IntermediateOutputPath=%(_FrameworkListOutputs.RelativeDir) -p:AndroidApiLevel=%(_FrameworkListOutputs.AndroidApiLevel) -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
</Target>

<Target Name="PackLocalTemplates"
Expand Down
Loading
Loading