diff --git a/Directory.Build.props b/Directory.Build.props index 767a2516b..5d0198439 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -26,7 +26,7 @@ true true - net8.0 + net9.0 + diff --git a/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj b/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj index 35e8e88e2..6ed44942b 100644 --- a/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj +++ b/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj @@ -1,7 +1,7 @@ Exe - net8.0 + net9.0 Windows diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f9a55fc66..18afccbfc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,42 +5,42 @@ Source-build uses transitive dependency resolution to determine correct build SHA of all product contributing repos. The order of dependencies is important and should not be modified without approval from dotnet/source-build-internal. --> - + https://github.com/dotnet/windowsdesktop - 52e969f93c15d4eaa2f709ebbfe168fb1bb09fa2 + 16efaf8b79a8924f02a8e7500bc7d81d1253007d - + https://github.com/dotnet/windowsdesktop - 52e969f93c15d4eaa2f709ebbfe168fb1bb09fa2 + 16efaf8b79a8924f02a8e7500bc7d81d1253007d - + https://github.com/dotnet/windowsdesktop - 52e969f93c15d4eaa2f709ebbfe168fb1bb09fa2 + 16efaf8b79a8924f02a8e7500bc7d81d1253007d - + https://github.com/dotnet/windowsdesktop - 52e969f93c15d4eaa2f709ebbfe168fb1bb09fa2 + 16efaf8b79a8924f02a8e7500bc7d81d1253007d - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/runtime - f8c110b8003d68cc635add4ca791d6cf2e645561 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 @@ -48,55 +48,55 @@ https://github.com/dotnet/core-setup 7d57652f33493fa022125b7f63aad0d70c52d810 - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/aspnetcore - fa54329186df2e11b40bdfec4ae08f16fdbe9d99 + 3d83ad986828391652e48ebd037c5f485b4edd26 - + https://github.com/dotnet/sdk - db5e29522ce8381a9b4c133e9001edb1f90a7d5c + fdb372b3219a898aa5f8bb5c135afbfd6b81e8c4 - + https://github.com/dotnet/sdk - db5e29522ce8381a9b4c133e9001edb1f90a7d5c + fdb372b3219a898aa5f8bb5c135afbfd6b81e8c4 - + https://github.com/dotnet/sdk - db5e29522ce8381a9b4c133e9001edb1f90a7d5c + fdb372b3219a898aa5f8bb5c135afbfd6b81e8c4 - + https://github.com/dotnet/sdk - db5e29522ce8381a9b4c133e9001edb1f90a7d5c + fdb372b3219a898aa5f8bb5c135afbfd6b81e8c4 https://github.com/dotnet/test-templates @@ -128,62 +128,62 @@ https://github.com/dotnet/wpf 3a8376ca92de4c85dd92b05fba8a1c0a49b14cb9 - + https://github.com/dotnet/fsharp - 767ffa73e8147418ecf54df376e6685b03efd6e4 + 736b7454a057e390bf46a05c0f2d8b5760fd5ce9 - + https://github.com/dotnet/fsharp - 767ffa73e8147418ecf54df376e6685b03efd6e4 + 736b7454a057e390bf46a05c0f2d8b5760fd5ce9 - + https://github.com/microsoft/vstest - cf7d549fc0197abaabec19d61d2c20d7a7b089f8 + 89a55b6ca9270e3e12e3e158104518c225f5ed46 - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + b331f23f3fb62ae355a42d2ec9c8aefdd0da4073 - + https://github.com/dotnet/roslyn - 79963f8a40c6429cd25667c4c62e717b4ca72098 + 17e4696ee6ed0a077650e8cabe6f507e2497a8da - + https://github.com/dotnet/msbuild - 60ae06f6d20616f524a751373aea071df8c2ae48 + a9341111228592c25c43ecf6858e7b39e525b5a1 - + https://github.com/nuget/nuget.client - f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed + 5ce332fb834feea1f6c974d17456c8c9d5504e09 https://github.com/Microsoft/ApplicationInsights-dotnet 53b80940842204f78708a538628288ff5d741a1d - + https://github.com/dotnet/emsdk - bebe955e9f7d392fbca594b1c76c54ba2e27027e + 97568ad0e2120f194df7ac3895e9589fcc8a255b - + https://github.com/dotnet/deployment-tools - 5957c5c5f85f17c145e7fab4ece37ad6aafcded9 + 8babbda6fb22b1410c256bfffed9a8041ff87025 - + https://github.com/dotnet/deployment-tools - 5957c5c5f85f17c145e7fab4ece37ad6aafcded9 + 8babbda6fb22b1410c256bfffed9a8041ff87025 - + https://github.com/dotnet/source-build-externals - 588fbcbc2a221bc6cea33f12eb73c9117994154e + 54ad220ef4f236325dec31f2c0c66fa48a6fce33 @@ -202,18 +202,18 @@ - + https://github.com/dotnet/arcade - 1d451c32dda2314c721adbf8829e1c0cd4e681ff + 6a5ca678aef84f34a1fccc46f76623f41da56553 - + https://github.com/dotnet/arcade - 1d451c32dda2314c721adbf8829e1c0cd4e681ff + 6a5ca678aef84f34a1fccc46f76623f41da56553 - + https://github.com/dotnet/arcade - 1d451c32dda2314c721adbf8829e1c0cd4e681ff + 6a5ca678aef84f34a1fccc46f76623f41da56553 https://github.com/dotnet/arcade-services @@ -227,14 +227,14 @@ https://github.com/dotnet/runtime af841c8b33cecc92d74222298f1e45bf7bf3d90a - + https://github.com/dotnet/source-build-reference-packages - 26ce96327dd346534926c4551f8b8d62a6fc724f + 05ffbf9df6c1dc621665ee1864874c4fe6de874c - + https://github.com/dotnet/xliff-tasks - 194f32828726c3f1f63f79f3dc09b9e99c157b11 + d66a09c8b11e1235273c8e6cd946e5c8e247f189 diff --git a/eng/Versions.props b/eng/Versions.props index d9a7cadf1..685650048 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -39,7 +39,7 @@ - 8.0.0-beta.23463.1 + 9.0.0-beta.23518.2 @@ -71,50 +71,50 @@ - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 - 9.0.0-alpha.1.23470.9 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 + 9.0.0-alpha.1.23512.8 0.2.0 - 9.0.100-alpha.1.23477.13 - 9.0.100-alpha.1.23477.13 - 9.0.100-alpha.1.23477.13 + 9.0.100-alpha.1.23512.21 + 9.0.100-alpha.1.23512.21 + 9.0.100-alpha.1.23512.21 $(MicrosoftNETSdkPackageVersion) $(MicrosoftNETSdkPackageVersion) $(MicrosoftNETSdkPackageVersion) - 4.8.0-3.23470.12 + 4.9.0-1.23511.8 - 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23512.2 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23512.2 + 9.0.0-alpha.1.23512.2 + 9.0.0-alpha.1.23512.2 + 9.0.0-alpha.1.23512.2 + 9.0.0-alpha.1.23512.2 8.0.0-rc.1.23414.4 2.1.0 - 9.0.0-alpha.1.23456.3 - 9.0.0-alpha.1.23456.3 - 9.0.0-alpha.1.23456.3 - 9.0.0-alpha.1.23456.3 + 9.0.0-alpha.1.23477.3 + 9.0.0-alpha.1.23477.3 + 9.0.0-alpha.1.23477.3 + 9.0.0-alpha.1.23477.3 @@ -126,11 +126,11 @@ - 6.8.0-rc.112 + 6.9.0-preview.1.13 - 2.0.0-preview.1.23463.1 + 2.0.0-preview.1.23478.2 @@ -238,7 +238,7 @@ 2.2.0-beta.19072.10 2.0.0 - 17.8.0-release-23468-02 + 17.9.0-preview-23509-01 8.0.0-alpha.1.22557.12 8.0.0-preview.23424.2 @@ -254,7 +254,7 @@ 13.3.8825-net8-rc1 16.4.8825-net8-rc1 - 9.0.0-alpha.1.23465.3 + 9.0.0-alpha.1.23507.1 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportPackageVersion) 9.0.100$([System.Text.RegularExpressions.Regex]::Match($(EmscriptenWorkloadManifestVersion), `-[A-z]*[\.]*\d*`)) diff --git a/eng/common/build.sh b/eng/common/build.sh index 50af40cdd..2c17ba529 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -105,7 +105,7 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -excludeCIBinarylog|-nobl) + -excludecibinarylog|-nobl) exclude_ci_binary_log=true ;; -pipelineslog|-pl) diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 9caf9b021..4228f202e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -487,7 +487,7 @@ if [[ "$__CodeName" == "alpine" ]]; then -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ - search 'llvm*-libs' | sort | tail -1 | sed 's/-[^-]*//2g')" + search 'llvm*-libs' | grep -E '^llvm' | sort | tail -1 | sed 's/-[^-]*//2g')" fi # install all packages in one go diff --git a/eng/common/cross/riscv64/tizen/tizen.patch b/eng/common/cross/riscv64/tizen/tizen.patch new file mode 100644 index 000000000..eb6d1c074 --- /dev/null +++ b/eng/common/cross/riscv64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-littleriscv) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-riscv64-lp64d.so.1 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-riscv64-lp64d.so.1 ) ) diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh index ac84173d4..ba31c9328 100644 --- a/eng/common/cross/tizen-build-rootfs.sh +++ b/eng/common/cross/tizen-build-rootfs.sh @@ -22,6 +22,10 @@ case "$ARCH" in TIZEN_ARCH="x86_64" LINK_ARCH="x86" ;; + riscv64) + TIZEN_ARCH="riscv64" + LINK_ARCH="riscv" + ;; *) echo "Unsupported architecture for tizen: $ARCH" exit 1 @@ -58,4 +62,21 @@ rm -rf $TIZEN_TMP_DIR echo ">>Start configuring Tizen rootfs" ln -sfn asm-${LINK_ARCH} ./usr/include/asm patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +if [[ "$TIZEN_ARCH" == "riscv64" ]]; then + echo "Fixing broken symlinks in $PWD" + rm ./usr/lib64/libresolv.so + ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so + rm ./usr/lib64/libpthread.so + ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so + rm ./usr/lib64/libdl.so + ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so + rm ./usr/lib64/libutil.so + ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so + rm ./usr/lib64/libm.so + ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so + rm ./usr/lib64/librt.so + ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so + rm ./lib/ld-linux-riscv64-lp64d.so.1 + ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1 +fi echo "< /usr/local/bin/scancode << EOF +#!/bin/bash +set -euo pipefail +source $pyEnvPath/bin/activate +scancode "\$@" +deactivate +EOF + +chmod +x /usr/local/bin/scancode diff --git a/eng/pipelines/source-build-license-scan.yml b/eng/pipelines/source-build-license-scan.yml new file mode 100644 index 000000000..bcf7e84f1 --- /dev/null +++ b/eng/pipelines/source-build-license-scan.yml @@ -0,0 +1,137 @@ +# Pipeline documentation at https://github.com/dotnet/dotnet/blob/main/docs/license-scanning.md + +schedules: +- cron: "0 7 * * 1-5" + displayName: Run on weekdays at 7am UTC + branches: + include: + - main + - release/* + +pr: none +trigger: none + +parameters: +# Provides a way to scan a specific repo. If not provided, all repos of the VMR will be scanned. +- name: specificRepoName + type: string + displayName: "Specific repo name to scan (e.g. runtime, sdk). If empty, scans all repos of the VMR." + default: " " # Set it to an empty string to allow it be an optional parameter + +variables: + installerRoot: '$(Build.SourcesDirectory)/src/installer' + +jobs: +- job: Setup + pool: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals 1es-ubuntu-2004 + steps: + - script: | + vmrSrcDir="$(Build.SourcesDirectory)/src" + + # Builds an Azure DevOps matrix definition. Each entry in the matrix is a path, + # allowing a job to be run for each src repo. + matrix="" + + # Trim leading/trailing spaces from the repo name + specificRepoName=$(echo "${{ parameters.specificRepoName }}" | awk '{$1=$1};1') + + # If the repo name is provided, only scan that repo. + if [ ! -z "$specificRepoName" ]; then + matrix="\"$specificRepoName\": { \"repoPath\": \"$vmrSrcDir/$specificRepoName\" }" + else + for dir in $vmrSrcDir/*/ + do + if [ ! -z "$matrix" ]; then + matrix="$matrix," + fi + repoName=$(basename $dir) + matrix="$matrix \"$repoName\": { \"repoPath\": \"$dir\" }" + done + fi + + matrix="{ $matrix }" + + echo "##vso[task.setvariable variable=matrix;isOutput=true]$matrix" + name: GetMatrix + displayName: Get Matrix + +- job: LicenseScan + dependsOn: Setup + pool: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals 1es-ubuntu-2004 + timeoutInMinutes: 420 + strategy: + matrix: $[ dependencies.Setup.outputs['GetMatrix.matrix'] ] + steps: + + - script: $(Build.SourcesDirectory)/prep.sh --no-artifacts --no-bootstrap --no-prebuilts + displayName: 'Install .NET SDK' + + - task: PipAuthenticate@1 + displayName: 'Pip Authenticate' + inputs: + artifactFeeds: public/dotnet-public-pypi + onlyAddExtraIndex: false + + - script: $(installerRoot)/eng/install-scancode.sh + displayName: Install Scancode + + - script: > + $(Build.SourcesDirectory)/.dotnet/dotnet test + $(Build.SourcesDirectory)/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj + --filter "FullyQualifiedName=Microsoft.DotNet.SourceBuild.SmokeTests.LicenseScanTests.ScanForLicenses" + --logger:'trx;LogFileName=$(Agent.JobName)_LicenseScan.trx' + --logger:'console;verbosity=detailed' + -c Release + -bl:$(Build.SourcesDirectory)/artifacts/log/Debug/BuildTests_$(date +"%m%d%H%M%S").binlog + -flp:LogFile=$(Build.SourcesDirectory)/artifacts/logs/BuildTests_$(date +"%m%d%H%M%S").log + -clp:v=m + -e SMOKE_TESTS_LICENSE_SCAN_PATH=$(repoPath) + -e SMOKE_TESTS_RUNNING_IN_CI=true + -e SMOKE_TESTS_WARN_LICENSE_SCAN_DIFFS=false + -e SMOKE_TESTS_TARGET_RID=linux-x64 + -e SMOKE_TESTS_PORTABLE_RID=linux-x64 + displayName: Run Tests + workingDirectory: $(Build.SourcesDirectory) + + - script: | + set -x + targetFolder=$(Build.StagingDirectory)/BuildLogs/ + mkdir -p ${targetFolder} + cd "$(Build.SourcesDirectory)" + find artifacts/ -type f -name "BuildTests*.binlog" -exec cp {} --parents -t ${targetFolder} \; + find artifacts/ -type f -name "BuildTests*.log" -exec cp {} --parents -t ${targetFolder} \; + echo "Updated:" + find test/ -type f -name "Updated*.json" + find test/ -type f -name "Updated*.json" -exec cp {} --parents -t ${targetFolder} \; + echo "Results:" + find test/ -type f -name "scancode-results*.json" + find test/ -type f -name "scancode-results*.json" -exec cp {} --parents -t ${targetFolder} \; + echo "All:" + ls -R test/ + echo "BuildLogs:" + ls -R ${targetFolder} + displayName: Prepare BuildLogs staging directory + continueOnError: true + condition: succeededOrFailed() + + - publish: '$(Build.StagingDirectory)/BuildLogs' + artifact: $(Agent.JobName)_BuildLogs_Attempt$(System.JobAttempt) + displayName: Publish BuildLogs + continueOnError: true + condition: succeededOrFailed() + + - task: PublishTestResults@2 + displayName: Publish Test Results + condition: succeededOrFailed() + continueOnError: true + inputs: + testRunner: vSTest + testResultsFiles: '*.trx' + searchFolder: $(Build.SourcesDirectory)/test/Microsoft.DotNet.SourceBuild.SmokeTests/TestResults + mergeTestResults: true + publishRunAttachments: true + testRunTitle: $(Agent.JobName) diff --git a/eng/pipelines/vmr-build.yml b/eng/pipelines/vmr-build.yml index a675aed38..e6a827a51 100644 --- a/eng/pipelines/vmr-build.yml +++ b/eng/pipelines/vmr-build.yml @@ -4,6 +4,10 @@ pr: include: - main - release/* + exclude: + - release/*.0.2xx + - release/*.0.3xx + - release/*.0.4xx parameters: - name: vmrBranch diff --git a/eng/pipelines/vmr-sync-internal.yml b/eng/pipelines/vmr-sync-internal.yml index 176f98910..0a10a518e 100644 --- a/eng/pipelines/vmr-sync-internal.yml +++ b/eng/pipelines/vmr-sync-internal.yml @@ -5,6 +5,10 @@ trigger: branches: include: - internal/release/* + exclude: + - internal/release/*.0.2xx + - internal/release/*.0.3xx + - internal/release/*.0.4xx resources: repositories: diff --git a/global.json b/global.json index 44e4a3092..32975e690 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "8.0.100-rc.1.23463.5", + "dotnet": "9.0.100-alpha.1.23511.2", "runtimes": { "dotnet": [ "$(VSRedistCommonNetCoreSharedFrameworkx6490PackageVersion)", @@ -12,7 +12,7 @@ "cmake": "3.21.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23463.1", - "Microsoft.DotNet.CMake.Sdk": "8.0.0-beta.23463.1" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23518.2", + "Microsoft.DotNet.CMake.Sdk": "9.0.0-beta.23518.2" } } diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 6c86e0b76..fd4ef5129 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -8,6 +8,10 @@ + + true + + diff --git a/src/SourceBuild/content/docs/license-scanning.md b/src/SourceBuild/content/docs/license-scanning.md new file mode 100644 index 000000000..6007776ab --- /dev/null +++ b/src/SourceBuild/content/docs/license-scanning.md @@ -0,0 +1,24 @@ +# License Scanning + +The VMR is regularly scanned for license references to ensure that only open-source license are used where relevant. + +License scanning pipline: https://dev.azure.com/dnceng/internal/_build?definitionId=1301 (internal only) + +License scanning test: https://github.com/dotnet/dotnet/blob/main/test/Microsoft.DotNet.SourceBuild.SmokeTests/LicenseScanTests.cs + +By default, running the pipeline will scan all repos within the VMR which takes several hours to run. +The pipeline can be triggered manually to target a specific repo within the VMR by setting the `specificRepoName` parameter. +This value should be the name of the repo within the VMR (i.e. a name of a directory within https://github.com/dotnet/dotnet/tree/main/src). +To test source modifications intended to resolve a license issue, apply the change in an internal branch of the VMR. +Run this pipeline, targeting your branch, and set the `specificRepoName` parameter to the name of the repo containing the change. + +The output of the pipeline is a set of test results and logs. +The logs are published as an artifact and can be found at test/Microsoft.DotNet/SourceBuild.SmokeTests/bin/Release/netX.0/logs. +It consists of the following: + * `UpdatedLicenses..json`: This is the output of that gets compared to the stored baseline. + If they're the same, the test passes; if not, it fails. By comparing this file to the baseline, one can determine which new license + references have been introduced. + If everything is deemed to be acceptable, the developer can either update the allowed licenses, update the exclusions file, update the + baseline, or any combination. + * `scancode-results.json`: This is the raw output that comes from scancode. This file is useful for diagnostic purposes because it tells you + the exact line number of where a license has been detected in a file. diff --git a/src/SourceBuild/content/eng/Versions.props b/src/SourceBuild/content/eng/Versions.props index 80faaca38..e22e27fa3 100644 --- a/src/SourceBuild/content/eng/Versions.props +++ b/src/SourceBuild/content/eng/Versions.props @@ -32,5 +32,6 @@ --> https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Artifacts.8.0.100-rc.1.23455.1.centos.8-x64.tar.gz https://dotnetcli.azureedge.net/source-built-artifacts/sdks/dotnet-sdk-8.0.100-rc.1.23455.1-centos.8-x64.tar.gz + https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Prebuilts.0.1.0-9.0.100-3.centos.8-x64.tar.gz diff --git a/src/SourceBuild/content/eng/pipelines/ci.yml b/src/SourceBuild/content/eng/pipelines/ci.yml index 55b6a212d..be751b083 100644 --- a/src/SourceBuild/content/eng/pipelines/ci.yml +++ b/src/SourceBuild/content/eng/pipelines/ci.yml @@ -7,6 +7,13 @@ trigger: - main - release/* - internal/release/* + exclude: + - release/*.0.2xx + - release/*.0.3xx + - release/*.0.4xx + - internal/release/*.0.2xx + - internal/release/*.0.3xx + - internal/release/*.0.4xx pr: branches: diff --git a/src/SourceBuild/content/global.json b/src/SourceBuild/content/global.json index 1d6588cf9..e1487359b 100644 --- a/src/SourceBuild/content/global.json +++ b/src/SourceBuild/content/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "8.0.100-rc.1.23455.8" + "dotnet": "9.0.100-alpha.1.23511.2" }, "msbuild-sdks": { "Microsoft.Build.CentralPackageVersions": "2.0.1", diff --git a/src/SourceBuild/content/prep.sh b/src/SourceBuild/content/prep.sh index 472c348ae..f9e88d6c4 100755 --- a/src/SourceBuild/content/prep.sh +++ b/src/SourceBuild/content/prep.sh @@ -157,6 +157,9 @@ function BootstrapArtifacts { if [ "$installDotnet" == true ]; then echo " Installing dotnet..." (source ./eng/common/tools.sh && InitializeDotNetCli true) + + # TODO: Remove once runtime dependency is gone (https://github.com/dotnet/runtime/issues/93666) + bash .dotnet/dotnet-install.sh --install-dir "$SCRIPT_ROOT/.dotnet" --channel 8.0 --runtime dotnet fi # Read the eng/Versions.props to get the archives to download and download them diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ArtifactsSizeTest.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ArtifactsSizeTest.cs index ab60beb00..52517ca1f 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ArtifactsSizeTest.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ArtifactsSizeTest.cs @@ -16,7 +16,7 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; [Trait("Category", "SdkContent")] -public class ArtifactsSizeTest : SmokeTests +public class ArtifactsSizeTest : SdkTests { private const int SizeThresholdPercentage = 25; private static readonly string BaselineFilePath = BaselineHelper.GetBaselineFilePath($"ArtifactsSizes/{Config.TargetRid}.txt"); @@ -41,7 +41,8 @@ public class ArtifactsSizeTest : SmokeTests } - [SkippableFact(Config.IncludeArtifactsSizeEnv, skipOnFalseEnv: true)] + // https://github.com/dotnet/source-build/issues/3668 + //[SkippableFact(Config.IncludeArtifactsSizeEnv, skipOnFalseEnv: true)] public void CompareArtifactsToBaseline() { Utilities.ValidateNotNullOrWhiteSpace(Config.SourceBuiltArtifactsPath, Config.SourceBuiltArtifactsPathEnv); @@ -64,7 +65,7 @@ public class ArtifactsSizeTest : SmokeTests try { - string actualFilePath = Path.Combine(DotNetHelper.LogsDirectory, $"UpdatedArtifactsSizes_{Config.TargetRid}.txt"); + string actualFilePath = Path.Combine(LogsDirectory, $"UpdatedArtifactsSizes_{Config.TargetRid}.txt"); File.WriteAllLines(actualFilePath, tarEntries.Select(entry => $"{entry.FilePath}: {entry.Bytes}")); } catch (IOException ex) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs index f5bf4ebe8..6b7c6f71a 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs @@ -41,12 +41,12 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests Assert.Null(message); } - public static void CompareBaselineContents(string baselineFileName, string actualContents, ITestOutputHelper outputHelper, bool warnOnDiffs = false) + public static void CompareBaselineContents(string baselineFileName, string actualContents, ITestOutputHelper outputHelper, bool warnOnDiffs = false, string baselineSubDir = "") { - string actualFilePath = Path.Combine(DotNetHelper.LogsDirectory, $"Updated{baselineFileName}"); + string actualFilePath = Path.Combine(TestBase.LogsDirectory, $"Updated{baselineFileName}"); File.WriteAllText(actualFilePath, actualContents); - CompareFiles(GetBaselineFilePath(baselineFileName), actualFilePath, outputHelper, warnOnDiffs); + CompareFiles(GetBaselineFilePath(baselineFileName, baselineSubDir), actualFilePath, outputHelper, warnOnDiffs); } public static void CompareFiles(string expectedFilePath, string actualFilePath, ITestOutputHelper outputHelper, bool warnOnDiffs = false) @@ -87,7 +87,8 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests public static string GetAssetsDirectory() => Path.Combine(Directory.GetCurrentDirectory(), "assets"); - public static string GetBaselineFilePath(string baselineFileName) => Path.Combine(GetAssetsDirectory(), "baselines", baselineFileName); + public static string GetBaselineFilePath(string baselineFileName, string baselineSubDir = "") => + Path.Combine(GetAssetsDirectory(), "baselines", baselineSubDir, baselineFileName); public static string RemoveRids(string diff, bool isPortable = false) => isPortable ? diff.Replace(Config.PortableRid, "portable-rid") : diff.Replace(Config.TargetRid, "banana-rid"); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BasicScenarioTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BasicScenarioTests.cs index 4f1aafc68..92342a2b1 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BasicScenarioTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BasicScenarioTests.cs @@ -15,12 +15,13 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests; /// for related web scenarios. /// They are encapsulated in a separate testclass so that they can be run in parallel. /// -public class BasicScenarioTests : SmokeTests +public class BasicScenarioTests : SdkTests { public BasicScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - [Theory] - [MemberData(nameof(GetScenarioObjects))] + // https://github.com/dotnet/source-build/issues/3668 + // [Theory] + // [MemberData(nameof(GetScenarioObjects))] public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper); public static IEnumerable GetScenarioObjects() => GetScenarios().Select(scenario => new object[] { scenario }); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs index 080e19d67..6bc2393e8 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Config.cs @@ -21,7 +21,9 @@ internal static class Config public const string SourceBuiltArtifactsPathEnv = "SMOKE_TESTS_SOURCEBUILT_ARTIFACTS_PATH"; public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID"; public const string WarnSdkContentDiffsEnv = "SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS"; + public const string WarnLicenseScanDiffsEnv = "SMOKE_TESTS_WARN_LICENSE_SCAN_DIFFS"; public const string RunningInCIEnv = "SMOKE_TESTS_RUNNING_IN_CI"; + public const string LicenseScanPathEnv = "SMOKE_TESTS_LICENSE_SCAN_PATH"; public static string DotNetDirectory { get; } = Environment.GetEnvironmentVariable(DotNetDirectoryEnv) ?? Path.Combine(Directory.GetCurrentDirectory(), ".dotnet"); @@ -32,15 +34,18 @@ internal static class Config public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv); public static string? CustomPackagesPath { get; } = Environment.GetEnvironmentVariable(CustomPackagesPathEnv); public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv); - public static string SourceBuiltArtifactsPath { get; } = Environment.GetEnvironmentVariable(SourceBuiltArtifactsPathEnv) ?? - throw new InvalidOperationException($"'{Config.SourceBuiltArtifactsPathEnv}' must be specified"); + public static string? SourceBuiltArtifactsPath { get; } = Environment.GetEnvironmentVariable(SourceBuiltArtifactsPathEnv); public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ?? throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified"); public static string TargetArchitecture { get; } = TargetRid.Split('-')[1]; public static bool WarnOnSdkContentDiffs { get; } = bool.TryParse(Environment.GetEnvironmentVariable(WarnSdkContentDiffsEnv), out bool warnOnSdkContentDiffs) && warnOnSdkContentDiffs; + public static bool WarnOnLicenseScanDiffs { get; } = + bool.TryParse(Environment.GetEnvironmentVariable(WarnLicenseScanDiffsEnv), out bool warnOnLicenseScanDiffs) && warnOnLicenseScanDiffs; // Indicates whether the tests are being run in the context of a CI pipeline public static bool RunningInCI { get; } = bool.TryParse(Environment.GetEnvironmentVariable(RunningInCIEnv), out bool runningInCI) && runningInCI; + + public static string? LicenseScanPath { get; } = Environment.GetEnvironmentVariable(LicenseScanPathEnv); } diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DebugTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DebugTests.cs index 939339207..1876bf20f 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DebugTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DebugTests.cs @@ -12,7 +12,7 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; -public class DebugTests : SmokeTests +public class DebugTests : SdkTests { private record ScanResult(string FileName, bool HasDebugInfo, bool HasDebugAbbrevs, bool HasFileSymbols, bool HasGnuDebugLink); @@ -21,7 +21,8 @@ public class DebugTests : SmokeTests /// /// Verifies that all generated native files include native debug symbols. /// - [Fact] + // https://github.com/dotnet/source-build/issues/3668 + //[Fact] public void SourceBuiltSdkContainsNativeDebugSymbols() { diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetFormatTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetFormatTests.cs index 86c6f2650..4ec0ad325 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetFormatTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetFormatTests.cs @@ -8,7 +8,7 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; -public class DotNetFormatTests : SmokeTests +public class DotNetFormatTests : SdkTests { private const string TestFileName = "FormatTest.cs"; private const string UnformattedFileName = "FormatTestUnformatted.cs"; diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs index 7c1a8673c..f35440d4c 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs @@ -3,14 +3,12 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Sockets; -using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -21,7 +19,6 @@ internal class DotNetHelper private static readonly object s_lockObj = new(); public static string DotNetPath { get; } = Path.Combine(Config.DotNetDirectory, "dotnet"); - public static string LogsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "logs"); public static string PackagesDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "packages"); public static string ProjectsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), $"projects-{DateTime.Now:yyyyMMddHHmmssffff}"); @@ -56,11 +53,6 @@ internal class DotNetHelper { Directory.CreateDirectory(PackagesDirectory); } - - if (!Directory.Exists(LogsDirectory)) - { - Directory.CreateDirectory(LogsDirectory); - } } } @@ -261,7 +253,7 @@ internal class DotNetHelper fileName += $"-{differentiator}"; } - return $"/bl:{Path.Combine(LogsDirectory, $"{fileName}.binlog")}"; + return $"/bl:{Path.Combine(TestBase.LogsDirectory, $"{fileName}.binlog")}"; } private static bool DetermineIsMonoRuntime(string dotnetRoot) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs index a65f6d7e0..f8dd365ec 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs @@ -9,11 +9,12 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; -public class DotNetWatchTests : SmokeTests +public class DotNetWatchTests : SdkTests { public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - [Fact] + // https://github.com/dotnet/source-build/issues/3668 + //[Fact] public void WatchTests() { string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests)); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/LicenseScanTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/LicenseScanTests.cs new file mode 100644 index 000000000..46efa0420 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/LicenseScanTests.cs @@ -0,0 +1,292 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.RegularExpressions; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.DotNet.SourceBuild.SmokeTests; + +/// +/// Scans the VMR for licenses and compares them to a baseline. This ensures that only open-source licenses are used for relevant files. +/// +/// +/// Each sub-repo of the VMR is scanned separately because of the amount of time it takes. +/// When scanning is run, the test provides a list of files for the scanner to ignore. These include binary file types. It also includes +/// .il/.ildump file types which are massive, causing the scanner to choke and don't include license references anyway. +/// Once the scanner returns the results, a filtering process occurs. First, any detected license that is in the allowed list of licenses +/// is filtered out. The test defines a list of such licenses that all represent open-source licenses. Next, a license exclusions file is +/// applied to the filtering. This file contains a set of paths for which certain detected licenses are to be ignored. Such a path can be +/// defined to ignore all detected licenses or specific ones. These exclusions are useful for ignoring false positives where the scanning +/// tool has detected something in the file that makes it think it's a license reference when that's not actually the intent. Other cases +/// that are excluded are when the license is meant as configuration or test data and not actually applying to the code. These exclusions +/// further filter down the set of the detected licenses for each file. Everything that's left at this point is reported. It gets compared +/// to a baseline file (which is defined for each sub-repo). If the filtered results differ from what's defined in the baseline, the test fails. +/// +/// Rules for determining how to resolve a detected license: +/// 1. If it's an allowed open-source license, add it to the list of allowed licenses in LicenseScanTests.cs. +/// 2. If the file shouldn't be scanned as a general rule because of its file type (e.g. image file), add it to the list of excluded file types in LicenseScanTests.cs. +/// 3. Add it to LicenseExclusions.txt if the referenced license is one of the following: +/// a. Not applicable (e.g. test data) +/// b. False positive +/// 4. If the license is not allowed for open-souce, the license needs to be fixed. Everything else should go in the baseline file. +/// +public class LicenseScanTests : TestBase +{ + private const string BaselineSubDir = "licenses"; + + private static readonly string[] s_allowedLicenseExpressions = new string[] + { + "apache-1.1", // https://opensource.org/license/apache-1-1/ + "apache-2.0", // https://opensource.org/license/apache-2-0/ + "apache-2.0 WITH apple-runtime-library-exception", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/apple-runtime-library-exception.LICENSE + "apache-2.0 WITH llvm-exception", // https://foundation.llvm.org/relicensing/LICENSE.txt + "apsl-2.0", // https://opensource.org/license/apsl-2-0-php/ + "boost-1.0", // https://opensource.org/license/bsl-1-0/ + "bsd-new", // https://opensource.org/license/BSD-3-clause/ + "bsd-original", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/bsd-original.LICENSE + "bsd-original-uc", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/bsd-original-uc.LICENSE + "bsd-simplified", // https://opensource.org/license/bsd-2-clause/ + "bytemark", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/bytemark.LICENSE + "bzip2-libbzip-2010", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/bzip2-libbzip-2010.LICENSE + "cc0-1.0", // https://creativecommons.org/publicdomain/zero/1.0/legalcode + "cc-by-3.0", // https://creativecommons.org/licenses/by/3.0/legalcode + "cc-by-sa-3.0", // https://creativecommons.org/licenses/by-sa/3.0/legalcode + "cc-by-sa-4.0", // https://creativecommons.org/licenses/by-sa/4.0/legalcode + "cc-pd", // https://creativecommons.org/publicdomain/mark/1.0/ + "epl-1.0", // https://opensource.org/license/epl-1-0/ + "generic-cla", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/generic-cla.LICENSE + "gpl-1.0-plus", // https://opensource.org/license/gpl-1-0/ + "gpl-2.0", // https://opensource.org/license/gpl-2-0/ + "ietf", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/ietf.LICENSE + "gpl-2.0-plus WITH autoconf-simple-exception-2.0", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/rules/gpl-2.0-plus_with_autoconf-simple-exception-2.0_8.RULE + "gpl-2.0 WITH gcc-linking-exception-2.0", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/rules/gpl-2.0_with_gcc-linking-exception-2.0_6.RULE + "isc", // https://opensource.org/license/isc-license-txt/ + "iso-8879", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/iso-8879.LICENSE + "lgpl-2.0-plus", // https://opensource.org/license/lgpl-2-0/ + "lgpl-2.1", // https://opensource.org/license/lgpl-2-1/ + "lgpl-2.1-plus", // https://opensource.org/license/lgpl-2-1/ + "mit", // https://opensource.org/license/mit/ + "mit-addition", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/mit-addition.LICENSE + "ms-patent-promise", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/ms-patent-promise.LICENSE + "ms-lpl", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/ms-lpl.LICENSE + "ms-pl", // https://opensource.org/license/ms-pl-html/ + "ms-rl", // https://opensource.org/license/ms-rl-html/ + "newton-king-cla", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/newton-king-cla.LICENSE + "ngpl", // https://opensource.org/license/nethack-php/ + "object-form-exception-to-mit", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/object-form-exception-to-mit.LICENSE + "ofl-1.1", // https://opensource.org/license/ofl-1-1/ + "osf-1990", // https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#HP_Variant + "public-domain", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/public-domain.LICENSE + "public-domain-disclaimer", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/public-domain-disclaimer.LICENSE + "python", // https://opensource.org/license/python-2-0/ + "rpl-1.5", // https://opensource.org/license/rpl-1-5/ + "sax-pd", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/sax-pd.LICENSE + "unicode", // https://opensource.org/license/unicode-inc-license-agreement-data-files-and-software/ + "unicode-mappings", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/unicode-mappings.LICENSE + "uoi-ncsa", // https://opensource.org/license/uoi-ncsa-php/ + "w3c-software-19980720", // https://opensource.org/license/w3c/ + "w3c-software-doc-20150513", // https://opensource.org/license/w3c/ + "warranty-disclaimer", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/warranty-disclaimer.LICENSE + "x11", // https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/x11.LICENSE + "zlib" // https://opensource.org/license/zlib/ + }; + + private static readonly string[] s_ignoredFilePatterns = new string[] + { + "*.bin", + "*.bmp", + "*.bson", + "*.db", + "*.dic", + "*.eot", + "*.gif", + "*.ico", + "*.jpg", + "*.il", + "*.ildump", + "*.lss", + "*.nlp", + "*.otf", + "*.pdf", + "*.pfx", + "*.png", + "*.snk", + "*.ttf", + "*.vsd", + "*.vsdx", + "*.winmd", + "*.woff", + "*.woff2", + "*.xlsx", + }; + + private readonly string _targetRepo; + + public LicenseScanTests(ITestOutputHelper outputHelper) : base(outputHelper) + { + Assert.NotNull(Config.LicenseScanPath); + _targetRepo = new DirectoryInfo(Config.LicenseScanPath).Name; + } + + // https://github.com/dotnet/source-build/issues/3668 + //[SkippableFact(Config.LicenseScanPathEnv, skipOnNullOrWhiteSpaceEnv: true)] + public void ScanForLicenses() + { + Assert.NotNull(Config.LicenseScanPath); + + string OriginalScancodeResultsPath = Path.Combine(LogsDirectory, "scancode-results-original.json"); + string FilteredScancodeResultsPath = Path.Combine(LogsDirectory, "scancode-results-filtered.json"); + + // Scancode Doc: https://scancode-toolkit.readthedocs.io/en/latest/index.html + string ignoreOptions = string.Join(" ", s_ignoredFilePatterns.Select(pattern => $"--ignore {pattern}")); + ExecuteHelper.ExecuteProcessValidateExitCode( + "scancode", + $"--license --strip-root --only-findings {ignoreOptions} --json-pp {OriginalScancodeResultsPath} {Config.LicenseScanPath}", + OutputHelper); + + JsonDocument doc = JsonDocument.Parse(File.ReadAllText(OriginalScancodeResultsPath)); + ScancodeResults? scancodeResults = doc.Deserialize(); + Assert.NotNull(scancodeResults); + + FilterFiles(scancodeResults); + + JsonSerializerOptions options = new() + { + WriteIndented = true + }; + string json = JsonSerializer.Serialize(scancodeResults, options); + File.WriteAllText(FilteredScancodeResultsPath, json); + + string baselineName = $"Licenses.{_targetRepo}.json"; + + string baselinePath = BaselineHelper.GetBaselineFilePath(baselineName, BaselineSubDir); + if (!File.Exists(baselinePath)) + { + Assert.Fail($"No license baseline file exists for repo '{_targetRepo}'. Expected file: {baselinePath}"); + } + + BaselineHelper.CompareBaselineContents(baselineName, json, OutputHelper, Config.WarnOnLicenseScanDiffs, BaselineSubDir); + } + + private LicenseExclusion ParseLicenseExclusion(string rawExclusion) + { + string[] parts = rawExclusion.Split('|', StringSplitOptions.RemoveEmptyEntries); + + Match repoNameMatch = Regex.Match(parts[0], @"(?<=src/)[^/]+"); + + Assert.True(repoNameMatch.Success); + + // The path in the exclusion file is rooted from the VMR. But the path in the scancode results is rooted from the + // target repo within the VMR. So we need to strip off the beginning part of the path. + Match restOfPathMatch = Regex.Match(parts[0], @"(?<=src/[^/]+/).*"); + string path = restOfPathMatch.Value; + + if (parts.Length == 0 || parts.Length > 2) + { + throw new Exception($"Invalid license exclusion: '{rawExclusion}'"); + } + + if (parts.Length > 1) + { + string[] licenseExpressions = parts[1].Split(',', StringSplitOptions.RemoveEmptyEntries); + return new LicenseExclusion(repoNameMatch.Value, path, licenseExpressions); + } + else + { + return new LicenseExclusion(repoNameMatch.Value, path, Enumerable.Empty()); + } + } + + private void FilterFiles(ScancodeResults scancodeResults) + { + IEnumerable rawExclusions = Utilities.ParseExclusionsFile("LicenseExclusions.txt"); + IEnumerable exclusions = rawExclusions + .Select(exclusion => ParseLicenseExclusion(exclusion)) + .Where(exclusion => exclusion.Repo == _targetRepo) + .ToList(); + + // This will filter out files that we don't want to include in the baseline. + // Filtering can happen in two ways: + // 1. There are a set of allowed license expressions that apply to all files. If a file has a match on one of those licenses, + // that license will not be considered. + // 2. The LicenseExclusions.txt file contains a list of files and the licenses that should be excluded from those files. + // Once the license expression filtering has been applied, if a file has any licenses left, it will be included in the baseline. + // In that case, the baseline will list all of the licenses for that file, even if some were originally excluded during this processing. + // In other words, the baseline will be fully representative of the licenses that apply to the files that are listed there. + + for (int i = scancodeResults.Files.Count - 1; i >= 0; i--) + { + ScancodeFileResult file = scancodeResults.Files[i]; + + // A license expression can be a logical expression, e.g. "(MIT OR Apache-2.0)" + // For our purposes, we just care about the license involved, not the semantics of the expression. + // Parse out all the expression syntax to just get the license names. + string[] licenses = file.LicenseExpression? + .Replace("(", string.Empty) + .Replace(")", string.Empty) + .Replace(" AND ", ",") + .Replace(" OR ", ",") + .Split(",", StringSplitOptions.RemoveEmptyEntries) + .Select(license => license.Trim()) + .ToArray() + ?? Array.Empty(); + + // First check whether the file's licenses can all be matched with allowed expressions + IEnumerable disallowedLicenses = licenses + .Where(license => !s_allowedLicenseExpressions.Contains(license, StringComparer.OrdinalIgnoreCase)); + + if (!disallowedLicenses.Any()) + { + scancodeResults.Files.Remove(file); + } + else + { + // There are some licenses that are not allowed. Now check whether the file is excluded. + + IEnumerable matchingExclusions = + Utilities.GetMatchingFileExclusions(file.Path, exclusions, exclusion => exclusion.Path); + + IEnumerable excludedLicenses = matchingExclusions.SelectMany(exclusion => exclusion.LicenseExpressions); + // If no licenses are explicitly specified, it means they're all excluded. + if (matchingExclusions.Any() && !excludedLicenses.Any()) + { + scancodeResults.Files.Remove(file); + } + else + { + IEnumerable remainingLicenses = disallowedLicenses.Except(excludedLicenses); + + if (!remainingLicenses.Any()) + { + scancodeResults.Files.Remove(file); + } + } + } + } + } + + private record LicenseExclusion(string Repo, string Path, IEnumerable LicenseExpressions); + + private class ScancodeResults + { + [JsonPropertyName("files")] + public List Files { get; set; } = new(); + } + + private class ScancodeFileResult + { + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + [JsonPropertyName("detected_license_expression")] + public string? LicenseExpression { get; set; } + } +} diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj index c491778a8..7dea9a19c 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj @@ -11,8 +11,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/OmniSharpTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/OmniSharpTests.cs index 48cdb1d50..027be80d5 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/OmniSharpTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/OmniSharpTests.cs @@ -16,27 +16,28 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests; /// /// OmniSharp tests to ensure it works with a source-built sdk. /// -public class OmniSharpTests : SmokeTests +public class OmniSharpTests : SdkTests { // Update version as new releases become available: https://github.com/OmniSharp/omnisharp-roslyn/releases - private const string OmniSharpReleaseVersion = "1.39.8"; + private const string OmniSharpReleaseVersion = "1.39.10"; private string OmniSharpDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), nameof(OmniSharpTests)); public OmniSharpTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - [SkippableTheory(Config.ExcludeOmniSharpEnv, skipOnTrueEnv: true, skipArchitectures: new[] { "ppc64le", "s390x" })] - [InlineData(DotNetTemplate.BlazorWasm)] - [InlineData(DotNetTemplate.ClassLib)] - [InlineData(DotNetTemplate.Console)] - [InlineData(DotNetTemplate.MSTest)] - [InlineData(DotNetTemplate.Mvc)] - [InlineData(DotNetTemplate.NUnit)] - [InlineData(DotNetTemplate.Web)] - [InlineData(DotNetTemplate.WebApp)] - [InlineData(DotNetTemplate.WebApi)] - [InlineData(DotNetTemplate.Worker)] - [InlineData(DotNetTemplate.XUnit)] + // https://github.com/dotnet/source-build/issues/3668 + // [SkippableTheory(Config.ExcludeOmniSharpEnv, skipOnTrueEnv: true, skipArchitectures: new[] { "ppc64le", "s390x" })] + // [InlineData(DotNetTemplate.BlazorWasm)] + // [InlineData(DotNetTemplate.ClassLib)] + // [InlineData(DotNetTemplate.Console)] + // [InlineData(DotNetTemplate.MSTest)] + // [InlineData(DotNetTemplate.Mvc)] + // [InlineData(DotNetTemplate.NUnit)] + // [InlineData(DotNetTemplate.Web)] + // [InlineData(DotNetTemplate.WebApp)] + // [InlineData(DotNetTemplate.WebApi)] + // [InlineData(DotNetTemplate.Worker)] + // [InlineData(DotNetTemplate.XUnit)] public async void VerifyScenario(DotNetTemplate template) { await InitializeOmniSharp(); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/PoisonTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/PoisonTests.cs index 6eb8203f5..3caada6f7 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/PoisonTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/PoisonTests.cs @@ -9,11 +9,12 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests { - public class PoisonTests : SmokeTests + public class PoisonTests : SdkTests { public PoisonTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - - [SkippableFact(Config.PoisonReportPathEnv, skipOnNullOrWhiteSpaceEnv: true)] + + // https://github.com/dotnet/source-build/issues/3668 + // [SkippableFact(Config.PoisonReportPathEnv, skipOnNullOrWhiteSpaceEnv: true)] public void VerifyUsage() { if (!File.Exists(Config.PoisonReportPath)) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs index d3b0c8a26..8dda3be9e 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs @@ -17,7 +17,7 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; [Trait("Category", "SdkContent")] -public class SdkContentTests : SmokeTests +public class SdkContentTests : SdkTests { private const string MsftSdkType = "msft"; private const string SourceBuildSdkType = "sb"; @@ -31,7 +31,8 @@ public class SdkContentTests : SmokeTests /// This makes the baseline durable between releases. This does mean however, entries /// in the baseline may appear identical if the diff is version specific. /// - [SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)] + // https://github.com/dotnet/source-build/issues/3668 + //[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)] public void CompareMsftToSbFileList() { const string msftFileListingFileName = "msftSdkFiles.txt"; @@ -44,7 +45,8 @@ public class SdkContentTests : SmokeTests BaselineHelper.CompareBaselineContents("MsftToSbSdkFiles.diff", diff, OutputHelper, Config.WarnOnSdkContentDiffs); } - [SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)] + // https://github.com/dotnet/source-build/issues/3668 + //[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)] public void CompareMsftToSbAssemblyVersions() { Assert.NotNull(Config.MsftSdkTarballPath); @@ -98,7 +100,7 @@ public class SdkContentTests : SmokeTests if (sbVersion is not null && msftVersion is not null && sbVersion >= msftVersion && - IsFileExcluded(assemblyPath, assemblyVersionDiffFilters)) + Utilities.IsFileExcluded(assemblyPath, assemblyVersionDiffFilters)) { sbSdkAssemblyVersions.Remove(assemblyPath); msftSdkAssemblyVersions.Remove(assemblyPath); @@ -182,7 +184,7 @@ public class SdkContentTests : SmokeTests string relativePath = Path.GetRelativePath(sbSdkPath, file); string normalizedPath = BaselineHelper.RemoveVersions(relativePath); - if (!IsFileExcluded(normalizedPath, exclusionFilters)) + if (!Utilities.IsFileExcluded(normalizedPath, exclusionFilters)) { sbSdkAssemblyVersions.Add(normalizedPath, GetVersion(assemblyName)); } @@ -208,32 +210,13 @@ public class SdkContentTests : SmokeTests } private static IEnumerable RemoveExclusions(IEnumerable files, IEnumerable exclusions) => - files.Where(item => !IsFileExcluded(item, exclusions)); - - private static bool IsFileExcluded(string filePath, IEnumerable exclusions) => - exclusions.Any(p => FileSystemName.MatchesSimpleExpression(p, filePath)); + files.Where(item => !Utilities.IsFileExcluded(item, exclusions)); private static IEnumerable GetSdkDiffExclusionFilters(string sdkType) => - ParseExclusionsFile("SdkFileDiffExclusions.txt", sdkType); + Utilities.ParseExclusionsFile("SdkFileDiffExclusions.txt", sdkType); private static IEnumerable GetSdkAssemblyVersionDiffExclusionFilters() => - ParseExclusionsFile("SdkAssemblyVersionDiffExclusions.txt"); - - private static IEnumerable ParseExclusionsFile(string exclusionsFileName, string? prefix = null) - { - string exclusionsFilePath = Path.Combine(BaselineHelper.GetAssetsDirectory(), exclusionsFileName); - int prefixSkip = prefix?.Length + 1 ?? 0; - return File.ReadAllLines(exclusionsFilePath) - // process only specific sdk exclusions if a prefix is provided - .Where(line => prefix is null || line.StartsWith(prefix + ",")) - .Select(line => - { - // Ignore comments - var index = line.IndexOf('#'); - return index >= 0 ? line[prefixSkip..index].TrimEnd() : line[prefixSkip..]; - }) - .ToList(); - } + Utilities.ParseExclusionsFile("SdkAssemblyVersionDiffExclusions.txt"); private static string RemoveDiffMarkers(string source) { diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SmokeTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkTests.cs similarity index 66% rename from src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SmokeTests.cs rename to src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkTests.cs index 3c197262b..ba3381360 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SmokeTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkTests.cs @@ -7,16 +7,14 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; /// -/// Shared base class for all smoke tests. +/// Shared base class for all SDK-based smoke tests. /// -public abstract class SmokeTests +public abstract class SdkTests : TestBase { internal DotNetHelper DotNetHelper { get; } - internal ITestOutputHelper OutputHelper { get; } - protected SmokeTests(ITestOutputHelper outputHelper) + protected SdkTests(ITestOutputHelper outputHelper) : base(outputHelper) { DotNetHelper = new DotNetHelper(outputHelper); - OutputHelper = outputHelper; } } diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SourceBuiltArtifactsTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SourceBuiltArtifactsTests.cs index 9fbbbc781..8ab1a9600 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SourceBuiltArtifactsTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SourceBuiltArtifactsTests.cs @@ -13,13 +13,14 @@ using Xunit.Abstractions; namespace Microsoft.DotNet.SourceBuild.SmokeTests; -public class SourceBuiltArtifactsTests : SmokeTests +public class SourceBuiltArtifactsTests : SdkTests { public SourceBuiltArtifactsTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - [Fact] + [SkippableFact(Config.SourceBuiltArtifactsPathEnv, skipOnNullOrWhiteSpaceEnv: true)] public void VerifyVersionFile() { + Assert.NotNull(Config.SourceBuiltArtifactsPath); string outputDir = Path.Combine(Directory.GetCurrentDirectory(), "sourcebuilt-artifacts"); Directory.CreateDirectory(outputDir); try diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/TestBase.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/TestBase.cs new file mode 100644 index 000000000..963f07109 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/TestBase.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using Xunit.Abstractions; + +namespace Microsoft.DotNet.SourceBuild.SmokeTests; + +public abstract class TestBase +{ + public static string LogsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "logs"); + + public ITestOutputHelper OutputHelper { get; } + + public TestBase(ITestOutputHelper outputHelper) + { + OutputHelper = outputHelper; + + if (!Directory.Exists(LogsDirectory)) + { + Directory.CreateDirectory(LogsDirectory); + } + } +} diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Utilities.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Utilities.cs index ad454aad6..228a65a61 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Utilities.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Utilities.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Formats.Tar; using System.IO; using System.IO.Compression; +using System.IO.Enumeration; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,37 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests; public static class Utilities { + /// + /// Returns whether the given file path is excluded by the given exclusions using glob file matching. + /// + public static bool IsFileExcluded(string filePath, IEnumerable exclusions) => + GetMatchingFileExclusions(filePath, exclusions, exclusion => exclusion).Any(); + + public static IEnumerable GetMatchingFileExclusions(string filePath, IEnumerable exclusions, Func getExclusionExpression) => + exclusions.Where(exclusion => FileSystemName.MatchesSimpleExpression(getExclusionExpression(exclusion), filePath)); + + /// + /// Parses a common file format in the test suite for listing file exclusions. + /// + /// Name of the exclusions file. + /// When specified, filters the exclusions to those that begin with the prefix value. + public static IEnumerable ParseExclusionsFile(string exclusionsFileName, string? prefix = null) + { + string exclusionsFilePath = Path.Combine(BaselineHelper.GetAssetsDirectory(), exclusionsFileName); + int prefixSkip = prefix?.Length + 1 ?? 0; + return File.ReadAllLines(exclusionsFilePath) + // process only specific exclusions if a prefix is provided + .Where(line => prefix is null || line.StartsWith(prefix + ",")) + .Select(line => + { + // Ignore comments + var index = line.IndexOf('#'); + return index >= 0 ? line[prefixSkip..index].TrimEnd() : line[prefixSkip..]; + }) + .Where(line => !string.IsNullOrEmpty(line)) + .ToList(); + } + public static void ExtractTarball(string tarballPath, string outputDir, ITestOutputHelper outputHelper) { // TarFile doesn't properly handle hard links (https://github.com/dotnet/runtime/pull/85378#discussion_r1221817490), diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/WebScenarioTests.cs b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/WebScenarioTests.cs index 654fe9552..7add54635 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/WebScenarioTests.cs +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/WebScenarioTests.cs @@ -16,12 +16,13 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests; /// for related basic scenarios. /// They are encapsulated in a separate testclass so that they can be run in parallel. /// -public class WebScenarioTests : SmokeTests +public class WebScenarioTests : SdkTests { public WebScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - [Theory] - [MemberData(nameof(GetScenarioObjects))] + // https://github.com/dotnet/source-build/issues/3668 + // [Theory] + // [MemberData(nameof(GetScenarioObjects))] public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper); public static IEnumerable GetScenarioObjects() => GetScenarios().Select(scenario => new object[] { scenario }); diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt new file mode 100644 index 000000000..e0efc77dd --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/LicenseExclusions.txt @@ -0,0 +1,257 @@ +# Contains the list of files to be excluded from license scanning. +# +# This list is processed using FileSystemName.MatchesSimpleExpression +# +# Format: +# Exclude the file entirely from license scanning: +# +# Exclude a specific detected license expression from the scan results for the file: +# |[,...] + +# +# arcade +# + +# False positive +src/arcade/Documentation/UnifiedBuild/Foundational-Concepts.md +src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/src/BuildFPMToolPreReqs.cs|json +src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/build/rpm_templates/copyright|cecill-c +src/arcade/src/SignCheck/SignCheck/THIRD-PARTY-NOTICES.TXT + +# Doesn't apply to code +src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Licenses/* + +# Applies to installer, not source +src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/build/wix/eula.rtf + +# +# aspnetcore +# + +# Line 1 is a generic statement about license applicability that is being detected as "unknown" +src/aspnetcore/src/Components/THIRD-PARTY-NOTICES.txt|unknown + +# Windows installer files that have a reference to a URL for license +src/aspnetcore/src/Installers/Windows/**/*.wxl|unknown-license-reference +src/aspnetcore/src/Installers/Windows/**/*.wxs|unknown-license-reference + +# License reference used in configuration, but not applying to code +src/aspnetcore/src/Mvc/Settings.StyleCop|unknown-license-reference +src/aspnetcore/src/submodules/MessagePack-CSharp/stylecop.json|unknown + +# +# command-line-api +# + +# False positive +src/command-line-api/System.CommandLine.sln|json + +# +# deployment-tools +# + +# False positive +src/deployment-tools/THIRD-PARTY-NOTICES.TXT|unknown-license-reference + +# +# diagnostics +# + +# False positive +src/diagnostics/THIRD-PARTY-NOTICES.TXT|codesourcery-2004 + +# +# format +# + +# False positive +src/format/THIRD-PARTY-NOTICES.TXT|unknown-license-reference + +# +# fsharp +# + +# False positive +src/fsharp/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs|unknown-license-reference +src/fsharp/tests/service/data/TestTP/ProvidedTypes.fs|unknown-license-reference +src/fsharp/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs|unknown-license-reference + +# Applies to installer, not source +src/fsharp/setup/resources/eula/*.rtf + +# +# installer +# + +# False positive +src/installer/src/core-sdk-tasks/BuildFPMToolPreReqs.cs|json +src/installer/src/redist/targets/packaging/osx/clisdk/resources/en.lproj/welcome.html|cecill-c +src/installer/THIRD-PARTY-NOTICES|proprietary-license + +# Configuration, doesn't apply to source directly +src/installer/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt +src/installer/src/redist/targets/packaging/**/*.json + +# +# msbuild +# + +# License reference used in build configuration, but not applying to code +src/msbuild/src/Directory.Build.props|ms-net-library-2018-11 + +# False positive +src/msbuild/src/Build/Instance/ProjectItemInstance.cs|generic-exception + +# +# nuget-client +# + +# False positive +src/nuget-client/build/NOTICES.txt|other-copyleft +src/nuget-client/README.md|unknown-license-reference +src/nuget-client/src/NuGet.Clients/NuGet.PackageManagement.UI/Resources.Designer.cs|unknown-license-reference +src/nuget-client/src/NuGet.Clients/NuGet.PackageManagement.UI/Actions/UIActionEngine.cs|unknown-license-reference +src/nuget-client/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Services/NuGetPackageFileService.cs|proprietary-license +src/nuget-client/src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/Formatters/LicenseMetadataFormatter.cs|proprietary-license +src/nuget-client/src/NuGet.Core/NuGet.Packaging/PackageCreation/Authoring/LicenseMetadata.cs|unknown-license-reference +src/nuget-client/src/NuGet.Core/NuGet.Packaging/Rules/DefaultManifestValuesRule.cs|unknown-license-reference +src/nuget-client/test/TestExtensions/GenerateLicenseList/Program.cs|json + +# Test data +src/nuget-client/test/**/resources/*.json +src/nuget-client/test/**/resources/*.xml +src/nuget-client/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/PackageLicenseUtilitiesTests.cs +src/nuget-client/test/NuGet.Core.Tests/NuGet.Packaging.Test/DefaultManifestValuesRuleTests.cs +src/nuget-client/test/NuGet.Core.Tests/NuGet.Packaging.Test/LicensesTests/LicenseExpressionTokenizerTests.cs +src/nuget-client/test/NuGet.Core.Tests/NuGet.Packaging.Test/LicensesTests/NuGetLicenseExpressionParserTests.cs +src/nuget-client/test/NuGet.Core.Tests/NuGet.Packaging.Test/LicensesTests/NuGetLicenseTests.cs +src/nuget-client/test/TestUtilities/Test.Utility/JsonData.cs + +# +# roslyn-analyzers +# + +# Build asset, not applicable to source +src/roslyn-analyzers/assets/EULA.txt|ms-net-library + +# +# roslyn +# + +# Test data +src/roslyn/src/Analyzers/VisualBasic/Tests/FileHeaders/FileHeaderTests.vb|unknown-license-reference +src/roslyn/src/EditorFeatures/CSharpTest2/EmbeddedLanguages/RegularExpressions/Regex_RealWorldPatterns.json + +# False positive +src/roslyn/src/Compilers/**/Portable/Symbols/NonMissingModuleSymbol.*|proprietary-license +src/roslyn/src/NuGet/ThirdPartyNotices.rtf|json + +# Applicable to installer, not source +src/roslyn/src/Setup/Roslyn.ThirdPartyNotices/ThirdPartyNotices.rtf +src/roslyn/src/Setup/Roslyn.VsixLicense/EULA.rtf + +# +# runtime +# + +# Doc describing licenses, not applicable to source +src/runtime/docs/project/copyright.md +src/runtime/docs/project/glossary.md + +# Doc that references a license, not applicable to source +src/runtime/src/coreclr/nativeaot/docs/compiling.md|openssl-ssleay + +# Installer asset, not applicable to source +src/runtime/src/installer/pkg/LICENSE-MSFT.TXT +src/runtime/src/installer/pkg/THIRD-PARTY-NOTICES.TXT + +# False positive +src/runtime/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicFileLicenseProvider.cs|proprietary-license +src/runtime/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/LongValidatorTest.cs|json +src/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs|other-permissive +src/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs|other-permissive +src/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs|other-permissive +src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/README.md|unknown-license-reference +src/runtime/src/libraries/System.Runtime/tests/TestModule/README.md|unknown-license-reference +src/runtime/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlLicenseTransform.cs|proprietary-license +src/runtime/src/libraries/System.ServiceModel.Syndication/tests/BasicScenarioTests.cs|unknown-license-reference +src/runtime/src/mono/mono/mini/mini-posix.c|unknown-license-reference +src/runtime/src/mono/mono/mini/mini-windows.c|unknown-license-reference +src/runtime/src/native/external/libunwind/doc/libunwind-ia64.*|generic-exception +src/runtime/src/tests/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs|unknown-license-reference + +# Test data +src/runtime/src/libraries/System.Private.Xml.Linq/tests/XDocument.Common/InputSpace.cs|other-permissive +src/runtime/src/libraries/System.Private.Xml.Linq/tests/XDocument.Common/THIRD-PARTY-NOTICE|other-permissive +src/runtime/src/libraries/System.ServiceModel.Syndication/tests/TestFeeds/AtomFeeds/*.xml +src/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs|other-permissive + +# Reference to a license, not applicable to source +src/runtime/src/libraries/System.Text.Json/roadmap/images/core-components.txt|unknown-license-reference +src/runtime/src/libraries/System.Text.Json/roadmap/images/higher-level-components.txt + +# Sample data +src/runtime/src/mono/sample/wasm/browser-webpack/package-lock.json + +# +# source-build-externals +# + +# False positive +src/source-build-externals/src/abstractions-xunit/README.md|free-unknown +src/source-build-externals/src/application-insights/NETCORE/ThirdPartyNotices.txt|unknown +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/benchmark/Microsoft.IdentityModel.Benchmarks/CreateTokenTests.cs|proprietary-license +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.JsonWebTokens/JsonClaimValueTypes.cs|proprietary-license +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.Tokens.Saml/Saml/ClaimProperties.cs|proprietary-license +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlTokenUtilities.cs|proprietary-license +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.Tokens.Saml/Saml2/ClaimProperties.cs|proprietary-license +src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/src/System.IdentityModel.Tokens.Jwt/JsonClaimValueTypes.cs|proprietary-license +src/source-build-externals/src/humanizer/readme.md|free-unknown +src/source-build-externals/src/humanizer/NuSpecs/*.nuspec* +src/source-build-externals/src/xunit/README.md|free-unknown +src/source-build-externals/src/xunit/src/xunit.assert/Asserts/README.md|free-unknown +src/source-build-externals/src/xunit/xunit.sln|json + +# A patch which removes the license usage but contains references to the removed license as part of the patch reference lines +src/source-build-externals/patches/application-insights/0002-Remove-WebGrease-from-TPN-2816.patch + +# +# source-build-reference-packages +# + +# False positive +src/source-build-reference-packages/src/targetPacks/ILsrc/microsoft.netcore.app.ref/3.*/THIRD-PARTY-NOTICES.TXT|codesourcery-2004 +src/source-build-reference-packages/src/targetPacks/ILsrc/netstandard.library/1.6.1/ThirdPartyNotices.txt|unknown +src/source-build-reference-packages/src/targetPacks/ILsrc/netstandard.library/2.0.*/THIRD-PARTY-NOTICES.TXT|unknown +src/source-build-reference-packages/src/targetPacks/ILsrc/netstandard.library.ref/2.1.0/THIRD-PARTY-NOTICES.TXT|codesourcery-2004 +src/source-build-reference-packages/src/textOnlyPackages/src/microsoft.codeanalysis.collections/4.2.0-1.22102.8/ThirdPartyNotices.rtf|json +src/source-build-reference-packages/src/textOnlyPackages/src/microsoft.netcore.*/1.*/ThirdPartyNotices.txt|unknown + +# Contains references to licenses which are not applicable to the source +src/source-build-reference-packages/src/packageSourceGenerator/PackageSourceGeneratorTask/RewriteNuspec.cs|unknown-license-reference,ms-net-library-2018-11 +src/source-build-reference-packages/src/textOnlyPackages/src/microsoft.private.intellisense/8.0.0-preview-20230918.1/IntellisenseFiles/windowsdesktop/1033/PresentationCore.xml|proprietary-license + +# +# sourcelink +# + +# False positive +src/sourcelink/docs/GitSpec/GitSpec.md|unknown-license-reference + +# +# test-templates +# + +# Not applicable to source +src/test-templates/Templates/**/*.vstemplate + +# +# vstest +# + +# False positive +src/vstest/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs|proprietary-license + +# Build asset, but not applying to code +src/vstest/src/package/Microsoft.CodeCoverage/ThirdPartyNoticesCodeCoverage.txt +src/vstest/src/package/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI/License.rtf diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.arcade.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.arcade.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.arcade.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.aspnetcore.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.aspnetcore.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.aspnetcore.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.cecil.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.cecil.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.cecil.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.command-line-api.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.command-line-api.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.command-line-api.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.deployment-tools.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.deployment-tools.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.deployment-tools.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.diagnostics.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.diagnostics.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.diagnostics.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.emsdk.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.emsdk.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.emsdk.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.format.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.format.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.format.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.fsharp.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.fsharp.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.fsharp.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.installer.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.installer.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.installer.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.msbuild.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.msbuild.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.msbuild.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.nuget-client.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.nuget-client.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.nuget-client.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.razor.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.razor.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.razor.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn-analyzers.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn-analyzers.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn-analyzers.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.roslyn.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.runtime.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.runtime.json new file mode 100644 index 000000000..472899b4c --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.runtime.json @@ -0,0 +1,20 @@ +{ + "files": [ + { + "path": "src/tests/GC/Scenarios/GCBench/THIRD-PARTY-NOTICES", + "detected_license_expression": "unknown-license-reference" + }, + { + "path": "src/tests/JIT/Performance/CodeQuality/Benchstones/BenchF/LLoops/THIRD-PARTY-NOTICES", + "detected_license_expression": "unknown-license-reference" + }, + { + "path": "src/tests/JIT/Performance/CodeQuality/Benchstones/MDBenchF/MDLLoops/THIRD-PARTY-NOTICES", + "detected_license_expression": "unknown-license-reference" + }, + { + "path": "src/tests/JIT/Performance/CodeQuality/V8/Richards/THIRD-PARTY-NOTICES", + "detected_license_expression": "unknown-license-reference" + } + ] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sdk.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sdk.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sdk.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-externals.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-externals.json new file mode 100644 index 000000000..42c3e6895 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-externals.json @@ -0,0 +1,12 @@ +{ + "files": [ + { + "path": "src/application-insights/LOGGING/ThirdPartyNotices.txt", + "detected_license_expression": "unknown AND apache-2.0 AND mit AND bsd-new" + }, + { + "path": "src/application-insights/WEB/ThirdPartyNotices.txt", + "detected_license_expression": "bsd-new AND mit AND ms-pl AND apache-2.0 AND (cc-by-3.0-us AND cc-by-3.0 AND mit) AND ms-net-library AND ms-rl" + } + ] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-reference-packages.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-reference-packages.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.source-build-reference-packages.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sourcelink.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sourcelink.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.sourcelink.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.symreader.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.symreader.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.symreader.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.templating.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.templating.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.templating.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.test-templates.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.test-templates.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.test-templates.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.vstest.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.vstest.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.vstest.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xdt.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xdt.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xdt.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xliff-tasks.json b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xliff-tasks.json new file mode 100644 index 000000000..6941fa698 --- /dev/null +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/baselines/licenses/Licenses.xliff-tasks.json @@ -0,0 +1,3 @@ +{ + "files": [] +} \ No newline at end of file diff --git a/src/SourceBuild/patches/format/0001-Explicitly-set-TFM-to-net9.0.patch b/src/SourceBuild/patches/format/0001-Explicitly-set-TFM-to-net9.0.patch new file mode 100644 index 000000000..ac34d9338 --- /dev/null +++ b/src/SourceBuild/patches/format/0001-Explicitly-set-TFM-to-net9.0.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Wed, 18 Oct 2023 12:50:21 -0500 +Subject: [PATCH] Explicitly set TFM to net9.0 + +Backport: https://github.com/dotnet/source-build/issues/3663 +--- + perf/dotnet-format.Performance.csproj | 2 +- + src/dotnet-format.csproj | 2 +- + tests/dotnet-format.UnitTests.csproj | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj +index 677b7b9a..3e1387d1 100644 +--- a/perf/dotnet-format.Performance.csproj ++++ b/perf/dotnet-format.Performance.csproj +@@ -1,7 +1,7 @@ +  + + +- $(NetCurrent) ++ net9.0 + Exe + true + Release +diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj +index 5549fb71..8a77d03f 100644 +--- a/src/dotnet-format.csproj ++++ b/src/dotnet-format.csproj +@@ -1,7 +1,7 @@ +  + + +- $(NetCurrent) ++ net9.0 + Exe + Microsoft.CodeAnalysis.Tools + true +diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj +index c4311a1a..5b1bcfb9 100644 +--- a/tests/dotnet-format.UnitTests.csproj ++++ b/tests/dotnet-format.UnitTests.csproj +@@ -1,7 +1,7 @@ +  + + +- $(NetCurrent) ++ net9.0 + Microsoft.CodeAnalysis.Tools.Tests + + diff --git a/src/SourceBuild/patches/format/0002-Update-Microsoft.Build.Locator-to-1.6.10.patch b/src/SourceBuild/patches/format/0002-Update-Microsoft.Build.Locator-to-1.6.10.patch new file mode 100644 index 000000000..7ce4f5dc2 --- /dev/null +++ b/src/SourceBuild/patches/format/0002-Update-Microsoft.Build.Locator-to-1.6.10.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Wed, 18 Oct 2023 13:05:45 -0500 +Subject: [PATCH] Update Microsoft.Build.Locator to 1.6.10 + +Backport: https://github.com/dotnet/sdk/issues/36219 +--- + eng/Versions.props | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/eng/Versions.props b/eng/Versions.props +index 961660e5..c330813b 100644 +--- a/eng/Versions.props ++++ b/eng/Versions.props +@@ -40,7 +40,7 @@ + + 0.13.5 + 0.13.5 +- 1.5.5 ++ 1.6.10 + 17.4.16 + + diff --git a/src/SourceBuild/patches/fsharp/0001-Explicitly-set-net9.0-TFM.patch b/src/SourceBuild/patches/fsharp/0001-Explicitly-set-net9.0-TFM.patch new file mode 100644 index 000000000..a00a05403 --- /dev/null +++ b/src/SourceBuild/patches/fsharp/0001-Explicitly-set-net9.0-TFM.patch @@ -0,0 +1,640 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Thu, 19 Oct 2023 08:33:01 -0500 +Subject: [PATCH] Explicitly use net9.0 TFM + +Backport: https://github.com/dotnet/source-build/issues/3663 +--- + Directory.Build.props | 4 +-- + buildtools/AssemblyCheck/AssemblyCheck.fsproj | 2 +- + .../FSharp.Compiler.Service_notshipped.fsproj | 2 +- + buildtools/fslex/fslex.fsproj | 2 +- + buildtools/fsyacc/fsyacc.fsproj | 2 +- + eng/build.sh | 6 ++-- + .../EditorService/EditorService.fsproj | 2 +- + src/Compiler/FSharp.Compiler.Service.fsproj | 6 ++-- + .../Microsoft.FSharp.Compiler.fsproj | 2 +- + .../Microsoft.FSharp.Compiler.nuspec | 28 +++++++++---------- + src/fsc/fscProject/fsc.fsproj | 6 ++-- + src/fsi/fsiProject/fsi.fsproj | 6 ++-- + .../SelfContained_Trimming_Test.fsproj | 6 ++-- + ...taticLinkedFSharpCore_Trimming_Test.fsproj | 6 ++-- + .../BasicProvider.DesignTime.fsproj | 2 +- + .../BasicProvider.Tests.fsproj | 2 +- + .../BasicProvider/BasicProvider.fsproj | 2 +- + .../FSharp.Build.UnitTests.fsproj | 4 +-- + .../FSharp.Compiler.ComponentTests.fsproj | 4 +-- + ...ompiler.Private.Scripting.UnitTests.fsproj | 4 +-- + .../FSharp.Compiler.Service.Tests.fsproj | 4 +-- + .../FSharp.Compiler.UnitTests.fsproj | 4 +-- + .../FSharp.Core.UnitTests.fsproj | 4 +-- + .../FSharp.Test.Utilities.fsproj | 4 +-- + .../MicroPerf/MicroPerf.fsproj | 2 +- + .../TaskPerf/TaskPerf/TaskPerf.fsproj | 2 +- + .../TaskPerfPreviousCompiler.fsproj | 2 +- + .../HistoricalBenchmark.Runner.fsproj | 2 +- + .../HistoricalBenchmark.fsproj | 2 +- + .../FSharp.Compiler.Benchmarks.fsproj | 2 +- + .../FCSSourceFiles/FCSSourceFiles.fsproj | 2 +- + .../Fsharp.ProfilingStartpointProject.fsproj | 2 +- + tests/fsharp/FSharpSuite.Tests.fsproj | 4 +-- + .../Sample_ConsoleApp_net7.fsproj | 6 ++-- + .../Sample_ConsoleApp_net7.fsproj | 6 ++-- + 35 files changed, 73 insertions(+), 73 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index 879bd8941..161d115ad 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -30,8 +30,8 @@ + $(MSBuildThisFileDirectory)artifacts/ + $(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/ + $(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/ +- $(ArtifactsDir)/bin/fslex/$(Configuration)/net8.0/fslex.dll +- $(ArtifactsDir)/bin/fsyacc/$(Configuration)/net8.0/fsyacc.dll ++ $(ArtifactsDir)/bin/fslex/$(Configuration)/net9.0/fslex.dll ++ $(ArtifactsDir)/bin/fsyacc/$(Configuration)/net9.0/fsyacc.dll + + + +diff --git a/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/buildtools/AssemblyCheck/AssemblyCheck.fsproj +index 46ffb722c..9d391689d 100644 +--- a/buildtools/AssemblyCheck/AssemblyCheck.fsproj ++++ b/buildtools/AssemblyCheck/AssemblyCheck.fsproj +@@ -2,7 +2,7 @@ + + + Exe +- net8.0 ++ net9.0 + true + false + +diff --git a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj +index 514b1f4dd..d3df3b688 100644 +--- a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj ++++ b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj +@@ -3,7 +3,7 @@ + + + +- net8.0 ++ net9.0 + true + $(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid()) + $(CachePath)\bin +diff --git a/buildtools/fslex/fslex.fsproj b/buildtools/fslex/fslex.fsproj +index 674dde7c7..8764e40e1 100644 +--- a/buildtools/fslex/fslex.fsproj ++++ b/buildtools/fslex/fslex.fsproj +@@ -2,7 +2,7 @@ + + + Exe +- net8.0 ++ net9.0 + true + false + LatestMajor +diff --git a/buildtools/fsyacc/fsyacc.fsproj b/buildtools/fsyacc/fsyacc.fsproj +index fc072b7cf..4110186e5 100644 +--- a/buildtools/fsyacc/fsyacc.fsproj ++++ b/buildtools/fsyacc/fsyacc.fsproj +@@ -2,7 +2,7 @@ + + + Exe +- net8.0 ++ net9.0 + true + false + LatestMajor +diff --git a/eng/build.sh b/eng/build.sh +index 3b992d6bf..3a4444081 100755 +--- a/eng/build.sh ++++ b/eng/build.sh +@@ -264,8 +264,8 @@ function BuildSolution { + MSBuild "$repo_root/buildtools/buildtools.proj" /restore "$bltools" /p:Configuration=$bootstrap_config + + mkdir -p "$bootstrap_dir" +- cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net8.0 $bootstrap_dir/fslex +- cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net8.0 $bootstrap_dir/fsyacc ++ cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net9.0 $bootstrap_dir/fslex ++ cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net9.0 $bootstrap_dir/fsyacc + fi + if [ ! -f "$bootstrap_dir/fsc.exe" ]; then + local bltools="" +@@ -274,7 +274,7 @@ function BuildSolution { + fi + BuildMessage="Error building bootstrap" + MSBuild "$repo_root/Proto.sln" /restore "$bltools" /p:Configuration=$bootstrap_config +- cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net8.0 $bootstrap_dir/fsc ++ cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net9.0 $bootstrap_dir/fsc + fi + fi + +diff --git a/fcs-samples/EditorService/EditorService.fsproj b/fcs-samples/EditorService/EditorService.fsproj +index e4103999f..fe08d0cc4 100644 +--- a/fcs-samples/EditorService/EditorService.fsproj ++++ b/fcs-samples/EditorService/EditorService.fsproj +@@ -1,7 +1,7 @@ +  + + +- $(FcsTargetNetFxFramework);net8.0 ++ $(FcsTargetNetFxFramework);net9.0 + true + Exe + false +diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj +index 45ae22a3e..56a587c30 100644 +--- a/src/Compiler/FSharp.Compiler.Service.fsproj ++++ b/src/Compiler/FSharp.Compiler.Service.fsproj +@@ -521,15 +521,15 @@ + + + +- TargetFramework=net8.0 ++ TargetFramework=net9.0 + compile + + +- TargetFramework=net8.0 ++ TargetFramework=net9.0 + compile + + +- TargetFramework=net8.0 ++ TargetFramework=net9.0 + compile + + +diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj +index f7560b707..68b02ce25 100644 +--- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj ++++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj +@@ -3,7 +3,7 @@ + + true + Exe +- net8.0 ++ net9.0 + Microsoft.FSharp.Compiler.nuspec + true + .NET Core compatible version of the F# compiler fsc.exe. +diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec +index ca36309d5..e567e478b 100644 +--- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec ++++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec +@@ -4,7 +4,7 @@ + $CommonMetadataElements$ + en-US + +- ++ + + + +@@ -26,16 +26,16 @@ + this approach gives a very small deployment. Which is kind of necessary. + --> + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + ++ target="lib\net9.0" /> + ++ target="lib\net9.0" /> + + + +@@ -45,14 +45,14 @@ + + + +- ++ + ++ target="lib\net9.0" /> + +- ++ target="lib\net9.0" /> ++ + ++ target="lib\net9.0" /> + + +diff --git a/src/fsc/fscProject/fsc.fsproj b/src/fsc/fscProject/fsc.fsproj +index 64c4651a7..985f1492b 100644 +--- a/src/fsc/fscProject/fsc.fsproj ++++ b/src/fsc/fscProject/fsc.fsproj +@@ -3,15 +3,15 @@ + + + +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + x86 + Debug;Release;Proto;ReleaseCompressed + + + + net472 +- net8.0 ++ net9.0 + x86 + + +diff --git a/src/fsi/fsiProject/fsi.fsproj b/src/fsi/fsiProject/fsi.fsproj +index dd17f8bd5..6bfa01c3e 100644 +--- a/src/fsi/fsiProject/fsi.fsproj ++++ b/src/fsi/fsiProject/fsi.fsproj +@@ -3,15 +3,15 @@ + + + +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + x86 + Debug;Release;Proto;ReleaseCompressed + + + + net472 +- net8.0 ++ net9.0 + x86 + + +diff --git a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +index cb02b7e0f..acd4e8f10 100644 +--- a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj ++++ b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +@@ -2,7 +2,7 @@ + + + Exe +- net8.0 ++ net9.0 + preview + true + true +@@ -17,8 +17,8 @@ + + + +- $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll +- $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll ++ $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll ++ $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll + False + True + +diff --git a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj +index d36faf2c0..2004fafbe 100644 +--- a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj ++++ b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj +@@ -2,7 +2,7 @@ + + + Exe +- net8.0 ++ net9.0 + preview + true + true +@@ -19,8 +19,8 @@ + + + +- $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll +- $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll ++ $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll ++ $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll + False + True + +diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj +index b05e1882f..53c32b81b 100644 +--- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj ++++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj +@@ -2,7 +2,7 @@ + + + Library +- net8.0;net472 ++ net9.0;net472 + typeproviders + NO_GENERATIVE + IS_DESIGNTIME +diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +index 5da0cbb3b..981441310 100644 +--- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj ++++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +@@ -2,7 +2,7 @@ + + + Library +- net8.0 ++ net9.0 + $(TestTargetFramework) + false + NO_GENERATIVE +diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj +index 96006f066..24c2188c5 100644 +--- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj ++++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj +@@ -2,7 +2,7 @@ + + + Library +- net8.0;net472 ++ net9.0;net472 + typeproviders + $(FSharpCoreShippedPackageVersionValue) + typeproviders +diff --git a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj +index e3c796d0b..e4926cd6c 100644 +--- a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj ++++ b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj +@@ -3,8 +3,8 @@ + + + +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + Library + true + xunit +diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +index aefeb44cc..1d07c4d06 100644 +--- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj ++++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +@@ -3,8 +3,8 @@ + + + +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + Library + false + true +diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj +index cdfd467e5..2fdcffc90 100644 +--- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj ++++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj +@@ -2,8 +2,8 @@ + + + +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + Library + true + xunit +diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +index 7cb2dfd22..1fa999721 100644 +--- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj ++++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +@@ -3,8 +3,8 @@ + + + Exe +- net472;net8.0 +- net8.0 ++ net472;net9.0 ++ net9.0 + + + +- $(NetCurrent) ++ net9.0 + $(DefaultNetCoreTargetFramework) + + diff --git a/src/SourceBuild/patches/sdk/0001-Use-net9.0-for-tool-dependencies.patch b/src/SourceBuild/patches/sdk/0001-Use-net9.0-for-tool-dependencies.patch new file mode 100644 index 000000000..aa356f97c --- /dev/null +++ b/src/SourceBuild/patches/sdk/0001-Use-net9.0-for-tool-dependencies.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Thu, 19 Oct 2023 08:52:35 -0500 +Subject: [PATCH] Use net9.0 for tool dependencies + +Backport: https://github.com/dotnet/source-build/issues/3663 +--- + src/Layout/redist/targets/GenerateLayout.targets | 8 ++++---- + src/Layout/tool_fsharp/tool_fsc.csproj | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets +index eab01ef144..922b959531 100644 +--- a/src/Layout/redist/targets/GenerateLayout.targets ++++ b/src/Layout/redist/targets/GenerateLayout.targets +@@ -112,9 +112,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -178,7 +178,7 @@ + BeforeTargets="Build"> + + netcoreapp3.1 +- net8.0 ++ net9.0 + $(NuGetPackageRoot)/microsoft.testplatform.cli/$(MicrosoftTestPlatformCLIPackageVersion)/contentFiles/any/$(TestCliNuGetDirectoryTargetFramework)/ + + +diff --git a/src/Layout/tool_fsharp/tool_fsc.csproj b/src/Layout/tool_fsharp/tool_fsc.csproj +index adb50eed03..530c3a546b 100644 +--- a/src/Layout/tool_fsharp/tool_fsc.csproj ++++ b/src/Layout/tool_fsharp/tool_fsc.csproj +@@ -20,7 +20,7 @@ + + + +Date: Thu, 19 Oct 2023 08:29:45 -0500 +Subject: [PATCH] Explicitly use net9.0 TFM + +Backport: https://github.com/dotnet/source-build/issues/3663 +--- + Directory.Build.targets | 2 +- + .../Microsoft.TestPlatform.Build.csproj | 2 +- + .../Microsoft.TestPlatform.CLI.csproj | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Directory.Build.targets b/Directory.Build.targets +index b720568b..617ca4fc 100644 +--- a/Directory.Build.targets ++++ b/Directory.Build.targets +@@ -6,7 +6,7 @@ + + + +- $(NetCurrent) ++ net9.0 + + $(NetCurrent) + +diff --git a/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.Build.csproj b/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.Build.csproj +index a93852ce..945b1ac2 100644 +--- a/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.Build.csproj ++++ b/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.Build.csproj +@@ -12,7 +12,7 @@ + + + +- $(NetCurrent) ++ net9.0 + + + +diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.csproj b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.csproj +index b8f6849b..b56b993c 100644 +--- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.csproj ++++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.csproj +@@ -31,7 +31,7 @@ + + + +- ++ + + + diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets index 3b35e3233..d32e82555 100644 --- a/src/redist/targets/Crossgen.targets +++ b/src/redist/targets/Crossgen.targets @@ -37,13 +37,15 @@ no that we do not silently miss cross-genning some bits. When a TFM for a tool is updated, update its path explicitly. If all TFMs match, update DefaultToolTfm --> - net8.0 + net9.0 + + net8.0 $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk\tools\$(DefaultToolTfm)\ $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\tools\$(DefaultToolTfm)\ $(SdkOutputDirectory)Sdks\NuGet.Build.Tasks.Pack\CoreCLR\ $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\$(DefaultToolTfm)\ - $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\$(PreviousToolTfm)\ $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Publish\tools\$(DefaultToolTfm)\ $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web\tools\$(DefaultToolTfm)\ $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\tools\$(DefaultToolTfm)\ diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index 80082d771..29679f48f 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -106,7 +106,6 @@ <_NET70RuntimePackVersion>7.0.$(VersionFeature70) <_NET70TargetingPackVersion>7.0.$(VersionFeature70) - <_NET70WebAssemblyPackVersion>7.0.$(VersionFeature70) <_WindowsDesktop70RuntimePackVersion>7.0.$(VersionFeature70) <_WindowsDesktop70TargetingPackVersion>7.0.$(VersionFeature70) <_AspNet70RuntimePackVersion>7.0.$(VersionFeature70) @@ -335,16 +334,16 @@ win-x64; " /> - - - + + + WebAssemblySdkPackVersion="$(_NET80WebAssemblyPackVersion)" /> + WebAssemblySdkPackVersion="$(_NET80WebAssemblyPackVersion)" /> - +