Skip to content

Commit 80b9c64

Browse files
committed
Merge branch 'main' into dev/grendel/blobs-in-lib
* main: [tests] fix `MAUI Integration` lane (#8614) [xaprepare] use `$(XAPackagesDir)` for NuGet folder (#8613) Add ApiScan to nightly build (#8605) Bump to dotnet/installer@29db8a1157 9.0.100-alpha.1.23628.5 (#8611) [Mono.Android] Fix ServerCertificateCustomValidator (#8594) Bump to dotnet/installer@e08874da58 9.0.100-alpha.1.23625.1 Bump to dotnet/installer@fae23c6571 9.0.100-alpha.1.23618.2 Localized file check-in by OneLocBuild Task (#8589) [tests] enable Xamarin.Android.LibraryProjectZip-LibBinding test (#8588)
2 parents c4c65be + a2472a1 commit 80b9c64

File tree

23 files changed

+235
-200
lines changed

23 files changed

+235
-200
lines changed

build-tools/automation/azure-pipelines-nightly.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,80 @@ stages:
280280
artifactName: Test Results - Localization With Emulator - macOS-$(System.JobPositionInPhase)
281281

282282
- template: yaml-templates/fail-on-issue.yaml
283+
284+
285+
- stage: compliance_scan
286+
displayName: Compliance
287+
dependsOn: mac_build
288+
jobs:
289+
- job: api_scan
290+
displayName: API Scan
291+
pool:
292+
name: Azure Pipelines
293+
vmImage: windows-2022
294+
timeoutInMinutes: 480
295+
workspace:
296+
clean: all
297+
variables:
298+
- name: ApiScan.Enabled
299+
value: true
300+
steps:
301+
- template: yaml-templates/setup-test-environment.yaml
302+
parameters:
303+
installApkDiff: false
304+
installLegacyDotNet: false
305+
restoreNUnitConsole: false
306+
updateMono: false
307+
308+
### Copy .dll and .pdb files for APIScan
309+
- task: CopyFiles@2
310+
displayName: Collect Files for APIScan
311+
inputs:
312+
Contents: $(System.DefaultWorkingDirectory)\bin\$(XA.Build.Configuration)\dotnet\packs\Microsoft.Android*\**\?(*.dll|*.pdb)
313+
TargetFolder: $(Build.StagingDirectory)\apiscan
314+
OverWrite: true
315+
flattenFolders: true
316+
condition: and(succeeded(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
317+
318+
- pwsh: Get-ChildItem -Path "$(Build.StagingDirectory)\apiscan" -Recurse
319+
displayName: List Files for APIScan
320+
condition: and(succeeded(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
321+
322+
### Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task
323+
- task: APIScan@2
324+
displayName: Run APIScan
325+
inputs:
326+
softwareFolder: $(Build.StagingDirectory)\apiscan
327+
symbolsFolder: 'SRV*http://symweb;$(Build.StagingDirectory)\apiscan'
328+
softwareName: $(ApiScanName)
329+
softwareVersionNum: $(Build.SourceBranchName)-$(Build.SourceVersion)-$(Rev:r)
330+
isLargeApp: true
331+
toolVersion: Latest
332+
condition: and(succeeded(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
333+
env:
334+
AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)
335+
336+
- task: SdtReport@2
337+
displayName: Guardian Export - Security Report
338+
inputs:
339+
GdnExportAllTools: false
340+
GdnExportGdnToolApiScan: true
341+
GdnExportOutputSuppressionFile: source.gdnsuppress
342+
condition: and(succeededOrFailed(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
343+
344+
- task: PublishSecurityAnalysisLogs@3
345+
displayName: Publish Guardian Artifacts
346+
inputs:
347+
ArtifactName: APIScan Logs
348+
ArtifactType: Container
349+
AllTools: false
350+
APIScan: true
351+
ToolLogsNotFoundAction: Warning
352+
condition: and(succeededOrFailed(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
353+
354+
- task: PostAnalysis@2
355+
displayName: Fail Build on Guardian Issues
356+
inputs:
357+
GdnBreakAllTools: false
358+
GdnBreakGdnToolApiScan: true
359+
condition: and(succeededOrFailed(), eq(variables['ApiScan.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))

build-tools/automation/azure-pipelines.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ resources:
3333
- repository: maui
3434
type: github
3535
name: dotnet/maui
36-
ref: refs/heads/net8.0
36+
ref: refs/heads/net9.0
3737
endpoint: xamarin
3838

3939
parameters:
@@ -406,6 +406,14 @@ stages:
406406
displayName: Create MAUI template
407407
continueOnError: false
408408

409+
- powershell: |
410+
$project = '$(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj'
411+
[xml] $xml = Get-Content $project
412+
$node = $xml.SelectSingleNode('/Project/PropertyGroup/TargetFrameworks')
413+
$node.InnerText = '$(DotNetTargetFramework)-android'
414+
$xml.Save($project)
415+
displayName: set TargetFrameworks to Android-only
416+
409417
- template: yaml-templates/run-dotnet-preview.yaml
410418
parameters:
411419
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj

build-tools/xaprepare/xaprepare/Application/KnownProperties.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static class KnownProperties
5858
public const string XABuildToolsPackagePrefix = "XABuildToolsPackagePrefix";
5959
public const string XABinRelativeInstallPrefix = "XABinRelativeInstallPrefix";
6060
public const string XAInstallPrefix = "XAInstallPrefix";
61+
public const string XAPackagesDir = "XAPackagesDir";
6162
public const string XAPlatformToolsVersion = "XAPlatformToolsVersion";
6263
public const string XAPlatformToolsPackagePrefix = "XAPlatformToolsPackagePrefix";
6364
}

build-tools/xaprepare/xaprepare/Application/Properties.Defaults.cs.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ namespace Xamarin.Android.Prepare
6262
properties.Add (KnownProperties.XABuildToolsPackagePrefix, StripQuotes ("@XABuildToolsPackagePrefix@"));
6363
properties.Add (KnownProperties.XABinRelativeInstallPrefix, StripQuotes (@"@XABinRelativeInstallPrefix@"));
6464
properties.Add (KnownProperties.XAInstallPrefix, StripQuotes (@"@XAInstallPrefix@"));
65+
properties.Add (KnownProperties.XAPackagesDir, StripQuotes (@"@XAPackagesDir@"));
6566
properties.Add (KnownProperties.XAPlatformToolsVersion, StripQuotes ("@XAPlatformToolsVersion@"));
6667
properties.Add (KnownProperties.XAPlatformToolsPackagePrefix, StripQuotes ("@XAPlatformToolsPackagePrefix@"));
6768
}

build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public static partial class Paths
263263

264264
// not really configurables, merely convenience aliases for more frequently used paths that come from properties
265265
public static string XAInstallPrefix => ctx.Properties.GetRequiredValue (KnownProperties.XAInstallPrefix);
266-
public static string XAPackagesDir = DetermineNugetPackagesDir (ctx);
266+
public static string XAPackagesDir => ctx.Properties.GetRequiredValue (KnownProperties.XAPackagesDir);
267267

268268
static string GetNetcoreAppRuntimePath (Context ctx, string androidTarget)
269269
{
@@ -276,17 +276,6 @@ static string GetNetcoreAppRuntimePath (Context ctx, string androidTarget)
276276
);
277277
}
278278

279-
static string DetermineNugetPackagesDir (Context ctx)
280-
{
281-
return Path.GetFullPath (
282-
Path.Combine (
283-
ctx.Properties.GetRequiredValue (KnownProperties.PkgXamarin_LibZipSharp),
284-
"..",
285-
".."
286-
)
287-
);
288-
}
289-
290279
static string EnsureAndroidToolchainBinDirectories ()
291280
{
292281
if (androidToolchainBinDirectory != null)

build-tools/xaprepare/xaprepare/xaprepare.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<Replacement Include="@XAPlatformToolsVersion@=$(XAPlatformToolsVersion)" />
9797
<Replacement Include="@XAInstallPrefix@=$(XAInstallPrefix)" />
9898
<Replacement Include="@XABinRelativeInstallPrefix@=$(_XABinRelativeInstallPrefix)" />
99+
<Replacement Include="@XAPackagesDir@=$(XAPackagesDir)" />
99100
<Replacement Include="@XAPlatformToolsPackagePrefix@=$(XAPlatformToolsPackagePrefix)" />
100101
</ItemGroup>
101102

eng/Version.Details.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-alpha.1.23610.1">
3+
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-alpha.1.23628.5">
44
<Uri>https://github.com/dotnet/installer</Uri>
5-
<Sha>26001f1c39241dc3caf71eb31c805c021c684be7</Sha>
5+
<Sha>29db8a1157d69ade22d933d666ea5ec21a42c8c8</Sha>
66
</Dependency>
7-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-alpha.1.23577.7" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
7+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-alpha.1.23627.5" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
88
<Uri>https://github.com/dotnet/runtime</Uri>
9-
<Sha>a26802aa5793060c512359c2be83e9a4c51964c1</Sha>
9+
<Sha>8121f82d7d46118eef03a99eecbde64d8021cec7</Sha>
1010
</Dependency>
11-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-alpha.1.23577.7" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
11+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-alpha.1.23627.5" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
1212
<Uri>https://github.com/dotnet/runtime</Uri>
13-
<Sha>a26802aa5793060c512359c2be83e9a4c51964c1</Sha>
13+
<Sha>8121f82d7d46118eef03a99eecbde64d8021cec7</Sha>
1414
</Dependency>
15-
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.23572.3" CoherentParentDependency="Microsoft.NETCore.App.Ref">
15+
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.23617.2" CoherentParentDependency="Microsoft.NETCore.App.Ref">
1616
<Uri>https://github.com/dotnet/emsdk</Uri>
17-
<Sha>74e4868be8423562ba8ec2aac522f94a8c2c9f37</Sha>
17+
<Sha>13ad0749b943e56246a8c40aea3e58648dfa0996</Sha>
1818
</Dependency>
19-
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.23509.2" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
19+
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.23617.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
2020
<Uri>https://github.com/dotnet/cecil</Uri>
21-
<Sha>45dd3a73dd5b64b010c4251303b3664bb30df029</Sha>
21+
<Sha>02026e5c1b054958851d2711fefa1b37027cab23</Sha>
2222
</Dependency>
2323
</ProductDependencies>
2424
<ToolsetDependencies>

eng/Versions.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project>
22
<!--Package versions-->
33
<PropertyGroup>
4-
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-alpha.1.23610.1</MicrosoftDotnetSdkInternalPackageVersion>
5-
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-alpha.1.23577.7</MicrosoftNETILLinkTasksPackageVersion>
6-
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-alpha.1.23577.7</MicrosoftNETCoreAppRefPackageVersion>
4+
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-alpha.1.23628.5</MicrosoftDotnetSdkInternalPackageVersion>
5+
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-alpha.1.23627.5</MicrosoftNETILLinkTasksPackageVersion>
6+
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-alpha.1.23627.5</MicrosoftNETCoreAppRefPackageVersion>
77
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
88
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
9-
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.23572.3</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
9+
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.23617.2</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
1010
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
1111
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
12-
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.23509.2</MicrosoftDotNetCecilPackageVersion>
12+
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.23617.1</MicrosoftDotNetCecilPackageVersion>
1313
<SystemIOHashingPackageVersion>$(MicrosoftNETCoreAppRefPackageVersion)</SystemIOHashingPackageVersion>
1414
</PropertyGroup>
1515
<PropertyGroup>

src/Mono.Android/Xamarin.Android.Net/ServerCertificateCustomValidator.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics.CodeAnalysis;
34
using System.Net.Http;
45
using System.Net.Security;
56
using System.Security.Cryptography.X509Certificates;
@@ -31,12 +32,12 @@ public ITrustManager[] ReplaceX509TrustManager (ITrustManager[]? trustManagers,
3132

3233
private sealed class TrustManager : Java.Lang.Object, IX509TrustManager
3334
{
34-
private readonly IX509TrustManager? _internalTrustManager;
35+
private readonly IX509TrustManager _internalTrustManager;
3536
private readonly HttpRequestMessage _request;
3637
private readonly Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool> _serverCertificateCustomValidationCallback;
3738

3839
public TrustManager (
39-
IX509TrustManager? internalTrustManager,
40+
IX509TrustManager internalTrustManager,
4041
HttpRequestMessage request,
4142
Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool> serverCertificateCustomValidationCallback)
4243
{
@@ -50,7 +51,7 @@ public void CheckServerTrusted (JavaX509Certificate[] javaChain, string authType
5051
var sslPolicyErrors = SslPolicyErrors.None;
5152

5253
try {
53-
_internalTrustManager?.CheckServerTrusted (javaChain, authType);
54+
_internalTrustManager.CheckServerTrusted (javaChain, authType);
5455
} catch (JavaCertificateException) {
5556
sslPolicyErrors |= SslPolicyErrors.RemoteCertificateChainErrors;
5657
}
@@ -158,33 +159,29 @@ private sealed class AlwaysAcceptingHostnameVerifier : Java.Lang.Object, IHostna
158159
public bool Verify (string? hostname, ISSLSession? session) => true;
159160
}
160161

161-
private static IX509TrustManager? FindX509TrustManager(ITrustManager[]? trustManagers)
162+
[DynamicDependency(nameof(IX509TrustManager.CheckServerTrusted), typeof(IX509TrustManagerInvoker))]
163+
[DynamicDependency(nameof(IX509TrustManager.CheckServerTrusted), typeof(X509ExtendedTrustManagerInvoker))]
164+
private static IX509TrustManager FindX509TrustManager(ITrustManager[] trustManagers)
162165
{
163-
if (trustManagers is null)
164-
return null;
165-
166166
foreach (var trustManager in trustManagers) {
167167
if (trustManager is IX509TrustManager tm)
168168
return tm;
169169
}
170170

171-
return null;
171+
throw new InvalidOperationException($"Could not find {nameof(IX509TrustManager)} in {nameof(ITrustManager)} array.");
172172
}
173173

174-
private static ITrustManager[] ModifyTrustManagersArray (ITrustManager[] trustManagers, IX509TrustManager? original, IX509TrustManager replacement)
174+
private static ITrustManager[] ModifyTrustManagersArray (ITrustManager[] trustManagers, IX509TrustManager original, IX509TrustManager replacement)
175175
{
176-
var modifiedTrustManagersCount = original is null ? trustManagers.Length + 1 : trustManagers.Length;
177-
var modifiedTrustManagersArray = new ITrustManager [modifiedTrustManagersCount];
178-
179-
modifiedTrustManagersArray [0] = replacement;
180-
int nextIndex = 1;
176+
var modifiedTrustManagersArray = new ITrustManager [trustManagers.Length];
181177

182178
for (int i = 0; i < trustManagers.Length; i++) {
183179
if (trustManagers [i] == original) {
184-
continue;
180+
modifiedTrustManagersArray [i] = replacement;
181+
} else {
182+
modifiedTrustManagersArray [i] = trustManagers [i];
185183
}
186184

187-
modifiedTrustManagersArray [nextIndex++] = trustManagers [i];
188185
}
189186

190187
return modifiedTrustManagersArray;

0 commit comments

Comments
 (0)