diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f9290ddaeb0ed8..0496625f2aec1d 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "8.0.0-prerelease.25064.4", + "version": "8.0.0-prerelease.25103.2", "commands": [ "xharness" ] diff --git a/NuGet.config b/NuGet.config index d77971e4e05b10..3795f6e59e8c2b 100644 --- a/NuGet.config +++ b/NuGet.config @@ -9,15 +9,7 @@ - - - - - - - - - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a18cf63ebb8954..23e581ade23d81 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -90,13 +90,13 @@ 45dd3a73dd5b64b010c4251303b3664bb30df029 - + https://github.com/dotnet/emsdk - ec84e775d21d3b7a6698ec30f7b2a5a9e3acd314 + 6afd7b9f34943078f2e3b747f33350e5fe114269 - + https://github.com/dotnet/emsdk - ec84e775d21d3b7a6698ec30f7b2a5a9e3acd314 + 6afd7b9f34943078f2e3b747f33350e5fe114269 @@ -111,9 +111,9 @@ - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c @@ -121,121 +121,121 @@ 73f0850939d96131c28cf6ea6ee5aacb4da0083a - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 https://github.com/dotnet/llvm-project @@ -322,21 +322,21 @@ https://github.com/dotnet/runtime edbd5c769a19798b6955050baccf99e6797d3208 - + https://github.com/dotnet/xharness - 3ba447103e5b0a23bbe544d6c3701f0fc64d2cfe + d33548342ade8e537d891c8f0f593aa206418625 - + https://github.com/dotnet/xharness - 3ba447103e5b0a23bbe544d6c3701f0fc64d2cfe + d33548342ade8e537d891c8f0f593aa206418625 - + https://github.com/dotnet/xharness - 3ba447103e5b0a23bbe544d6c3701f0fc64d2cfe + d33548342ade8e537d891c8f0f593aa206418625 - + https://github.com/dotnet/arcade - c255aae7f2b128fa20a4441f0e192c3c53561621 + 802042c6e779b73b4edb012ee1d5bae02ec8d41c https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -354,13 +354,13 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization 67613417f5e1af250e6ddfba79f8f2885d8e90fb - + https://github.com/dotnet/hotreload-utils - feeef0335323285595eff5fdb6fcb9f3f724a37d + 232793be175603f21989ca3be5dbe53dc41fc96d - + https://github.com/dotnet/runtime-assets - 6db56a1a9a15801f7095ed88bb0c44def23c8ccd + 88293463a34f5451d8a01b77b292b059bcacc3e4 https://github.com/dotnet/roslyn diff --git a/eng/Versions.props b/eng/Versions.props index 968e942fd774eb..0b891b622d4037 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,11 +1,11 @@ - 8.0.14 + 8.0.15 8 0 - 14 + 15 8.0.100 7.0.20 6.0.36 @@ -87,21 +87,21 @@ 8.0.100 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 2.5.1-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 - 8.0.0-beta.25060.1 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 2.5.1-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 + 8.0.0-beta.25164.5 6.0.0-preview.1.102 @@ -145,20 +145,20 @@ 4.5.0 8.0.0-rc.1.23406.6 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 - 8.0.0-beta.25071.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 + 8.0.0-beta.25113.1 1.0.0-prerelease.23566.3 1.0.0-prerelease.23566.3 @@ -185,10 +185,10 @@ 1.1.0 17.4.0-preview-20220707-01 - 8.0.0-prerelease.25064.4 - 8.0.0-prerelease.25064.4 - 8.0.0-prerelease.25064.4 - 8.0.0-alpha.0.25077.2 + 8.0.0-prerelease.25103.2 + 8.0.0-prerelease.25103.2 + 8.0.0-prerelease.25103.2 + 8.0.0-alpha.0.25124.2 2.4.2 1.0.0 2.4.5 @@ -221,7 +221,7 @@ 8.0.0-rtm.23523.2 - 2.3.5 + 2.4.8 8.0.0-alpha.1.23527.1 16.0.5-alpha.1.24362.2 @@ -242,7 +242,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-8_0_100_Transport --> - 8.0.14 + 8.0.15 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) 1.1.87-gba258badda @@ -259,7 +259,7 @@ 3.1.7 1.0.406601 - 8.0.110 + 8.0.114 $(MicrosoftDotnetSdkInternalVersion) diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index dafabdcaef00d4..f93dc440df0e9c 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -280,6 +280,8 @@ elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64)$") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") add_toolchain_linker_flag("-Wl,--rpath-link=${TIZEN_TOOLCHAIN_PATH}") endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_toolchain_linker_flag("--target=${TOOLCHAIN}") elseif(TARGET_ARCH_NAME STREQUAL "x86") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) add_toolchain_linker_flag("--target=${TOOLCHAIN}") @@ -327,6 +329,8 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") if(TARGET_ARCH_NAME STREQUAL "armel") add_compile_options(-mfloat-abi=softfp) endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_compile_options("--target=${TOOLCHAIN}") elseif(TARGET_ARCH_NAME STREQUAL "x86") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) add_compile_options(--target=${TOOLCHAIN}) diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 index 3e5c1c74a1c50d..a0c7d792a76fbe 100644 --- a/eng/common/generate-sbom-prep.ps1 +++ b/eng/common/generate-sbom-prep.ps1 @@ -4,18 +4,26 @@ Param( . $PSScriptRoot\pipeline-logging-functions.ps1 +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" +$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' +$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName + +Write-Host "Artifact name before : $ArtifactName" +Write-Host "Artifact name after : $SafeArtifactName" + Write-Host "Creating dir $ManifestDirPath" + # create directory for sbom manifest to be placed -if (!(Test-Path -path $ManifestDirPath)) +if (!(Test-Path -path $SbomGenerationDir)) { - New-Item -ItemType Directory -path $ManifestDirPath - Write-Host "Successfully created directory $ManifestDirPath" + New-Item -ItemType Directory -path $SbomGenerationDir + Write-Host "Successfully created directory $SbomGenerationDir" } else{ Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." } Write-Host "Updating artifact name" -$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' -Write-Host "Artifact name $artifact_name" -Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh index d5c76dc827b496..bbb4922151e625 100644 --- a/eng/common/generate-sbom-prep.sh +++ b/eng/common/generate-sbom-prep.sh @@ -14,19 +14,24 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" . $scriptroot/pipeline-logging-functions.sh +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" + manifest_dir=$1 -if [ ! -d "$manifest_dir" ] ; then - mkdir -p "$manifest_dir" - echo "Sbom directory created." $manifest_dir +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +sbom_generation_dir="$manifest_dir/$safe_artifact_name" + +if [ ! -d "$sbom_generation_dir" ] ; then + mkdir -p "$sbom_generation_dir" + echo "Sbom directory created." $sbom_generation_dir else Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." fi -artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" echo "Artifact name before : "$artifact_name -# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. -safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" echo "Artifact name after : "$safe_artifact_name export ARTIFACT_NAME=$safe_artifact_name echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 73828dd30d3179..4f0546dce1208d 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -64,7 +64,7 @@ try { $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty } if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.8.1-2" -MemberType NoteProperty + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.12.0" -MemberType NoteProperty } if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 1f035fee73f4a9..98ccbd7a9c16ec 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -38,6 +38,7 @@ parameters: enableSbom: true PackageVersion: 7.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom jobs: - job: ${{ parameters.name }} @@ -261,4 +262,4 @@ jobs: targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' artifactName: 'BuildConfiguration' displayName: 'Publish build retry configuration' - continueOnError: true \ No newline at end of file + continueOnError: true diff --git a/eng/common/templates-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml index 1bf43bf807af39..daf0957b68d762 100644 --- a/eng/common/templates-official/steps/generate-sbom.yml +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -35,7 +35,7 @@ steps: PackageName: ${{ parameters.packageName }} BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} - ManifestDirPath: ${{ parameters.manifestDirPath }} + ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME) ${{ if ne(parameters.IgnoreDirectories, '') }}: AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml index 3eb7e2d5f840c7..22f2501307d4ba 100644 --- a/eng/common/templates-official/steps/send-to-helix.yml +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -8,6 +8,7 @@ parameters: HelixConfiguration: '' # optional -- additional property attached to a job HelixPreCommands: '' # optional -- commands to run before Helix work item execution HelixPostCommands: '' # optional -- commands to run after Helix work item execution + HelixProjectArguments: '' # optional -- arguments passed to the build command for helixpublish.proj WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects @@ -24,12 +25,12 @@ parameters: IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj ${{ parameters.HelixProjectArguments }} /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' displayName: ${{ parameters.DisplayNamePrefix }} (Windows) env: BuildConfig: $(_BuildConfig) @@ -59,7 +60,7 @@ steps: SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj ${{ parameters.HelixProjectArguments }} /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog displayName: ${{ parameters.DisplayNamePrefix }} (Unix) env: BuildConfig: $(_BuildConfig) diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 3eb7e2d5f840c7..22f2501307d4ba 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -8,6 +8,7 @@ parameters: HelixConfiguration: '' # optional -- additional property attached to a job HelixPreCommands: '' # optional -- commands to run before Helix work item execution HelixPostCommands: '' # optional -- commands to run after Helix work item execution + HelixProjectArguments: '' # optional -- arguments passed to the build command for helixpublish.proj WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects @@ -24,12 +25,12 @@ parameters: IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj ${{ parameters.HelixProjectArguments }} /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' displayName: ${{ parameters.DisplayNamePrefix }} (Windows) env: BuildConfig: $(_BuildConfig) @@ -59,7 +60,7 @@ steps: SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj ${{ parameters.HelixProjectArguments }} /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog displayName: ${{ parameters.DisplayNamePrefix }} (Unix) env: BuildConfig: $(_BuildConfig) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60352ede194ec3..82b2798ba307d5 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -42,7 +42,7 @@ [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1 +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 [string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -263,7 +263,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + $uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" Retry({ Write-Host "GET $uri" @@ -384,8 +384,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/RoslynTools.MSBuild/versions/17.8.1-2 - $defaultXCopyMSBuildVersion = '17.8.1-2' + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/RoslynTools.MSBuild/versions/17.12.0 + $defaultXCopyMSBuildVersion = '17.12.0' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { diff --git a/eng/common/tools.sh b/eng/common/tools.sh index b9b329ce37fff4..68db15430230ae 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -54,7 +54,7 @@ warn_as_error=${warn_as_error:-true} use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -297,7 +297,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 60265718a35b93..e2d82ddc86ff7e 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -40,7 +40,7 @@ case "$os" in export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 # brew update --preinstall - brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" + brew bundle --no-upgrade --file "$(dirname "$0")/Brewfile" ;; *) diff --git a/eng/packaging.targets b/eng/packaging.targets index 2207a9d1f29a84..2c8d30b905fe53 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -148,7 +148,7 @@ - <_RuntimeSymbolPath Include="$(RuntimeSymbolPath)" /> + <_RuntimeSymbolPath Include="@(TfmRuntimeSpecificPackageFile->'%(RootDir)%(Directory)%(FileName).pdb')" Condition="'%(TfmRuntimeSpecificPackageFile.Extension)' == '.dll'" KeepMetadata="None" /> 5 AM PST displayName: HttpStress nightly run + always: true branches: include: - main - - release/6.0 - - release/7.0 - - release/8.0 + - release/*-staging variables: - template: ../variables.yml diff --git a/eng/pipelines/libraries/stress/ssl.yml b/eng/pipelines/libraries/stress/ssl.yml index 1e8cddf228bcb1..ed1306990e294b 100644 --- a/eng/pipelines/libraries/stress/ssl.yml +++ b/eng/pipelines/libraries/stress/ssl.yml @@ -8,12 +8,11 @@ pr: schedules: - cron: "0 13 * * *" # 1PM UTC => 5 AM PST displayName: SslStress nightly run + always: true branches: include: - main - - release/6.0 - - release/7.0 - - release/8.0 + - release/*-staging variables: - template: ../variables.yml diff --git a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml index 24fd2df48d74be..4327746620095b 100644 --- a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml +++ b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml @@ -64,6 +64,10 @@ jobs: /bl:$(Build.SourcesDirectory)\prepare-artifacts.binlog displayName: Prepare artifacts and upload to build + - template: /eng/common/templates-official/steps/generate-sbom.yml + parameters: + BuildDropPath: $(Build.SourcesDirectory)\artifacts + - task: CopyFiles@2 displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs inputs: @@ -73,4 +77,4 @@ jobs: **/*.binlog TargetFolder: '$(Build.StagingDirectory)\BuildLogs' continueOnError: true - condition: succeededOrFailed() \ No newline at end of file + condition: succeededOrFailed() diff --git a/global.json b/global.json index 6abaf940387f48..00765629ae001a 100644 --- a/global.json +++ b/global.json @@ -1,16 +1,16 @@ { "sdk": { - "version": "8.0.110", + "version": "8.0.114", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "8.0.110" + "dotnet": "8.0.114" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25060.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25060.1", - "Microsoft.DotNet.SharedFramework.Sdk": "8.0.0-beta.25060.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25164.5", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25164.5", + "Microsoft.DotNet.SharedFramework.Sdk": "8.0.0-beta.25164.5", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", "Microsoft.NET.Sdk.IL": "8.0.0-rc.1.23406.6" diff --git a/src/libraries/Common/src/Interop/Interop.Ldap.cs b/src/libraries/Common/src/Interop/Interop.Ldap.cs index d933cf98f2ed1c..568a3c594b25a1 100644 --- a/src/libraries/Common/src/Interop/Interop.Ldap.cs +++ b/src/libraries/Common/src/Interop/Interop.Ldap.cs @@ -157,6 +157,8 @@ internal enum LdapOption LDAP_OPT_ROOTDSE_CACHE = 0x9a, // Not Supported in Linux LDAP_OPT_DEBUG_LEVEL = 0x5001, LDAP_OPT_URI = 0x5006, // Not Supported in Windows + LDAP_OPT_X_TLS_CACERTDIR = 0x6003, // Not Supported in Windows + LDAP_OPT_X_TLS_NEWCTX = 0x600F, // Not Supported in Windows LDAP_OPT_X_SASL_REALM = 0x6101, LDAP_OPT_X_SASL_AUTHCID = 0x6102, LDAP_OPT_X_SASL_AUTHZID = 0x6103 diff --git a/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml b/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml index 3523d7762232af..11e42e4fcf4ff6 100644 --- a/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml +++ b/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml @@ -4,6 +4,14 @@ To enable the tests marked with [ConditionalFact(nameof(IsLdapConfigurationExist To ship, we should test on both an Active Directory LDAP server, and at least one other server, as behaviors are a little different. However for local testing, it is easiest to connect to an OpenDJ LDAP server in a docker container (eg., in WSL2). +When testing with later of versions of LDAP, the ldapsearch commands below may need to use + + -H ldap://localhost: + +instead of + + -h localhost -p + OPENDJ SERVER ============= diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs index 6a166b298cd517..1cd57d147a77ed 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs @@ -26,6 +26,7 @@ public static partial class PlatformDetection public static bool IsWindows10OrLater => IsWindowsVersionOrLater(10, 0); public static bool IsWindowsServer2019 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 17763; public static bool IsWindowsServer2022 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 20348; + public static bool IsWindowsServer2025 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 26100; public static bool IsWindowsNanoServer => IsWindows && (IsNotWindowsIoTCore && GetWindowsInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); public static bool IsWindowsServerCore => IsWindows && GetWindowsInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase); public static int WindowsVersion => IsWindows ? (int)GetWindowsVersion() : -1; diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs index 0c23059c17ae88..ecfe219e072843 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs @@ -145,6 +145,7 @@ public async Task TestBasicReceiveAndResponseEvents() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/112792")] [OuterLoop] [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestW3CHeaders() @@ -194,6 +195,7 @@ public void TestW3CHeadersTraceStateAndCorrelationContext() { using (var eventRecords = new EventObserverAndRecorder()) { + Activity.DefaultIdFormat = ActivityIdFormat.W3C; var parent = new Activity("w3c activity"); parent.SetParentId(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom()); parent.TraceStateString = "some=state"; diff --git a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj index 32185c679f3d1d..b7307449560cd4 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -3,8 +3,8 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true true - false - 1 + true + 2 Provides the System.Diagnostics.EventLog class, which allows the applications to use the Windows event log service. Commonly Used Types: diff --git a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs index 32262da81be3e2..126be30b3ddb26 100644 --- a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs +++ b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs @@ -382,6 +382,8 @@ public partial class LdapSessionOptions internal LdapSessionOptions() { } public bool AutoReconnect { get { throw null; } set { } } public string DomainName { get { throw null; } set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] + public string TrustedCertificatesDirectory { get { throw null; } set { } } public string HostName { get { throw null; } set { } } public bool HostReachable { get { throw null; } } public System.DirectoryServices.Protocols.LocatorFlags LocatorFlag { get { throw null; } set { } } @@ -402,6 +404,8 @@ internal LdapSessionOptions() { } public bool Signing { get { throw null; } set { } } public System.DirectoryServices.Protocols.SecurityPackageContextConnectionInformation SslInformation { get { throw null; } } public int SspiFlag { get { throw null; } set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] + public void StartNewTlsSessionContext() { } public bool TcpKeepAlive { get { throw null; } set { } } public System.DirectoryServices.Protocols.VerifyServerCertificateCallback VerifyServerCertificate { get { throw null; } set { } } public void FastConcurrentBind() { } diff --git a/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml b/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml new file mode 100644 index 00000000000000..9ba63ce011e8aa --- /dev/null +++ b/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml @@ -0,0 +1,88 @@ + + + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/net6.0/System.DirectoryServices.Protocols.dll + lib/net6.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/net6.0/System.DirectoryServices.Protocols.dll + lib/net6.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/net6.0/System.DirectoryServices.Protocols.dll + lib/net6.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/net7.0/System.DirectoryServices.Protocols.dll + lib/net7.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/net7.0/System.DirectoryServices.Protocols.dll + lib/net7.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/net7.0/System.DirectoryServices.Protocols.dll + lib/net7.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + \ No newline at end of file diff --git a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx index b63f103619fbdb..1f6c9734a7384c 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx +++ b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx @@ -426,4 +426,7 @@ Only ReferralChasingOptions.None and ReferralChasingOptions.All are supported on Linux. + + The directory '{0}' does not exist. + \ No newline at end of file diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj index cfcab2e34245e8..dff002915f8770 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj @@ -4,6 +4,8 @@ true true true + true + 1 true true Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2.0 (V2) standards. diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs index e1cfffebb531fc..5059c40499d5c6 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; +using System.IO; +using System.Runtime.Versioning; namespace System.DirectoryServices.Protocols { @@ -11,6 +13,34 @@ public partial class LdapSessionOptions private bool _secureSocketLayer; + /// + /// Specifies the path of the directory containing CA certificates in the PEM format. + /// Multiple directories may be specified by separating with a semi-colon. + /// + /// + /// The certificate files are looked up by the CA subject name hash value where that hash can be + /// obtained by using, for example, openssl x509 -hash -noout -in CA.crt. + /// It is a common practice to have the certificate file be a symbolic link to the actual certificate file + /// which can be done by using openssl rehash . or c_rehash . in the directory + /// containing the certificate files. + /// + /// The directory not exist. + [UnsupportedOSPlatform("windows")] + public string TrustedCertificatesDirectory + { + get => GetStringValueHelper(LdapOption.LDAP_OPT_X_TLS_CACERTDIR, releasePtr: true); + + set + { + if (!Directory.Exists(value)) + { + throw new DirectoryNotFoundException(SR.Format(SR.DirectoryNotFound, value)); + } + + SetStringOptionHelper(LdapOption.LDAP_OPT_X_TLS_CACERTDIR, value); + } + } + public bool SecureSocketLayer { get @@ -52,6 +82,16 @@ public ReferralChasingOptions ReferralChasing } } + /// + /// Create a new TLS library context. + /// Calling this is necessary after setting TLS-based options, such as TrustedCertificatesDirectory. + /// + [UnsupportedOSPlatform("windows")] + public void StartNewTlsSessionContext() + { + SetIntValueHelper(LdapOption.LDAP_OPT_X_TLS_NEWCTX, 0); + } + private bool GetBoolValueHelper(LdapOption option) { if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); @@ -71,5 +111,14 @@ private void SetBoolValueHelper(LdapOption option, bool value) ErrorChecking.CheckAndSetLdapError(error); } + + private void SetStringOptionHelper(LdapOption option, string value) + { + if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); + + int error = LdapPal.SetStringOption(_connection._ldapHandle, option, value); + + ErrorChecking.CheckAndSetLdapError(error); + } } } diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs index 813005c5ecb72b..cc73449104adf4 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs @@ -10,6 +10,13 @@ public partial class LdapSessionOptions { private static void PALCertFreeCRLContext(IntPtr certPtr) => Interop.Ldap.CertFreeCRLContext(certPtr); + [UnsupportedOSPlatform("windows")] + public string TrustedCertificatesDirectory + { + get => throw new PlatformNotSupportedException(); + set => throw new PlatformNotSupportedException(); + } + public bool SecureSocketLayer { get @@ -24,6 +31,9 @@ public bool SecureSocketLayer } } + [UnsupportedOSPlatform("windows")] + public void StartNewTlsSessionContext() => throw new PlatformNotSupportedException(); + public int ProtocolVersion { get => GetIntValueHelper(LdapOption.LDAP_OPT_VERSION); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs index b31cf294f4d217..92a5c9558563bd 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs @@ -2,12 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; -using System.Diagnostics; using System.DirectoryServices.Tests; using System.Globalization; +using System.IO; using System.Net; -using System.Text; -using System.Threading; using Xunit; namespace System.DirectoryServices.Protocols.Tests @@ -16,7 +14,7 @@ public partial class DirectoryServicesProtocolsTests { internal static bool IsLdapConfigurationExist => LdapConfiguration.Configuration != null; internal static bool IsActiveDirectoryServer => IsLdapConfigurationExist && LdapConfiguration.Configuration.IsActiveDirectoryServer; - + internal static bool UseTls => IsLdapConfigurationExist && LdapConfiguration.Configuration.UseTls; internal static bool IsServerSideSortSupported => IsLdapConfigurationExist && LdapConfiguration.Configuration.SupportsServerSideSort; [ConditionalFact(nameof(IsLdapConfigurationExist))] @@ -694,6 +692,64 @@ public void TestMultipleServerBind() connection.Timeout = new TimeSpan(0, 3, 0); } +#if NET + [ConditionalFact(nameof(UseTls))] + [PlatformSpecific(TestPlatforms.Linux)] + public void StartNewTlsSessionContext() + { + using (var connection = GetConnection(bind: false)) + { + // We use "." as the directory since it must be a valid directory for StartNewTlsSessionContext() + Bind() to be successful even + // though there are no client certificates in ".". + connection.SessionOptions.TrustedCertificatesDirectory = "."; + + // For a real-world scenario, we would call 'StartTransportLayerSecurity(null)' here which would do the TLS handshake including + // providing the client certificate to the server and validating the server certificate. However, this requires additional + // setup that we don't have including trusting the server certificate and by specifying "demand" in the setup of the server + // via 'LDAP_TLS_VERIFY_CLIENT=demand' to force the TLS handshake to occur. + + connection.SessionOptions.StartNewTlsSessionContext(); + connection.Bind(); + + SearchRequest searchRequest = new (LdapConfiguration.Configuration.SearchDn, "(objectClass=*)", SearchScope.Subtree); + _ = (SearchResponse)connection.SendRequest(searchRequest); + } + } + + [ConditionalFact(nameof(UseTls))] + [PlatformSpecific(TestPlatforms.Linux)] + public void StartNewTlsSessionContext_ThrowsLdapException() + { + using (var connection = GetConnection(bind: false)) + { + // Create a new session context without setting TrustedCertificatesDirectory. + connection.SessionOptions.StartNewTlsSessionContext(); + Assert.Throws(() => connection.Bind()); + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + [PlatformSpecific(TestPlatforms.Linux)] + public void TrustedCertificatesDirectory_ThrowsDirectoryNotFoundException() + { + using (var connection = GetConnection(bind: false)) + { + Assert.Throws(() => connection.SessionOptions.TrustedCertificatesDirectory = "nonexistent"); + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + [PlatformSpecific(TestPlatforms.Windows)] + public void StartNewTlsSessionContext_ThrowsPlatformNotSupportedException() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Throws(() => options.StartNewTlsSessionContext()); + } + } +#endif + private void DeleteAttribute(LdapConnection connection, string entryDn, string attributeName) { string dn = entryDn + "," + LdapConfiguration.Configuration.SearchDn; @@ -774,13 +830,18 @@ private SearchResultEntry SearchUser(LdapConnection connection, string rootDn, s return null; } - private LdapConnection GetConnection() + private LdapConnection GetConnection(bool bind = true) { LdapDirectoryIdentifier directoryIdentifier = string.IsNullOrEmpty(LdapConfiguration.Configuration.Port) ? new LdapDirectoryIdentifier(LdapConfiguration.Configuration.ServerName, true, false) : new LdapDirectoryIdentifier(LdapConfiguration.Configuration.ServerName, int.Parse(LdapConfiguration.Configuration.Port, NumberStyles.None, CultureInfo.InvariantCulture), - true, false); + fullyQualifiedDnsHostName: true, connectionless: false); + return GetConnection(directoryIdentifier, bind); + } + + private static LdapConnection GetConnection(LdapDirectoryIdentifier directoryIdentifier, bool bind = true) + { NetworkCredential credential = new NetworkCredential(LdapConfiguration.Configuration.UserName, LdapConfiguration.Configuration.Password); LdapConnection connection = new LdapConnection(directoryIdentifier, credential) @@ -792,7 +853,11 @@ private LdapConnection GetConnection() // to LDAP v2, which we do not support, and will return LDAP_PROTOCOL_ERROR connection.SessionOptions.ProtocolVersion = 3; connection.SessionOptions.SecureSocketLayer = LdapConfiguration.Configuration.UseTls; - connection.Bind(); + + if (bind) + { + connection.Bind(); + } connection.Timeout = new TimeSpan(0, 3, 0); return connection; diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs index 5f6a737834ac23..39c708bd340b53 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs @@ -756,5 +756,32 @@ public void StopTransportLayerSecurity_Disposed_ThrowsObjectDisposedException() Assert.Throws(() => connection.SessionOptions.StopTransportLayerSecurity()); } + +#if NET + [Fact] + [PlatformSpecific(TestPlatforms.Linux)] + public void CertificateDirectoryProperty() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Null(options.TrustedCertificatesDirectory); + + options.TrustedCertificatesDirectory = "."; + Assert.Equal(".", options.TrustedCertificatesDirectory); + } + } + + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void CertificateDirectoryProperty_ThrowsPlatformNotSupportedException() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Throws(() => options.TrustedCertificatesDirectory = "CertificateDirectory"); + } + } +#endif } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs index 7b8cc18c40f3b7..662f7d1fa48e93 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs @@ -9,8 +9,9 @@ using System.Text; using System.Threading; using System.Threading.Tasks; - +using Microsoft.DotNet.XUnitExtensions; using Xunit; +using Xunit.Abstractions; namespace System.Net.Security.Tests { @@ -192,6 +193,11 @@ public async Task NegotiateStream_StreamToStream_Authentication_EmptyCredentials { string targetName = "testTargetName"; + if (PlatformDetection.IsWindowsServer2025) + { + throw new SkipTestException("Empty credentials not supported on Server 2025"); + } + // Ensure there is no confusion between DefaultCredentials / DefaultNetworkCredentials and a // NetworkCredential object with empty user, password and domain. NetworkCredential emptyNetworkCredential = new NetworkCredential("", "", ""); diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs index 5d1b79a3098e05..d59cde103713e5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs @@ -27,10 +27,26 @@ private static void GateThreadStart() bool debuggerBreakOnWorkStarvation = AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.DebugBreakOnWorkerStarvation", false); + // CPU utilization is updated when the gate thread performs periodic activities (GateActivitiesPeriodMs), so + // that would also affect the actual interval. Set to 0 to disable using CPU utilization and have components + // behave as though CPU utilization is low. The default value of 1 causes CPU utilization to be updated whenever + // the gate thread performs periodic activities. + int cpuUtilizationIntervalMs = + AppContextConfigHelper.GetInt32Config( + "System.Threading.ThreadPool.CpuUtilizationIntervalMs", + "DOTNET_ThreadPool_CpuUtilizationIntervalMs", + defaultValue: 1, + allowNegative: false); + // The first reading is over a time range other than what we are focusing on, so we do not use the read other // than to send it to any runtime-specific implementation that may also use the CPU utilization. CpuUtilizationReader cpuUtilizationReader = default; - _ = cpuUtilizationReader.CurrentUtilization; + int lastCpuUtilizationRefreshTimeMs = 0; + if (cpuUtilizationIntervalMs > 0) + { + lastCpuUtilizationRefreshTimeMs = Environment.TickCount; + _ = cpuUtilizationReader.CurrentUtilization; + } PortableThreadPool threadPoolInstance = ThreadPoolInstance; LowLevelLock threadAdjustmentLock = threadPoolInstance._threadAdjustmentLock; @@ -102,8 +118,17 @@ private static void GateThreadStart() (uint)threadPoolInstance.GetAndResetHighWatermarkCountOfThreadsProcessingUserCallbacks()); } - int cpuUtilization = (int)cpuUtilizationReader.CurrentUtilization; - threadPoolInstance._cpuUtilization = cpuUtilization; + // Determine whether CPU utilization should be updated. CPU utilization is only used by the starvation + // heuristic and hill climbing, and neither of those are active when there is a pending blocking + // adjustment. + if (cpuUtilizationIntervalMs > 0 && + threadPoolInstance._pendingBlockingAdjustment == PendingBlockingAdjustment.None && + (uint)(currentTimeMs - lastCpuUtilizationRefreshTimeMs) >= (uint)cpuUtilizationIntervalMs) + { + lastCpuUtilizationRefreshTimeMs = currentTimeMs; + int cpuUtilization = (int)cpuUtilizationReader.CurrentUtilization; + threadPoolInstance._cpuUtilization = cpuUtilization; + } if (!disableStarvationDetection && threadPoolInstance._pendingBlockingAdjustment == PendingBlockingAdjustment.None && diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs index 0f7fbc06a9a8eb..29cf2dce305657 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs @@ -15,6 +15,7 @@ internal sealed class ThreadInt64PersistentCounter private static List? t_nodeFinalizationHelpers; private long _overflowCount; + private long _lastReturnedCount; // dummy node serving as a start and end of the ring list private readonly ThreadLocalNode _nodes; @@ -31,6 +32,13 @@ public static void Increment(object threadLocalCountObject) Unsafe.As(threadLocalCountObject).Increment(); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Decrement(object threadLocalCountObject) + { + Debug.Assert(threadLocalCountObject is ThreadLocalNode); + Unsafe.As(threadLocalCountObject).Decrement(); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Add(object threadLocalCountObject, uint count) { @@ -76,6 +84,17 @@ public long Count count += node.Count; node = node._next; } + + // Ensure that the returned value is monotonically increasing + long lastReturnedCount = _lastReturnedCount; + if (count > lastReturnedCount) + { + _lastReturnedCount = count; + } + else + { + count = lastReturnedCount; + } } finally { @@ -134,6 +153,18 @@ public void Increment() OnAddOverflow(1); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Decrement() + { + if (_count != 0) + { + _count--; + return; + } + + OnAddOverflow(-1); + } + public void Add(uint count) { Debug.Assert(count != 0); @@ -149,7 +180,7 @@ public void Add(uint count) } [MethodImpl(MethodImplOptions.NoInlining)] - private void OnAddOverflow(uint count) + private void OnAddOverflow(long count) { Debug.Assert(count != 0); @@ -161,7 +192,7 @@ private void OnAddOverflow(uint count) counter._lock.Acquire(); try { - counter._overflowCount += (long)_count + count; + counter._overflowCount += _count + count; _count = 0; } finally diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs index 696c2960b05b5b..ebd1e58bae4fe1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs @@ -1204,6 +1204,9 @@ void IThreadPoolWorkItem.Execute() Interlocked.MemoryBarrier(); if (!_workItems.TryDequeue(out T workItem)) { + // Discount a work item here to avoid counting this queue processing work item + ThreadInt64PersistentCounter.Decrement( + ThreadPoolWorkQueueThreadLocals.threadLocals!.threadLocalCompletionCountObject!); return; } @@ -1247,7 +1250,11 @@ void IThreadPoolWorkItem.Execute() currentThread.ResetThreadPoolThread(); } - ThreadInt64PersistentCounter.Add(tl.threadLocalCompletionCountObject!, completedCount); + // Discount a work item here to avoid counting this queue processing work item + if (completedCount > 1) + { + ThreadInt64PersistentCounter.Add(tl.threadLocalCompletionCountObject!, completedCount - 1); + } } } diff --git a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj index 02d2e48dd5b55c..56cc33a539d702 100644 --- a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj +++ b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj @@ -7,7 +7,6 @@ true true $(BaseIntermediateOutputPath)SuggestedBindingRedirects.targets - $(BeforePack);GeneratePackageTargetsFile Provides classes which read and write resources in a format that supports non-primitive objects. Commonly Used Types: @@ -41,7 +40,7 @@ System.Resources.Extensions.PreserializedResourceWriter - @@ -51,10 +50,11 @@ System.Resources.Extensions.PreserializedResourceWriter - + AfterTargets="CoreCompile" + Condition="'$(TargetFramework)' == '$(NetFrameworkMinimum)'"> $(NetCoreAppCurrent)-windows + true true diff --git a/src/mono/mono.proj b/src/mono/mono.proj index a643e5a049e79c..d0e704abbdf5a7 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -688,7 +688,9 @@ - <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*"/> + <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so" Condition=" Exists('$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so') "/> + <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '@(_LibClang)' == '' "/> + <_LibClang Include="/usr/local/lib/libclang.so" Condition="'@(_LibClang)' == ''" /> true diff --git a/src/mono/mono/cil/opcode.def b/src/mono/mono/cil/opcode.def index 47bccb295e99b2..049c0500b66bd1 100644 --- a/src/mono/mono/cil/opcode.def +++ b/src/mono/mono/cil/opcode.def @@ -328,6 +328,8 @@ OPDEF(CEE_MONO_GET_SP, "mono_get_sp", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x20, OPDEF(CEE_MONO_METHODCONST, "mono_methodconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x21, NEXT) OPDEF(CEE_MONO_PINVOKE_ADDR_CACHE, "mono_pinvoke_addr_cache", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x22, NEXT) OPDEF(CEE_MONO_REMAP_OVF_EXC, "mono_remap_ovf_exc", Pop0, Push0, InlineI, 0, 2, 0xF0, 0x23, NEXT) +OPDEF(CEE_MONO_LDVIRTFTN_DELEGATE, "mono_ldvirtftn_delegate", PopI+PopI, PushI, InlineNone, 0, 2, 0xF0, 0x24, NEXT) + #ifndef OPALIAS #define _MONO_CIL_OPALIAS_DEFINED_ #define OPALIAS(a,s,r) diff --git a/src/mono/mono/metadata/class-internals.h b/src/mono/mono/metadata/class-internals.h index 4641ecec43799e..75cad112b38261 100644 --- a/src/mono/mono/metadata/class-internals.h +++ b/src/mono/mono/metadata/class-internals.h @@ -957,25 +957,20 @@ mono_class_get_##shortname##_class (void) \ // GENERATE_TRY_GET_CLASS_WITH_CACHE attempts mono_class_load_from_name approximately // only once. i.e. if it fails, it will return null and not retry. -// In a race it might try a few times, but not indefinitely. -// -// FIXME This maybe has excessive volatile/barriers. -// #define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,name_space,name) \ MonoClass* \ mono_class_try_get_##shortname##_class (void) \ { \ - static volatile MonoClass *tmp_class; \ - static volatile gboolean inited; \ - MonoClass *klass = (MonoClass *)tmp_class; \ - mono_memory_barrier (); \ - if (!inited) { \ - klass = mono_class_try_load_from_name (mono_class_generate_get_corlib_impl (), name_space, name); \ - tmp_class = klass; \ - mono_memory_barrier (); \ - inited = TRUE; \ + static MonoClass *cached_class; \ + static gboolean cached_class_inited; \ + gboolean tmp_inited; \ + mono_atomic_load_acquire(tmp_inited, gboolean, &cached_class_inited); \ + if (G_LIKELY(tmp_inited)) { \ + return (MonoClass*)cached_class; \ } \ - return klass; \ + cached_class = mono_class_try_load_from_name (mono_class_generate_get_corlib_impl (), name_space, name); \ + mono_atomic_store_release(&cached_class_inited, TRUE); \ + return (MonoClass*)cached_class; \ } GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle) diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 2f612be9859985..947ab70f31089b 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -3375,6 +3375,8 @@ static void init_io_stream_slots (void) { MonoClass* klass = mono_class_try_get_stream_class (); + g_assert(klass); + mono_class_setup_vtable (klass); MonoMethod **klass_methods = m_class_get_methods (klass); if (!klass_methods) { diff --git a/src/mono/mono/metadata/marshal-lightweight.c b/src/mono/mono/metadata/marshal-lightweight.c index 3c5b0de4c67bc2..b3499ca0b86ef9 100644 --- a/src/mono/mono/metadata/marshal-lightweight.c +++ b/src/mono/mono/metadata/marshal-lightweight.c @@ -2102,7 +2102,8 @@ emit_delegate_invoke_internal_ilgen (MonoMethodBuilder *mb, MonoMethodSignature else mono_mb_emit_ldarg (mb, 1); mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icall (mb, mono_get_addr_compiled_method); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDVIRTFTN_DELEGATE); mono_mb_emit_op (mb, CEE_CALLI, target_method_sig); } else { mono_mb_emit_byte (mb, CEE_LDNULL); diff --git a/src/mono/mono/metadata/monitor.c b/src/mono/mono/metadata/monitor.c index 1e861f8dec1b8e..14e3d31127b269 100644 --- a/src/mono/mono/metadata/monitor.c +++ b/src/mono/mono/metadata/monitor.c @@ -82,9 +82,9 @@ struct _MonitorArray { MonoThreadsSync monitors [MONO_ZERO_LEN_ARRAY]; }; -#define mono_monitor_allocator_lock() mono_os_mutex_lock (&monitor_mutex) -#define mono_monitor_allocator_unlock() mono_os_mutex_unlock (&monitor_mutex) -static mono_mutex_t monitor_mutex; +#define mono_monitor_allocator_lock() mono_coop_mutex_lock (&monitor_mutex) +#define mono_monitor_allocator_unlock() mono_coop_mutex_unlock (&monitor_mutex) +static MonoCoopMutex monitor_mutex; static MonoThreadsSync *monitor_freelist; static MonitorArray *monitor_allocated; static int array_size = 16; @@ -255,7 +255,7 @@ lock_word_new_flat (gint32 owner) void mono_monitor_init (void) { - mono_os_mutex_init_recursive (&monitor_mutex); + mono_coop_mutex_init_recursive (&monitor_mutex); } static int diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index c342ef5d007571..9b4527cfb6f97b 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -240,8 +240,11 @@ typedef struct MonoAotOptions { gboolean allow_errors; char *tool_prefix; char *as_prefix; + char *as_name; + char *as_options; char *ld_flags; char *ld_name; + char *ld_options; char *mtriple; char *llvm_path; char *temp_path; @@ -8866,10 +8869,16 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts) opts->tool_prefix = g_strdup (arg + strlen ("tool-prefix=")); } else if (str_begins_with (arg, "as-prefix=")) { opts->as_prefix = g_strdup (arg + strlen ("as-prefix=")); + } else if (str_begins_with (arg, "as-name=")) { + opts->as_name = g_strdup (arg + strlen ("as-name=")); + } else if (str_begins_with (arg, "as-options=")) { + opts->as_options = g_strdup (arg + strlen ("as-options=")); } else if (str_begins_with (arg, "ld-flags=")) { opts->ld_flags = g_strdup (arg + strlen ("ld-flags=")); } else if (str_begins_with (arg, "ld-name=")) { opts->ld_name = g_strdup (arg + strlen ("ld-name=")); + } else if (str_begins_with (arg, "ld-options=")) { + opts->ld_options = g_strdup (arg + strlen ("ld-options=")); } else if (str_begins_with (arg, "soft-debug")) { opts->soft_debug = TRUE; // Intentionally undocumented x2-- deprecated @@ -13275,7 +13284,16 @@ compile_asm (MonoAotCompile *acfg) g_string_append (acfg->as_args, "-c -x assembler "); #endif - command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", as_prefix, AS_NAME, AS_OPTIONS, + const char *as_binary_name = acfg->aot_opts.as_name; + if (as_binary_name == NULL) { + as_binary_name = AS_NAME; + } + const char *as_options = acfg->aot_opts.as_options; + if (as_options == NULL) { + as_options = AS_OPTIONS; + } + + command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", as_prefix, as_binary_name, as_options, acfg->as_args ? acfg->as_args->str : "", wrap_path (objfile), wrap_path (acfg->tmpfname)); aot_printf (acfg, "Executing the native assembler: %s\n", command); @@ -13286,7 +13304,7 @@ compile_asm (MonoAotCompile *acfg) } if (acfg->llvm && !acfg->llvm_owriter) { - command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", as_prefix, AS_NAME, AS_OPTIONS, + command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", as_prefix, as_binary_name, as_options, acfg->as_args ? acfg->as_args->str : "", wrap_path (acfg->llvm_ofile), wrap_path (acfg->llvm_sfile)); aot_printf (acfg, "Executing the native assembler: %s\n", command); @@ -13335,16 +13353,21 @@ compile_asm (MonoAotCompile *acfg) str = g_string_new (""); const char *ld_binary_name = acfg->aot_opts.ld_name; + + const char *ld_options = acfg->aot_opts.ld_options; + if (ld_options == NULL) { + ld_options = LD_OPTIONS; + } #if defined(LD_NAME) if (ld_binary_name == NULL) { ld_binary_name = LD_NAME; } if (acfg->aot_opts.tool_prefix) - g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, ld_options); else if (acfg->aot_opts.llvm_only) g_string_append_printf (str, "%s", acfg->aot_opts.clangxx); else - g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, ld_options); #else if (ld_binary_name == NULL) { ld_binary_name = "ld"; @@ -13353,7 +13376,7 @@ compile_asm (MonoAotCompile *acfg) // Default (linux) if (acfg->aot_opts.tool_prefix) /* Cross compiling */ - g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, LD_OPTIONS); + g_string_append_printf (str, "\"%s%s\" %s", tool_prefix, ld_binary_name, ld_options); else if (acfg->aot_opts.llvm_only) g_string_append_printf (str, "%s", acfg->aot_opts.clangxx); else @@ -14284,8 +14307,11 @@ aot_opts_free (MonoAotOptions *aot_opts) g_free (aot_opts->dedup_include); g_free (aot_opts->tool_prefix); g_free (aot_opts->as_prefix); + g_free (aot_opts->as_name); + g_free (aot_opts->as_options); g_free (aot_opts->ld_flags); g_free (aot_opts->ld_name); + g_free (aot_opts->ld_options); g_free (aot_opts->mtriple); g_free (aot_opts->llvm_path); g_free (aot_opts->temp_path); diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 5328d982af6f03..fd8a6560f19e87 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -3744,6 +3744,34 @@ max_d (double lhs, double rhs) static JiterpreterCallInfo jiterpreter_call_info = { 0 }; #endif +// Equivalent of mono_get_addr_compiled_method +static gpointer +interp_ldvirtftn_delegate (gpointer arg, MonoDelegate *del) +{ + MonoMethod *virtual_method = del->method; + ERROR_DECL(error); + + MonoClass *klass = del->object.vtable->klass; + MonoMethod *invoke = mono_get_delegate_invoke_internal (klass); + MonoMethodSignature *invoke_sig = mono_method_signature_internal (invoke); + + MonoClass *arg_class = NULL; + if (m_type_is_byref (invoke_sig->params [0])) { + arg_class = mono_class_from_mono_type_internal (invoke_sig->params [0]); + } else { + MonoObject *object = (MonoObject*)arg; + arg_class = object->vtable->klass; + } + + MonoMethod *res = mono_class_get_virtual_method (arg_class, virtual_method, error); + mono_error_assert_ok (error); + + gboolean need_unbox = m_class_is_valuetype (res->klass) && !m_class_is_valuetype (virtual_method->klass); + + InterpMethod *imethod = mono_interp_get_imethod (res); + return imethod_to_ftnptr (imethod, need_unbox); +} + /* * If CLAUSE_ARGS is non-null, start executing from it. * The ERROR argument is used to avoid declaring an error object for every interp frame, its not used @@ -7566,6 +7594,15 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; ip += 3; MINT_IN_BREAK; } + MINT_IN_CASE(MINT_LDVIRTFTN_DELEGATE) { + gpointer arg = LOCAL_VAR (ip [2], gpointer); + MonoDelegate *del = LOCAL_VAR (ip [3], MonoDelegate*); + NULL_CHECK (arg); + + LOCAL_VAR (ip [1], gpointer) = interp_ldvirtftn_delegate (arg, del); + ip += 4; + MINT_IN_BREAK; + } #define MATH_UNOP(mathfunc) \ LOCAL_VAR (ip [1], double) = mathfunc (LOCAL_VAR (ip [2], double)); \ diff --git a/src/mono/mono/mini/interp/mintops.def b/src/mono/mono/mini/interp/mintops.def index 5352b65a4ae8df..4c4f85a30fcfc7 100644 --- a/src/mono/mono/mini/interp/mintops.def +++ b/src/mono/mono/mini/interp/mintops.def @@ -716,6 +716,7 @@ OPDEF(MINT_SDB_INTR_LOC, "sdb_intr_loc", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_SDB_SEQ_POINT, "sdb_seq_point", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_SDB_BREAKPOINT, "sdb_breakpoint", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_LD_DELEGATE_METHOD_PTR, "ld_delegate_method_ptr", 3, 1, 1, MintOpNoArgs) +OPDEF(MINT_LDVIRTFTN_DELEGATE, "ldvirtftn_delegate", 4, 1, 2, MintOpNoArgs) // Math intrinsics // double diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index da1d0c31e086d8..66e9f4373f4f24 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -7604,6 +7604,16 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, push_simple_type (td, STACK_TYPE_I); interp_ins_set_dreg (td->last_ins, td->sp [-1].local); break; + case CEE_MONO_LDVIRTFTN_DELEGATE: + CHECK_STACK (td, 2); + td->sp -= 2; + td->ip += 1; + interp_add_ins (td, MINT_LDVIRTFTN_DELEGATE); + interp_ins_set_sregs2 (td->last_ins, td->sp [0].local, td->sp [1].local); + push_simple_type (td, STACK_TYPE_I); + interp_ins_set_dreg (td->last_ins, td->sp [-1].local); + break; + case CEE_MONO_CALLI_EXTRA_ARG: { int saved_local = td->sp [-1].local; /* Same as CEE_CALLI, except that we drop the extra arg required for llvm specific behaviour */ diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 0b1706dd3c61be..3faf125cd0af4b 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -11342,6 +11342,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b *sp++ = ins; break; } + case MONO_CEE_MONO_LDVIRTFTN_DELEGATE: { + CHECK_STACK (2); + sp -= 2; + + ins = mono_emit_jit_icall (cfg, mono_get_addr_compiled_method, sp); + *sp++ = ins; + break; + } case MONO_CEE_MONO_CALLI_EXTRA_ARG: { MonoInst *addr; MonoInst *arg; diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index 99a226aafc603a..f8cca5121ea20c 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -125,12 +125,21 @@ <_AotOutputType>ObjectFile - - - - - + + <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi + <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android + + + + <_AsOptions>-target $(_Triple) -c -x assembler + <_LdName>clang + <_LdOptions>-fuse-ld=lld + <_AsName>clang + + @@ -154,19 +163,6 @@ 21 - - - - - - - - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) @@ -234,20 +230,23 @@ diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index c5316052559933..fd222fb3a4fb32 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -70,36 +70,40 @@ 21 - - - - - - - - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) + + <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi + <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android + + + + <_AsOptions>-target $(_Triple) -c -x assembler + <_LdName>clang + <_LdOptions>-fuse-ld=lld + <_AsName>clang + + diff --git a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs index 329ecbe0b49ca7..6c525fa4eab22c 100644 --- a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs @@ -16,7 +16,7 @@ public ConfigSrcTests(ITestOutputHelper output, SharedBuildPerTestClassFixture b // NOTE: port number determinizes dynamically, so could not generate absolute URI [Theory] - [BuildAndRun(host: RunHost.V8 | RunHost.NodeJS)] + [BuildAndRun(host: RunHost.V8)] public void ConfigSrcAbsolutePath(BuildArgs buildArgs, RunHost host, string id) { buildArgs = buildArgs with { ProjectName = $"configsrcabsolute_{buildArgs.Config}_{buildArgs.AOT}" }; diff --git a/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs b/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs index 3f1bc819ba2a6e..cf311557c27f2e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs +++ b/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs @@ -8,8 +8,8 @@ namespace Wasm.Build.Tests; public class NodeJSHostRunner : IHostRunner { public string GetTestCommand() => "wasm test"; - public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh"; - public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale} --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh"; + public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace"; + public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale}"; public bool UseWasmConsoleOutput() => true; public bool CanRunWBT() => true; } diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index 46fb36135d6f2a..08ac8512665b75 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -41,7 +41,6 @@ public void Build_NoAOT_ShouldNotRelink(BuildArgs buildArgs, RunHost host, strin Assert.DoesNotContain("Compiling native assets with emcc", output); RunAndTestWasmApp(buildArgs, - extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "", expectedExitCode: 42, test: output => { @@ -66,7 +65,6 @@ public void PublishWithSIMD_AOT(BuildArgs buildArgs, RunHost host, string id) DotnetWasmFromRuntimePack: false)); RunAndTestWasmApp(buildArgs, - extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "", expectedExitCode: 42, test: output => { diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs index 1cc70d823ef14e..ea2e49fd35c38e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs @@ -49,38 +49,11 @@ public string CreateWasmTemplateProject(string id, string template = "wasmbrowse if (runAnalyzers) extraProperties += "true"; - if (template == "wasmconsole") - { - UpdateRuntimeconfigTemplateForNode(_projectDir); - } - AddItemsPropertiesToProject(projectfile, extraProperties); return projectfile; } - private static void UpdateRuntimeconfigTemplateForNode(string projectDir) - { - // TODO: Can be removed once Node >= 20 - - string runtimeconfigTemplatePath = Path.Combine(projectDir, "runtimeconfig.template.json"); - string runtimeconfigTemplateContent = File.ReadAllText(runtimeconfigTemplatePath); - var runtimeconfigTemplate = JsonObject.Parse(runtimeconfigTemplateContent); - if (runtimeconfigTemplate == null) - throw new Exception($"Unable to parse runtimeconfigtemplate at '{runtimeconfigTemplatePath}'"); - - var perHostConfigs = runtimeconfigTemplate?["wasmHostProperties"]?["perHostConfig"]?.AsArray(); - if (perHostConfigs == null || perHostConfigs.Count == 0 || perHostConfigs[0] == null) - throw new Exception($"Unable to find perHostConfig in runtimeconfigtemplate at '{runtimeconfigTemplatePath}'"); - - perHostConfigs[0]!["host-args"] = new JsonArray( - "--experimental-wasm-simd", - "--experimental-wasm-eh" - ); - - File.WriteAllText(runtimeconfigTemplatePath, runtimeconfigTemplate!.ToString()); - } - public (string projectDir, string buildOutput) BuildTemplateProject(BuildArgs buildArgs, string id, BuildProjectOptions buildProjectOptions) diff --git a/src/native/libs/System.Native/pal_interfaceaddresses.c b/src/native/libs/System.Native/pal_interfaceaddresses.c index 8fee3e0e3e9649..fe42cd91dac609 100644 --- a/src/native/libs/System.Native/pal_interfaceaddresses.c +++ b/src/native/libs/System.Native/pal_interfaceaddresses.c @@ -117,7 +117,7 @@ static inline uint8_t mask2prefix(uint8_t* mask, int length) static int (*getifaddrs)(struct ifaddrs**) = NULL; static void (*freeifaddrs)(struct ifaddrs*) = NULL; -static void try_loading_getifaddrs() +static void try_loading_getifaddrs(void) { if (android_get_device_api_level() >= 24) { @@ -139,7 +139,7 @@ static void try_loading_getifaddrs() } } -static bool ensure_getifaddrs_is_loaded() +static bool ensure_getifaddrs_is_loaded(void) { static pthread_once_t getifaddrs_is_loaded = PTHREAD_ONCE_INIT; pthread_once(&getifaddrs_is_loaded, try_loading_getifaddrs); @@ -169,11 +169,12 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context, for (struct ifaddrs* current = headAddr; current != NULL; current = current->ifa_next) { - if (current->ifa_addr == NULL) + char *ifa_name = current->ifa_name; + if (current->ifa_addr == NULL || ifa_name == NULL) { continue; } - uint32_t interfaceIndex = if_nametoindex(current->ifa_name); + uint32_t interfaceIndex = if_nametoindex(ifa_name); // ifa_name may be an aliased interface name. // Use if_indextoname to map back to the true device name. char actualName[IF_NAMESIZE]; @@ -376,9 +377,17 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter while (ifaddrsEntry != NULL) { + char *ifa_name = ifaddrsEntry->ifa_name; + + if (ifa_name == NULL) + { + ifaddrsEntry = ifaddrsEntry->ifa_next; + continue; + } + //current = NULL; nii = NULL; - uint ifindex = if_nametoindex(ifaddrsEntry->ifa_name); + uint ifindex = if_nametoindex(ifa_name); for (index = 0; index < (int)ifcount; index ++) { if (((NetworkInterfaceInfo*)memoryBlock)[index].InterfaceIndex == ifindex) @@ -393,8 +402,8 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter // We git new interface. nii = &((NetworkInterfaceInfo*)memoryBlock)[ifcount++]; - memcpy(nii->Name, ifaddrsEntry->ifa_name, sizeof(nii->Name)); - nii->InterfaceIndex = if_nametoindex(ifaddrsEntry->ifa_name); + memcpy(nii->Name, ifa_name, sizeof(nii->Name)); + nii->InterfaceIndex = ifindex; nii->Speed = -1; nii->HardwareType = ((ifaddrsEntry->ifa_flags & IFF_LOOPBACK) == IFF_LOOPBACK) ? NetworkInterfaceType_Loopback : NetworkInterfaceType_Unknown; diff --git a/src/native/libs/System.Security.Cryptography.Native.Android/pal_cipher.c b/src/native/libs/System.Security.Cryptography.Native.Android/pal_cipher.c index b09932392eea08..d60dbdd02df060 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Android/pal_cipher.c +++ b/src/native/libs/System.Security.Cryptography.Native.Android/pal_cipher.c @@ -20,7 +20,7 @@ typedef struct CipherInfo } CipherInfo; #define DEFINE_CIPHER(cipherId, width, javaName, flags) \ -CipherInfo* AndroidCryptoNative_ ## cipherId() \ +CipherInfo* AndroidCryptoNative_ ## cipherId(void) \ { \ static CipherInfo info = { flags, width, javaName }; \ return &info; \ diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index 0a761b44a4c8f2..f4be178f274919 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; @@ -231,6 +231,16 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// public string? ToolPrefix { get; set; } + /// + /// Name of the assembler tool ran by the AOT compiler. + /// + public string? AsName { get; set; } + + /// + /// Passes as-options to the AOT compiler + /// + public string? AsOptions { get; set; } + /// /// Prepends a prefix to the name of the assembler (as) tool ran by the AOT compiler. /// @@ -278,6 +288,11 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// public string? LdFlags { get; set; } + /// + /// Passes ld-options to the AOT compiler + /// + public string? LdOptions { get; set; } + /// /// Specify WorkingDirectory for the AOT compiler /// @@ -728,6 +743,16 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st aotArgs.Add($"tool-prefix={ToolPrefix}"); } + if (!string.IsNullOrEmpty(AsName)) + { + aotArgs.Add($"as-name={AsName}"); + } + + if (!string.IsNullOrEmpty(AsOptions)) + { + aotArgs.Add($"as-options={AsOptions}"); + } + if (!string.IsNullOrEmpty(AsPrefix)) { aotArgs.Add($"as-prefix={AsPrefix}"); @@ -943,6 +968,11 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st aotArgs.Add($"ld-flags={LdFlags}"); } + if (!string.IsNullOrEmpty(LdOptions)) + { + aotArgs.Add($"ld-options={LdOptions}"); + } + // we need to quote the entire --aot arguments here to make sure it is parsed // on Windows as one argument. Otherwise it will be split up into multiple // values, which wont work. diff --git a/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs b/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs index 6370c49df85405..0741e92dfe8116 100644 --- a/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs +++ b/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs @@ -101,9 +101,9 @@ public string ClangPath private void ValidateRequiredProps(string hostOS) { - if (Ndk.NdkVersion.Main.Major != 23) + if (Ndk.NdkVersion.Main.Major != 27) { - throw new Exception($"NDK 23 is required. An unsupported NDK version was found ({Ndk.NdkVersion.Main.Major})."); + throw new Exception($"NDK 27 is required. An unsupported NDK version was found ({Ndk.NdkVersion.Main.Major})."); } try