Skip to content

Commit 89ac2ea

Browse files
Merge branch 'main' into naot-android-rid
2 parents f110b38 + a7768d0 commit 89ac2ea

File tree

55 files changed

+1444
-619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1444
-619
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
3838
-->
3939
<AndroidPackVersion>36.0.0</AndroidPackVersion>
40-
<AndroidPackVersionSuffix>rc.1</AndroidPackVersionSuffix>
40+
<AndroidPackVersionSuffix>rc.2</AndroidPackVersionSuffix>
4141
<!-- Final value set by GetXAVersionInfo target -->
4242
<IsStableBuild>false</IsStableBuild>
4343
</PropertyGroup>

NuGet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<clear />
55
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
66
<!-- Begin: Package sources from dotnet-android -->
7+
<add key="darc-pub-dotnet-android-a618557" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-android-a618557d/nuget/v3/index.json" />
8+
<add key="darc-pub-dotnet-android-a618557-1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-android-a618557d-1/nuget/v3/index.json" />
79
<!-- End: Package sources from dotnet-android -->
810
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
911
<!-- ensure only the sources defined below are used -->

build-tools/automation/yaml-templates/build-windows.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,18 @@ stages:
8787
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
8888
parameters:
8989
command: test
90-
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
91-
arguments: -c $(XA.Build.Configuration)
90+
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
91+
arguments: -c $(XA.Build.Configuration) --logger trx --results-directory $(Agent.TempDirectory)/analysis-tests
9292
displayName: Test Microsoft.Android.Sdk.Analysis $(XA.Build.Configuration)
93-
continueOnError: false
93+
continueOnError: true
94+
95+
- task: PublishTestResults@2
96+
displayName: publish Microsoft.Android.Sdk.Analysis.Tests results
97+
inputs:
98+
testResultsFormat: VSTest
99+
testResultsFiles: "$(Agent.TempDirectory)/analysis-tests/*.trx"
100+
testRunTitle: Microsoft.Android.Sdk.Analysis.Tests
101+
continueOnError: true
94102

95103
- task: BatchScript@1
96104
displayName: Test dotnet-local.cmd - create template

build-tools/automation/yaml-templates/stage-package-tests.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ stages:
4949
displayName: prepare java.interop $(XA.Build.Configuration)
5050
continueOnError: false
5151

52-
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
53-
parameters:
54-
command: test
55-
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
56-
arguments: -c $(XA.Build.Configuration)
57-
displayName: Test Microsoft.Android.Sdk.Analysis $(XA.Build.Configuration)
58-
continueOnError: false
59-
6052
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml
6153

6254
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
@@ -154,14 +146,6 @@ stages:
154146
displayName: prepare java.interop $(XA.Build.Configuration)
155147
continueOnError: false
156148

157-
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
158-
parameters:
159-
command: test
160-
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
161-
arguments: -c $(XA.Build.Configuration)
162-
displayName: Test Microsoft.Android.Sdk.Analysis $(XA.Build.Configuration)
163-
continueOnError: false
164-
165149
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml
166150

167151
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml

build-tools/create-packs/Directory.Build.targets

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,21 @@
3131

3232
<Target Name="_CreateItemGroups">
3333
<ItemGroup>
34-
<_AndroidRuntimeNames Include="@(AndroidAbiAndRuntimeFlavor->'%(AndroidRuntime)'->Distinct())" />
35-
<_AndroidRIDs Include="android-arm;android-arm64;android-x86;android-x64" Runtime="%(_AndroidRuntimeNames.Identity)" />
34+
<_AndroidRIDs
35+
Include="%(AndroidSupportedTargetJitAbi.AndroidRID)"
36+
Condition="'%(AndroidSupportedTargetJitAbi.SupportMonoVM)' == 'true'"
37+
Runtime="Mono"
38+
/>
39+
<_AndroidRIDs
40+
Include="%(AndroidSupportedTargetJitAbi.AndroidRID)"
41+
Condition="'%(AndroidSupportedTargetJitAbi.SupportNativeAOT)' == 'true'"
42+
Runtime="NativeAOT"
43+
/>
44+
<_AndroidRIDs
45+
Include="%(AndroidSupportedTargetJitAbi.AndroidRID)"
46+
Condition="'%(AndroidSupportedTargetJitAbi.SupportCoreCLR)' == 'true'"
47+
Runtime="CoreCLR"
48+
/>
3649
</ItemGroup>
3750
</Target>
3851

build-tools/manifest-attribute-codegen/metadata.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@
439439
<element path="uses-permission.minSdkVersion" visible="false" />
440440
<element path="uses-permission.requiredFeature" visible="false" />
441441
<element path="uses-permission.requiredNotFeature" visible="false" />
442-
<element path="uses-permission.usesPermissionFlags" visible="false" />
442+
<!-- usesPermissionFlags - https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#assert-never-for-location -->
443+
<element path="uses-permission.usesPermissionFlags" visible="true" />
443444

