Skip to content

Commit 2ca2a10

Browse files
[One .NET] update the .NET 6 packs used in .NET 7 (#7104)
Context: https://github.com/dotnet/maui/releases/tag/6.0.400 Context: #7023 MAUI SR 1 shipped along with a new .NET 6 Android workload. We should be able to use these packs in .NET 7. This would occur when building `net6.0-android` apps with a .NET 7 SDK. Since #7023 is in that release, we can: * Specify the .NET 6 packs as `sdk` where appropriate. * Condition `AutoImport.props` to apply for .NET 7-only. * We also need to remove `$(_DefaultJavaSourceJarPattern)` like we did in .NET 6.
1 parent 6401f2f commit 2ca2a10

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Configuration.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
4848
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
4949
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
50-
<AndroidNet6Version Condition=" '$(AndroidNet6Version)' == '' ">32.0.301</AndroidNet6Version>
50+
<AndroidNet6Version Condition=" '$(AndroidNet6Version)' == '' ">32.0.415</AndroidNet6Version>
5151
</PropertyGroup>
5252
<PropertyGroup Condition=" '$(HostOS)' == '' ">
5353
<HostOS Condition="$([MSBuild]::IsOSPlatform('windows'))">Windows</HostOS>

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/
1616
-->
1717
<Project>
1818

19-
<PropertyGroup>
20-
<_DefaultJavaSourceJarPattern>**\*-source.jar;**\*-sources.jar;**\*-src.jar</_DefaultJavaSourceJarPattern>
21-
</PropertyGroup>
22-
23-
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
19+
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
2420
<Using Include="Android.App" Platform="Android" />
2521
<Using Include="Android.Widget" Platform="Android" />
2622
<Using Include="Android.OS.Bundle" Alias="Bundle" Platform="Android" />
2723
</ItemGroup>
2824

29-
<ItemGroup Condition=" '$(EnableDefaultAndroidItems)' == 'true' ">
25+
<ItemGroup Condition=" '$(EnableDefaultAndroidItems)' == 'true' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) ">
3026
<!-- Default Resource file inclusion -->
3127
<!-- https://developer.android.com/guide/topics/resources/providing-resources -->
3228
<AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.xml" />
@@ -44,10 +40,10 @@ https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/
4440
<TransformFile Include="Transforms*.xml" />
4541
<TransformFile Include="Transforms\**\*.xml" />
4642
<!-- Default Java or native libraries -->
47-
<AndroidLibrary Include="**\*.jar" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(_DefaultJavaSourceJarPattern)" />
43+
<AndroidLibrary Include="**\*.jar" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);**\*-source.jar;**\*-sources.jar;**\*-src.jar" />
4844
<AndroidLibrary Include="**\*.aar" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
4945
<AndroidNativeLibrary Include="**\*.so" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
50-
<JavaSourceJar Include="$(_DefaultJavaSourceJarPattern)" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
46+
<JavaSourceJar Include="**\*-source.jar;**\*-sources.jar;**\*-src.jar" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
5147
<AndroidJavaSource Include="**\*.java" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
5248
</ItemGroup>
5349

src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444
},
4545
"Microsoft.Android.Sdk.NET6": {
46-
"kind": "framework",
46+
"kind": "sdk",
4747
"version": "@NET6_VERSION@",
4848
"alias-to": {
4949
"osx-x64": "Microsoft.Android.Sdk.Darwin",

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ void CreateEmptyFile (params string [] paths)
908908
public void XamarinLegacySdk ([Values ("net6.0", "net7.0")] string dotnetVersion)
909909
{
910910
var proj = new XASdkProject (outputType: "Library") {
911-
Sdk = "Xamarin.Legacy.Sdk/0.1.0-alpha4",
911+
Sdk = "Xamarin.Legacy.Sdk/0.2.0-alpha1",
912912
Sources = {
913913
new AndroidItem.AndroidLibrary ("javaclasses.jar") {
914914
BinaryContent = () => ResourceData.JavaSourceJarTestJar,

0 commit comments

Comments
 (0)