444445
</metadata>

eng/Version.Details.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-rc.1.25412.102">
3+
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-rc.2.25416.105">
44
<Uri>https://github.com/dotnet/dotnet</Uri>
5-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
5+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
66
</Dependency>
7-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="10.0.0-rc.1.25412.102">
7+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="10.0.0-rc.2.25416.105">
88
<Uri>https://github.com/dotnet/dotnet</Uri>
9-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
9+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
1010
</Dependency>
11-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="10.0.0-rc.1.25412.102">
11+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="10.0.0-rc.2.25416.105">
1212
<Uri>https://github.com/dotnet/dotnet</Uri>
13-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
13+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
1414
</Dependency>
15-
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.5-alpha.25412.102">
15+
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.5-alpha.25416.105">
1616
<Uri>https://github.com/dotnet/dotnet</Uri>
17-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
17+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
1818
</Dependency>
1919
<!-- Previous .NET Android version(s) -->
20-
<Dependency Name="Microsoft.NET.Sdk.Android.Manifest-9.0.100" Version="35.0.92">
20+
<Dependency Name="Microsoft.NET.Sdk.Android.Manifest-9.0.100" Version="35.0.101">
2121
<Uri>https://github.com/dotnet/android</Uri>
22-
<Sha>be1cab92326783479054e72990da08008e5be819</Sha>
22+
<Sha>a618557d1fa38074e0256317fb17c1baee245a79</Sha>
2323
</Dependency>
2424
<Dependency Name="Microsoft.NET.Sdk.Android.Manifest-8.0.100" Version="34.0.154">
2525
<Uri>https://github.com/dotnet/android</Uri>
2626
<Sha>82d8938cf80f6d5fa6c28529ddfbdb753d805ab4</Sha>
2727
</Dependency>
2828
</ProductDependencies>
2929
<ToolsetDependencies>
30-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="10.0.0-beta.25412.102">
30+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="10.0.0-beta.25416.105">
3131
<Uri>https://github.com/dotnet/dotnet</Uri>
32-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
32+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
3333
</Dependency>
34-
<Dependency Name="Microsoft.TemplateEngine.Authoring.Tasks" Version="10.0.100-rc.1.25412.102">
34+
<Dependency Name="Microsoft.TemplateEngine.Authoring.Tasks" Version="10.0.100-rc.2.25416.105">
3535
<Uri>https://github.com/dotnet/dotnet</Uri>
36-
<Sha>ca3dd2c2d95a49bfe07a7457101ba67513cf142d</Sha>
36+
<Sha>a01724db6d16445177cb31c6f300d38b0af06290</Sha>
3737
</Dependency>
3838
</ToolsetDependencies>
3939
</Dependencies>

eng/Versions.props

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<Project>
22
<!--Package versions-->
33
<PropertyGroup>
4-
<MicrosoftNETSdkPackageVersion>10.0.100-rc.1.25412.102</MicrosoftNETSdkPackageVersion>
4+
<MicrosoftNETSdkPackageVersion>10.0.100-rc.2.25416.105</MicrosoftNETSdkPackageVersion>
55
<MicrosoftDotnetSdkInternalPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftDotnetSdkInternalPackageVersion>
6-
<MicrosoftNETILLinkTasksPackageVersion>10.0.0-rc.1.25412.102</MicrosoftNETILLinkTasksPackageVersion>
7-
<MicrosoftNETCoreAppRefPackageVersion>10.0.0-rc.1.25412.102</MicrosoftNETCoreAppRefPackageVersion>
6+
<MicrosoftNETILLinkTasksPackageVersion>10.0.0-rc.2.25416.105</MicrosoftNETILLinkTasksPackageVersion>
7+
<MicrosoftNETCoreAppRefPackageVersion>10.0.0-rc.2.25416.105</MicrosoftNETCoreAppRefPackageVersion>
88
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
9-
<MicrosoftDotNetBuildTasksFeedPackageVersion>10.0.0-beta.25412.102</MicrosoftDotNetBuildTasksFeedPackageVersion>
9+
<MicrosoftDotNetBuildTasksFeedPackageVersion>10.0.0-beta.25416.105</MicrosoftDotNetBuildTasksFeedPackageVersion>
1010
<MicrosoftNETWorkloadMonoToolChainPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftNETWorkloadMonoToolChainPackageVersion>
1111
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
12-
<MicrosoftTemplateEngineAuthoringTasksPackageVersion>10.0.100-rc.1.25412.102</MicrosoftTemplateEngineAuthoringTasksPackageVersion>
13-
<MicrosoftDotNetCecilPackageVersion>0.11.5-alpha.25412.102</MicrosoftDotNetCecilPackageVersion>
12+
<MicrosoftTemplateEngineAuthoringTasksPackageVersion>10.0.100-rc.2.25416.105</MicrosoftTemplateEngineAuthoringTasksPackageVersion>
13+
<MicrosoftDotNetCecilPackageVersion>0.11.5-alpha.25416.105</MicrosoftDotNetCecilPackageVersion>
1414
<SystemIOHashingPackageVersion>9.0.4</SystemIOHashingPackageVersion>
1515
<!-- Previous .NET Android version -->
16-
<MicrosoftNETSdkAndroidManifest90100PackageVersion>35.0.92</MicrosoftNETSdkAndroidManifest90100PackageVersion>
16+
<MicrosoftNETSdkAndroidManifest90100PackageVersion>35.0.101</MicrosoftNETSdkAndroidManifest90100PackageVersion>
1717
<AndroidNetPreviousVersion>$(MicrosoftNETSdkAndroidManifest90100PackageVersion)</AndroidNetPreviousVersion>
1818
</PropertyGroup>
1919
<PropertyGroup>

external/xamarin-android-tools.override.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
BeforeTargets="SetVersion"
1717
DependsOnTargets="GetXAVersionInfo">
1818
<PropertyGroup>
19-
<PackageVersionSuffix>-preview.$(PackVersionCommitCount)</PackageVersionSuffix>
19+
<PackageVersionSuffix Condition="$(XAVersionBranch.StartsWith('release/'))">-preview.$(PackVersionCommitCount)</PackageVersionSuffix>
20+
<PackageVersionSuffix Condition="!$(XAVersionBranch.StartsWith('release/'))">-ci.$(_AndroidPackBranch).$(PackVersionCommitCount)</PackageVersionSuffix>
2021
</PropertyGroup>
2122
</Target>
2223
</Project>

src/Microsoft.Android.Sdk.Analysis/Analyzers/CustomApplicationAnalyzer.cs

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,39 @@ private static void AnalyzeClass (SyntaxNodeAnalysisContext context)
4444
if (!Utilities.IsDerivedFrom (classSymbol, AndroidApplication))
4545
return;
4646

47-
var constructors = classDeclarationSyntax.Members
48-
.OfType<ConstructorDeclarationSyntax> ();
49-
5047
bool foundActivationConstructor = false;
51-
foreach (var constructor in constructors) {
52-
var parameters = constructor.ParameterList.Parameters;
53-
if (parameters.Count != 2)
54-
continue;
55-
var type = parameters [0].Type switch {
56-
IdentifierNameSyntax identifierNameSyntax => identifierNameSyntax.Identifier.Text,
57-
QualifiedNameSyntax qualifiedNameSyntax => qualifiedNameSyntax.Right.Identifier.Text,
58-
_ => parameters [0].Type.ToString ()
59-
};
60-
if (type != "IntPtr" && type != "nint")
61-
continue;
62-
var ns = Utilities.GetNamespaceForParameterType (parameters [1], context.SemanticModel);
63-
type = parameters [1].Type switch {
64-
IdentifierNameSyntax identifierNameSyntax => identifierNameSyntax.Identifier.Text,
65-
QualifiedNameSyntax qualifiedNameSyntax => qualifiedNameSyntax.Right.Identifier.Text,
66-
_ => parameters [1].Type.ToString ()
67-
};
68-
var isJniHandle = (ns == "Android.Runtime") && (type == "JniHandleOwnership");
69-
if (!isJniHandle)
70-
continue;
71-
foundActivationConstructor = true;
48+
49+
// Check all constructors (including primary constructors) using symbol information
50+
foreach (var constructor in classSymbol.Constructors) {
51+
if (HasActivationConstructorSignature (constructor)) {
52+
foundActivationConstructor = true;
53+
break;
54+
}
7255
}
56+
7357
if (!foundActivationConstructor) {
7458
var diagnostic = Diagnostic.Create (Rule, classDeclarationSyntax.Identifier.GetLocation (), classDeclarationSyntax.Identifier.Text);
7559
context.ReportDiagnostic (diagnostic);
7660
}
7761
}
62+
63+
private static bool HasActivationConstructorSignature (IMethodSymbol constructor)
64+
{
65+
if (constructor.Parameters.Length != 2)
66+
return false;
67+
68+
var firstParam = constructor.Parameters [0];
69+
var secondParam = constructor.Parameters [1];
70+
71+
// Check first parameter: IntPtr or nint
72+
var firstParamType = firstParam.Type.ToDisplayString ();
73+
bool isValidFirstParam = firstParamType == "System.IntPtr" || firstParamType == "nint";
74+
75+
// Check second parameter: Android.Runtime.JniHandleOwnership
76+
var secondParamType = secondParam.Type;
77+
bool isValidSecondParam = secondParamType.ContainingNamespace?.ToDisplayString () == "Android.Runtime" &&
78+
secondParamType.Name == "JniHandleOwnership";
79+
80+
return isValidFirstParam && isValidSecondParam;
81+
}
7882
}

0 commit comments

Comments
 (0)