From 0339fe117122821856d94dcaa0b08ab966b7ecb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 19 Nov 2021 22:37:14 +0100 Subject: Remove netcore sources and arcade eng/common files (#21315) They are no longer needed here. --- .github/CODEOWNERS | 3 - .gitmodules | 3 - Makefile.am | 6 +- configure.ac | 473 ++-- eng/Version.Details.xml | 27 - eng/Versions.props | 14 - eng/common/CIBuild.cmd | 2 - eng/common/PSScriptAnalyzerSettings.psd1 | 11 - eng/common/README.md | 28 - eng/common/SetupNugetSources.ps1 | 141 -- eng/common/SetupNugetSources.sh | 149 -- eng/common/build.ps1 | 153 -- eng/common/build.sh | 216 -- eng/common/cibuild.sh | 16 - eng/common/cross/arm/sources.list.bionic | 11 - eng/common/cross/arm/sources.list.jessie | 3 - eng/common/cross/arm/sources.list.trusty | 11 - eng/common/cross/arm/sources.list.xenial | 11 - eng/common/cross/arm/sources.list.zesty | 11 - eng/common/cross/arm/trusty-lttng-2.4.patch | 71 - eng/common/cross/arm/trusty.patch | 97 - eng/common/cross/arm64/sources.list.bionic | 11 - eng/common/cross/arm64/sources.list.buster | 11 - eng/common/cross/arm64/sources.list.stretch | 12 - eng/common/cross/arm64/sources.list.trusty | 11 - eng/common/cross/arm64/sources.list.xenial | 11 - eng/common/cross/arm64/sources.list.zesty | 11 - eng/common/cross/armel/sources.list.jessie | 3 - eng/common/cross/armel/tizen-build-rootfs.sh | 44 - eng/common/cross/armel/tizen-fetch.sh | 171 -- eng/common/cross/armel/tizen/tizen-dotnet.ks | 50 - eng/common/cross/armel/tizen/tizen.patch | 18 - eng/common/cross/build-android-rootfs.sh | 131 -- eng/common/cross/build-rootfs.sh | 278 --- eng/common/cross/toolchain.cmake | 162 -- eng/common/cross/x86/sources.list.bionic | 11 - eng/common/cross/x86/sources.list.trusty | 11 - eng/common/cross/x86/sources.list.xenial | 11 - eng/common/darc-init.ps1 | 47 - eng/common/darc-init.sh | 82 - eng/common/dotnet-install.cmd | 2 - eng/common/dotnet-install.ps1 | 28 - eng/common/dotnet-install.sh | 89 - eng/common/enable-cross-org-publishing.ps1 | 13 - eng/common/generate-graph-files.ps1 | 86 - eng/common/helixpublish.proj | 26 - eng/common/init-tools-native.cmd | 3 - eng/common/init-tools-native.ps1 | 152 -- eng/common/init-tools-native.sh | 173 -- eng/common/internal-feed-operations.ps1 | 133 -- eng/common/internal-feed-operations.sh | 142 -- eng/common/internal/Directory.Build.props | 4 - eng/common/internal/Tools.csproj | 27 - eng/common/msbuild.ps1 | 26 - eng/common/msbuild.sh | 58 - eng/common/native/CommonLibrary.psm1 | 389 ---- eng/common/native/common-library.sh | 168 -- eng/common/native/install-cmake-test.sh | 117 - eng/common/native/install-cmake.sh | 117 - eng/common/native/install-tool.ps1 | 132 -- eng/common/performance/perfhelixpublish.proj | 121 - eng/common/performance/performance-setup.ps1 | 114 - eng/common/performance/performance-setup.sh | 223 -- eng/common/pipeline-logging-functions.ps1 | 242 -- eng/common/pipeline-logging-functions.sh | 179 -- eng/common/post-build/add-build-to-channel.ps1 | 48 - .../post-build/check-channel-consistency.ps1 | 25 - eng/common/post-build/nuget-validation.ps1 | 24 - eng/common/post-build/post-build-utils.ps1 | 91 - eng/common/post-build/sourcelink-validation.ps1 | 257 --- eng/common/post-build/symbols-validation.ps1 | 188 -- eng/common/post-build/trigger-subscriptions.ps1 | 64 - eng/common/sdk-task.ps1 | 78 - eng/common/sdl/NuGet.config | 13 - eng/common/sdl/execute-all-sdl-tools.ps1 | 114 - eng/common/sdl/extract-artifact-packages.ps1 | 80 - eng/common/sdl/init-sdl.ps1 | 67 - eng/common/sdl/packages.config | 4 - eng/common/sdl/push-gdn.ps1 | 69 - eng/common/sdl/run-sdl.ps1 | 73 - eng/common/templates/job/execute-sdl.yml | 89 - eng/common/templates/job/generate-graph-files.yml | 48 - eng/common/templates/job/job.yml | 220 -- eng/common/templates/job/performance.yml | 95 - eng/common/templates/job/publish-build-assets.yml | 97 - eng/common/templates/jobs/jobs.yml | 72 - eng/common/templates/phases/base.yml | 130 -- .../templates/phases/publish-build-assets.yml | 51 - .../channels/generic-internal-channel.yml | 172 -- .../post-build/channels/generic-public-channel.yml | 178 -- .../templates/post-build/common-variables.yml | 99 - eng/common/templates/post-build/post-build.yml | 382 ---- .../templates/post-build/setup-maestro-vars.yml | 81 - .../templates/post-build/trigger-subscription.yml | 13 - .../templates/steps/add-build-to-channel.yml | 13 - eng/common/templates/steps/build-reason.yml | 12 - eng/common/templates/steps/perf-send-to-helix.yml | 66 - eng/common/templates/steps/publish-logs.yml | 23 - eng/common/templates/steps/run-on-unix.yml | 7 - eng/common/templates/steps/run-on-windows.yml | 7 - .../templates/steps/run-script-ifequalelse.yml | 33 - eng/common/templates/steps/send-to-helix.yml | 94 - eng/common/templates/steps/telemetry-end.yml | 102 - eng/common/templates/steps/telemetry-start.yml | 241 -- eng/common/tools.ps1 | 702 ------ eng/common/tools.sh | 475 ---- eng/empty.csproj | 15 - external/helix-binaries | 1 - global.json | 9 - mcs/Makefile | 1 - mcs/build/common/Consts.cs.in | 11 - mcs/build/profiles/netcore.make | 16 - mcs/class/Makefile | 7 +- .../Test/System.Net.NetworkInformation/PingTest.cs | 3 + mcs/class/corlib/Mono/RuntimeStructs.cs | 4 - mcs/class/corlib/ReferenceSources/Buffer.cs | 4 - mcs/class/corlib/ReferenceSources/JitHelpers.cs | 8 - mcs/class/corlib/ReferenceSources/RuntimeType.cs | 72 +- mcs/class/corlib/ReferenceSources/Type.cs | 2 - mcs/class/corlib/System.Diagnostics/StackTrace.cs | 4 - .../corlib/System.Globalization/CultureInfo.cs | 4 - mcs/class/corlib/System.Reflection/AssemblyName.cs | 39 +- .../System.Reflection/CustomAttributeData.cs | 11 - .../corlib/System.Reflection/RuntimeEventInfo.cs | 19 - .../corlib/System.Reflection/RuntimeFieldInfo.cs | 22 - .../corlib/System.Reflection/RuntimeMethodInfo.cs | 130 -- .../corlib/System.Reflection/RuntimeModule.cs | 16 +- .../System.Reflection/RuntimeParameterInfo.cs | 6 - .../System.Reflection/RuntimePropertyInfo.cs | 38 - .../RuntimeHelpers.cs | 2 - .../System.Runtime.InteropServices/Marshal.cs | 74 +- mcs/class/corlib/System.Threading/Monitor.cs | 4 - .../corlib/System.Threading/NativeEventCalls.cs | 4 +- .../System.Threading/RegisteredWaitHandle.cs | 8 - mcs/class/corlib/System.Threading/Thread.cs | 6 - mcs/class/corlib/System/ArgIterator.cs | 3 - mcs/class/corlib/System/Array.cs | 8 - mcs/class/corlib/System/MonoCustomAttrs.cs | 5 - mcs/class/corlib/System/MulticastDelegate.cs | 7 - mcs/class/corlib/System/RuntimeTypeHandle.cs | 4 - mcs/tools/Makefile | 4 +- mcs/tools/mono-helix-client/HelixBase.cs | 155 -- mcs/tools/mono-helix-client/HelixTestBase.cs | 100 - mcs/tools/mono-helix-client/MainlineTests.cs | 161 -- mcs/tools/mono-helix-client/Makefile | 20 - mcs/tools/mono-helix-client/mono-helix-client.cs | 78 - .../mono-helix-client.exe.sources | 5 - mcs/tools/upload-to-sentry/Makefile | 31 - mcs/tools/upload-to-sentry/UploadToSentry.cs | 636 ------ .../upload-to-sentry/upload-to-sentry.exe.sources | 156 -- mono/Makefile.am | 12 - mono/culture/locales.c | 2 - mono/culture/w32process-unix-language.c | 4 +- mono/eglib/glib.h | 8 - mono/metadata/Makefile.am | 39 +- mono/metadata/appdomain.c | 461 ---- mono/metadata/assembly-internals.h | 6 - mono/metadata/assembly-load-context.c | 411 ---- mono/metadata/assembly.c | 307 --- mono/metadata/class-init.c | 53 - mono/metadata/class-internals.h | 24 - mono/metadata/class-setup-vtable.c | 3 - mono/metadata/class.c | 4 - mono/metadata/cominterop.c | 12 - mono/metadata/console-unix.c | 14 - mono/metadata/custom-attrs.c | 10 - mono/metadata/domain-internals.h | 48 - mono/metadata/domain.c | 50 - mono/metadata/environment.c | 2 - mono/metadata/exception.c | 12 - mono/metadata/filewatcher.c | 6 - mono/metadata/filewatcher.h | 2 - mono/metadata/gc.c | 46 - mono/metadata/icall-decl.h | 50 - mono/metadata/icall-def.h | 4 - mono/metadata/icall-eventpipe.c | 1081 --------- mono/metadata/icall.c | 706 ------ mono/metadata/image.c | 46 - mono/metadata/loaded-images-global.c | 2 - mono/metadata/loaded-images-internals.h | 2 - mono/metadata/loaded-images-netcore.c | 38 - mono/metadata/loaded-images.c | 12 - mono/metadata/loader-internals.h | 87 - mono/metadata/locales.h | 2 - mono/metadata/marshal-ilgen.c | 45 - mono/metadata/marshal-windows.c | 2 - mono/metadata/marshal.c | 172 -- mono/metadata/metadata-internals.h | 16 - mono/metadata/metadata.c | 2 +- mono/metadata/monitor.c | 33 - mono/metadata/monitor.h | 5 - mono/metadata/mono-mlist.c | 4 - mono/metadata/mono-perfcounters.c | 2 - mono/metadata/mono-route.c | 2 - mono/metadata/mono-security.c | 6 - mono/metadata/native-library.c | 797 ------- mono/metadata/object-internals.h | 60 - mono/metadata/object-offsets.h | 2 - mono/metadata/object.c | 158 -- mono/metadata/object.h | 4 - mono/metadata/rand.c | 6 - mono/metadata/reflection-internals.h | 2 - mono/metadata/reflection.c | 23 - mono/metadata/runtime.c | 13 - mono/metadata/sre.c | 18 - mono/metadata/support.c | 4 +- mono/metadata/sysmath.c | 48 - mono/metadata/threadpool-io.c | 4 - mono/metadata/threadpool-io.h | 2 - mono/metadata/threadpool-worker-default.c | 2 - mono/metadata/threadpool-worker-wasm.c | 2 - mono/metadata/threadpool-worker.h | 2 - mono/metadata/threadpool.c | 2 - mono/metadata/threads-types.h | 6 - mono/metadata/threads.c | 189 -- mono/metadata/w32event-unix.c | 2 - mono/metadata/w32file-unix.c | 2 - mono/metadata/w32file.c | 2 - mono/metadata/w32file.h | 2 - mono/metadata/w32process-unix.c | 50 +- mono/metadata/w32process.c | 4 - mono/metadata/w32socket-unix.c | 2 - mono/metadata/w32socket.c | 4 +- mono/mini/Makefile.am.in | 14 +- mono/mini/alias-analysis.c | 5 - mono/mini/aot-compiler.c | 47 - mono/mini/debugger-agent.c | 6 - mono/mini/driver.c | 34 - mono/mini/exceptions-amd64.c | 8 +- mono/mini/exceptions-x86.c | 2 +- mono/mini/interp/interp.c | 24 - mono/mini/interp/transform.c | 123 -- mono/mini/intrinsics.c | 74 - mono/mini/jit-icalls.c | 13 - mono/mini/main-core.c | 126 -- mono/mini/memory-access.c | 4 - mono/mini/method-to-ir.c | 149 -- mono/mini/mini-arm64.h | 3 - mono/mini/mini-exceptions.c | 5 - mono/mini/mini-llvm-cpp.cpp | 16 - mono/mini/mini-llvm.c | 368 ---- mono/mini/mini-runtime.c | 8 - mono/mini/mini-runtime.h | 3 - mono/mini/mini-wasm.c | 9 - mono/mini/mini-wasm.h | 3 - mono/mini/mini-x86.h | 2 - mono/mini/mini.c | 9 - mono/mini/mini.h | 2 - mono/mini/monovm.c | 272 --- mono/mini/simd-intrinsics-netcore.c | 2329 -------------------- mono/mini/simd-intrinsics.c | 2 +- mono/mini/simd-methods-netcore.h | 247 --- mono/mini/tasklets.c | 2 - mono/mini/tasklets.h | 2 - mono/sgen/sgen-debug.c | 2 - mono/tools/offsets-tool/offsets-tool.py | 4 - mono/utils/mono-complex.h | 2 - mono/utils/mono-dl-posix.c | 8 - mono/utils/mono-dl-wasm.c | 8 - mono/utils/mono-dl.c | 50 - mono/utils/mono-threads-posix.c | 2 +- mono/utils/mono-threads-windows.c | 5 - msvc/build-init.vcxproj | 1 - msvc/libmini-common.targets | 2 - msvc/libmini-common.targets.filters | 6 - msvc/libmini-netcore.targets | 6 - msvc/libmini-netcore.targets.filters | 13 - msvc/libmini.targets | 1 - msvc/libmini.targets.filters | 1 - msvc/libmono-dynamic.vcxproj | 4 +- msvc/libmonoruntime-common.targets | 1 - msvc/libmonoruntime-common.targets.filters | 3 - msvc/libmonoruntime.targets | 1 - msvc/mono.props | 12 - msvc/mono.winconfig.targets | 3 +- runtime/Makefile.am | 4 - scripts/ci/run-jenkins.sh | 17 +- scripts/ci/run-test-acceptance-tests.sh | 2 - scripts/ci/run-test-default.sh | 2 - scripts/ci/run-test-helix.sh | 41 - scripts/ci/run-test-interpreter.sh | 2 - scripts/ci/run-test-mac-sdk.sh | 2 - scripts/ci/run-test-mcs.sh | 2 - scripts/ci/run-test-profiler-stress-tests.sh | 2 - scripts/ci/run-test-stress-tests.sh | 2 - scripts/ci/run-test-testing_aot_bitcode.sh | 2 - scripts/ci/run-test-testing_aot_bitcode_interp.sh | 2 - scripts/ci/run-test-testing_aot_full.sh | 2 - scripts/ci/run-test-testing_aot_full_interp.sh | 2 - scripts/ci/run-test-testing_aot_hybrid.sh | 2 - scripts/ci/run-test-winaot.sh | 2 - scripts/ci/run-upload-sentry.sh | 15 - scripts/ci/util.sh | 68 - sdks/Make.config.sample | 9 - sdks/README.netcore.md | 25 - sdks/builds/.gitignore | 15 - sdks/builds/ios.mk | 120 +- sdks/ios/Makefile | 60 +- sdks/ios/app/Makefile | 32 +- sdks/ios/appbuilder/appbuilder.cs | 15 +- sdks/ios/test-runner/runner.cs | 2 - sdks/wasm/.gitignore | 2 +- sdks/wasm/Makefile | 140 +- sdks/wasm/corefx-exclusions.rsp | 239 -- sdks/wasm/corefx-test-suites.mk | 208 -- sdks/wasm/docs/development.md | 15 - sdks/wasm/init-tools.ps1 | 5 - sdks/wasm/init-tools.sh | 10 - sdks/wasm/packager.cs | 107 +- .../Mono.WebAssembly.Runtime.csproj | 6 - sdks/wasm/sdk/NuGet.config | 6 - sdks/wasm/src/driver.c | 26 - sdks/wasm/tests/browser/src/Directory.Build.props | 1 - sdks/wasm/tests/browser/src/NuGet.config | 6 - winconfig.h | 46 - 315 files changed, 258 insertions(+), 22238 deletions(-) delete mode 100644 eng/Version.Details.xml delete mode 100644 eng/Versions.props delete mode 100644 eng/common/CIBuild.cmd delete mode 100644 eng/common/PSScriptAnalyzerSettings.psd1 delete mode 100644 eng/common/README.md delete mode 100644 eng/common/SetupNugetSources.ps1 delete mode 100644 eng/common/SetupNugetSources.sh delete mode 100644 eng/common/build.ps1 delete mode 100755 eng/common/build.sh delete mode 100755 eng/common/cibuild.sh delete mode 100644 eng/common/cross/arm/sources.list.bionic delete mode 100644 eng/common/cross/arm/sources.list.jessie delete mode 100644 eng/common/cross/arm/sources.list.trusty delete mode 100644 eng/common/cross/arm/sources.list.xenial delete mode 100644 eng/common/cross/arm/sources.list.zesty delete mode 100644 eng/common/cross/arm/trusty-lttng-2.4.patch delete mode 100644 eng/common/cross/arm/trusty.patch delete mode 100644 eng/common/cross/arm64/sources.list.bionic delete mode 100644 eng/common/cross/arm64/sources.list.buster delete mode 100644 eng/common/cross/arm64/sources.list.stretch delete mode 100644 eng/common/cross/arm64/sources.list.trusty delete mode 100644 eng/common/cross/arm64/sources.list.xenial delete mode 100644 eng/common/cross/arm64/sources.list.zesty delete mode 100644 eng/common/cross/armel/sources.list.jessie delete mode 100644 eng/common/cross/armel/tizen-build-rootfs.sh delete mode 100644 eng/common/cross/armel/tizen-fetch.sh delete mode 100644 eng/common/cross/armel/tizen/tizen-dotnet.ks delete mode 100644 eng/common/cross/armel/tizen/tizen.patch delete mode 100644 eng/common/cross/build-android-rootfs.sh delete mode 100644 eng/common/cross/build-rootfs.sh delete mode 100644 eng/common/cross/toolchain.cmake delete mode 100644 eng/common/cross/x86/sources.list.bionic delete mode 100644 eng/common/cross/x86/sources.list.trusty delete mode 100644 eng/common/cross/x86/sources.list.xenial delete mode 100644 eng/common/darc-init.ps1 delete mode 100755 eng/common/darc-init.sh delete mode 100644 eng/common/dotnet-install.cmd delete mode 100644 eng/common/dotnet-install.ps1 delete mode 100644 eng/common/dotnet-install.sh delete mode 100644 eng/common/enable-cross-org-publishing.ps1 delete mode 100644 eng/common/generate-graph-files.ps1 delete mode 100644 eng/common/helixpublish.proj delete mode 100644 eng/common/init-tools-native.cmd delete mode 100644 eng/common/init-tools-native.ps1 delete mode 100644 eng/common/init-tools-native.sh delete mode 100644 eng/common/internal-feed-operations.ps1 delete mode 100644 eng/common/internal-feed-operations.sh delete mode 100644 eng/common/internal/Directory.Build.props delete mode 100644 eng/common/internal/Tools.csproj delete mode 100644 eng/common/msbuild.ps1 delete mode 100755 eng/common/msbuild.sh delete mode 100644 eng/common/native/CommonLibrary.psm1 delete mode 100644 eng/common/native/common-library.sh delete mode 100644 eng/common/native/install-cmake-test.sh delete mode 100644 eng/common/native/install-cmake.sh delete mode 100644 eng/common/native/install-tool.ps1 delete mode 100644 eng/common/performance/perfhelixpublish.proj delete mode 100644 eng/common/performance/performance-setup.ps1 delete mode 100644 eng/common/performance/performance-setup.sh delete mode 100644 eng/common/pipeline-logging-functions.ps1 delete mode 100644 eng/common/pipeline-logging-functions.sh delete mode 100644 eng/common/post-build/add-build-to-channel.ps1 delete mode 100644 eng/common/post-build/check-channel-consistency.ps1 delete mode 100644 eng/common/post-build/nuget-validation.ps1 delete mode 100644 eng/common/post-build/post-build-utils.ps1 delete mode 100644 eng/common/post-build/sourcelink-validation.ps1 delete mode 100644 eng/common/post-build/symbols-validation.ps1 delete mode 100644 eng/common/post-build/trigger-subscriptions.ps1 delete mode 100644 eng/common/sdk-task.ps1 delete mode 100644 eng/common/sdl/NuGet.config delete mode 100644 eng/common/sdl/execute-all-sdl-tools.ps1 delete mode 100644 eng/common/sdl/extract-artifact-packages.ps1 delete mode 100644 eng/common/sdl/init-sdl.ps1 delete mode 100644 eng/common/sdl/packages.config delete mode 100644 eng/common/sdl/push-gdn.ps1 delete mode 100644 eng/common/sdl/run-sdl.ps1 delete mode 100644 eng/common/templates/job/execute-sdl.yml delete mode 100644 eng/common/templates/job/generate-graph-files.yml delete mode 100644 eng/common/templates/job/job.yml delete mode 100644 eng/common/templates/job/performance.yml delete mode 100644 eng/common/templates/job/publish-build-assets.yml delete mode 100644 eng/common/templates/jobs/jobs.yml delete mode 100644 eng/common/templates/phases/base.yml delete mode 100644 eng/common/templates/phases/publish-build-assets.yml delete mode 100644 eng/common/templates/post-build/channels/generic-internal-channel.yml delete mode 100644 eng/common/templates/post-build/channels/generic-public-channel.yml delete mode 100644 eng/common/templates/post-build/common-variables.yml delete mode 100644 eng/common/templates/post-build/post-build.yml delete mode 100644 eng/common/templates/post-build/setup-maestro-vars.yml delete mode 100644 eng/common/templates/post-build/trigger-subscription.yml delete mode 100644 eng/common/templates/steps/add-build-to-channel.yml delete mode 100644 eng/common/templates/steps/build-reason.yml delete mode 100644 eng/common/templates/steps/perf-send-to-helix.yml delete mode 100644 eng/common/templates/steps/publish-logs.yml delete mode 100644 eng/common/templates/steps/run-on-unix.yml delete mode 100644 eng/common/templates/steps/run-on-windows.yml delete mode 100644 eng/common/templates/steps/run-script-ifequalelse.yml delete mode 100644 eng/common/templates/steps/send-to-helix.yml delete mode 100644 eng/common/templates/steps/telemetry-end.yml delete mode 100644 eng/common/templates/steps/telemetry-start.yml delete mode 100644 eng/common/tools.ps1 delete mode 100755 eng/common/tools.sh delete mode 100644 eng/empty.csproj delete mode 160000 external/helix-binaries delete mode 100644 global.json delete mode 100644 mcs/build/profiles/netcore.make delete mode 100644 mcs/tools/mono-helix-client/HelixBase.cs delete mode 100644 mcs/tools/mono-helix-client/HelixTestBase.cs delete mode 100644 mcs/tools/mono-helix-client/MainlineTests.cs delete mode 100644 mcs/tools/mono-helix-client/Makefile delete mode 100644 mcs/tools/mono-helix-client/mono-helix-client.cs delete mode 100644 mcs/tools/mono-helix-client/mono-helix-client.exe.sources delete mode 100644 mcs/tools/upload-to-sentry/Makefile delete mode 100644 mcs/tools/upload-to-sentry/UploadToSentry.cs delete mode 100644 mcs/tools/upload-to-sentry/upload-to-sentry.exe.sources delete mode 100644 mono/metadata/loaded-images-netcore.c delete mode 100644 mono/mini/main-core.c delete mode 100644 mono/mini/simd-intrinsics-netcore.c delete mode 100644 mono/mini/simd-methods-netcore.h delete mode 100644 msvc/libmini-netcore.targets delete mode 100644 msvc/libmini-netcore.targets.filters delete mode 100755 scripts/ci/run-test-helix.sh delete mode 100755 scripts/ci/run-upload-sentry.sh delete mode 100644 sdks/README.netcore.md delete mode 100644 sdks/wasm/corefx-exclusions.rsp delete mode 100644 sdks/wasm/corefx-test-suites.mk delete mode 100644 sdks/wasm/docs/development.md delete mode 100644 sdks/wasm/init-tools.ps1 delete mode 100755 sdks/wasm/init-tools.sh delete mode 100644 sdks/wasm/sdk/NuGet.config delete mode 100644 sdks/wasm/tests/browser/src/NuGet.config diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dd7fbe67a90..f81e09b5ab5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -74,7 +74,6 @@ /mcs/tools @marek-safar @akoeplinger @steveisok /mcs/tools/gensources @kg @akoeplinger /mcs/tools/resx2sr @baulig -/mcs/tools/upload-to-sentry @directhex @akoeplinger /mono/arch @vargaz @@ -129,8 +128,6 @@ /msvc @lateralusX @kg @akoeplinger -/netcore @marek-safar @akoeplinger @egorbo @vargaz @steveisok - /packaging @alexischr @akoeplinger @directhex /packaging/MacSDK/msbuild.py @radical @akoeplinger diff --git a/.gitmodules b/.gitmodules index 4f8ef2f34a7..291325d5c3b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,9 +58,6 @@ [submodule "external/api-snapshot"] path = external/api-snapshot url = https://github.com/mono/api-snapshot.git -[submodule "external/helix-binaries"] - path = external/helix-binaries - url = https://github.com/mono/helix-binaries.git [submodule "external/illinker-test-assets"] path = external/illinker-test-assets url = https://github.com/mono/illinker-test-assets.git diff --git a/Makefile.am b/Makefile.am index 5b02028fc35..2e095fb1db2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,8 +4,6 @@ SUBDIRS = @MONO_SUBDIRS@ noinst_SUBDIRS = @MONO_NOINST_SUBDIRS@ DIST_SUBDIRS = $(SUBDIRS) m4 -if !ENABLE_NETCORE - all: $(update_submodules) update_submodules: @@ -40,7 +38,7 @@ dist-hook: rm -f `find $(top_distdir)/external -path '*\.Plo'` rm -f `find $(top_distdir)/external -name '\.dirstamp'` rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'` - rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*' -not -path '*/helix-binaries/*'` + rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*' rm -rf "$(top_distdir)/external/linker/test" rm -rf "$(top_distdir)/external/llvm-project/lldb/test" rm -rf "$(top_distdir)/external/llvm-project/libcxx/test" @@ -100,5 +98,3 @@ install: update-llvm-version: if test "x$$LLVM_DIR" = "x"; then echo "Set the make variable LLVM_DIR to the directory containing the LLVM installation."; exit 1; fi REV=`$(LLVM_DIR)/bin/llvm-config --version` && sed -e "s,expected_llvm_version=.*,expected_llvm_version=\"$$REV\"," < configure.ac > tmp && mv tmp configure.ac && echo "Version set to $$REV." - -endif diff --git a/configure.ac b/configure.ac index c8c074b7478..badba3705ba 100644 --- a/configure.ac +++ b/configure.ac @@ -947,13 +947,6 @@ AC_ARG_WITH(mcs-path, [ --with-mcs-path=/path/to/mcs Specify an alternate AC_ARG_WITH(jumptables, [ --with-jumptables=yes,no enable/disable support for jumptables (ARM-only for now) (defaults to no)],[],[with_jumptables=no]) -AC_ARG_WITH(core, [ --with-core=only controls whether to build Mono as a .NET Core runtime (defaults to no)],[],[with_core=no]) -if test x$with_core = xonly; then - AC_DEFINE(ENABLE_NETCORE,1,[Enables the support for .NET Core Features in the MonoVM]) - with_runtime_preset=netcore -fi -AM_CONDITIONAL(ENABLE_NETCORE, test x$with_core = xonly) - # # A sanity check to catch cases where the package was unpacked # with an ancient tar program (Solaris) @@ -1391,31 +1384,7 @@ if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then DISABLE_MCS_DOCS_default=yes fi -if test x$with_runtime_preset = xnetcore; then - # Keep in sync with winconfig.h netcore configuration. - DISABLE_MCS_DOCS_default=yes - BTLS_SUPPORTED=no - enable_mcs_build=no - enable_support_build=no - - mono_feature_disable_remoting='yes' - mono_feature_disable_reflection_emit_save='yes' - mono_feature_disable_appdomains='yes' - mono_feature_disable_cleanup='yes' - mono_feature_disable_assembly_remapping='yes' - mono_feature_disable_security='yes' - mono_feature_disable_mdb='yes' - mono_feature_disable_com='yes' - mono_feature_disable_gac='yes' - mono_feature_disable_perfcounters='yes' - mono_feature_disable_attach='yes' - mono_feature_disable_cfgdir_config='yes' - if test "x$enable_monodroid" = "xno" -a "x$enable_monotouch" = "xno"; then - mono_feature_disable_dllmap='yes' # FIXME: the mobile products use this - fi - disable_mono_native=yes - support_boehm=no -elif test x$with_runtime_preset = xnet_4_x; then +if test x$with_runtime_preset = xnet_4_x; then with_profile4_x_default=yes TEST_PROFILE=net_4_x elif test x$with_runtime_preset = xall; then @@ -1710,7 +1679,6 @@ AM_CONDITIONAL(INSTALL_TESTING_WINAOT_INTERP, [test "x$with_testing_winaot_inter AM_CONDITIONAL(INSTALL_ORBIS, [test "x$with_orbis" != "xno"]) AM_CONDITIONAL(INSTALL_UNREAL, [test "x$with_unreal" != "xno"]) AM_CONDITIONAL(INSTALL_WASM, [test "x$with_wasm" != "xno"]) -AM_CONDITIONAL(INSTALL_NETCORE, [test "x$with_core" != "xno"]) AM_CONDITIONAL(HYBRID_AOT_TESTS, [test "x$TEST_PROFILE" = "xtesting_aot_hybrid"] || [test "x$TEST_PROFILE" = "xunreal"]) AM_CONDITIONAL(FULL_AOT_TESTS, [test "x$TEST_PROFILE" = "xtesting_aot_full"] || [test "x$TEST_PROFILE" = "xtesting_aot_bitcode"] || [test "x$TEST_PROFILE" = "xwinaot"] || [test "x$TEST_PROFILE" = "xorbis"] || [test "x$TEST_PROFILE" = "xwasm"]) @@ -5166,7 +5134,6 @@ case "$host" in SQLITE3="libsqlite3.so" ;; *-*-*linux*) - if test "x$with_core" != "xonly"; then AC_PATH_X dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh` AC_MSG_CHECKING(for the soname of libX11.so) @@ -5183,7 +5150,6 @@ case "$host" in AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]); X11=libX11.so.6 fi - fi ;; esac @@ -6243,192 +6209,185 @@ AC_SUBST(mono_cfg_dir) AC_SUBST(CSC) -if test "x$with_core" != "xonly"; then - - AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/1.0 - cd runtime/etc/mono/1.0 - rm -f machine.config - $LN_S $reldir/data/net_1_1/machine.config machine.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/2.0 - cd runtime/etc/mono/2.0 - rm -f machine.config - $LN_S $reldir/data/net_2_0/machine.config machine.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/2.0 - cd runtime/etc/mono/2.0 - rm -f web.config - $LN_S $reldir/data/net_2_0/web.config web.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini], - [ depth=../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/ - cd runtime/etc/mono/ - rm -f browscap.ini - $LN_S $reldir/data/browscap.ini browscap.ini - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser], - [ depth=../../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/ - cd runtime/etc/mono/2.0/Browsers - rm -f Compat.browser - $LN_S $reldir/data/Browsers/Compat.browser Compat.browser - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/Browsers/Compat.browser], - [ depth=../../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.0/Browsers/ - cd runtime/etc/mono/4.0/Browsers - rm -f Compat.browser - $LN_S $reldir/data/Browsers/Compat.browser Compat.browser - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/Browsers/Compat.browser], - [ depth=../../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.5/Browsers/ - cd runtime/etc/mono/4.5/Browsers - rm -f Compat.browser - $LN_S $reldir/data/Browsers/Compat.browser Compat.browser - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/machine.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.0 - cd runtime/etc/mono/4.0 - rm -f machine.config - $LN_S $reldir/data/net_4_0/machine.config machine.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/web.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.0 - cd runtime/etc/mono/4.0 - rm -f web.config - $LN_S $reldir/data/net_4_0/web.config web.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/machine.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.5 - cd runtime/etc/mono/4.5 - rm -f machine.config - $LN_S $reldir/data/net_4_5/machine.config machine.config - cd $depth - ],[LN_S='$LN_S']) - - AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/web.config], - [ depth=../../../.. - case $srcdir in - [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; - .) reldir=$depth ;; - *) reldir=$depth/$srcdir ;; - esac - $ac_aux_dir/install-sh -d runtime/etc/mono/4.5 - cd runtime/etc/mono/4.5 - rm -f web.config - $LN_S $reldir/data/net_4_5/web.config web.config - cd $depth - ],[LN_S='$LN_S']) -fi +AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/1.0 + cd runtime/etc/mono/1.0 + rm -f machine.config + $LN_S $reldir/data/net_1_1/machine.config machine.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/2.0 + cd runtime/etc/mono/2.0 + rm -f machine.config + $LN_S $reldir/data/net_2_0/machine.config machine.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/2.0 + cd runtime/etc/mono/2.0 + rm -f web.config + $LN_S $reldir/data/net_2_0/web.config web.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini], +[ depth=../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/ + cd runtime/etc/mono/ + rm -f browscap.ini + $LN_S $reldir/data/browscap.ini browscap.ini + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser], +[ depth=../../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/ + cd runtime/etc/mono/2.0/Browsers + rm -f Compat.browser + $LN_S $reldir/data/Browsers/Compat.browser Compat.browser + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/Browsers/Compat.browser], +[ depth=../../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.0/Browsers/ + cd runtime/etc/mono/4.0/Browsers + rm -f Compat.browser + $LN_S $reldir/data/Browsers/Compat.browser Compat.browser + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/Browsers/Compat.browser], +[ depth=../../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.5/Browsers/ + cd runtime/etc/mono/4.5/Browsers + rm -f Compat.browser + $LN_S $reldir/data/Browsers/Compat.browser Compat.browser + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/machine.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.0 + cd runtime/etc/mono/4.0 + rm -f machine.config + $LN_S $reldir/data/net_4_0/machine.config machine.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/web.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.0 + cd runtime/etc/mono/4.0 + rm -f web.config + $LN_S $reldir/data/net_4_0/web.config web.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/machine.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.5 + cd runtime/etc/mono/4.5 + rm -f machine.config + $LN_S $reldir/data/net_4_5/machine.config machine.config + cd $depth +],[LN_S='$LN_S']) + +AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/web.config], +[ depth=../../../.. + case $srcdir in + [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;; + .) reldir=$depth ;; + *) reldir=$depth/$srcdir ;; + esac + $ac_aux_dir/install-sh -d runtime/etc/mono/4.5 + cd runtime/etc/mono/4.5 + rm -f web.config + $LN_S $reldir/data/net_4_5/web.config web.config + cd $depth +],[LN_S='$LN_S']) # Top level Makefile.am subdirs -if test "x$with_core" = "xonly"; then - MONO_SUBDIRS="llvm mono" -else - if test "x$support_boehm" = "xyes" -a "x$libgc" = "xincluded"; then - mono_subdirs_libgc=external/bdwgc - fi - - if test x$enable_support_build != xno; then - mono_subdirs_support=support - fi +if test "x$support_boehm" = "xyes" -a "x$libgc" = "xincluded"; then + mono_subdirs_libgc=external/bdwgc +fi - if test x$cross_compiling = xno; then - # Some tools might not build when cross-compiling - mono_subdirs_tools=tools - fi +if test x$enable_support_build != xno; then + mono_subdirs_support=support +fi - if test x$DISABLE_MCS_DOCS != xyes; then - mono_subdirs_docs=docs - fi +if test x$cross_compiling = xno; then + # Some tools might not build when cross-compiling + mono_subdirs_tools=tools +fi - if test x$with_ikvm_native = xyes; then - mono_subdirs_ikvm_native=ikvm-native - fi +if test x$DISABLE_MCS_DOCS != xyes; then + mono_subdirs_docs=docs +fi - MONO_SUBDIRS="po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests" - MONO_NOINST_SUBDIRS="$mono_subdirs_libgc" +if test x$with_ikvm_native = xyes; then + mono_subdirs_ikvm_native=ikvm-native fi +MONO_SUBDIRS="po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests" +MONO_NOINST_SUBDIRS="$mono_subdirs_libgc" + AC_SUBST(MONO_SUBDIRS) AC_SUBST(MONO_NOINST_SUBDIRS) @@ -6874,63 +6833,6 @@ AC_COMPILE_IFELSE( AC_MSG_RESULT(no) ]) -# for icu shim -ICU_SHIM_PATH=. -if test x$with_core = xonly; then - if test x$cross_compiling = xno; then - AC_CHECK_FILE($srcdir/../libraries/Native/Unix/System.Globalization.Native/pal_icushim.h, [have_shim_globalization=yes], [have_shim_globalization=no]) - fi - if test x$have_shim_globalization = xyes || test x$cross_compiling = xyes; then - ICU_SHIM_PATH=../../../libraries/Native/Unix/System.Globalization.Native - if test x$target_wasm = xyes && test x$with_static_icu = xyes; then - ICU_CFLAGS="-DTARGET_UNIX -DU_DISABLE_RENAMING -DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS -DHAVE_SET_MAX_VARIABLE" - have_sys_icu=yes - elif test x$target_osx = xyes; then - ORIG_CPPFLAGS=$CPPFLAGS - # adding icu path to pkg_config_path - PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig - export PKG_CONFIG_PATH - CPPFLAGS="`pkg-config --cflags-only-I icu-uc`" - AC_CHECK_LIB(icucore, ucol_open, LIBS=$LIBS, - [AC_MSG_ERROR([Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.])]) - AC_CHECK_HEADER(unicode/utypes.h, [have_sys_icu=yes], [have_sys_icu=no]) - if test x$have_sys_icu = xyes; then - ICU_CFLAGS="$CPPFLAGS -DPALEXPORT="" -DOSX_ICU_LIBRARY_PATH=AS_ESCAPE(\"/usr/lib/libicucore.dylib\", '\"') -DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations" - fi - CPPFLAGS=$ORIG_CPPFLAGS - elif test x$platform_android = xyes; then - ICU_CFLAGS="-DPALEXPORT="" -DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS -DHAVE_SET_MAX_VARIABLE -DTARGET_UNIX -DTARGET_ANDROID -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option" - have_sys_icu=yes - elif test x$host_linux = xyes; then - AC_CHECK_LIB(icuuc, main, LIBS=$LIBS, - [AC_MSG_ERROR([Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform).])]) - AC_CHECK_LIB(icui18n, main, LIBS=$LIBS, - [AC_MSG_ERROR([Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform).])]) - AC_CHECK_HEADER(unicode/utypes.h, [have_sys_icu=yes], [have_sys_icu=no]) - if test x$have_sys_icu = xyes; then - ICU_CFLAGS="-DPALEXPORT="" -DTARGET_UNIX -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option" - fi - elif test x$host_sunos = xyes; then - ICU_CFLAGS="-DPALEXPORT="" -DTARGET_UNIX -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option" - have_sys_icu=yes - elif test x$host_wasm = xyes; then - ICU_CFLAGS="-DPALEXPORT="" -DTARGET_UNIX -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option" - have_sys_icu=yes - else - GLOBALIZATION_SHIM_DEFINES="-DNO_GLOBALIZATION_SHIM" - fi - AC_SUBST(ICU_CFLAGS) - else - GLOBALIZATION_SHIM_DEFINES="-DNO_GLOBALIZATION_SHIM" - fi -else - GLOBALIZATION_SHIM_DEFINES="-DNO_GLOBALIZATION_SHIM" -fi - -AC_SUBST(GLOBALIZATION_SHIM_DEFINES) -AC_SUBST(ICU_SHIM_PATH) -AM_CONDITIONAL(HAVE_SYS_ICU, test x$have_sys_icu = xyes) - AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) @@ -6938,9 +6840,7 @@ AC_SUBST(CCLDFLAGS) AC_SUBST(ZLIB_CFLAGS) # Update all submodules recursively to ensure everything is checked out -if test "x$with_core" != "xonly"; then - (cd $srcdir && scripts/update_submodules.sh) -fi +(cd $srcdir && scripts/update_submodules.sh) AC_MONO_OUTPUT() @@ -7160,32 +7060,6 @@ if test x$buildsgen = xyes; then fi fi -if test "x$with_core" = "xonly"; then - if test ! -e netcore/Makefile; then - # Out of tree builds - mkdir -p netcore - echo "all:" > netcore/Makefile - fi - echo "VERSION = $VERSION" > netcore/config.make - echo "RID = $RID" >> netcore/config.make - echo "COREARCH = $COREARCH" >> netcore/config.make - echo "CORETARGETS = $CORETARGETS" >> netcore/config.make - echo "MONO_CORLIB_VERSION = $MONO_CORLIB_VERSION" >> netcore/config.make - - if test x$build_darwin = xyes; then - echo "HOST_PLATFORM ?= macos" >> netcore/config.make - elif test x$host_darwin = xyes; then - echo "HOST_PLATFORM ?= macos" >> netcore/config.make - elif test x$host_win32 = xyes; then - echo "HOST_PLATFORM ?= win32" >> netcore/config.make - elif test x$host_linux = xyes; then - echo "HOST_PLATFORM ?= linux" >> netcore/config.make - else - echo "HOST_PLATFORM ?= unix" >> netcore/config.make - fi -fi - - echo " mcs source: $mcsdir C# Compiler: $csc_compiler @@ -7223,7 +7097,6 @@ echo " BTLS: $enable_btls$btls_platform_string jemalloc: $with_jemalloc (always use: $with_jemalloc_always) crash reporting: $crash_reporting (private crashes: $with_crash_privacy) - .NET Core: $with_core $disabled " if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml deleted file mode 100644 index 511ba6622d1..00000000000 --- a/eng/Version.Details.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - https://github.com/dotnet/corefx - 5cee7c97d602f294e27c582d4dab81ec388f1d7b - - - https://github.com/dotnet/core-setup - c77948d92a2f950140f09384f057cb893ec3955a - - - https://github.com/dotnet/roslyn - 39d545dc14bc4d5a546e5e2f58d1ebaca72fcd61 - - - - - https://github.com/dotnet/arcade - bce0a98620c1c5a110b2bba9912f3d5929069c6b - - - https://github.com/dotnet/arcade - bce0a98620c1c5a110b2bba9912f3d5929069c6b - - - diff --git a/eng/Versions.props b/eng/Versions.props deleted file mode 100644 index f65a94ab3b9..00000000000 --- a/eng/Versions.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - 5.0.0 - prerelease - - - 5.0.0-alpha.1.19563.3 - - 5.0.0-alpha.1.19564.1 - - 3.3.1-beta4-19476-06 - - diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd deleted file mode 100644 index 56c2f25ac22..00000000000 --- a/eng/common/CIBuild.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" \ No newline at end of file diff --git a/eng/common/PSScriptAnalyzerSettings.psd1 b/eng/common/PSScriptAnalyzerSettings.psd1 deleted file mode 100644 index 4c1ea7c98ea..00000000000 --- a/eng/common/PSScriptAnalyzerSettings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -@{ - IncludeRules=@('PSAvoidUsingCmdletAliases', - 'PSAvoidUsingWMICmdlet', - 'PSAvoidUsingPositionalParameters', - 'PSAvoidUsingInvokeExpression', - 'PSUseDeclaredVarsMoreThanAssignments', - 'PSUseCmdletCorrectly', - 'PSStandardDSCFunctionsInResource', - 'PSUseIdenticalMandatoryParametersForDSC', - 'PSUseIdenticalParametersForDSC') -} \ No newline at end of file diff --git a/eng/common/README.md b/eng/common/README.md deleted file mode 100644 index ff49c371527..00000000000 --- a/eng/common/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Don't touch this folder - - uuuuuuuuuuuuuuuuuuuu - u" uuuuuuuuuuuuuuuuuu "u - u" u$$$$$$$$$$$$$$$$$$$$u "u - u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u - u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u - u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u - u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u - $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ - $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ - $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ - $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ - $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ - $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ - $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ - $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ - "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" - "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" - "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" - "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" - "u "$$$$$$$$$$$$$$$$$$$$" u" - "u """""""""""""""""" u" - """""""""""""""""""" - -!!! Changes made in this directory are subject to being overwritten by automation !!! - -The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 deleted file mode 100644 index a5a1e711d79..00000000000 --- a/eng/common/SetupNugetSources.ps1 +++ /dev/null @@ -1,141 +0,0 @@ -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 -# -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. -# -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# - task: PowerShell@2 -# displayName: Setup Private Feeds Credentials -# condition: eq(variables['Agent.OS'], 'Windows_NT') -# inputs: -# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 -# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token -# env: -# Token: $(dn-bot-dnceng-artifact-feeds-rw) - -[CmdletBinding()] -param ( - [Parameter(Mandatory = $true)][string]$ConfigFile, - [Parameter(Mandatory = $true)][string]$Password -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -. $PSScriptRoot\tools.ps1 - -# Add source entry to PackageSources -function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) { - $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']") - - if ($packageSource -eq $null) - { - $packageSource = $doc.CreateElement("add") - $packageSource.SetAttribute("key", $SourceName) - $packageSource.SetAttribute("value", $SourceEndPoint) - $sources.AppendChild($packageSource) | Out-Null - } - else { - Write-Host "Package source $SourceName already present." - } - - AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password -} - -# Add a credential node for the specified source -function AddCredential($creds, $source, $username, $password) { - # Looks for credential configuration for the given SourceName. Create it if none is found. - $sourceElement = $creds.SelectSingleNode($Source) - if ($sourceElement -eq $null) - { - $sourceElement = $doc.CreateElement($Source) - $creds.AppendChild($sourceElement) | Out-Null - } - - # Add the node to the credential if none is found. - $usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']") - if ($usernameElement -eq $null) - { - $usernameElement = $doc.CreateElement("add") - $usernameElement.SetAttribute("key", "Username") - $sourceElement.AppendChild($usernameElement) | Out-Null - } - $usernameElement.SetAttribute("value", $Username) - - # Add the to the credential if none is found. - # Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs. - # -> https://github.com/NuGet/Home/issues/5526 - $passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']") - if ($passwordElement -eq $null) - { - $passwordElement = $doc.CreateElement("add") - $passwordElement.SetAttribute("key", "ClearTextPassword") - $sourceElement.AppendChild($passwordElement) | Out-Null - } - $passwordElement.SetAttribute("value", $Password) -} - -function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) { - $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") - - Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." - - ForEach ($PackageSource in $maestroPrivateSources) { - Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key - AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password - } -} - -if (!(Test-Path $ConfigFile -PathType Leaf)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" - ExitWithExitCode 1 -} - -if (!$Password) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT' - ExitWithExitCode 1 -} - -# Load NuGet.config -$doc = New-Object System.Xml.XmlDocument -$filename = (Get-Item $ConfigFile).FullName -$doc.Load($filename) - -# Get reference to or create one if none exist already -$sources = $doc.DocumentElement.SelectSingleNode("packageSources") -if ($sources -eq $null) { - $sources = $doc.CreateElement("packageSources") - $doc.DocumentElement.AppendChild($sources) | Out-Null -} - -# Looks for a node. Create it if none is found. -$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") -if ($creds -eq $null) { - $creds = $doc.CreateElement("packageSourceCredentials") - $doc.DocumentElement.AppendChild($creds) | Out-Null -} - -# Insert credential nodes for Maestro's private feeds -InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password - -$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']") -if ($dotnet3Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password -} - -$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") -if ($dotnet31Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password -} - -$doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh deleted file mode 100644 index 7d6fef27fe4..00000000000 --- a/eng/common/SetupNugetSources.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env bash - -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 -# -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro's managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. -# -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# - task: Bash@3 -# displayName: Setup Private Feeds Credentials -# inputs: -# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh -# arguments: $(Build.SourcesDirectory)/NuGet.config $Token -# condition: ne(variables['Agent.OS'], 'Windows_NT') -# env: -# Token: $(dn-bot-dnceng-artifact-feeds-rw) - -ConfigFile=$1 -CredToken=$2 -NL='\n' -TB=' ' - -source="${BASH_SOURCE[0]}" - -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. "$scriptroot/tools.sh" - -if [ ! -f "$ConfigFile" ]; then - Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" - ExitWithExitCode 1 -fi - -if [ -z "$CredToken" ]; then - Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT" - ExitWithExitCode 1 -fi - -if [[ `uname -s` == "Darwin" ]]; then - NL=$'\\\n' - TB='' -fi - -# Ensure there is a ... section. -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding ... section." - ConfigNodeHeader="" - PackageSourcesTemplate="${TB}${NL}${TB}" - - sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" NuGet.config -fi - -# Ensure there is a ... section. -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding ... section." - - PackageSourcesNodeFooter="" - PackageSourceCredentialsTemplate="${TB}${NL}${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config -fi - -PackageSources=() - -# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present -grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet3-internal') - - grep -i "" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet3-internal-transport') -fi - -# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present -grep -i "" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet3.1-internal') - - grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet3.1-internal-transport to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet3.1-internal-transport') -fi - -# I want things split line by line -PrevIFS=$IFS -IFS=$'\n' -PackageSources+="$IFS" -PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') -IFS=$PrevIFS - -for FeedName in ${PackageSources[@]} ; do - # Check if there is no existing credential for this FeedName - grep -i "<$FeedName>" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding credentials for $FeedName." - - PackageSourceCredentialsNodeFooter="" - NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" - - sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile - fi -done diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 deleted file mode 100644 index 813d440d2a8..00000000000 --- a/eng/common/build.ps1 +++ /dev/null @@ -1,153 +0,0 @@ -[CmdletBinding(PositionalBinding=$false)] -Param( - [string][Alias('c')]$configuration = "Debug", - [string]$platform = $null, - [string] $projects, - [string][Alias('v')]$verbosity = "minimal", - [string] $msbuildEngine = $null, - [bool] $warnAsError = $true, - [bool] $nodeReuse = $true, - [switch][Alias('r')]$restore, - [switch] $deployDeps, - [switch][Alias('b')]$build, - [switch] $rebuild, - [switch] $deploy, - [switch][Alias('t')]$test, - [switch] $integrationTest, - [switch] $performanceTest, - [switch] $sign, - [switch] $pack, - [switch] $publish, - [switch] $clean, - [switch][Alias('bl')]$binaryLog, - [switch] $ci, - [switch] $prepareMachine, - [switch] $help, - [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties -) - -# Unset 'Platform' environment variable to avoid unwanted collision in InstallDotNetCore.targets file -# some computer has this env var defined (e.g. Some HP) -if($env:Platform) { - $env:Platform="" -} -function Print-Usage() { - Write-Host "Common settings:" - Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" - Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" - Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - Write-Host " -binaryLog Output binary log (short: -bl)" - Write-Host " -help Print help and exit" - Write-Host "" - - Write-Host "Actions:" - Write-Host " -restore Restore dependencies (short: -r)" - Write-Host " -build Build solution (short: -b)" - Write-Host " -rebuild Rebuild solution" - Write-Host " -deploy Deploy built VSIXes" - Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" - Write-Host " -test Run all unit tests in the solution (short: -t)" - Write-Host " -integrationTest Run all integration tests in the solution" - Write-Host " -performanceTest Run all performance tests in the solution" - Write-Host " -pack Package build outputs into NuGet packages and Willow components" - Write-Host " -sign Sign build outputs" - Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -clean Clean the solution" - Write-Host "" - - Write-Host "Advanced settings:" - Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" - Write-Host " -ci Set when running on CI server" - Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" - Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" - Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." - Write-Host "" - - Write-Host "Command line arguments not listed above are passed thru to msbuild." - Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." -} - -. $PSScriptRoot\tools.ps1 - -function InitializeCustomToolset { - if (-not $restore) { - return - } - - $script = Join-Path $EngRoot 'restore-toolset.ps1' - - if (Test-Path $script) { - . $script - } -} - -function Build { - $toolsetBuildProj = InitializeToolset - InitializeCustomToolset - - $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' } - $platformArg = if ($platform) { "/p:Platform=$platform" } else { '' } - - if ($projects) { - # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. - # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. - [string[]] $msbuildArgs = $properties - - # Resolve relative project paths into full paths - $projects = ($projects.Split(';').ForEach({Resolve-Path $_}) -join ';') - - $msbuildArgs += "/p:Projects=$projects" - $properties = $msbuildArgs - } - - MSBuild $toolsetBuildProj ` - $bl ` - $platformArg ` - /p:Configuration=$configuration ` - /p:RepoRoot=$RepoRoot ` - /p:Restore=$restore ` - /p:DeployDeps=$deployDeps ` - /p:Build=$build ` - /p:Rebuild=$rebuild ` - /p:Deploy=$deploy ` - /p:Test=$test ` - /p:Pack=$pack ` - /p:IntegrationTest=$integrationTest ` - /p:PerformanceTest=$performanceTest ` - /p:Sign=$sign ` - /p:Publish=$publish ` - @properties -} - -try { - if ($clean) { - if (Test-Path $ArtifactsDir) { - Remove-Item -Recurse -Force $ArtifactsDir - Write-Host 'Artifacts directory deleted.' - } - exit 0 - } - - if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { - Print-Usage - exit 0 - } - - if ($ci) { - $binaryLog = $true - $nodeReuse = $false - } - - if ($restore) { - InitializeNativeTools - } - - Build -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ - ExitWithExitCode 1 -} - -ExitWithExitCode 0 diff --git a/eng/common/build.sh b/eng/common/build.sh deleted file mode 100755 index 36f9aa0462e..00000000000 --- a/eng/common/build.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env bash - -# Stop script if unbound variable found (use ${var:-} if intentional) -set -u - -# Stop script if command returns non-zero exit code. -# Prevents hidden errors caused by missing error code propagation. -set -e - -usage() -{ - echo "Common settings:" - echo " --configuration Build configuration: 'Debug' or 'Release' (short: -c)" - echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" - echo " --binaryLog Create MSBuild binary log (short: -bl)" - echo " --help Print help and exit (short: -h)" - echo "" - - echo "Actions:" - echo " --restore Restore dependencies (short: -r)" - echo " --build Build solution (short: -b)" - echo " --rebuild Rebuild solution" - echo " --test Run all unit tests in the solution (short: -t)" - echo " --integrationTest Run all integration tests in the solution" - echo " --performanceTest Run all performance tests in the solution" - echo " --pack Package build outputs into NuGet packages and Willow components" - echo " --sign Sign build outputs" - echo " --publish Publish artifacts (e.g. symbols)" - echo " --clean Clean the solution" - echo "" - - echo "Advanced settings:" - echo " --projects Project or solution file(s) to build" - echo " --ci Set when running on CI server" - echo " --prepareMachine Prepare machine for CI run, clean up processes after build" - echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" - echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" - echo "" - echo "Command line arguments not listed above are passed thru to msbuild." - echo "Arguments can also be passed in with a single hyphen." -} - -source="${BASH_SOURCE[0]}" - -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -restore=false -build=false -rebuild=false -test=false -integration_test=false -performance_test=false -pack=false -publish=false -sign=false -public=false -ci=false -clean=false - -warn_as_error=true -node_reuse=true -binary_log=false -pipelines_log=false - -projects='' -configuration='Debug' -prepare_machine=false -verbosity='minimal' - -properties='' - -while [[ $# > 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -help|-h) - usage - exit 0 - ;; - -clean) - clean=true - ;; - -configuration|-c) - configuration=$2 - shift - ;; - -verbosity|-v) - verbosity=$2 - shift - ;; - -binarylog|-bl) - binary_log=true - ;; - -pipelineslog|-pl) - pipelines_log=true - ;; - -restore|-r) - restore=true - ;; - -build|-b) - build=true - ;; - -rebuild) - rebuild=true - ;; - -pack) - pack=true - ;; - -test|-t) - test=true - ;; - -integrationtest) - integration_test=true - ;; - -performancetest) - performance_test=true - ;; - -sign) - sign=true - ;; - -publish) - publish=true - ;; - -preparemachine) - prepare_machine=true - ;; - -projects) - projects=$2 - shift - ;; - -ci) - ci=true - ;; - -warnaserror) - warn_as_error=$2 - shift - ;; - -nodereuse) - node_reuse=$2 - shift - ;; - *) - properties="$properties $1" - ;; - esac - - shift -done - -if [[ "$ci" == true ]]; then - pipelines_log=true - binary_log=true - node_reuse=false -fi - -. "$scriptroot/tools.sh" - -function InitializeCustomToolset { - local script="$eng_root/restore-toolset.sh" - - if [[ -a "$script" ]]; then - . "$script" - fi -} - -function Build { - InitializeToolset - InitializeCustomToolset - - if [[ ! -z "$projects" ]]; then - properties="$properties /p:Projects=$projects" - fi - - local bl="" - if [[ "$binary_log" == true ]]; then - bl="/bl:\"$log_dir/Build.binlog\"" - fi - - MSBuild $_InitializeToolset \ - $bl \ - /p:Configuration=$configuration \ - /p:RepoRoot="$repo_root" \ - /p:Restore=$restore \ - /p:Build=$build \ - /p:Rebuild=$rebuild \ - /p:Test=$test \ - /p:Pack=$pack \ - /p:IntegrationTest=$integration_test \ - /p:PerformanceTest=$performance_test \ - /p:Sign=$sign \ - /p:Publish=$publish \ - $properties - - ExitWithExitCode 0 -} - -if [[ "$clean" == true ]]; then - if [ -d "$artifacts_dir" ]; then - rm -rf $artifacts_dir - echo "Artifacts directory deleted." - fi - exit 0 -fi - -if [[ "$restore" == true ]]; then - InitializeNativeTools -fi - -Build diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh deleted file mode 100755 index 1a02c0dec8f..00000000000 --- a/eng/common/cibuild.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" - -# resolve $SOURCE until the file is no longer a symlink -while [[ -h $source ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - - # if $source was a relative symlink, we need to resolve it relative to the path where - # the symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.bionic b/eng/common/cross/arm/sources.list.bionic deleted file mode 100644 index 21095574095..00000000000 --- a/eng/common/cross/arm/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jessie b/eng/common/cross/arm/sources.list.jessie deleted file mode 100644 index 4d142ac9b10..00000000000 --- a/eng/common/cross/arm/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (sid) # UNSTABLE -deb http://ftp.debian.org/debian/ sid main contrib non-free -deb-src http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/eng/common/cross/arm/sources.list.trusty b/eng/common/cross/arm/sources.list.trusty deleted file mode 100644 index 07d8f88d82e..00000000000 --- a/eng/common/cross/arm/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.xenial b/eng/common/cross/arm/sources.list.xenial deleted file mode 100644 index eacd86b7df3..00000000000 --- a/eng/common/cross/arm/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.zesty b/eng/common/cross/arm/sources.list.zesty deleted file mode 100644 index ea2c14a7874..00000000000 --- a/eng/common/cross/arm/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/arm/trusty-lttng-2.4.patch b/eng/common/cross/arm/trusty-lttng-2.4.patch deleted file mode 100644 index 8e4dd7ae719..00000000000 --- a/eng/common/cross/arm/trusty-lttng-2.4.patch +++ /dev/null @@ -1,71 +0,0 @@ -From e72c9d7ead60e3317bd6d1fade995c07021c947b Mon Sep 17 00:00:00 2001 -From: Mathieu Desnoyers -Date: Thu, 7 May 2015 13:25:04 -0400 -Subject: [PATCH] Fix: building probe providers with C++ compiler - -Robert Daniels wrote: -> > I'm attempting to use lttng userspace tracing with a C++ application -> > on an ARM platform. I'm using GCC 4.8.4 on Linux 3.14 with the 2.6 -> > release of lttng. I've compiled lttng-modules, lttng-ust, and -> > lttng-tools and have been able to get a simple test working with C -> > code. When I attempt to run the hello.cxx test on my target it will -> > segfault. -> -> -> I spent a little time digging into this issue and finally discovered the -> cause of my segfault with ARM C++ tracepoints. -> -> There is a struct called 'lttng_event' in ust-events.h which contains an -> empty union 'u'. This was the cause of my issue. Under C, this empty union -> compiles to a zero byte member while under C++ it compiles to a one byte -> member, and in my case was four-byte aligned which caused my C++ code to -> have the 'cds_list_head node' offset incorrectly by four bytes. This lead -> to an incorrect linked list structure which caused my issue. -> -> Since this union is empty, I simply removed it from the struct and everything -> worked correctly. -> -> I don't know the history or purpose behind this empty union so I'd like to -> know if this is a safe fix. If it is I can submit a patch with the union -> removed. - -That's a very nice catch! - -We do not support building tracepoint probe provider with -g++ yet, as stated in lttng-ust(3): - -"- Note for C++ support: although an application instrumented with - tracepoints can be compiled with g++, tracepoint probes should be - compiled with gcc (only tested with gcc so far)." - -However, if it works fine with this fix, then I'm tempted to take it, -especially because removing the empty union does not appear to affect -the layout of struct lttng_event as seen from liblttng-ust, which must -be compiled with a C compiler, and from probe providers compiled with -a C compiler. So all we are changing is the layout of a probe provider -compiled with a C++ compiler, which is anyway buggy at the moment, -because it is not compatible with the layout expected by liblttng-ust -compiled with a C compiler. - -Reported-by: Robert Daniels -Signed-off-by: Mathieu Desnoyers ---- - include/lttng/ust-events.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/usr/include/lttng/ust-events.h b/usr/include/lttng/ust-events.h -index 328a875..3d7a274 100644 ---- a/usr/include/lttng/ust-events.h -+++ b/usr/include/lttng/ust-events.h -@@ -407,8 +407,6 @@ struct lttng_event { - void *_deprecated1; - struct lttng_ctx *ctx; - enum lttng_ust_instrumentation instrumentation; -- union { -- } u; - struct cds_list_head node; /* Event list in session */ - struct cds_list_head _deprecated2; - void *_deprecated3; --- -2.7.4 - diff --git a/eng/common/cross/arm/trusty.patch b/eng/common/cross/arm/trusty.patch deleted file mode 100644 index 2f2972f8eb5..00000000000 --- a/eng/common/cross/arm/trusty.patch +++ /dev/null @@ -1,97 +0,0 @@ -diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h ---- a/usr/include/urcu/uatomic/generic.h 2014-03-28 06:04:42.000000000 +0900 -+++ b/usr/include/urcu/uatomic/generic.h 2017-02-13 10:35:21.189927116 +0900 -@@ -65,17 +65,17 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- return __sync_val_compare_and_swap_1(addr, old, _new); -+ return __sync_val_compare_and_swap_1((uint8_t *) addr, old, _new); - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- return __sync_val_compare_and_swap_2(addr, old, _new); -+ return __sync_val_compare_and_swap_2((uint16_t *) addr, old, _new); - #endif - case 4: -- return __sync_val_compare_and_swap_4(addr, old, _new); -+ return __sync_val_compare_and_swap_4((uint32_t *) addr, old, _new); - #if (CAA_BITS_PER_LONG == 64) - case 8: -- return __sync_val_compare_and_swap_8(addr, old, _new); -+ return __sync_val_compare_and_swap_8((uint64_t *) addr, old, _new); - #endif - } - _uatomic_link_error(); -@@ -100,20 +100,20 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- __sync_and_and_fetch_1(addr, val); -+ __sync_and_and_fetch_1((uint8_t *) addr, val); - return; - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- __sync_and_and_fetch_2(addr, val); -+ __sync_and_and_fetch_2((uint16_t *) addr, val); - return; - #endif - case 4: -- __sync_and_and_fetch_4(addr, val); -+ __sync_and_and_fetch_4((uint32_t *) addr, val); - return; - #if (CAA_BITS_PER_LONG == 64) - case 8: -- __sync_and_and_fetch_8(addr, val); -+ __sync_and_and_fetch_8((uint64_t *) addr, val); - return; - #endif - } -@@ -139,20 +139,20 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- __sync_or_and_fetch_1(addr, val); -+ __sync_or_and_fetch_1((uint8_t *) addr, val); - return; - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- __sync_or_and_fetch_2(addr, val); -+ __sync_or_and_fetch_2((uint16_t *) addr, val); - return; - #endif - case 4: -- __sync_or_and_fetch_4(addr, val); -+ __sync_or_and_fetch_4((uint32_t *) addr, val); - return; - #if (CAA_BITS_PER_LONG == 64) - case 8: -- __sync_or_and_fetch_8(addr, val); -+ __sync_or_and_fetch_8((uint64_t *) addr, val); - return; - #endif - } -@@ -180,17 +180,17 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- return __sync_add_and_fetch_1(addr, val); -+ return __sync_add_and_fetch_1((uint8_t *) addr, val); - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- return __sync_add_and_fetch_2(addr, val); -+ return __sync_add_and_fetch_2((uint16_t *) addr, val); - #endif - case 4: -- return __sync_add_and_fetch_4(addr, val); -+ return __sync_add_and_fetch_4((uint32_t *) addr, val); - #if (CAA_BITS_PER_LONG == 64) - case 8: -- return __sync_add_and_fetch_8(addr, val); -+ return __sync_add_and_fetch_8((uint64_t *) addr, val); - #endif - } - _uatomic_link_error(); diff --git a/eng/common/cross/arm64/sources.list.bionic b/eng/common/cross/arm64/sources.list.bionic deleted file mode 100644 index 21095574095..00000000000 --- a/eng/common/cross/arm64/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.buster b/eng/common/cross/arm64/sources.list.buster deleted file mode 100644 index 7194ac64a96..00000000000 --- a/eng/common/cross/arm64/sources.list.buster +++ /dev/null @@ -1,11 +0,0 @@ -deb http://deb.debian.org/debian buster main -deb-src http://deb.debian.org/debian buster main - -deb http://deb.debian.org/debian-security/ buster/updates main -deb-src http://deb.debian.org/debian-security/ buster/updates main - -deb http://deb.debian.org/debian buster-updates main -deb-src http://deb.debian.org/debian buster-updates main - -deb http://deb.debian.org/debian buster-backports main contrib non-free -deb-src http://deb.debian.org/debian buster-backports main contrib non-free diff --git a/eng/common/cross/arm64/sources.list.stretch b/eng/common/cross/arm64/sources.list.stretch deleted file mode 100644 index 0e121577436..00000000000 --- a/eng/common/cross/arm64/sources.list.stretch +++ /dev/null @@ -1,12 +0,0 @@ -deb http://deb.debian.org/debian stretch main -deb-src http://deb.debian.org/debian stretch main - -deb http://deb.debian.org/debian-security/ stretch/updates main -deb-src http://deb.debian.org/debian-security/ stretch/updates main - -deb http://deb.debian.org/debian stretch-updates main -deb-src http://deb.debian.org/debian stretch-updates main - -deb http://deb.debian.org/debian stretch-backports main contrib non-free -deb-src http://deb.debian.org/debian stretch-backports main contrib non-free - diff --git a/eng/common/cross/arm64/sources.list.trusty b/eng/common/cross/arm64/sources.list.trusty deleted file mode 100644 index 07d8f88d82e..00000000000 --- a/eng/common/cross/arm64/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.xenial b/eng/common/cross/arm64/sources.list.xenial deleted file mode 100644 index eacd86b7df3..00000000000 --- a/eng/common/cross/arm64/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.zesty b/eng/common/cross/arm64/sources.list.zesty deleted file mode 100644 index ea2c14a7874..00000000000 --- a/eng/common/cross/arm64/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/armel/sources.list.jessie b/eng/common/cross/armel/sources.list.jessie deleted file mode 100644 index 3d9c3059d89..00000000000 --- a/eng/common/cross/armel/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (jessie) # Stable -deb http://ftp.debian.org/debian/ jessie main contrib non-free -deb-src http://ftp.debian.org/debian/ jessie main contrib non-free diff --git a/eng/common/cross/armel/tizen-build-rootfs.sh b/eng/common/cross/armel/tizen-build-rootfs.sh deleted file mode 100644 index 87c48e78fbb..00000000000 --- a/eng/common/cross/armel/tizen-build-rootfs.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -set -e - -__ARM_SOFTFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -__TIZEN_CROSSDIR="$__ARM_SOFTFP_CrossDir/tizen" - -if [[ -z "$ROOTFS_DIR" ]]; then - echo "ROOTFS_DIR is not defined." - exit 1; -fi - -# Clean-up (TODO-Cleanup: We may already delete $ROOTFS_DIR at ./cross/build-rootfs.sh.) -# hk0110 -if [ -d "$ROOTFS_DIR" ]; then - umount $ROOTFS_DIR/* - rm -rf $ROOTFS_DIR -fi - -TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp -mkdir -p $TIZEN_TMP_DIR - -# Download files -echo ">>Start downloading files" -VERBOSE=1 $__ARM_SOFTFP_CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR -echo "<>Start constructing Tizen rootfs" -TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` -cd $ROOTFS_DIR -for f in $TIZEN_RPM_FILES; do - rpm2cpio $f | cpio -idm --quiet -done -echo "<>Start configuring Tizen rootfs" -rm ./usr/lib/libunwind.so -ln -s libunwind.so.8 ./usr/lib/libunwind.so -ln -sfn asm-arm ./usr/include/asm -patch -p1 < $__TIZEN_CROSSDIR/tizen.patch -echo "</dev/null; then - VERBOSE=0 -fi - -Log() -{ - if [ $VERBOSE -ge $1 ]; then - echo ${@:2} - fi -} - -Inform() -{ - Log 1 -e "\x1B[0;34m$@\x1B[m" -} - -Debug() -{ - Log 2 -e "\x1B[0;32m$@\x1B[m" -} - -Error() -{ - >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" -} - -Fetch() -{ - URL=$1 - FILE=$2 - PROGRESS=$3 - if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then - CURL_OPT="--progress-bar" - else - CURL_OPT="--silent" - fi - curl $CURL_OPT $URL > $FILE -} - -hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } -hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } -hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } - -TMPDIR=$1 -if [ ! -d $TMPDIR ]; then - TMPDIR=./tizen_tmp - Debug "Create temporary directory : $TMPDIR" - mkdir -p $TMPDIR -fi - -TIZEN_URL=http://download.tizen.org/releases/milestone/tizen -BUILD_XML=build.xml -REPOMD_XML=repomd.xml -PRIMARY_XML=primary.xml -TARGET_URL="http://__not_initialized" - -Xpath_get() -{ - XPATH_RESULT='' - XPATH=$1 - XML_FILE=$2 - RESULT=$(xmllint --xpath $XPATH $XML_FILE) - if [[ -z ${RESULT// } ]]; then - Error "Can not find target from $XML_FILE" - Debug "Xpath = $XPATH" - exit 1 - fi - XPATH_RESULT=$RESULT -} - -fetch_tizen_pkgs_init() -{ - TARGET=$1 - PROFILE=$2 - Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" - - TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs - if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi - mkdir -p $TMP_PKG_DIR - - PKG_URL=$TIZEN_URL/$PROFILE/latest - - BUILD_XML_URL=$PKG_URL/$BUILD_XML - TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML - TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML - TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML - TMP_PRIMARYGZ=${TMP_PRIMARY}.gz - - Fetch $BUILD_XML_URL $TMP_BUILD - - Debug "fetch $BUILD_XML_URL to $TMP_BUILD" - - TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" - Xpath_get $TARGET_XPATH $TMP_BUILD - TARGET_PATH=$XPATH_RESULT - TARGET_URL=$PKG_URL/$TARGET_PATH - - REPOMD_URL=$TARGET_URL/repodata/repomd.xml - PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' - - Fetch $REPOMD_URL $TMP_REPOMD - - Debug "fetch $REPOMD_URL to $TMP_REPOMD" - - Xpath_get $PRIMARY_XPATH $TMP_REPOMD - PRIMARY_XML_PATH=$XPATH_RESULT - PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH - - Fetch $PRIMARY_URL $TMP_PRIMARYGZ - - Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" - - gunzip $TMP_PRIMARYGZ - - Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" -} - -fetch_tizen_pkgs() -{ - ARCH=$1 - PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' - - PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' - - for pkg in ${@:2} - do - Inform "Fetching... $pkg" - XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} - XPATH=${XPATH/_ARCH_/$ARCH} - Xpath_get $XPATH $TMP_PRIMARY - PKG_PATH=$XPATH_RESULT - - XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} - XPATH=${XPATH/_ARCH_/$ARCH} - Xpath_get $XPATH $TMP_PRIMARY - CHECKSUM=$XPATH_RESULT - - PKG_URL=$TARGET_URL/$PKG_PATH - PKG_FILE=$(basename $PKG_PATH) - PKG_PATH=$TMPDIR/$PKG_FILE - - Debug "Download $PKG_URL to $PKG_PATH" - Fetch $PKG_URL $PKG_PATH true - - echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null - if [ $? -ne 0 ]; then - Error "Fail to fetch $PKG_URL to $PKG_PATH" - Debug "Checksum = $CHECKSUM" - exit 1 - fi - done -} - -Inform "Initialize arm base" -fetch_tizen_pkgs_init standard base -Inform "fetch common packages" -fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel libatomic -fetch_tizen_pkgs noarch linux-glibc-devel -Inform "fetch coreclr packages" -fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu -Inform "fetch corefx packages" -fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel - -Inform "Initialize standard unified" -fetch_tizen_pkgs_init standard unified -Inform "fetch corefx packages" -fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release - diff --git a/eng/common/cross/armel/tizen/tizen-dotnet.ks b/eng/common/cross/armel/tizen/tizen-dotnet.ks deleted file mode 100644 index 506d455bd4f..00000000000 --- a/eng/common/cross/armel/tizen/tizen-dotnet.ks +++ /dev/null @@ -1,50 +0,0 @@ -lang en_US.UTF-8 -keyboard us -timezone --utc Asia/Seoul - -part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime - -rootpw tizen -desktop --autologinuser=root -user --name root --groups audio,video --password 'tizen' - -repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no -repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no - -%packages -tar -gzip - -sed -grep -gawk -perl - -binutils -findutils -util-linux -lttng-ust -userspace-rcu -procps-ng -tzdata -ca-certificates - - -### Core FX -libicu -libunwind -iputils -zlib -krb5 -libcurl -libopenssl - -%end - -%post - -### Update /tmp privilege -chmod 777 /tmp -#################################### - -%end diff --git a/eng/common/cross/armel/tizen/tizen.patch b/eng/common/cross/armel/tizen/tizen.patch deleted file mode 100644 index d223427c978..00000000000 --- a/eng/common/cross/armel/tizen/tizen.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so ---- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 -+++ b/usr/lib/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(elf32-littlearm) --GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) -+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) -diff -u -r a/usr/lib/libpthread.so b/usr/lib/libpthread.so ---- a/usr/lib/libpthread.so 2016-12-30 23:00:19.408951841 +0900 -+++ b/usr/lib/libpthread.so 2016-12-30 23:00:39.068951801 +0900 -@@ -2,4 +2,4 @@ - Use the shared library, but some functions are only in - the static library, so try that secondarily. */ - OUTPUT_FORMAT(elf32-littlearm) --GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a ) -+GROUP ( libpthread.so.0 libpthread_nonshared.a ) diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh deleted file mode 100644 index e7f12edb565..00000000000 --- a/eng/common/cross/build-android-rootfs.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env bash -set -e -__NDK_Version=r21 - -usage() -{ - echo "Creates a toolchain and sysroot used for cross-compiling for Android." - echo. - echo "Usage: $0 [BuildArch] [ApiLevel]" - echo. - echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." - echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" - echo. - echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" - echo "by setting the TOOLCHAIN_DIR environment variable" - echo. - echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," - echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." - echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.28-arm64. This file is to replace '/etc/os-release', which is not available for Android." - exit 1 -} - -__ApiLevel=28 # The minimum platform for arm64 is API level 21 but the minimum version that support glob(3) is 28. See $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/glob.h -__BuildArch=arm64 -__AndroidArch=aarch64 -__AndroidToolchain=aarch64-linux-android - -for i in "$@" - do - lowerI="$(echo $i | awk '{print tolower($0)}')" - case $lowerI in - -?|-h|--help) - usage - exit 1 - ;; - arm64) - __BuildArch=arm64 - __AndroidArch=aarch64 - __AndroidToolchain=aarch64-linux-android - ;; - arm) - __BuildArch=arm - __AndroidArch=arm - __AndroidToolchain=arm-linux-androideabi - ;; - *[0-9]) - __ApiLevel=$i - ;; - *) - __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" - ;; - esac -done - -# Obtain the location of the bash script to figure out where the root of the repo is. -__ScriptBaseDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -__CrossDir="$__ScriptBaseDir/../../../.tools/android-rootfs" - -if [[ ! -f "$__CrossDir" ]]; then - mkdir -p "$__CrossDir" -fi - -# Resolve absolute path to avoid `../` in build logs -__CrossDir="$( cd "$__CrossDir" && pwd )" - -__NDK_Dir="$__CrossDir/android-ndk-$__NDK_Version" -__lldb_Dir="$__CrossDir/lldb" -__ToolchainDir="$__CrossDir/android-ndk-$__NDK_Version" - -if [[ -n "$TOOLCHAIN_DIR" ]]; then - __ToolchainDir=$TOOLCHAIN_DIR -fi - -if [[ -n "$NDK_DIR" ]]; then - __NDK_Dir=$NDK_DIR -fi - -echo "Target API level: $__ApiLevel" -echo "Target architecture: $__BuildArch" -echo "NDK location: $__NDK_Dir" -echo "Target Toolchain location: $__ToolchainDir" - -# Download the NDK if required -if [ ! -d $__NDK_Dir ]; then - echo Downloading the NDK into $__NDK_Dir - mkdir -p $__NDK_Dir - wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux-x86_64.zip -O $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip - unzip -q $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip -d $__CrossDir -fi - -if [ ! -d $__lldb_Dir ]; then - mkdir -p $__lldb_Dir - echo Downloading LLDB into $__lldb_Dir - wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip -O $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip - unzip -q $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip -d $__lldb_Dir -fi - -echo "Download dependencies..." -__TmpDir=$__CrossDir/tmp/$__BuildArch/ -mkdir -p "$__TmpDir" - -# combined dependencies for coreclr, installer and libraries -__AndroidPackages="libicu" -__AndroidPackages+=" libandroid-glob" -__AndroidPackages+=" liblzma" -__AndroidPackages+=" krb5" -__AndroidPackages+=" openssl" - -for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\ - grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do - - if [[ "$path" != "Filename:" ]]; then - echo "Working on: $path" - wget -qO- http://termux.net/$path | dpkg -x - "$__TmpDir" - fi -done - -cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/sysroot/usr/" - -# Generate platform file for build.sh script to assign to __DistroRid -echo "Generating platform file..." -echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/sysroot/android_platform - -echo "Now to build coreclr, libraries and installers; run:" -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory coreclr -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory libraries -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory installer diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh deleted file mode 100644 index 2cdd82d30df..00000000000 --- a/eng/common/cross/build-rootfs.sh +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env bash - -usage() -{ - echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]" - echo "BuildArch can be: arm(default), armel, arm64, x86" - echo "CodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." - echo " for FreeBSD can be: freebsd11 or freebsd12." - echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FReeBSD" - echo "--skipunmount - optional, will skip the unmount of rootfs folder." - exit 1 -} - -__CodeName=xenial -__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -__InitialDir=$PWD -__BuildArch=arm -__UbuntuArch=armhf -__UbuntuRepo="http://ports.ubuntu.com/" -__LLDB_Package="liblldb-3.9-dev" -__SkipUnmount=0 - -# base development support -__UbuntuPackages="build-essential" - -__AlpinePackages="alpine-base" -__AlpinePackages+=" build-base" -__AlpinePackages+=" linux-headers" -__AlpinePackagesEdgeTesting=" lldb-dev" -__AlpinePackagesEdgeMain=" llvm9-libs" -__AlpinePackagesEdgeMain+=" python3" - -# symlinks fixer -__UbuntuPackages+=" symlinks" - -# CoreCLR and CoreFX dependencies -__UbuntuPackages+=" libicu-dev" -__UbuntuPackages+=" liblttng-ust-dev" -__UbuntuPackages+=" libunwind8-dev" - -__AlpinePackages+=" gettext-dev" -__AlpinePackages+=" icu-dev" -__AlpinePackages+=" libunwind-dev" -__AlpinePackages+=" lttng-ust-dev" - -# CoreFX dependencies -__UbuntuPackages+=" libcurl4-openssl-dev" -__UbuntuPackages+=" libkrb5-dev" -__UbuntuPackages+=" libssl-dev" -__UbuntuPackages+=" zlib1g-dev" - -__AlpinePackages+=" curl-dev" -__AlpinePackages+=" krb5-dev" -__AlpinePackages+=" openssl-dev" -__AlpinePackages+=" zlib-dev" - -__FreeBSDBase="12.1-RELEASE" -__FreeBSDPkg="1.10.5" -__FreeBSDPackages="libunwind" -__FreeBSDPackages+=" icu" -__FreeBSDPackages+=" libinotify" -__FreeBSDPackages+=" lttng-ust" -__FreeBSDPackages+=" llvm-90" -__FreeBSDPackages+=" krb5" - -__UnprocessedBuildArgs= -while :; do - if [ $# -le 0 ]; then - break - fi - - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -?|-h|--help) - usage - exit 1 - ;; - arm) - __BuildArch=arm - __UbuntuArch=armhf - __AlpineArch=armhf - __QEMUArch=arm - ;; - arm64) - __BuildArch=arm64 - __UbuntuArch=arm64 - __AlpineArch=aarch64 - __QEMUArch=aarch64 - ;; - armel) - __BuildArch=armel - __UbuntuArch=armel - __UbuntuRepo="http://ftp.debian.org/debian/" - __CodeName=jessie - ;; - x86) - __BuildArch=x86 - __UbuntuArch=i386 - __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" - ;; - lldb3.6) - __LLDB_Package="lldb-3.6-dev" - ;; - lldb3.8) - __LLDB_Package="lldb-3.8-dev" - ;; - lldb3.9) - __LLDB_Package="liblldb-3.9-dev" - ;; - lldb4.0) - __LLDB_Package="liblldb-4.0-dev" - ;; - lldb5.0) - __LLDB_Package="liblldb-5.0-dev" - ;; - lldb6.0) - __LLDB_Package="liblldb-6.0-dev" - ;; - no-lldb) - unset __LLDB_Package - ;; - trusty) # Ubuntu 14.04 - if [ "$__CodeName" != "jessie" ]; then - __CodeName=trusty - fi - ;; - xenial) # Ubuntu 16.04 - if [ "$__CodeName" != "jessie" ]; then - __CodeName=xenial - fi - ;; - zesty) # Ubuntu 17.04 - if [ "$__CodeName" != "jessie" ]; then - __CodeName=zesty - fi - ;; - bionic) # Ubuntu 18.04 - if [ "$__CodeName" != "jessie" ]; then - __CodeName=bionic - fi - ;; - jessie) # Debian 8 - __CodeName=jessie - __UbuntuRepo="http://ftp.debian.org/debian/" - ;; - stretch) # Debian 9 - __CodeName=stretch - __UbuntuRepo="http://ftp.debian.org/debian/" - __LLDB_Package="liblldb-6.0-dev" - ;; - buster) # Debian 10 - __CodeName=buster - __UbuntuRepo="http://ftp.debian.org/debian/" - __LLDB_Package="liblldb-6.0-dev" - ;; - tizen) - if [ "$__BuildArch" != "armel" ]; then - echo "Tizen is available only for armel." - usage; - exit 1; - fi - __CodeName= - __UbuntuRepo= - __Tizen=tizen - ;; - alpine) - __CodeName=alpine - __UbuntuRepo= - ;; - freebsd11) - __FreeBSDBase="11.3-RELEASE" - ;& - freebsd12) - __CodeName=freebsd - __BuildArch=x64 - __SkipUnmount=1 - ;; - --skipunmount) - __SkipUnmount=1 - ;; - --rootfsdir|-rootfsdir) - shift - __RootfsDir=$1 - ;; - *) - __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" - ;; - esac - - shift -done - -if [ "$__BuildArch" == "armel" ]; then - __LLDB_Package="lldb-3.5-dev" -fi -__UbuntuPackages+=" ${__LLDB_Package:-}" - -if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then - __RootfsDir=$ROOTFS_DIR -fi - -if [ -z "$__RootfsDir" ]; then - __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" -fi - -if [ -d "$__RootfsDir" ]; then - if [ $__SkipUnmount == 0 ]; then - umount $__RootfsDir/* - fi - rm -rf $__RootfsDir -fi - -if [[ "$__CodeName" == "alpine" ]]; then - __ApkToolsVersion=2.9.1 - __AlpineVersion=3.9 - __ApkToolsDir=$(mktemp -d) - wget https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -P $__ApkToolsDir - tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir - mkdir -p $__RootfsDir/usr/bin - cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin - - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \ - -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackages - - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeMain - - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeTesting - - rm -r $__ApkToolsDir -elif [[ "$__CodeName" == "freebsd" ]]; then - mkdir -p $__RootfsDir/usr/local/etc - wget -O - https://download.freebsd.org/ftp/releases/amd64/${__FreeBSDBase}/base.txz | tar -C $__RootfsDir -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version - # For now, ask for 11 ABI even on 12. This can be revisited later. - echo "ABI = \"FreeBSD:11:amd64\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > ${__RootfsDir}/usr/local/etc/pkg.conf - echo "FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"${__RootfsDir}/usr/share/keys/pkg\", enabled: yes }" > ${__RootfsDir}/etc/pkg/FreeBSD.conf - mkdir -p $__RootfsDir/tmp - # get and build package manager - wget -O - https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz | tar -C $__RootfsDir/tmp -zxf - - cd $__RootfsDir/tmp/pkg-${__FreeBSDPkg} - ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make install - rm -rf $__RootfsDir/tmp/pkg-${__FreeBSDPkg} - # install packages we need. - $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update - $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages -elif [[ -n $__CodeName ]]; then - qemu-debootstrap --arch $__UbuntuArch $__CodeName $__RootfsDir $__UbuntuRepo - cp $__CrossDir/$__BuildArch/sources.list.$__CodeName $__RootfsDir/etc/apt/sources.list - chroot $__RootfsDir apt-get update - chroot $__RootfsDir apt-get -f -y install - chroot $__RootfsDir apt-get -y install $__UbuntuPackages - chroot $__RootfsDir symlinks -cr /usr - - if [ $__SkipUnmount == 0 ]; then - umount $__RootfsDir/* - fi - - if [[ "$__BuildArch" == "arm" && "$__CodeName" == "trusty" ]]; then - pushd $__RootfsDir - patch -p1 < $__CrossDir/$__BuildArch/trusty.patch - patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch - popd - fi -elif [ "$__Tizen" == "tizen" ]; then - ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh -else - echo "Unsupported target platform." - usage; - exit 1 -fi diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake deleted file mode 100644 index 534f1d19de6..00000000000 --- a/eng/common/cross/toolchain.cmake +++ /dev/null @@ -1,162 +0,0 @@ -set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) - -set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) -if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) - set(CMAKE_SYSTEM_NAME FreeBSD) -else() - set(CMAKE_SYSTEM_NAME Linux) -endif() -set(CMAKE_SYSTEM_VERSION 1) - -if(TARGET_ARCH_NAME STREQUAL "armel") - set(CMAKE_SYSTEM_PROCESSOR armv7l) - set(TOOLCHAIN "arm-linux-gnueabi") - if("$ENV{__DistroRid}" MATCHES "tizen.*") - set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/6.2.1") - endif() -elseif(TARGET_ARCH_NAME STREQUAL "arm") - set(CMAKE_SYSTEM_PROCESSOR armv7l) - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) - set(TOOLCHAIN "armv6-alpine-linux-musleabihf") - else() - set(TOOLCHAIN "arm-linux-gnueabihf") - endif() -elseif(TARGET_ARCH_NAME STREQUAL "arm64") - set(CMAKE_SYSTEM_PROCESSOR aarch64) - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) - set(TOOLCHAIN "aarch64-alpine-linux-musl") - else() - set(TOOLCHAIN "aarch64-linux-gnu") - endif() -elseif(TARGET_ARCH_NAME STREQUAL "x86") - set(CMAKE_SYSTEM_PROCESSOR i686) - set(TOOLCHAIN "i686-linux-gnu") -elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - set(CMAKE_SYSTEM_PROCESSOR "x86_64") - set(triple "x86_64-unknown-freebsd11") -else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") -endif() - -if(DEFINED ENV{TOOLCHAIN}) - set(TOOLCHAIN $ENV{TOOLCHAIN}) -endif() - -# Specify include paths -if(TARGET_ARCH_NAME STREQUAL "armel") - if(DEFINED TIZEN_TOOLCHAIN) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) - endif() -endif() - -if("$ENV{__DistroRid}" MATCHES "android.*") - if(TARGET_ARCH_NAME STREQUAL "arm") - set(ANDROID_ABI armeabi-v7a) - elseif(TARGET_ARCH_NAME STREQUAL "arm64") - set(ANDROID_ABI arm64-v8a) - endif() - - # extract platform number required by the NDK's toolchain - string(REGEX REPLACE ".*\\.([0-9]+)-.*" "\\1" ANDROID_PLATFORM "$ENV{__DistroRid}") - - set(ANDROID_TOOLCHAIN clang) - set(FEATURE_EVENT_TRACE 0) # disable event trace as there is no lttng-ust package in termux repository - set(CMAKE_SYSTEM_LIBRARY_PATH "${CROSS_ROOTFS}/usr/lib") - set(CMAKE_SYSTEM_INCLUDE_PATH "${CROSS_ROOTFS}/usr/include") - - # include official NDK toolchain script - include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake) -elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - # we cross-compile by instructing clang - set(CMAKE_C_COMPILER_TARGET ${triple}) - set(CMAKE_CXX_COMPILER_TARGET ${triple}) - set(CMAKE_ASM_COMPILER_TARGET ${triple}) - set(CMAKE_SYSROOT "${CROSS_ROOTFS}") -else() - set(CMAKE_SYSROOT "${CROSS_ROOTFS}") - - set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") - set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") - set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") -endif() - -# Specify link flags - -if(TARGET_ARCH_NAME STREQUAL "armel") - if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only - add_link_options("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") - add_link_options("-L${CROSS_ROOTFS}/lib") - add_link_options("-L${CROSS_ROOTFS}/usr/lib") - add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") - endif() -elseif(TARGET_ARCH_NAME STREQUAL "x86") - add_link_options(-m32) -endif() - -# Specify compile options - -if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$" AND NOT "$ENV{__DistroRid}" MATCHES "android.*") - set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) - set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) - set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) -endif() - -if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") - add_compile_options(-mthumb) - if (NOT DEFINED CLR_ARM_FPU_TYPE) - set (CLR_ARM_FPU_TYPE vfpv3) - endif (NOT DEFINED CLR_ARM_FPU_TYPE) - - add_compile_options (-mfpu=${CLR_ARM_FPU_TYPE}) - if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) - set (CLR_ARM_FPU_CAPABILITY 0x7) - endif (NOT DEFINED CLR_ARM_FPU_CAPABILITY) - - add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) - - if(TARGET_ARCH_NAME STREQUAL "armel") - add_compile_options(-mfloat-abi=softfp) - if(DEFINED TIZEN_TOOLCHAIN) - add_compile_options(-Wno-deprecated-declarations) # compile-time option - add_compile_options(-D__extern_always_inline=inline) # compile-time option - endif() - endif() -elseif(TARGET_ARCH_NAME STREQUAL "x86") - add_compile_options(-m32) - add_compile_options(-Wno-error=unused-command-line-argument) -endif() - -# Set LLDB include and library paths for builds that need lldb. -if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") - if(TARGET_ARCH_NAME STREQUAL "x86") - set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") - else() # arm/armel case - set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") - endif() - if(LLVM_CROSS_DIR) - set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") - set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") - set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") - set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") - else() - if(TARGET_ARCH_NAME STREQUAL "x86") - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") - set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") - if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") - set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") - else() - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") - endif() - else() # arm/armel case - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") - endif() - endif() -endif() - - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/x86/sources.list.bionic b/eng/common/cross/x86/sources.list.bionic deleted file mode 100644 index a71ccadcffa..00000000000 --- a/eng/common/cross/x86/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.trusty b/eng/common/cross/x86/sources.list.trusty deleted file mode 100644 index 9b3085436e9..00000000000 --- a/eng/common/cross/x86/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.xenial b/eng/common/cross/x86/sources.list.xenial deleted file mode 100644 index ad9c5a0144e..00000000000 --- a/eng/common/cross/x86/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 deleted file mode 100644 index 435e7641341..00000000000 --- a/eng/common/darc-init.ps1 +++ /dev/null @@ -1,47 +0,0 @@ -param ( - $darcVersion = $null, - $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16', - $verbosity = 'minimal', - $toolpath = $null -) - -. $PSScriptRoot\tools.ps1 - -function InstallDarcCli ($darcVersion, $toolpath) { - $darcCliPackageName = 'microsoft.dotnet.darc' - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list -g - - if ($toolList -like "*$darcCliPackageName*") { - & "$dotnet" tool uninstall $darcCliPackageName -g - } - - # If the user didn't explicitly specify the darc version, - # query the Maestro API for the correct version of darc to install. - if (-not $darcVersion) { - $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content - } - - $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - - Write-Host "Installing Darc CLI version $darcVersion..." - Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' - if (-not $toolpath) { - Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g - }else { - Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" - } -} - -try { - InstallDarcCli $darcVersion $toolpath -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Darc' -Message $_ - ExitWithExitCode 1 -} \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh deleted file mode 100755 index d981d7bbf38..00000000000 --- a/eng/common/darc-init.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -darcVersion='' -versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16' -verbosity='minimal' - -while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" - case "$opt" in - --darcversion) - darcVersion=$2 - shift - ;; - --versionendpoint) - versionEndpoint=$2 - shift - ;; - --verbosity) - verbosity=$2 - shift - ;; - --toolpath) - toolpath=$2 - shift - ;; - *) - echo "Invalid argument: $1" - usage - exit 1 - ;; - esac - - shift -done - -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. "$scriptroot/tools.sh" - -if [ -z "$darcVersion" ]; then - darcVersion=$(curl -X GET "$versionEndpoint" -H "accept: text/plain") -fi - -function InstallDarcCli { - local darc_cli_package_name="microsoft.dotnet.darc" - - InitializeDotNetCli - local dotnet_root=$_InitializeDotNetCli - - if [ -z "$toolpath" ]; then - local tool_list=$($dotnet_root/dotnet tool list -g) - if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) - fi - else - local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath") - if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath") - fi - fi - - local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" - - echo "Installing Darc CLI version $darcVersion..." - echo "You may need to restart your command shell if this is the first dotnet tool you have installed." - if [ -z "$toolpath" ]; then - echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) - else - echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") - fi -} - -InstallDarcCli diff --git a/eng/common/dotnet-install.cmd b/eng/common/dotnet-install.cmd deleted file mode 100644 index b1c2642e76f..00000000000 --- a/eng/common/dotnet-install.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet-install.ps1""" %*" \ No newline at end of file diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 deleted file mode 100644 index 811f0f717f7..00000000000 --- a/eng/common/dotnet-install.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -[CmdletBinding(PositionalBinding=$false)] -Param( - [string] $verbosity = 'minimal', - [string] $architecture = '', - [string] $version = 'Latest', - [string] $runtime = 'dotnet', - [string] $RuntimeSourceFeed = '', - [string] $RuntimeSourceFeedKey = '' -) - -. $PSScriptRoot\tools.ps1 - -$dotnetRoot = Join-Path $RepoRoot '.dotnet' - -$installdir = $dotnetRoot -try { - if ($architecture -and $architecture.Trim() -eq 'x86') { - $installdir = Join-Path $installdir 'x86' - } - InstallDotNet $installdir $version $architecture $runtime $true -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ - ExitWithExitCode 1 -} - -ExitWithExitCode 0 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh deleted file mode 100644 index ead6a1d9a24..00000000000 --- a/eng/common/dotnet-install.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. "$scriptroot/tools.sh" - -version='Latest' -architecture='' -runtime='dotnet' -runtimeSourceFeed='' -runtimeSourceFeedKey='' -while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" - case "$opt" in - -version|-v) - shift - version="$1" - ;; - -architecture|-a) - shift - architecture="$1" - ;; - -runtime|-r) - shift - runtime="$1" - ;; - -runtimesourcefeed) - shift - runtimeSourceFeed="$1" - ;; - -runtimesourcefeedkey) - shift - runtimeSourceFeedKey="$1" - ;; - *) - Write-PipelineTelemetryError -Category 'Build' -Message "Invalid argument: $1" - exit 1 - ;; - esac - shift -done - -# Use uname to determine what the CPU is. -cpuname=$(uname -p) -# Some Linux platforms report unknown for platform, but the arch for machine. -if [[ "$cpuname" == "unknown" ]]; then - cpuname=$(uname -m) -fi - -case $cpuname in - aarch64) - buildarch=arm64 - ;; - amd64|x86_64) - buildarch=x64 - ;; - armv*l) - buildarch=arm - ;; - i686) - buildarch=x86 - ;; - *) - echo "Unknown CPU $cpuname detected, treating it as x64" - buildarch=x64 - ;; -esac - -dotnetRoot="$repo_root/.dotnet" -if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then - dotnetRoot="$dotnetRoot/$architecture" -fi - -InstallDotNet $dotnetRoot $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { - local exit_code=$? - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 - ExitWithExitCode $exit_code -} - -ExitWithExitCode 0 diff --git a/eng/common/enable-cross-org-publishing.ps1 b/eng/common/enable-cross-org-publishing.ps1 deleted file mode 100644 index da09da4f1fc..00000000000 --- a/eng/common/enable-cross-org-publishing.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -param( - [string] $token -) - - -. $PSScriptRoot\pipeline-logging-functions.ps1 - -# Write-PipelineSetVariable will no-op if a variable named $ci is not defined -# Since this script is only ever called in AzDO builds, just universally set it -$ci = $true - -Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 deleted file mode 100644 index 0728b1a8b57..00000000000 --- a/eng/common/generate-graph-files.ps1 +++ /dev/null @@ -1,86 +0,0 @@ -Param( - [Parameter(Mandatory=$true)][string] $barToken, # Token generated at https://maestro-prod.westus2.cloudapp.azure.com/Account/Tokens - [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed) - [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed) - [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created - [string] $darcVersion, # darc's version - [string] $graphvizVersion = '2.38', # GraphViz version - [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about - # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies -) - -function CheckExitCode ([string]$stage) -{ - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - Write-PipelineTelemetryError -Category 'Arcade' -Message "Something failed in stage: '$stage'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode - } -} - -try { - $ErrorActionPreference = 'Stop' - . $PSScriptRoot\tools.ps1 - - Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1') - - Push-Location $PSScriptRoot - - Write-Host 'Installing darc...' - . .\darc-init.ps1 -darcVersion $darcVersion - CheckExitCode 'Running darc-init' - - $engCommonBaseDir = Join-Path $PSScriptRoot 'native\' - $graphvizInstallDir = CommonLibrary\Get-NativeInstallDirectory - $nativeToolBaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external' - $installBin = Join-Path $graphvizInstallDir 'bin' - - Write-Host 'Installing dot...' - .\native\install-tool.ps1 -ToolName graphviz -InstallPath $installBin -BaseUri $nativeToolBaseUri -CommonLibraryDirectory $engCommonBaseDir -Version $graphvizVersion -Verbose - - $darcExe = "$env:USERPROFILE\.dotnet\tools" - $darcExe = Resolve-Path "$darcExe\darc.exe" - - Create-Directory $outputFolder - - # Generate 3 graph descriptions: - # 1. Flat with coherency information - # 2. Graphviz (dot) file - # 3. Standard dependency graph - $graphVizFilePath = "$outputFolder\graphviz.txt" - $graphVizImageFilePath = "$outputFolder\graph.png" - $normalGraphFilePath = "$outputFolder\graph-full.txt" - $flatGraphFilePath = "$outputFolder\graph-flat.txt" - $baseOptions = @( '--github-pat', "$gitHubPat", '--azdev-pat', "$azdoPat", '--password', "$barToken" ) - - if ($includeToolset) { - Write-Host 'Toolsets will be included in the graph...' - $baseOptions += @( '--include-toolset' ) - } - - Write-Host 'Generating standard dependency graph...' - & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath - CheckExitCode 'Generating normal dependency graph' - - Write-Host 'Generating flat dependency graph and graphviz file...' - & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath - CheckExitCode 'Generating flat and graphviz dependency graph' - - Write-Host "Generating graph image $graphVizFilePath" - $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe" - & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath" - CheckExitCode 'Generating graphviz image' - - Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" -} -catch { - if (!$includeToolset) { - Write-Host 'This might be a toolset repo which includes only toolset dependencies. ' -NoNewline -ForegroundColor Yellow - Write-Host 'Since -includeToolset is not set there is no graph to create. Include -includeToolset and try again...' -ForegroundColor Yellow - } - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Arcade' -Message $_ - ExitWithExitCode 1 -} finally { - Pop-Location -} \ No newline at end of file diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj deleted file mode 100644 index d7f185856e7..00000000000 --- a/eng/common/helixpublish.proj +++ /dev/null @@ -1,26 +0,0 @@ - - - - msbuild - - - - - %(Identity) - - - - - - $(WorkItemDirectory) - $(WorkItemCommand) - $(WorkItemTimeout) - - - - - - - - - diff --git a/eng/common/init-tools-native.cmd b/eng/common/init-tools-native.cmd deleted file mode 100644 index 438cd548c45..00000000000 --- a/eng/common/init-tools-native.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" -exit /b %ErrorLevel% \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 deleted file mode 100644 index db830c00a6f..00000000000 --- a/eng/common/init-tools-native.ps1 +++ /dev/null @@ -1,152 +0,0 @@ -<# -.SYNOPSIS -Entry point script for installing native tools - -.DESCRIPTION -Reads $RepoRoot\global.json file to determine native assets to install -and executes installers for those tools - -.PARAMETER BaseUri -Base file directory or Url from which to acquire tool archives - -.PARAMETER InstallDirectory -Directory to install native toolset. This is a command-line override for the default -Install directory precedence order: -- InstallDirectory command-line override -- NETCOREENG_INSTALL_DIRECTORY environment variable -- (default) %USERPROFILE%/.netcoreeng/native - -.PARAMETER Clean -Switch specifying to not install anything, but cleanup native asset folders - -.PARAMETER Force -Clean and then install tools - -.PARAMETER DownloadRetries -Total number of retry attempts - -.PARAMETER RetryWaitTimeInSeconds -Wait time between retry attempts in seconds - -.PARAMETER GlobalJsonFile -File path to global.json file - -.NOTES -#> -[CmdletBinding(PositionalBinding=$false)] -Param ( - [string] $BaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external', - [string] $InstallDirectory, - [switch] $Clean = $False, - [switch] $Force = $False, - [int] $DownloadRetries = 5, - [int] $RetryWaitTimeInSeconds = 30, - [string] $GlobalJsonFile -) - -if (!$GlobalJsonFile) { - $GlobalJsonFile = Join-Path (Get-Item $PSScriptRoot).Parent.Parent.FullName 'global.json' -} - -Set-StrictMode -version 2.0 -$ErrorActionPreference='Stop' - -. $PSScriptRoot\pipeline-logging-functions.ps1 -Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1') - -try { - # Define verbose switch if undefined - $Verbose = $VerbosePreference -Eq 'Continue' - - $EngCommonBaseDir = Join-Path $PSScriptRoot 'native\' - $NativeBaseDir = $InstallDirectory - if (!$NativeBaseDir) { - $NativeBaseDir = CommonLibrary\Get-NativeInstallDirectory - } - $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir - $InstallBin = Join-Path $NativeBaseDir 'bin' - $InstallerPath = Join-Path $EngCommonBaseDir 'install-tool.ps1' - - # Process tools list - Write-Host "Processing $GlobalJsonFile" - If (-Not (Test-Path $GlobalJsonFile)) { - Write-Host "Unable to find '$GlobalJsonFile'" - exit 0 - } - $NativeTools = Get-Content($GlobalJsonFile) -Raw | - ConvertFrom-Json | - Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue - if ($NativeTools) { - $NativeTools.PSObject.Properties | ForEach-Object { - $ToolName = $_.Name - $ToolVersion = $_.Value - $LocalInstallerArguments = @{ ToolName = "$ToolName" } - $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } - $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } - $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } - $LocalInstallerArguments += @{ Version = "$ToolVersion" } - - if ($Verbose) { - $LocalInstallerArguments += @{ Verbose = $True } - } - if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { - if($Force) { - $LocalInstallerArguments += @{ Force = $True } - } - } - if ($Clean) { - $LocalInstallerArguments += @{ Clean = $True } - } - - Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" - & $InstallerPath @LocalInstallerArguments - if ($LASTEXITCODE -Ne "0") { - $errMsg = "$ToolName installation failed" - if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { - $showNativeToolsWarning = $true - if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { - $showNativeToolsWarning = $false - } - if ($showNativeToolsWarning) { - Write-Warning $errMsg - } - $toolInstallationFailure = $true - } else { - # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 - Write-Host $errMsg - exit 1 - } - } - } - - if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { - # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 - Write-Host 'Native tools bootstrap failed' - exit 1 - } - } - else { - Write-Host 'No native tools defined in global.json' - exit 0 - } - - if ($Clean) { - exit 0 - } - if (Test-Path $InstallBin) { - Write-Host 'Native tools are available from ' (Convert-Path -Path $InstallBin) - Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" - return $InstallBin - } - else { - Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools install directory does not exist, installation failed' - exit 1 - } - exit 0 -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh deleted file mode 100644 index 29fc5db8ae0..00000000000 --- a/eng/common/init-tools-native.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -base_uri='https://netcorenativeassets.blob.core.windows.net/resource-packages/external' -install_directory='' -clean=false -force=false -download_retries=5 -retry_wait_time_seconds=30 -global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json" -declare -A native_assets - -. $scriptroot/pipeline-logging-functions.sh -. $scriptroot/native/common-library.sh - -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --baseuri) - base_uri=$2 - shift 2 - ;; - --installdirectory) - install_directory=$2 - shift 2 - ;; - --clean) - clean=true - shift 1 - ;; - --force) - force=true - shift 1 - ;; - --donotabortonfailure) - donotabortonfailure=true - shift 1 - ;; - --donotdisplaywarnings) - donotdisplaywarnings=true - shift 1 - ;; - --downloadretries) - download_retries=$2 - shift 2 - ;; - --retrywaittimeseconds) - retry_wait_time_seconds=$2 - shift 2 - ;; - --help) - echo "Common settings:" - echo " --installdirectory Directory to install native toolset." - echo " This is a command-line override for the default" - echo " Install directory precedence order:" - echo " - InstallDirectory command-line override" - echo " - NETCOREENG_INSTALL_DIRECTORY environment variable" - echo " - (default) %USERPROFILE%/.netcoreeng/native" - echo "" - echo " --clean Switch specifying not to install anything, but cleanup native asset folders" - echo " --donotabortonfailure Switch specifiying whether to abort native tools installation on failure" - echo " --donotdisplaywarnings Switch specifiying whether to display warnings during native tools installation on failure" - echo " --force Clean and then install tools" - echo " --help Print help and exit" - echo "" - echo "Advanced settings:" - echo " --baseuri Base URI for where to download native tools from" - echo " --downloadretries Number of times a download should be attempted" - echo " --retrywaittimeseconds Wait time between download attempts" - echo "" - exit 0 - ;; - esac -done - -function ReadGlobalJsonNativeTools { - # Get the native-tools section from the global.json. - local native_tools_section=$(cat $global_json_file | awk '/"native-tools"/,/}/') - # Only extract the contents of the object. - local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}') - native_tools_list=${native_tools_list//[\" ]/} - native_tools_list=$( echo "$native_tools_list" | sed 's/\s//g' | sed 's/,/\n/g' ) - - local old_IFS=$IFS - while read -r line; do - # Lines are of the form: 'tool:version' - IFS=: - while read -r key value; do - native_assets[$key]=$value - done <<< "$line" - done <<< "$native_tools_list" - IFS=$old_IFS - - return 0; -} - -native_base_dir=$install_directory -if [[ -z $install_directory ]]; then - native_base_dir=$(GetNativeInstallDirectory) -fi - -install_bin="${native_base_dir}/bin" -installed_any=false - -ReadGlobalJsonNativeTools - -if [[ ${#native_assets[@]} -eq 0 ]]; then - echo "No native tools defined in global.json" - exit 0; -else - native_installer_dir="$scriptroot/native" - for tool in "${!native_assets[@]}" - do - tool_version=${native_assets[$tool]} - installer_path="$native_installer_dir/install-$tool.sh" - installer_command="$installer_path" - installer_command+=" --baseuri $base_uri" - installer_command+=" --installpath $install_bin" - installer_command+=" --version $tool_version" - echo $installer_command - - if [[ $force = true ]]; then - installer_command+=" --force" - fi - - if [[ $clean = true ]]; then - installer_command+=" --clean" - fi - - if [[ -a $installer_path ]]; then - $installer_command - if [[ $? != 0 ]]; then - if [[ $donotabortonfailure = true ]]; then - if [[ $donotdisplaywarnings != true ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" - fi - else - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" - exit 1 - fi - else - $installed_any = true - fi - else - if [[ $donotabortonfailure == true ]]; then - if [[ $donotdisplaywarnings != true ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" - fi - else - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" - exit 1 - fi - fi - done -fi - -if [[ $clean = true ]]; then - exit 0 -fi - -if [[ -d $install_bin ]]; then - echo "Native tools are available from $install_bin" - echo "##vso[task.prependpath]$install_bin" -else - if [[ $installed_any = true ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Native tools install directory does not exist, installation failed" - exit 1 - fi -fi - -exit 0 diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 deleted file mode 100644 index db0baac9a44..00000000000 --- a/eng/common/internal-feed-operations.ps1 +++ /dev/null @@ -1,133 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $Operation, - [string] $AuthToken, - [string] $CommitSha, - [string] $RepoName, - [switch] $IsFeedPrivate -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 -. $PSScriptRoot\tools.ps1 - -# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed -# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in -# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. This should ONLY be called from identified -# internal builds -function SetupCredProvider { - param( - [string] $AuthToken - ) - - # Install the Cred Provider NuGet plugin - Write-Host 'Setting up Cred Provider NuGet plugin in the agent...' - Write-Host "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." - - $url = 'https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1' - - Write-Host "Writing the contents of 'installcredprovider.ps1' locally..." - Invoke-WebRequest $url -OutFile installcredprovider.ps1 - - Write-Host 'Installing plugin...' - .\installcredprovider.ps1 -Force - - Write-Host "Deleting local copy of 'installcredprovider.ps1'..." - Remove-Item .\installcredprovider.ps1 - - if (-Not("$env:USERPROFILE\.nuget\plugins\netcore")) { - Write-PipelineTelemetryError -Category 'Arcade' -Message 'CredProvider plugin was not installed correctly!' - ExitWithExitCode 1 - } - else { - Write-Host 'CredProvider plugin was installed correctly!' - } - - # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable - # feeds successfully - - $nugetConfigPath = "$RepoRoot\NuGet.config" - - if (-Not (Test-Path -Path $nugetConfigPath)) { - Write-PipelineTelemetryError -Category 'Build' -Message 'NuGet.config file not found in repo root!' - ExitWithExitCode 1 - } - - $endpoints = New-Object System.Collections.ArrayList - $nugetConfigPackageSources = Select-Xml -Path $nugetConfigPath -XPath "//packageSources/add[contains(@key, 'darc-int-')]/@value" | foreach{$_.Node.Value} - - if (($nugetConfigPackageSources | Measure-Object).Count -gt 0 ) { - foreach ($stableRestoreResource in $nugetConfigPackageSources) { - $trimmedResource = ([string]$stableRestoreResource).Trim() - [void]$endpoints.Add(@{endpoint="$trimmedResource"; password="$AuthToken"}) - } - } - - if (($endpoints | Measure-Object).Count -gt 0) { - # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' - $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress - - # Create the environment variables the AzDo way - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $endpointCredentials -Properties @{ - 'variable' = 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' - 'issecret' = 'false' - } - - # We don't want sessions cached since we will be updating the endpoints quite frequently - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data 'False' -Properties @{ - 'variable' = 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' - 'issecret' = 'false' - } - } - else - { - Write-Host 'No internal endpoints found in NuGet.config' - } -} - -#Workaround for https://github.com/microsoft/msbuild/issues/4430 -function InstallDotNetSdkAndRestoreArcade { - $dotnetTempDir = "$RepoRoot\dotnet" - $dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) - $dotnet = "$dotnetTempDir\dotnet.exe" - $restoreProjPath = "$PSScriptRoot\restore.proj" - - Write-Host "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." - InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" - - '' | Out-File "$restoreProjPath" - - & $dotnet restore $restoreProjPath - - Write-Host 'Arcade SDK restored!' - - if (Test-Path -Path $restoreProjPath) { - Remove-Item $restoreProjPath - } - - if (Test-Path -Path $dotnetTempDir) { - Remove-Item $dotnetTempDir -Recurse - } -} - -try { - Push-Location $PSScriptRoot - - if ($Operation -like 'setup') { - SetupCredProvider $AuthToken - } - elseif ($Operation -like 'install-restore') { - InstallDotNetSdkAndRestoreArcade - } - else { - Write-PipelineTelemetryError -Category 'Arcade' -Message "Unknown operation '$Operation'!" - ExitWithExitCode 1 - } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Arcade' -Message $_ - ExitWithExitCode 1 -} -finally { - Pop-Location -} diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh deleted file mode 100644 index 5941ea28335..00000000000 --- a/eng/common/internal-feed-operations.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed -# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in -# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. -# This should ONLY be called from identified internal builds -function SetupCredProvider { - local authToken=$1 - - # Install the Cred Provider NuGet plugin - echo "Setting up Cred Provider NuGet plugin in the agent..."... - echo "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." - - local url="https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" - - echo "Writing the contents of 'installcredprovider.ps1' locally..." - local installcredproviderPath="installcredprovider.sh" - if command -v curl > /dev/null; then - curl $url > "$installcredproviderPath" - else - wget -q -O "$installcredproviderPath" "$url" - fi - - echo "Installing plugin..." - . "$installcredproviderPath" - - echo "Deleting local copy of 'installcredprovider.sh'..." - rm installcredprovider.sh - - if [ ! -d "$HOME/.nuget/plugins" ]; then - Write-PipelineTelemetryError -category 'Build' 'CredProvider plugin was not installed correctly!' - ExitWithExitCode 1 - else - echo "CredProvider plugin was installed correctly!" - fi - - # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable - # feeds successfully - - local nugetConfigPath="$repo_root/NuGet.config" - - if [ ! "$nugetConfigPath" ]; then - Write-PipelineTelemetryError -category 'Build' "NuGet.config file not found in repo's root!" - ExitWithExitCode 1 - fi - - local endpoints='[' - local nugetConfigPackageValues=`cat "$nugetConfigPath" | grep "key=\"darc-int-"` - local pattern="value=\"(.*)\"" - - for value in $nugetConfigPackageValues - do - if [[ $value =~ $pattern ]]; then - local endpoint="${BASH_REMATCH[1]}" - endpoints+="{\"endpoint\": \"$endpoint\", \"password\": \"$authToken\"}," - fi - done - - endpoints=${endpoints%?} - endpoints+=']' - - if [ ${#endpoints} -gt 2 ]; then - # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' - local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" - - echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials" - echo "##vso[task.setvariable variable=NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED]False" - else - echo "No internal endpoints found in NuGet.config" - fi -} - -# Workaround for https://github.com/microsoft/msbuild/issues/4430 -function InstallDotNetSdkAndRestoreArcade { - local dotnetTempDir="$repo_root/dotnet" - local dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) - local restoreProjPath="$repo_root/eng/common/restore.proj" - - echo "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." - echo "" > "$restoreProjPath" - - InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" - - local res=`$dotnetTempDir/dotnet restore $restoreProjPath` - echo "Arcade SDK restored!" - - # Cleanup - if [ "$restoreProjPath" ]; then - rm "$restoreProjPath" - fi - - if [ "$dotnetTempDir" ]; then - rm -r $dotnetTempDir - fi -} - -source="${BASH_SOURCE[0]}" -operation='' -authToken='' -repoName='' - -while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" - case "$opt" in - --operation) - operation=$2 - shift - ;; - --authtoken) - authToken=$2 - shift - ;; - *) - echo "Invalid argument: $1" - usage - exit 1 - ;; - esac - - shift -done - -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. "$scriptroot/tools.sh" - -if [ "$operation" = "setup" ]; then - SetupCredProvider $authToken -elif [ "$operation" = "install-restore" ]; then - InstallDotNetSdkAndRestoreArcade -else - echo "Unknown operation '$operation'!" -fi diff --git a/eng/common/internal/Directory.Build.props b/eng/common/internal/Directory.Build.props deleted file mode 100644 index e33179ef373..00000000000 --- a/eng/common/internal/Directory.Build.props +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj deleted file mode 100644 index 1a39a7ef3f6..00000000000 --- a/eng/common/internal/Tools.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - net472 - false - - - - - - - - - - - https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-core-internal-tooling/nuget/v3/index.json; - - - $(RestoreSources); - https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; - - - - - - diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 deleted file mode 100644 index c6401230002..00000000000 --- a/eng/common/msbuild.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -[CmdletBinding(PositionalBinding=$false)] -Param( - [string] $verbosity = 'minimal', - [bool] $warnAsError = $true, - [bool] $nodeReuse = $true, - [switch] $ci, - [switch] $prepareMachine, - [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs -) - -. $PSScriptRoot\tools.ps1 - -try { - if ($ci) { - $nodeReuse = $false - } - - MSBuild @extraArgs -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Build' -Message $_ - ExitWithExitCode 1 -} - -ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh deleted file mode 100755 index 8160cd5a59d..00000000000 --- a/eng/common/msbuild.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" - -# resolve $source until the file is no longer a symlink -while [[ -h "$source" ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -verbosity='minimal' -warn_as_error=true -node_reuse=true -prepare_machine=false -extra_args='' - -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --verbosity) - verbosity=$2 - shift 2 - ;; - --warnaserror) - warn_as_error=$2 - shift 2 - ;; - --nodereuse) - node_reuse=$2 - shift 2 - ;; - --ci) - ci=true - shift 1 - ;; - --preparemachine) - prepare_machine=true - shift 1 - ;; - *) - extra_args="$extra_args $1" - shift 1 - ;; - esac -done - -. "$scriptroot/tools.sh" - -if [[ "$ci" == true ]]; then - node_reuse=false -fi - -MSBuild $extra_args -ExitWithExitCode 0 diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 deleted file mode 100644 index 41416862d91..00000000000 --- a/eng/common/native/CommonLibrary.psm1 +++ /dev/null @@ -1,389 +0,0 @@ -<# -.SYNOPSIS -Helper module to install an archive to a directory - -.DESCRIPTION -Helper module to download and extract an archive to a specified directory - -.PARAMETER Uri -Uri of artifact to download - -.PARAMETER InstallDirectory -Directory to extract artifact contents to - -.PARAMETER Force -Force download / extraction if file or contents already exist. Default = False - -.PARAMETER DownloadRetries -Total number of retry attempts. Default = 5 - -.PARAMETER RetryWaitTimeInSeconds -Wait time between retry attempts in seconds. Default = 30 - -.NOTES -Returns False if download or extraction fail, True otherwise -#> -function DownloadAndExtract { - [CmdletBinding(PositionalBinding=$false)] - Param ( - [Parameter(Mandatory=$True)] - [string] $Uri, - [Parameter(Mandatory=$True)] - [string] $InstallDirectory, - [switch] $Force = $False, - [int] $DownloadRetries = 5, - [int] $RetryWaitTimeInSeconds = 30 - ) - # Define verbose switch if undefined - $Verbose = $VerbosePreference -Eq "Continue" - - $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri - - # Download native tool - $DownloadStatus = CommonLibrary\Get-File -Uri $Uri ` - -Path $TempToolPath ` - -DownloadRetries $DownloadRetries ` - -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` - -Force:$Force ` - -Verbose:$Verbose - - if ($DownloadStatus -Eq $False) { - Write-Error "Download failed" - return $False - } - - # Extract native tool - $UnzipStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` - -OutputDirectory $InstallDirectory ` - -Force:$Force ` - -Verbose:$Verbose - - if ($UnzipStatus -Eq $False) { - # Retry Download one more time with Force=true - $DownloadRetryStatus = CommonLibrary\Get-File -Uri $Uri ` - -Path $TempToolPath ` - -DownloadRetries 1 ` - -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` - -Force:$True ` - -Verbose:$Verbose - - if ($DownloadRetryStatus -Eq $False) { - Write-Error "Last attempt of download failed as well" - return $False - } - - # Retry unzip again one more time with Force=true - $UnzipRetryStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` - -OutputDirectory $InstallDirectory ` - -Force:$True ` - -Verbose:$Verbose - if ($UnzipRetryStatus -Eq $False) - { - Write-Error "Last attempt of unzip failed as well" - # Clean up partial zips and extracts - if (Test-Path $TempToolPath) { - Remove-Item $TempToolPath -Force - } - if (Test-Path $InstallDirectory) { - Remove-Item $InstallDirectory -Force -Recurse - } - return $False - } - } - - return $True -} - -<# -.SYNOPSIS -Download a file, retry on failure - -.DESCRIPTION -Download specified file and retry if attempt fails - -.PARAMETER Uri -Uri of file to download. If Uri is a local path, the file will be copied instead of downloaded - -.PARAMETER Path -Path to download or copy uri file to - -.PARAMETER Force -Overwrite existing file if present. Default = False - -.PARAMETER DownloadRetries -Total number of retry attempts. Default = 5 - -.PARAMETER RetryWaitTimeInSeconds -Wait time between retry attempts in seconds Default = 30 - -#> -function Get-File { - [CmdletBinding(PositionalBinding=$false)] - Param ( - [Parameter(Mandatory=$True)] - [string] $Uri, - [Parameter(Mandatory=$True)] - [string] $Path, - [int] $DownloadRetries = 5, - [int] $RetryWaitTimeInSeconds = 30, - [switch] $Force = $False - ) - $Attempt = 0 - - if ($Force) { - if (Test-Path $Path) { - Remove-Item $Path -Force - } - } - if (Test-Path $Path) { - Write-Host "File '$Path' already exists, skipping download" - return $True - } - - $DownloadDirectory = Split-Path -ErrorAction Ignore -Path "$Path" -Parent - if (-Not (Test-Path $DownloadDirectory)) { - New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null - } - - if (Test-Path -IsValid -Path $Uri) { - Write-Verbose "'$Uri' is a file path, copying file to '$Path'" - Copy-Item -Path $Uri -Destination $Path - return $? - } - else { - Write-Verbose "Downloading $Uri" - # Don't display the console progress UI - it's a huge perf hit - $ProgressPreference = 'SilentlyContinue' - while($Attempt -Lt $DownloadRetries) - { - try { - Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path - Write-Verbose "Downloaded to '$Path'" - return $True - } - catch { - $Attempt++ - if ($Attempt -Lt $DownloadRetries) { - $AttemptsLeft = $DownloadRetries - $Attempt - Write-Warning "Download failed, $AttemptsLeft attempts remaining, will retry in $RetryWaitTimeInSeconds seconds" - Start-Sleep -Seconds $RetryWaitTimeInSeconds - } - else { - Write-Error $_ - Write-Error $_.Exception - } - } - } - } - - return $False -} - -<# -.SYNOPSIS -Generate a shim for a native tool - -.DESCRIPTION -Creates a wrapper script (shim) that passes arguments forward to native tool assembly - -.PARAMETER ShimName -The name of the shim - -.PARAMETER ShimDirectory -The directory where shims are stored - -.PARAMETER ToolFilePath -Path to file that shim forwards to - -.PARAMETER Force -Replace shim if already present. Default = False - -.NOTES -Returns $True if generating shim succeeds, $False otherwise -#> -function New-ScriptShim { - [CmdletBinding(PositionalBinding=$false)] - Param ( - [Parameter(Mandatory=$True)] - [string] $ShimName, - [Parameter(Mandatory=$True)] - [string] $ShimDirectory, - [Parameter(Mandatory=$True)] - [string] $ToolFilePath, - [Parameter(Mandatory=$True)] - [string] $BaseUri, - [switch] $Force - ) - try { - Write-Verbose "Generating '$ShimName' shim" - - if (-Not (Test-Path $ToolFilePath)){ - Write-Error "Specified tool file path '$ToolFilePath' does not exist" - return $False - } - - # WinShimmer is a small .NET Framework program that creates .exe shims to bootstrapped programs - # Many of the checks for installed programs expect a .exe extension for Windows tools, rather - # than a .bat or .cmd file. - # Source: https://github.com/dotnet/arcade/tree/master/src/WinShimmer - if (-Not (Test-Path "$ShimDirectory\WinShimmer\winshimmer.exe")) { - $InstallStatus = DownloadAndExtract -Uri "$BaseUri/windows/winshimmer/WinShimmer.zip" ` - -InstallDirectory $ShimDirectory\WinShimmer ` - -Force:$Force ` - -DownloadRetries 2 ` - -RetryWaitTimeInSeconds 5 ` - -Verbose:$Verbose - } - - if ((Test-Path (Join-Path $ShimDirectory "$ShimName.exe"))) { - Write-Host "$ShimName.exe already exists; replacing..." - Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") - } - - & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory - return $True - } - catch { - Write-Host $_ - Write-Host $_.Exception - return $False - } -} - -<# -.SYNOPSIS -Returns the machine architecture of the host machine - -.NOTES -Returns 'x64' on 64 bit machines - Returns 'x86' on 32 bit machines -#> -function Get-MachineArchitecture { - $ProcessorArchitecture = $Env:PROCESSOR_ARCHITECTURE - $ProcessorArchitectureW6432 = $Env:PROCESSOR_ARCHITEW6432 - if($ProcessorArchitecture -Eq "X86") - { - if(($ProcessorArchitectureW6432 -Eq "") -Or - ($ProcessorArchitectureW6432 -Eq "X86")) { - return "x86" - } - $ProcessorArchitecture = $ProcessorArchitectureW6432 - } - if (($ProcessorArchitecture -Eq "AMD64") -Or - ($ProcessorArchitecture -Eq "IA64") -Or - ($ProcessorArchitecture -Eq "ARM64")) { - return "x64" - } - return "x86" -} - -<# -.SYNOPSIS -Get the name of a temporary folder under the native install directory -#> -function Get-TempDirectory { - return Join-Path (Get-NativeInstallDirectory) "temp/" -} - -function Get-TempPathFilename { - [CmdletBinding(PositionalBinding=$false)] - Param ( - [Parameter(Mandatory=$True)] - [string] $Path - ) - $TempDir = CommonLibrary\Get-TempDirectory - $TempFilename = Split-Path $Path -leaf - $TempPath = Join-Path $TempDir $TempFilename - return $TempPath -} - -<# -.SYNOPSIS -Returns the base directory to use for native tool installation - -.NOTES -Returns the value of the NETCOREENG_INSTALL_DIRECTORY if that environment variable -is set, or otherwise returns an install directory under the %USERPROFILE% -#> -function Get-NativeInstallDirectory { - $InstallDir = $Env:NETCOREENG_INSTALL_DIRECTORY - if (!$InstallDir) { - $InstallDir = Join-Path $Env:USERPROFILE ".netcoreeng/native/" - } - return $InstallDir -} - -<# -.SYNOPSIS -Unzip an archive - -.DESCRIPTION -Powershell module to unzip an archive to a specified directory - -.PARAMETER ZipPath (Required) -Path to archive to unzip - -.PARAMETER OutputDirectory (Required) -Output directory for archive contents - -.PARAMETER Force -Overwrite output directory contents if they already exist - -.NOTES -- Returns True and does not perform an extraction if output directory already exists but Overwrite is not True. -- Returns True if unzip operation is successful -- Returns False if Overwrite is True and it is unable to remove contents of OutputDirectory -- Returns False if unable to extract zip archive -#> -function Expand-Zip { - [CmdletBinding(PositionalBinding=$false)] - Param ( - [Parameter(Mandatory=$True)] - [string] $ZipPath, - [Parameter(Mandatory=$True)] - [string] $OutputDirectory, - [switch] $Force - ) - - Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" - try { - if ((Test-Path $OutputDirectory) -And (-Not $Force)) { - Write-Host "Directory '$OutputDirectory' already exists, skipping extract" - return $True - } - if (Test-Path $OutputDirectory) { - Write-Verbose "'Force' is 'True', but '$OutputDirectory' exists, removing directory" - Remove-Item $OutputDirectory -Force -Recurse - if ($? -Eq $False) { - Write-Error "Unable to remove '$OutputDirectory'" - return $False - } - } - if (-Not (Test-Path $OutputDirectory)) { - New-Item -path $OutputDirectory -Force -itemType "Directory" | Out-Null - } - - Add-Type -assembly "system.io.compression.filesystem" - [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$OutputDirectory") - if ($? -Eq $False) { - Write-Error "Unable to extract '$ZipPath'" - return $False - } - } - catch { - Write-Host $_ - Write-Host $_.Exception - - return $False - } - return $True -} - -export-modulemember -function DownloadAndExtract -export-modulemember -function Expand-Zip -export-modulemember -function Get-File -export-modulemember -function Get-MachineArchitecture -export-modulemember -function Get-NativeInstallDirectory -export-modulemember -function Get-TempDirectory -export-modulemember -function Get-TempPathFilename -export-modulemember -function New-ScriptShim diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh deleted file mode 100644 index bf272dcf55a..00000000000 --- a/eng/common/native/common-library.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env bash - -function GetNativeInstallDirectory { - local install_dir - - if [[ -z $NETCOREENG_INSTALL_DIRECTORY ]]; then - install_dir=$HOME/.netcoreeng/native/ - else - install_dir=$NETCOREENG_INSTALL_DIRECTORY - fi - - echo $install_dir - return 0 -} - -function GetTempDirectory { - - echo $(GetNativeInstallDirectory)temp/ - return 0 -} - -function ExpandZip { - local zip_path=$1 - local output_directory=$2 - local force=${3:-false} - - echo "Extracting $zip_path to $output_directory" - if [[ -d $output_directory ]] && [[ $force = false ]]; then - echo "Directory '$output_directory' already exists, skipping extract" - return 0 - fi - - if [[ -d $output_directory ]]; then - echo "'Force flag enabled, but '$output_directory' exists. Removing directory" - rm -rf $output_directory - if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to remove '$output_directory'" - return 1 - fi - fi - - echo "Creating directory: '$output_directory'" - mkdir -p $output_directory - - echo "Extracting archive" - tar -xf $zip_path -C $output_directory - if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to extract '$zip_path'" - return 1 - fi - - return 0 -} - -function GetCurrentOS { - local unameOut="$(uname -s)" - case $unameOut in - Linux*) echo "Linux";; - Darwin*) echo "MacOS";; - esac - return 0 -} - -function GetFile { - local uri=$1 - local path=$2 - local force=${3:-false} - local download_retries=${4:-5} - local retry_wait_time_seconds=${5:-30} - - if [[ -f $path ]]; then - if [[ $force = false ]]; then - echo "File '$path' already exists. Skipping download" - return 0 - else - rm -rf $path - fi - fi - - if [[ -f $uri ]]; then - echo "'$uri' is a file path, copying file to '$path'" - cp $uri $path - return $? - fi - - echo "Downloading $uri" - # Use curl if available, otherwise use wget - if command -v curl > /dev/null; then - curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail - else - wget -q -O "$path" "$uri" --tries="$download_retries" - fi - - return $? -} - -function GetTempPathFileName { - local path=$1 - - local temp_dir=$(GetTempDirectory) - local temp_file_name=$(basename $path) - echo $temp_dir$temp_file_name - return 0 -} - -function DownloadAndExtract { - local uri=$1 - local installDir=$2 - local force=${3:-false} - local download_retries=${4:-5} - local retry_wait_time_seconds=${5:-30} - - local temp_tool_path=$(GetTempPathFileName $uri) - - echo "downloading to: $temp_tool_path" - - # Download file - GetFile "$uri" "$temp_tool_path" $force $download_retries $retry_wait_time_seconds - if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to download '$uri' to '$temp_tool_path'." - return 1 - fi - - # Extract File - echo "extracting from $temp_tool_path to $installDir" - ExpandZip "$temp_tool_path" "$installDir" $force $download_retries $retry_wait_time_seconds - if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to extract '$temp_tool_path' to '$installDir'." - return 1 - fi - - return 0 -} - -function NewScriptShim { - local shimpath=$1 - local tool_file_path=$2 - local force=${3:-false} - - echo "Generating '$shimpath' shim" - if [[ -f $shimpath ]]; then - if [[ $force = false ]]; then - echo "File '$shimpath' already exists." >&2 - return 1 - else - rm -rf $shimpath - fi - fi - - if [[ ! -f $tool_file_path ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" - return 1 - fi - - local shim_contents=$'#!/usr/bin/env bash\n' - shim_contents+="SHIMARGS="$'$1\n' - shim_contents+="$tool_file_path"$' $SHIMARGS\n' - - # Write shim file - echo "$shim_contents" > $shimpath - - chmod +x $shimpath - - echo "Finished generating shim '$shimpath'" - - return $? -} - diff --git a/eng/common/native/install-cmake-test.sh b/eng/common/native/install-cmake-test.sh deleted file mode 100644 index 12339a40761..00000000000 --- a/eng/common/native/install-cmake-test.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. $scriptroot/common-library.sh - -base_uri= -install_path= -version= -clean=false -force=false -download_retries=5 -retry_wait_time_seconds=30 - -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --baseuri) - base_uri=$2 - shift 2 - ;; - --installpath) - install_path=$2 - shift 2 - ;; - --version) - version=$2 - shift 2 - ;; - --clean) - clean=true - shift 1 - ;; - --force) - force=true - shift 1 - ;; - --downloadretries) - download_retries=$2 - shift 2 - ;; - --retrywaittimeseconds) - retry_wait_time_seconds=$2 - shift 2 - ;; - --help) - echo "Common settings:" - echo " --baseuri Base file directory or Url wrom which to acquire tool archives" - echo " --installpath Base directory to install native tool to" - echo " --clean Don't install the tool, just clean up the current install of the tool" - echo " --force Force install of tools even if they previously exist" - echo " --help Print help and exit" - echo "" - echo "Advanced settings:" - echo " --downloadretries Total number of retry attempts" - echo " --retrywaittimeseconds Wait time between retry attempts in seconds" - echo "" - exit 0 - ;; - esac -done - -tool_name="cmake-test" -tool_os=$(GetCurrentOS) -tool_folder=$(echo $tool_os | awk '{print tolower($0)}') -tool_arch="x86_64" -tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" -tool_install_directory="$install_path/$tool_name/$version" -tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" -shim_path="$install_path/$tool_name.sh" -uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" - -# Clean up tool and installers -if [[ $clean = true ]]; then - echo "Cleaning $tool_install_directory" - if [[ -d $tool_install_directory ]]; then - rm -rf $tool_install_directory - fi - - echo "Cleaning $shim_path" - if [[ -f $shim_path ]]; then - rm -rf $shim_path - fi - - tool_temp_path=$(GetTempPathFileName $uri) - echo "Cleaning $tool_temp_path" - if [[ -f $tool_temp_path ]]; then - rm -rf $tool_temp_path - fi - - exit 0 -fi - -# Install tool -if [[ -f $tool_file_path ]] && [[ $force = false ]]; then - echo "$tool_name ($version) already exists, skipping install" - exit 0 -fi - -DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds - -if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' - exit 1 -fi - -# Generate Shim -# Always rewrite shims so that we are referencing the expected version -NewScriptShim $shim_path $tool_file_path true - -if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' - exit 1 -fi - -exit 0 \ No newline at end of file diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh deleted file mode 100644 index 18041be8763..00000000000 --- a/eng/common/native/install-cmake.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -. $scriptroot/common-library.sh - -base_uri= -install_path= -version= -clean=false -force=false -download_retries=5 -retry_wait_time_seconds=30 - -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --baseuri) - base_uri=$2 - shift 2 - ;; - --installpath) - install_path=$2 - shift 2 - ;; - --version) - version=$2 - shift 2 - ;; - --clean) - clean=true - shift 1 - ;; - --force) - force=true - shift 1 - ;; - --downloadretries) - download_retries=$2 - shift 2 - ;; - --retrywaittimeseconds) - retry_wait_time_seconds=$2 - shift 2 - ;; - --help) - echo "Common settings:" - echo " --baseuri Base file directory or Url wrom which to acquire tool archives" - echo " --installpath Base directory to install native tool to" - echo " --clean Don't install the tool, just clean up the current install of the tool" - echo " --force Force install of tools even if they previously exist" - echo " --help Print help and exit" - echo "" - echo "Advanced settings:" - echo " --downloadretries Total number of retry attempts" - echo " --retrywaittimeseconds Wait time between retry attempts in seconds" - echo "" - exit 0 - ;; - esac -done - -tool_name="cmake" -tool_os=$(GetCurrentOS) -tool_folder=$(echo $tool_os | awk '{print tolower($0)}') -tool_arch="x86_64" -tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" -tool_install_directory="$install_path/$tool_name/$version" -tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" -shim_path="$install_path/$tool_name.sh" -uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" - -# Clean up tool and installers -if [[ $clean = true ]]; then - echo "Cleaning $tool_install_directory" - if [[ -d $tool_install_directory ]]; then - rm -rf $tool_install_directory - fi - - echo "Cleaning $shim_path" - if [[ -f $shim_path ]]; then - rm -rf $shim_path - fi - - tool_temp_path=$(GetTempPathFileName $uri) - echo "Cleaning $tool_temp_path" - if [[ -f $tool_temp_path ]]; then - rm -rf $tool_temp_path - fi - - exit 0 -fi - -# Install tool -if [[ -f $tool_file_path ]] && [[ $force = false ]]; then - echo "$tool_name ($version) already exists, skipping install" - exit 0 -fi - -DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds - -if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' - exit 1 -fi - -# Generate Shim -# Always rewrite shims so that we are referencing the expected version -NewScriptShim $shim_path $tool_file_path true - -if [[ $? != 0 ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' - exit 1 -fi - -exit 0 \ No newline at end of file diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 deleted file mode 100644 index f397e1c75d4..00000000000 --- a/eng/common/native/install-tool.ps1 +++ /dev/null @@ -1,132 +0,0 @@ -<# -.SYNOPSIS -Install native tool - -.DESCRIPTION -Install cmake native tool from Azure blob storage - -.PARAMETER InstallPath -Base directory to install native tool to - -.PARAMETER BaseUri -Base file directory or Url from which to acquire tool archives - -.PARAMETER CommonLibraryDirectory -Path to folder containing common library modules - -.PARAMETER Force -Force install of tools even if they previously exist - -.PARAMETER Clean -Don't install the tool, just clean up the current install of the tool - -.PARAMETER DownloadRetries -Total number of retry attempts - -.PARAMETER RetryWaitTimeInSeconds -Wait time between retry attempts in seconds - -.NOTES -Returns 0 if install succeeds, 1 otherwise -#> -[CmdletBinding(PositionalBinding=$false)] -Param ( - [Parameter(Mandatory=$True)] - [string] $ToolName, - [Parameter(Mandatory=$True)] - [string] $InstallPath, - [Parameter(Mandatory=$True)] - [string] $BaseUri, - [Parameter(Mandatory=$True)] - [string] $Version, - [string] $CommonLibraryDirectory = $PSScriptRoot, - [switch] $Force = $False, - [switch] $Clean = $False, - [int] $DownloadRetries = 5, - [int] $RetryWaitTimeInSeconds = 30 -) - -. $PSScriptRoot\..\pipeline-logging-functions.ps1 - -# Import common library modules -Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") - -try { - # Define verbose switch if undefined - $Verbose = $VerbosePreference -Eq "Continue" - - $Arch = CommonLibrary\Get-MachineArchitecture - $ToolOs = "win64" - if($Arch -Eq "x32") { - $ToolOs = "win32" - } - $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" - $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" - $Uri = "$BaseUri/windows/$ToolName/$ToolNameMoniker.zip" - $ShimPath = Join-Path $InstallPath "$ToolName.exe" - - if ($Clean) { - Write-Host "Cleaning $ToolInstallDirectory" - if (Test-Path $ToolInstallDirectory) { - Remove-Item $ToolInstallDirectory -Force -Recurse - } - Write-Host "Cleaning $ShimPath" - if (Test-Path $ShimPath) { - Remove-Item $ShimPath -Force - } - $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri - Write-Host "Cleaning $ToolTempPath" - if (Test-Path $ToolTempPath) { - Remove-Item $ToolTempPath -Force - } - exit 0 - } - - # Install tool - if ((Test-Path $ToolInstallDirectory) -And (-Not $Force)) { - Write-Verbose "$ToolName ($Version) already exists, skipping install" - } - else { - $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` - -InstallDirectory $ToolInstallDirectory ` - -Force:$Force ` - -DownloadRetries $DownloadRetries ` - -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` - -Verbose:$Verbose - - if ($InstallStatus -Eq $False) { - Write-PipelineTelemetryError "Installation failed" -Category "NativeToolsetBootstrapping" - exit 1 - } - } - - $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } - if (@($ToolFilePath).Length -Gt 1) { - Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" - exit 1 - } elseif (@($ToolFilePath).Length -Lt 1) { - Write-Host "$ToolName was not found in $ToolFilePath." - exit 1 - } - - # Generate shim - # Always rewrite shims so that we are referencing the expected version - $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` - -ShimDirectory $InstallPath ` - -ToolFilePath "$ToolFilePath" ` - -BaseUri $BaseUri ` - -Force:$Force ` - -Verbose:$Verbose - - if ($GenerateShimStatus -Eq $False) { - Write-PipelineTelemetryError "Generate shim failed" -Category "NativeToolsetBootstrapping" - return 1 - } - - exit 0 -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category "NativeToolsetBootstrapping" -Message $_ - exit 1 -} diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj deleted file mode 100644 index cf5941e1b64..00000000000 --- a/eng/common/performance/perfhelixpublish.proj +++ /dev/null @@ -1,121 +0,0 @@ - - - - %HELIX_CORRELATION_PAYLOAD%\performance\scripts\benchmarks_ci.py --csproj %HELIX_CORRELATION_PAYLOAD%\performance\$(TargetCsproj) - --dotnet-versions %DOTNET_VERSION% --cli-source-info args --cli-branch %PERFLAB_BRANCH% --cli-commit-sha %PERFLAB_HASH% --cli-repository https://github.com/%PERFLAB_REPO% --cli-source-timestamp %PERFLAB_BUILDTIMESTAMP% - py -3 - %HELIX_CORRELATION_PAYLOAD%\Core_Root\CoreRun.exe - %HELIX_CORRELATION_PAYLOAD%\Baseline_Core_Root\CoreRun.exe - $(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD% - %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts - %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts_Baseline - %HELIX_CORRELATION_PAYLOAD%\performance\src\tools\ResultsComparer\ResultsComparer.csproj - %HELIX_CORRELATION_PAYLOAD%\performance\tools\dotnet\$(Architecture)\dotnet.exe - %25%25 - %HELIX_WORKITEM_ROOT%\testResults.xml - - - - $HELIX_CORRELATION_PAYLOAD - $(BaseDirectory)/performance - - - - $HELIX_WORKITEM_PAYLOAD - $(BaseDirectory) - - - - $(PerformanceDirectory)/scripts/benchmarks_ci.py --csproj $(PerformanceDirectory)/$(TargetCsproj) - --dotnet-versions $DOTNET_VERSION --cli-source-info args --cli-branch $PERFLAB_BRANCH --cli-commit-sha $PERFLAB_HASH --cli-repository https://github.com/$PERFLAB_REPO --cli-source-timestamp $PERFLAB_BUILDTIMESTAMP - python3 - $(BaseDirectory)/Core_Root/corerun - $(BaseDirectory)/Baseline_Core_Root/corerun - $(HelixPreCommands);chmod +x $(PerformanceDirectory)/tools/machine-setup.sh;. $(PerformanceDirectory)/tools/machine-setup.sh - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts_Baseline - $(PerformanceDirectory)/src/tools/ResultsComparer/ResultsComparer.csproj - $(PerformanceDirectory)/tools/dotnet/$(Architecture)/dotnet - %25 - $HELIX_WORKITEM_ROOT/testResults.xml - - - - --corerun $(CoreRun) - - - - --corerun $(BaselineCoreRun) - - - - $(Python) $(WorkItemCommand) --incremental no --architecture $(Architecture) -f $(_Framework) $(PerfLabArguments) - - - - $(WorkItemCommand) $(CliArguments) - - - - - %(Identity) - - - - - 5 - - - - - - - - - - - false - - - - - - $(WorkItemDirectory) - $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" - $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" - $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) - 4:00 - - - - - - $(WorkItemDirectory) - $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument)" - $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument)" - $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults) - 4:00 - - - - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name System.Private.Xml.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name System.Linq.Expressions.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name Microsoft.CodeAnalysis.VisualBasic.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name Microsoft.CodeAnalysis.CSharp.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - \ No newline at end of file diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 deleted file mode 100644 index 1763a1a97b0..00000000000 --- a/eng/common/performance/performance-setup.ps1 +++ /dev/null @@ -1,114 +0,0 @@ -Param( - [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, - [string] $CoreRootDirectory, - [string] $BaselineCoreRootDirectory, - [string] $Architecture="x64", - [string] $Framework="netcoreapp5.0", - [string] $CompilationMode="Tiered", - [string] $Repository=$env:BUILD_REPOSITORY_NAME, - [string] $Branch=$env:BUILD_SOURCEBRANCH, - [string] $CommitSha=$env:BUILD_SOURCEVERSION, - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, - [string] $RunCategories="Libraries Runtime", - [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", - [string] $Kind="micro", - [switch] $Internal, - [switch] $Compare, - [string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind" -) - -$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") -or ($Repository -eq "dotnet-performance") -$UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) -$UseBaselineCoreRun = ($BaselineCoreRootDirectory -ne [string]::Empty) - -$PayloadDirectory = (Join-Path $SourceDirectory "Payload") -$PerformanceDirectory = (Join-Path $PayloadDirectory "performance") -$WorkItemDirectory = (Join-Path $SourceDirectory "workitem") -$ExtraBenchmarkDotNetArguments = "--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" -$Creator = $env:BUILD_DEFINITIONNAME -$PerfLabArguments = "" -$HelixSourcePrefix = "pr" - -$Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" - -if ($Framework.StartsWith("netcoreapp")) { - $Queue = "Windows.10.Amd64.ClientRS5.Open" -} - -if ($Compare) { - $Queue = "Windows.10.Amd64.19H1.Tiger.Perf.Open" - $PerfLabArguments = "" - $ExtraBenchmarkDotNetArguments = "" -} - -if ($Internal) { - $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" - $PerfLabArguments = "--upload-to-perflab-container" - $ExtraBenchmarkDotNetArguments = "" - $Creator = "" - $HelixSourcePrefix = "official" -} - -# FIX ME: This is a workaround until we get this from the actual pipeline -$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture" -$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" - - -#This grabs the LKG version number of dotnet and passes it to our scripts -$VersionJSON = Get-Content global.json | ConvertFrom-Json -$DotNetVersion = $VersionJSON.tools.dotnet -$SetupArguments = "--dotnet-versions $DotNetVersion $SetupArguments" - - -if ($RunFromPerformanceRepo) { - $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" - - robocopy $SourceDirectory $PerformanceDirectory /E /XD $PayloadDirectory $SourceDirectory\artifacts $SourceDirectory\.git -} -else { - git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory -} - -if ($UseCoreRun) { - $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") - Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot -} -if ($UseBaselineCoreRun) { - $NewBaselineCoreRoot = (Join-Path $PayloadDirectory "Baseline_Core_Root") - Move-Item -Path $BaselineCoreRootDirectory -Destination $NewBaselineCoreRoot -} - -$DocsDir = (Join-Path $PerformanceDirectory "docs") -robocopy $DocsDir $WorkItemDirectory - -# Set variables that we will need to have in future steps -$ci = $true - -. "$PSScriptRoot\..\pipeline-logging-functions.ps1" - -# Directories -Write-PipelineSetVariable -Name 'PayloadDirectory' -Value "$PayloadDirectory" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'PerformanceDirectory' -Value "$PerformanceDirectory" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'WorkItemDirectory' -Value "$WorkItemDirectory" -IsMultiJobVariable $false - -# Script Arguments -Write-PipelineSetVariable -Name 'Python' -Value "py -3" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'ExtraBenchmarkDotNetArguments' -Value "$ExtraBenchmarkDotNetArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'SetupArguments' -Value "$SetupArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'PerfLabArguments' -Value "$PerfLabArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'BDNCategories' -Value "$RunCategories" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false - -# Helix Arguments -Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Queue' -Value "$Queue" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'HelixSourcePrefix' -Value "$HelixSourcePrefix" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name '_BuildConfig' -Value "$Architecture.$Kind.$Framework" -IsMultiJobVariable $false - -exit 0 \ No newline at end of file diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh deleted file mode 100644 index b9eecf94bd0..00000000000 --- a/eng/common/performance/performance-setup.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env bash - -source_directory=$BUILD_SOURCESDIRECTORY -core_root_directory= -baseline_core_root_directory= -architecture=x64 -framework=netcoreapp5.0 -compilation_mode=tiered -repository=$BUILD_REPOSITORY_NAME -branch=$BUILD_SOURCEBRANCH -commit_sha=$BUILD_SOURCEVERSION -build_number=$BUILD_BUILDNUMBER -internal=false -compare=false -kind="micro" -run_categories="Libraries Runtime" -csproj="src\benchmarks\micro\MicroBenchmarks.csproj" -configurations="CompliationMode=$compilation_mode RunKind=$kind" -run_from_perf_repo=false -use_core_run=true -use_baseline_core_run=true - -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --sourcedirectory) - source_directory=$2 - shift 2 - ;; - --corerootdirectory) - core_root_directory=$2 - shift 2 - ;; - --baselinecorerootdirectory) - baseline_core_root_directory=$2 - shift 2 - ;; - --architecture) - architecture=$2 - shift 2 - ;; - --framework) - framework=$2 - shift 2 - ;; - --compilationmode) - compilation_mode=$2 - shift 2 - ;; - --repository) - repository=$2 - shift 2 - ;; - --branch) - branch=$2 - shift 2 - ;; - --commitsha) - commit_sha=$2 - shift 2 - ;; - --buildnumber) - build_number=$2 - shift 2 - ;; - --kind) - kind=$2 - shift 2 - ;; - --runcategories) - run_categories=$2 - shift 2 - ;; - --csproj) - csproj=$2 - shift 2 - ;; - --internal) - internal=true - shift 1 - ;; - --compare) - compare=true - shift 1 - ;; - --configurations) - configurations=$2 - shift 2 - ;; - --help) - echo "Common settings:" - echo " --corerootdirectory Directory where Core_Root exists, if running perf testing with --corerun" - echo " --architecture Architecture of the testing being run" - echo " --configurations List of key=value pairs that will be passed to perf testing infrastructure." - echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\"" - echo " --help Print help and exit" - echo "" - echo "Advanced settings:" - echo " --framework The framework to run, if not running in master" - echo " --compliationmode The compilation mode if not passing --configurations" - echo " --sourcedirectory The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY" - echo " --repository The name of the repository in the / format. Defaults to env:BUILD_REPOSITORY_NAME" - echo " --branch The name of the branch. Defaults to env:BUILD_SOURCEBRANCH" - echo " --commitsha The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION" - echo " --buildnumber The build number currently running. Defaults to env:BUILD_BUILDNUMBER" - echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj" - echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro" - echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" - echo " --internal If the benchmarks are running as an official job." - echo "" - exit 0 - ;; - esac -done - -if [ "$repository" == "dotnet/performance" ] || [ "$repository" == "dotnet-performance" ]; then - run_from_perf_repo=true -fi - -if [ -z "$configurations" ]; then - configurations="CompliationMode=$compilation_mode" -fi - -if [ -z "$core_root_directory" ]; then - use_core_run=false -fi - -if [ -z "$baseline_core_root_directory" ]; then - use_baseline_core_run=false -fi - -payload_directory=$source_directory/Payload -performance_directory=$payload_directory/performance -workitem_directory=$source_directory/workitem -extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" -perflab_arguments= -queue=Ubuntu.1804.Amd64.Open -creator=$BUILD_DEFINITIONNAME -helix_source_prefix="pr" - -if [[ "$compare" == true ]]; then - extra_benchmark_dotnet_arguments= - perflab_arguments= - - # No open queues for arm64 - if [[ "$architecture" = "arm64" ]]; then - echo "Compare not available for arm64" - exit 1 - fi - - queue=Ubuntu.1804.Amd64.Tiger.Perf.Open -fi - -if [[ "$internal" == true ]]; then - perflab_arguments="--upload-to-perflab-container" - helix_source_prefix="official" - creator= - extra_benchmark_dotnet_arguments= - - if [[ "$architecture" = "arm64" ]]; then - queue=Ubuntu.1804.Arm64.Perf - else - queue=Ubuntu.1804.Amd64.Tiger.Perf - fi -fi - -common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" -setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" - - -# Get the tools section from the global.json. -# This grabs the LKG version number of dotnet and passes it to our scripts -dotnet_version=`cat global.json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tools"]["dotnet"])'` -setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" - - -if [[ "$run_from_perf_repo" = true ]]; then - payload_directory= - workitem_directory=$source_directory - performance_directory=$workitem_directory - setup_arguments="--perf-hash $commit_sha $common_setup_arguments" -else - git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory - - docs_directory=$performance_directory/docs - mv $docs_directory $workitem_directory -fi - -if [[ "$use_core_run" = true ]]; then - new_core_root=$payload_directory/Core_Root - mv $core_root_directory $new_core_root -fi - -if [[ "$use_baseline_core_run" = true ]]; then - new_baseline_core_root=$payload_directory/Baseline_Core_Root - mv $baseline_core_root_directory $new_baseline_core_root -fi - -ci=true - -_script_dir=$(pwd)/eng/common -. "$_script_dir/pipeline-logging-functions.sh" - -# Make sure all of our variables are available for future steps -Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false -Write-PipelineSetVariable -name "UseBaselineCoreRun" -value "$use_baseline_core_run" -is_multi_job_variable false -Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false -Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false -Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "Python" -value "$python3" -is_multi_job_variable false -Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false -Write-PipelineSetVariable -name "TargetCsproj" -value "$csproj" -is_multi_job_variable false -Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" -is_multi_job_variable false -Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false -Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false -Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false -Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false -Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 deleted file mode 100644 index 8484451f3a5..00000000000 --- a/eng/common/pipeline-logging-functions.ps1 +++ /dev/null @@ -1,242 +0,0 @@ -# Source for this file was taken from https://github.com/microsoft/azure-pipelines-task-lib/blob/11c9439d4af17e6475d9fe058e6b2e03914d17e6/powershell/VstsTaskSdk/LoggingCommandFunctions.ps1 and modified. - -# NOTE: You should not be calling these method directly as they are likely to change. Instead you should be calling the Write-Pipeline* functions defined in tools.ps1 - -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -# Specify "-Force" to force pipeline formatted output even if "$ci" is false or not set -function Write-PipelineTelemetryError { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Category, - [Parameter(Mandatory = $true)] - [string]$Message, - [Parameter(Mandatory = $false)] - [string]$Type = 'error', - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput, - [switch]$Force) - - $PSBoundParameters.Remove('Category') | Out-Null - - if($Force -Or ((Test-Path variable:ci) -And $ci)) { - $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" - } - $PSBoundParameters.Remove('Message') | Out-Null - $PSBoundParameters.Add('Message', $Message) - Write-PipelineTaskError @PSBoundParameters -} - -# Specify "-Force" to force pipeline formatted output even if "$ci" is false or not set -function Write-PipelineTaskError { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Message, - [Parameter(Mandatory = $false)] - [string]$Type = 'error', - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput, - [switch]$Force - ) - - if(!$Force -And (-Not (Test-Path variable:ci) -Or !$ci)) { - if($Type -eq 'error') { - Write-Host $Message -ForegroundColor Red - return - } - elseif ($Type -eq 'warning') { - Write-Host $Message -ForegroundColor Yellow - return - } - } - - if(($Type -ne 'error') -and ($Type -ne 'warning')) { - Write-Host $Message - return - } - $PSBoundParameters.Remove('Force') | Out-Null - if(-not $PSBoundParameters.ContainsKey('Type')) { - $PSBoundParameters.Add('Type', 'error') - } - Write-LogIssue @PSBoundParameters - } - - function Write-PipelineSetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput, - [bool]$IsMultiJobVariable=$true) - - if((Test-Path variable:ci) -And $ci) { - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'isSecret' = $Secret - 'isOutput' = $IsMultiJobVariable - } -AsOutput:$AsOutput - } - } - - function Write-PipelinePrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string]$Path, - [switch]$AsOutput) - - if((Test-Path variable:ci) -And $ci) { - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput - } - } - -<######################################## -# Private functions. -########################################> -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh deleted file mode 100644 index 33c3f0d8072..00000000000 --- a/eng/common/pipeline-logging-functions.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env bash - -function Write-PipelineTelemetryError { - local telemetry_category='' - local force=false - local function_args=() - local message='' - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -category|-c) - telemetry_category=$2 - shift - ;; - -force|-f) - force=true - ;; - -*) - function_args+=("$1 $2") - shift - ;; - *) - message=$* - ;; - esac - shift - done - - if [[ $force != true ]] && [[ "$ci" != true ]]; then - echo "$message" >&2 - return - fi - - message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" - function_args+=("$message") - if [[ $force == true ]]; then - function_args+=("-force") - fi - - Write-PipelineTaskError $function_args -} - -function Write-PipelineTaskError { - if [[ $force != true ]] && [[ "$ci" != true ]]; then - echo "$@" >&2 - return - fi - - local message_type="error" - local sourcepath='' - local linenumber='' - local columnnumber='' - local error_code='' - - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -type|-t) - message_type=$2 - shift - ;; - -sourcepath|-s) - sourcepath=$2 - shift - ;; - -linenumber|-ln) - linenumber=$2 - shift - ;; - -columnnumber|-cn) - columnnumber=$2 - shift - ;; - -errcode|-e) - error_code=$2 - shift - ;; - *) - break - ;; - esac - - shift - done - - local message="##vso[task.logissue" - - message="$message type=$message_type" - - if [ -n "$sourcepath" ]; then - message="$message;sourcepath=$sourcepath" - fi - - if [ -n "$linenumber" ]; then - message="$message;linenumber=$linenumber" - fi - - if [ -n "$columnnumber" ]; then - message="$message;columnnumber=$columnnumber" - fi - - if [ -n "$error_code" ]; then - message="$message;code=$error_code" - fi - - message="$message]$*" - echo "$message" -} - -function Write-PipelineSetVariable { - if [[ "$ci" != true ]]; then - return - fi - - local name='' - local value='' - local secret=false - local as_output=false - local is_multi_job_variable=true - - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -name|-n) - name=$2 - shift - ;; - -value|-v) - value=$2 - shift - ;; - -secret|-s) - secret=true - ;; - -as_output|-a) - as_output=true - ;; - -is_multi_job_variable|-i) - is_multi_job_variable=$2 - shift - ;; - esac - shift - done - - value=${value/;/%3B} - value=${value/\\r/%0D} - value=${value/\\n/%0A} - value=${value/]/%5D} - - local message="##vso[task.setvariable variable=$name;isSecret=$secret;isOutput=$is_multi_job_variable]$value" - - if [[ "$as_output" == true ]]; then - $message - else - echo "$message" - fi -} - -function Write-PipelinePrependPath { - local prepend_path='' - - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -path|-p) - prepend_path=$2 - shift - ;; - esac - shift - done - - export PATH="$prepend_path:$PATH" - - if [[ "$ci" == true ]]; then - echo "##vso[task.prependpath]$prepend_path" - fi -} \ No newline at end of file diff --git a/eng/common/post-build/add-build-to-channel.ps1 b/eng/common/post-build/add-build-to-channel.ps1 deleted file mode 100644 index de2d957922a..00000000000 --- a/eng/common/post-build/add-build-to-channel.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -param( - [Parameter(Mandatory=$true)][int] $BuildId, - [Parameter(Mandatory=$true)][int] $ChannelId, - [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', - [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - # Check that the channel we are going to promote the build to exist - $channelInfo = Get-MaestroChannel -ChannelId $ChannelId - - if (!$channelInfo) { - Write-PipelineTelemetryCategory -Category 'PromoteBuild' -Message "Channel with BAR ID $ChannelId was not found in BAR!" - ExitWithExitCode 1 - } - - # Get info about which channel(s) the build has already been promoted to - $buildInfo = Get-MaestroBuild -BuildId $BuildId - - if (!$buildInfo) { - Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "Build with BAR ID $BuildId was not found in BAR!" - ExitWithExitCode 1 - } - - # Find whether the build is already assigned to the channel or not - if ($buildInfo.channels) { - foreach ($channel in $buildInfo.channels) { - if ($channel.Id -eq $ChannelId) { - Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!" - ExitWithExitCode 0 - } - } - } - - Write-Host "Promoting build '$BuildId' to channel '$ChannelId'." - - Assign-BuildToChannel -BuildId $BuildId -ChannelId $ChannelId - - Write-Host 'done.' -} -catch { - Write-Host $_ - Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'" - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 deleted file mode 100644 index 7e6618d64ad..00000000000 --- a/eng/common/post-build/check-channel-consistency.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $PromoteToChannels, # List of channels that the build should be promoted to - [Parameter(Mandatory=$true)][array] $AvailableChannelIds # List of channel IDs available in the YAML implementation -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - # Check that every channel that Maestro told to promote the build to - # is available in YAML - $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ } - - foreach ($id in $PromoteToChannelsIds) { - if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) { - Write-PipelineTaskError -Type 'warning' -Message "Channel $id is not present in the post-build YAML configuration!" - } - } - - Write-Host 'done.' -} -catch { - Write-Host $_ - Write-PipelineTelemetryError -Category 'CheckChannelConsistency' -Message "There was an error while trying to check consistency of Maestro default channels for the build and post-build YAML configuration." - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 deleted file mode 100644 index dab3534ab53..00000000000 --- a/eng/common/post-build/nuget-validation.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -# This script validates NuGet package metadata information using this -# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage - -param( - [Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are - [Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - $url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1' - - New-Item -ItemType 'directory' -Path ${ToolDestinationPath} -Force - - Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1 - - & ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'NuGetValidation' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/post-build-utils.ps1 b/eng/common/post-build/post-build-utils.ps1 deleted file mode 100644 index 7d49744795f..00000000000 --- a/eng/common/post-build/post-build-utils.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -# Most of the functions in this file require the variables `MaestroApiEndPoint`, -# `MaestroApiVersion` and `MaestroApiAccessToken` to be globally available. - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 - -# `tools.ps1` checks $ci to perform some actions. Since the post-build -# scripts don't necessarily execute in the same agent that run the -# build.ps1/sh script this variable isn't automatically set. -$ci = $true -$disableConfigureToolsetImport = $true -. $PSScriptRoot\..\tools.ps1 - -function Create-MaestroApiRequestHeaders([string]$ContentType = 'application/json') { - Validate-MaestroVars - - $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $headers.Add('Accept', $ContentType) - $headers.Add('Authorization',"Bearer $MaestroApiAccessToken") - return $headers -} - -function Get-MaestroChannel([int]$ChannelId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders - $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}?api-version=$MaestroApiVersion" - - $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Get-MaestroBuild([int]$BuildId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/builds/${BuildId}?api-version=$MaestroApiVersion" - - $result = try { return Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Get-MaestroSubscriptions([string]$SourceRepository, [int]$ChannelId) { - Validate-MaestroVars - - $SourceRepository = [System.Web.HttpUtility]::UrlEncode($SourceRepository) - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions?sourceRepository=$SourceRepository&channelId=$ChannelId&api-version=$MaestroApiVersion" - - $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Assign-BuildToChannel([int]$BuildId, [int]$ChannelId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$MaestroApiVersion" - Invoke-WebRequest -Method Post -Uri $apiEndpoint -Headers $apiHeaders | Out-Null -} - -function Trigger-Subscription([string]$SubscriptionId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions/$SubscriptionId/trigger?api-version=$MaestroApiVersion" - Invoke-WebRequest -Uri $apiEndpoint -Headers $apiHeaders -Method Post | Out-Null -} - -function Validate-MaestroVars { - try { - Get-Variable MaestroApiEndPoint -Scope Global | Out-Null - Get-Variable MaestroApiVersion -Scope Global | Out-Null - Get-Variable MaestroApiAccessToken -Scope Global | Out-Null - - if (!($MaestroApiEndPoint -Match '^http[s]?://maestro-(int|prod).westus2.cloudapp.azure.com$')) { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message "MaestroApiEndPoint is not a valid Maestro URL. '$MaestroApiEndPoint'" - ExitWithExitCode 1 - } - - if (!($MaestroApiVersion -Match '^[0-9]{4}-[0-9]{2}-[0-9]{2}$')) { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message "MaestroApiVersion does not match a version string in the format yyyy-MM-DD. '$MaestroApiVersion'" - ExitWithExitCode 1 - } - } - catch { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message 'Error: Variables `MaestroApiEndPoint`, `MaestroApiVersion` and `MaestroApiAccessToken` are required while using this script.' - Write-Host $_ - ExitWithExitCode 1 - } -} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 deleted file mode 100644 index cc9d059d04f..00000000000 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ /dev/null @@ -1,257 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade - [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages - [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use -) - -. $PSScriptRoot\post-build-utils.ps1 - -# Cache/HashMap (File -> Exist flag) used to consult whether a file exist -# in the repository at a specific commit point. This is populated by inserting -# all files present in the repo at a specific commit point. -$global:RepoFiles = @{} - -# Maximum number of jobs to run in parallel -$MaxParallelJobs = 6 - -# Wait time between check for system load -$SecondsBetweenLoadChecks = 10 - -$ValidatePackage = { - param( - [string] $PackagePath # Full path to a Symbols.NuGet package - ) - - . $using:PSScriptRoot\..\tools.ps1 - - # Ensure input file exist - if (!(Test-Path $PackagePath)) { - Write-Host "Input file does not exist: $PackagePath" - return 1 - } - - # Extensions for which we'll look for SourceLink information - # For now we'll only care about Portable & Embedded PDBs - $RelevantExtensions = @('.dll', '.exe', '.pdb') - - Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId - $FailedFiles = 0 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - - [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null - - try { - $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - - $zip.Entries | - Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | - ForEach-Object { - $FileName = $_.FullName - $Extension = [System.IO.Path]::GetExtension($_.Name) - $FakeName = -Join((New-Guid), $Extension) - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName - - # We ignore resource DLLs - if ($FileName.EndsWith('.resources.dll')) { - return - } - - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) - - $ValidateFile = { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $RealPath, - [ref] $FailedFiles - ) - - $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" - $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" - $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String - - if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { - $NumFailedLinks = 0 - - # We only care about Http addresses - $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches - - if ($Matches.Count -ne 0) { - $Matches.Value | - ForEach-Object { - $Link = $_ - $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" - - $FilePath = $Link.Replace($CommitUrl, "") - $Status = 200 - $Cache = $using:RepoFiles - - if ( !($Cache.ContainsKey($FilePath)) ) { - try { - $Uri = $Link -as [System.URI] - - # Only GitHub links are valid - if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { - $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode - } - else { - $Status = 0 - } - } - catch { - write-host $_ - $Status = 0 - } - } - - if ($Status -ne 200) { - if ($NumFailedLinks -eq 0) { - if ($FailedFiles.Value -eq 0) { - Write-Host - } - - Write-Host "`tFile $RealPath has broken links:" - } - - Write-Host "`t`tFailed to retrieve $Link" - - $NumFailedLinks++ - } - } - } - - if ($NumFailedLinks -ne 0) { - $FailedFiles.value++ - $global:LASTEXITCODE = 1 - } - } - } - - &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) - } - } - catch { - - } - finally { - $zip.Dispose() - } - - if ($FailedFiles -eq 0) { - Write-Host 'Passed.' - return 0 - } - else { - Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." - return 1 - } -} - -function ValidateSourceLinkLinks { - if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { - if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { - Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format / or -. '$GHRepoName'" - ExitWithExitCode 1 - } - else { - $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; - } - } - - if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { - Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" - ExitWithExitCode 1 - } - - if ($GHRepoName -ne '' -and $GHCommit -ne '') { - $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') - $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') - - try { - # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash - $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree - - foreach ($file in $Data) { - $Extension = [System.IO.Path]::GetExtension($file.path) - - if ($CodeExtensions.Contains($Extension)) { - $RepoFiles[$file.path] = 1 - } - } - } - catch { - Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." - } - } - elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { - Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' - } - - if (Test-Path $ExtractPath) { - Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue - } - - # Process each NuGet package in parallel - Get-ChildItem "$InputPath\*.symbols.nupkg" | - ForEach-Object { - Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null - $NumJobs = @(Get-Job -State 'Running').Count - - while ($NumJobs -ge $MaxParallelJobs) { - Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." - sleep $SecondsBetweenLoadChecks - $NumJobs = @(Get-Job -State 'Running').Count - } - - foreach ($Job in @(Get-Job -State 'Completed')) { - Receive-Job -Id $Job.Id - Remove-Job -Id $Job.Id - } - } - - $ValidationFailures = 0 - foreach ($Job in @(Get-Job)) { - $jobResult = Wait-Job -Id $Job.Id | Receive-Job - if ($jobResult -ne '0') { - $ValidationFailures++ - } - } - if ($ValidationFailures -gt 0) { - Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." - ExitWithExitCode 1 - } -} - -function InstallSourcelinkCli { - $sourcelinkCliPackageName = 'sourcelink' - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { - Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." - } - else { - Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." - Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' - & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global - } -} - -try { - InstallSourcelinkCli - - ValidateSourceLinkLinks -} -catch { - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 deleted file mode 100644 index f7cfe986ddd..00000000000 --- a/eng/common/post-build/symbols-validation.ps1 +++ /dev/null @@ -1,188 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use -) - -function FirstMatchingSymbolDescriptionOrDefault { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols - [string] $SymbolsPath - ) - - $FileName = [System.IO.Path]::GetFileName($FullPath) - $Extension = [System.IO.Path]::GetExtension($FullPath) - - # Those below are potential symbol files that the `dotnet symbol` might - # return. Which one will be returned depend on the type of file we are - # checking and which type of file was uploaded. - - # The file itself is returned - $SymbolPath = $SymbolsPath + '\' + $FileName - - # PDB file for the module - $PdbPath = $SymbolPath.Replace($Extension, '.pdb') - - # PDB file for R2R module (created by crossgen) - $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') - - # DBG file for a .so library - $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') - - # DWARF file for a .dylib - $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') - - $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" - $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" - - & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null - - if (Test-Path $PdbPath) { - return 'PDB' - } - elseif (Test-Path $NGenPdb) { - return 'NGen PDB' - } - elseif (Test-Path $SODbg) { - return 'DBG for SO' - } - elseif (Test-Path $DylibDwarf) { - return 'Dwarf for Dylib' - } - elseif (Test-Path $SymbolPath) { - return 'Module' - } - else { - return $null - } -} - -function CountMissingSymbols { - param( - [string] $PackagePath # Path to a NuGet package - ) - - # Ensure input file exist - if (!(Test-Path $PackagePath)) { - Write-PipelineTaskError "Input file does not exist: $PackagePath" - ExitWithExitCode 1 - } - - # Extensions for which we'll look for symbols - $RelevantExtensions = @('.dll', '.exe', '.so', '.dylib') - - # How many files are missing symbol information - $MissingSymbols = 0 - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $PackageGuid = New-Guid - $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid - $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols' - - [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) - - Get-ChildItem -Recurse $ExtractPath | - Where-Object {$RelevantExtensions -contains $_.Extension} | - ForEach-Object { - if ($_.FullName -Match '\\ref\\') { - Write-Host "`t Ignoring reference assembly file " $_.FullName - return - } - - $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName '--microsoft-symbol-server' $SymbolsPath - $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName '--internal-server' $SymbolsPath - - Write-Host -NoNewLine "`t Checking file " $_.FullName "... " - - if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { - Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" - } - else { - $MissingSymbols++ - - if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { - Write-Host 'No symbols found on MSDL or SymWeb!' - } - else { - if ($SymbolsOnMSDL -eq $null) { - Write-Host 'No symbols found on MSDL!' - } - else { - Write-Host 'No symbols found on SymWeb!' - } - } - } - } - - Pop-Location - - return $MissingSymbols -} - -function CheckSymbolsAvailable { - if (Test-Path $ExtractPath) { - Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue - } - - Get-ChildItem "$InputPath\*.nupkg" | - ForEach-Object { - $FileName = $_.Name - - # These packages from Arcade-Services include some native libraries that - # our current symbol uploader can't handle. Below is a workaround until - # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. - if ($FileName -Match 'Microsoft\.DotNet\.Darc\.') { - Write-Host "Ignoring Arcade-services file: $FileName" - Write-Host - return - } - elseif ($FileName -Match 'Microsoft\.DotNet\.Maestro\.Tasks\.') { - Write-Host "Ignoring Arcade-services file: $FileName" - Write-Host - return - } - - Write-Host "Validating $FileName " - $Status = CountMissingSymbols "$InputPath\$FileName" - - if ($Status -ne 0) { - Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $Status modules in the package $FileName" - ExitWithExitCode $exitCode - } - - Write-Host - } -} - -function InstallDotnetSymbol { - $dotnetSymbolPackageName = 'dotnet-symbol' - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$dotnetSymbolPackageName*") -and ($toolList -like "*$dotnetSymbolVersion*")) { - Write-Host "dotnet-symbol version $dotnetSymbolVersion is already installed." - } - else { - Write-Host "Installing dotnet-symbol version $dotnetSymbolVersion..." - Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' - & "$dotnet" tool install $dotnetSymbolPackageName --version $dotnetSymbolVersion --verbosity "minimal" --global - } -} - -try { - . $PSScriptRoot\post-build-utils.ps1 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - - InstallDotnetSymbol - - CheckSymbolsAvailable -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'CheckSymbols' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 deleted file mode 100644 index 55dea518ac5..00000000000 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $SourceRepo, - [Parameter(Mandatory=$true)][int] $ChannelId, - [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', - [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - # Get all the $SourceRepo subscriptions - $normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '') - $subscriptions = Get-MaestroSubscriptions -SourceRepository $normalizedSourceRepo -ChannelId $ChannelId - - if (!$subscriptions) { - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'" - ExitWithExitCode 0 - } - - $subscriptionsToTrigger = New-Object System.Collections.Generic.List[string] - $failedTriggeredSubscription = $false - - # Get all enabled subscriptions that need dependency flow on 'everyBuild' - foreach ($subscription in $subscriptions) { - if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) { - Write-Host "Should trigger this subscription: ${$subscription.id}" - [void]$subscriptionsToTrigger.Add($subscription.id) - } - } - - foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { - try { - Write-Host "Triggering subscription '$subscriptionToTrigger'." - - Trigger-Subscription -SubscriptionId $subscriptionToTrigger - - Write-Host 'done.' - } - catch - { - Write-Host "There was an error while triggering subscription '$subscriptionToTrigger'" - Write-Host $_ - Write-Host $_.ScriptStackTrace - $failedTriggeredSubscription = $true - } - } - - if ($subscriptionsToTrigger.Count -eq 0) { - Write-Host "No subscription matched source repo '$normalizedSourceRepo' and channel ID '$ChannelId'." - } - elseif ($failedTriggeredSubscription) { - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message 'At least one subscription failed to be triggered...' - ExitWithExitCode 1 - } - else { - Write-Host 'All subscriptions were triggered successfully!' - } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 deleted file mode 100644 index 3872af59b97..00000000000 --- a/eng/common/sdk-task.ps1 +++ /dev/null @@ -1,78 +0,0 @@ -[CmdletBinding(PositionalBinding=$false)] -Param( - [string] $configuration = 'Debug', - [string] $task, - [string] $verbosity = 'minimal', - [string] $msbuildEngine = $null, - [switch] $restore, - [switch] $prepareMachine, - [switch] $help, - [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties -) - -$ci = $true -$binaryLog = $true -$warnAsError = $true - -. $PSScriptRoot\tools.ps1 - -function Print-Usage() { - Write-Host "Common settings:" - Write-Host " -task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" - Write-Host " -restore Restore dependencies" - Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" - Write-Host " -help Print help and exit" - Write-Host "" - - Write-Host "Advanced settings:" - Write-Host " -prepareMachine Prepare machine for CI run" - Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." - Write-Host "" - Write-Host "Command line arguments not listed above are passed thru to msbuild." -} - -function Build([string]$target) { - $logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" } - $log = Join-Path $LogDir "$task$logSuffix.binlog" - $outputPath = Join-Path $ToolsetDir "$task\\" - - MSBuild $taskProject ` - /bl:$log ` - /t:$target ` - /p:Configuration=$configuration ` - /p:RepoRoot=$RepoRoot ` - /p:BaseIntermediateOutputPath=$outputPath ` - @properties -} - -try { - if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { - Print-Usage - exit 0 - } - - if ($task -eq "") { - Write-PipelineTelemetryError -Category 'Build' -Message "Missing required parameter '-task '" -ForegroundColor Red - Print-Usage - ExitWithExitCode 1 - } - - $taskProject = GetSdkTaskProject $task - if (!(Test-Path $taskProject)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" -ForegroundColor Red - ExitWithExitCode 1 - } - - if ($restore) { - Build 'Restore' - } - - Build 'Execute' -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Build' -Message $_ - ExitWithExitCode 1 -} - -ExitWithExitCode 0 diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config deleted file mode 100644 index 0c5451c1141..00000000000 --- a/eng/common/sdl/NuGet.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 deleted file mode 100644 index b7f61f9a2f1..00000000000 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ /dev/null @@ -1,114 +0,0 @@ -Param( - [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) - [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) - [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified - [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) - [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master - [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located - [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ('artifacts')), # Required: the directory where build artifacts are located - [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault - [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code - [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts - [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. - [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) - [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed - [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. - [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. - [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error - [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") - [string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") -) - -try { - $ErrorActionPreference = 'Stop' - Set-StrictMode -Version 2.0 - $disableConfigureToolsetImport = $true - $LASTEXITCODE = 0 - - # `tools.ps1` checks $ci to perform some actions. Since the SDL - # scripts don't necessarily execute in the same agent that run the - # build.ps1/sh script this variable isn't automatically set. - $ci = $true - . $PSScriptRoot\..\tools.ps1 - - #Replace repo names to the format of org/repo - if (!($Repository.contains('/'))) { - $RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2'; - } - else{ - $RepoName = $Repository; - } - - if ($GuardianPackageName) { - $guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path 'tools' 'guardian.cmd')) - } else { - $guardianCliLocation = $GuardianCliLocation - } - - $workingDirectory = (Split-Path $SourceDirectory -Parent) - $ValidPath = Test-Path $guardianCliLocation - - if ($ValidPath -eq $False) - { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Invalid Guardian CLI Location.' - ExitWithExitCode 1 - } - - & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel - $gdnFolder = Join-Path $workingDirectory '.gdn' - - if ($TsaOnboard) { - if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { - Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-onboard failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - } else { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not onboard to TSA -- not all required values ($TsaCodebaseName, $TsaNotificationEmail, $TsaCodebaseAdmin, $TsaBugAreaPath) were specified.' - ExitWithExitCode 1 - } - } - - if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot 'run-sdl.ps1') -GuardianCliLocation $guardianCliLocation -WorkingDirectory $workingDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams - } - if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot 'run-sdl.ps1') -GuardianCliLocation $guardianCliLocation -WorkingDirectory $workingDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams - } - - if ($UpdateBaseline) { - & (Join-Path $PSScriptRoot 'push-gdn.ps1') -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason 'Update baseline' - } - - if ($TsaPublish) { - if ($TsaBranchName -and $BuildNumber) { - if (-not $TsaRepositoryName) { - $TsaRepositoryName = "$($Repository)-$($BranchName)" - } - Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-publish failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - } else { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not publish to TSA -- not all required values ($TsaBranchName, $BuildNumber) were specified.' - ExitWithExitCode 1 - } - } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ - exit 1 -} diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 deleted file mode 100644 index 9e5f3cb43c7..00000000000 --- a/eng/common/sdl/extract-artifact-packages.ps1 +++ /dev/null @@ -1,80 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored - [Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 - -$disableConfigureToolsetImport = $true - -function ExtractArtifacts { - if (!(Test-Path $InputPath)) { - Write-Host "Input Path does not exist: $InputPath" - ExitWithExitCode 0 - } - $Jobs = @() - Get-ChildItem "$InputPath\*.nupkg" | - ForEach-Object { - $Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName - } - - foreach ($Job in $Jobs) { - Wait-Job -Id $Job.Id | Receive-Job - } -} - -try { - # `tools.ps1` checks $ci to perform some actions. Since the SDL - # scripts don't necessarily execute in the same agent that run the - # build.ps1/sh script this variable isn't automatically set. - $ci = $true - . $PSScriptRoot\..\tools.ps1 - - $ExtractPackage = { - param( - [string] $PackagePath # Full path to a NuGet package - ) - - if (!(Test-Path $PackagePath)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Input file does not exist: $PackagePath" - ExitWithExitCode 1 - } - - $RelevantExtensions = @('.dll', '.exe', '.pdb') - Write-Host -NoNewLine 'Extracting ' ([System.IO.Path]::GetFileName($PackagePath)) '...' - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId - - Add-Type -AssemblyName System.IO.Compression.FileSystem - - [System.IO.Directory]::CreateDirectory($ExtractPath); - - try { - $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - - $zip.Entries | - Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | - ForEach-Object { - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.Name - - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) - } - } - catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ - ExitWithExitCode 1 - } - finally { - $zip.Dispose() - } - } - Measure-Command { ExtractArtifacts } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 deleted file mode 100644 index 1a91bbbc5a9..00000000000 --- a/eng/common/sdl/init-sdl.ps1 +++ /dev/null @@ -1,67 +0,0 @@ -Param( - [string] $GuardianCliLocation, - [string] $Repository, - [string] $BranchName='master', - [string] $WorkingDirectory, - [string] $AzureDevOpsAccessToken, - [string] $GuardianLoggerLevel='Standard' -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 -$disableConfigureToolsetImport = $true -$LASTEXITCODE = 0 - -# `tools.ps1` checks $ci to perform some actions. Since the SDL -# scripts don't necessarily execute in the same agent that run the -# build.ps1/sh script this variable isn't automatically set. -$ci = $true -. $PSScriptRoot\..\tools.ps1 - -# Don't display the console progress UI - it's a huge perf hit -$ProgressPreference = 'SilentlyContinue' - -# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file -$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) -$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") -$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1" -$zipFile = "$WorkingDirectory/gdn.zip" - -Add-Type -AssemblyName System.IO.Compression.FileSystem -$gdnFolder = (Join-Path $WorkingDirectory '.gdn') -try { - # We try to download the zip; if the request fails (e.g. the file doesn't exist), we catch it and init guardian instead - Write-Host 'Downloading gdn folder from internal config repostiory...' - Invoke-WebRequest -Headers @{ "Accept"="application/zip"; "Authorization"="Basic $encodedPat" } -Uri $uri -OutFile $zipFile - if (Test-Path $gdnFolder) { - # Remove the gdn folder if it exists (it shouldn't unless there's too much caching; this is just in case) - Remove-Item -Force -Recurse $gdnFolder - } - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $WorkingDirectory) - Write-Host $gdnFolder - ExitWithExitCode 0 -} catch [System.Net.WebException] { } # Catch and ignore webexception -try { - # if the folder does not exist, we'll do a guardian init and push it to the remote repository - Write-Host 'Initializing Guardian...' - Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel" - & $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian init failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - # We create the mainbaseline so it can be edited later - Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline" - & $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian baseline failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - & $(Join-Path $PSScriptRoot 'push-gdn.ps1') -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason 'Initialize gdn folder' - ExitWithExitCode 0 -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config deleted file mode 100644 index 256ffbfb93a..00000000000 --- a/eng/common/sdl/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 deleted file mode 100644 index d8fd2d82a68..00000000000 --- a/eng/common/sdl/push-gdn.ps1 +++ /dev/null @@ -1,69 +0,0 @@ -Param( - [string] $Repository, - [string] $BranchName='master', - [string] $GdnFolder, - [string] $AzureDevOpsAccessToken, - [string] $PushReason -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 -$disableConfigureToolsetImport = $true -$LASTEXITCODE = 0 - -try { - # `tools.ps1` checks $ci to perform some actions. Since the SDL - # scripts don't necessarily execute in the same agent that run the - # build.ps1/sh script this variable isn't automatically set. - $ci = $true - . $PSScriptRoot\..\tools.ps1 - - # We create the temp directory where we'll store the sdl-config repository - $sdlDir = Join-Path $env:TEMP 'sdl' - if (Test-Path $sdlDir) { - Remove-Item -Force -Recurse $sdlDir - } - - Write-Host "git clone https://dnceng:`$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" - git clone https://dnceng:$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git clone failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - # We copy the .gdn folder from our local run into the git repository so it can be committed - $sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) '.gdn' - if (Get-Command Robocopy) { - Robocopy /S $GdnFolder $sdlRepositoryFolder - } else { - rsync -r $GdnFolder $sdlRepositoryFolder - } - # cd to the sdl-config directory so we can run git there - Push-Location $sdlDir - # git add . --> git commit --> git push - Write-Host 'git add .' - git add . - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git add failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" - git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git commit failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - Write-Host 'git push' - git push - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git push failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - - # Return to the original directory - Pop-Location -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Sdl' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 deleted file mode 100644 index fe95ab35aa5..00000000000 --- a/eng/common/sdl/run-sdl.ps1 +++ /dev/null @@ -1,73 +0,0 @@ -Param( - [string] $GuardianCliLocation, - [string] $WorkingDirectory, - [string] $TargetDirectory, - [string] $GdnFolder, - [string[]] $ToolsList, - [string] $UpdateBaseline, - [string] $GuardianLoggerLevel='Standard', - [string[]] $CrScanAdditionalRunConfigParams, - [string[]] $PoliCheckAdditionalRunConfigParams -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 -$disableConfigureToolsetImport = $true -$LASTEXITCODE = 0 - -try { - # `tools.ps1` checks $ci to perform some actions. Since the SDL - # scripts don't necessarily execute in the same agent that run the - # build.ps1/sh script this variable isn't automatically set. - $ci = $true - . $PSScriptRoot\..\tools.ps1 - - # We store config files in the r directory of .gdn - Write-Host $ToolsList - $gdnConfigPath = Join-Path $GdnFolder 'r' - $ValidPath = Test-Path $GuardianCliLocation - - if ($ValidPath -eq $False) - { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." - ExitWithExitCode 1 - } - - $configParam = @('--config') - - foreach ($tool in $ToolsList) { - $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" - Write-Host $tool - # We have to manually configure tools that run on source to look at the source directory only - if ($tool -eq 'credscan') { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - } - if ($tool -eq 'policheck') { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - } - - $configParam+=$gdnConfigFile - } - - Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" - & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml deleted file mode 100644 index 640f2b04e24..00000000000 --- a/eng/common/templates/job/execute-sdl.yml +++ /dev/null @@ -1,89 +0,0 @@ -parameters: - enable: 'false' # Whether the SDL validation job should execute or not - overrideParameters: '' # Optional: to override values for parameters. - additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' - # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named - # 'continueOnError', the parameter value is not correctly picked up. - # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter - sdlContinueOnError: false # optional: determines whether to continue the build if the step errors; - dependsOn: '' # Optional: dependencies of the job - artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts - # Usage: - # artifactNames: - # - 'BlobArtifacts' - # - 'Artifacts_Windows_NT_Release' - -jobs: -- job: Run_SDL - dependsOn: ${{ parameters.dependsOn }} - displayName: Run SDL tool - condition: eq( ${{ parameters.enable }}, 'true') - variables: - - group: DotNet-VSTS-Bot - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - name: Hosted VS2017 - steps: - - checkout: self - clean: true - - ${{ if ne(parameters.artifactNames, '') }}: - - ${{ each artifactName in parameters.artifactNames }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: ${{ artifactName }} - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - - ${{ if eq(parameters.artifactNames, '') }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: specific files - itemPattern: "**" - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts - -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts - displayName: Extract Blob Artifacts - continueOnError: ${{ parameters.sdlContinueOnError }} - - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts - -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts - displayName: Extract Package Artifacts - continueOnError: ${{ parameters.sdlContinueOnError }} - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - task: NuGetCommand@2 - displayName: 'Install Guardian' - inputs: - restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config - feedsToUse: config - nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config - externalFeedCredentials: GuardianConnect - restoreDirectory: $(Build.SourcesDirectory)\.packages - - ${{ if ne(parameters.overrideParameters, '') }}: - - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 ${{ parameters.overrideParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} - - ${{ if eq(parameters.overrideParameters, '') }}: - - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.0.7.2 - -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) - ${{ parameters.additionalParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} diff --git a/eng/common/templates/job/generate-graph-files.yml b/eng/common/templates/job/generate-graph-files.yml deleted file mode 100644 index e54ce956f90..00000000000 --- a/eng/common/templates/job/generate-graph-files.yml +++ /dev/null @@ -1,48 +0,0 @@ -parameters: - # Optional: dependencies of the job - dependsOn: '' - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: {} - - # Optional: Include toolset dependencies in the generated graph files - includeToolset: false - -jobs: -- job: Generate_Graph_Files - - dependsOn: ${{ parameters.dependsOn }} - - displayName: Generate Graph Files - - pool: ${{ parameters.pool }} - - variables: - # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT - # DotNet-AllOrgs-Darc-Pats provides: dn-bot-devdiv-dnceng-rw-code-pat - - group: Publish-Build-Assets - - group: DotNet-AllOrgs-Darc-Pats - - name: _GraphArguments - value: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT) - -azdoPat $(dn-bot-devdiv-dnceng-rw-code-pat) - -barToken $(MaestroAccessToken) - -outputFolder '$(Build.StagingDirectory)/GraphFiles/' - - ${{ if ne(parameters.includeToolset, 'false') }}: - - name: _GraphArguments - value: ${{ variables._GraphArguments }} -includeToolset - - steps: - - task: PowerShell@2 - displayName: Generate Graph Files - inputs: - filePath: eng\common\generate-graph-files.ps1 - arguments: $(_GraphArguments) - continueOnError: true - - task: PublishBuildArtifacts@1 - displayName: Publish Graph to Artifacts - inputs: - PathtoPublish: '$(Build.StagingDirectory)/GraphFiles' - PublishLocation: Container - ArtifactName: GraphFiles - continueOnError: true - condition: always() diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml deleted file mode 100644 index 536c15c4641..00000000000 --- a/eng/common/templates/job/job.yml +++ /dev/null @@ -1,220 +0,0 @@ -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - -parameters: -# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - cancelTimeoutInMinutes: '' - condition: '' - container: '' - continueOnError: false - dependsOn: '' - displayName: '' - pool: '' - steps: [] - strategy: '' - timeoutInMinutes: '' - variables: [] - workspace: '' - -# Job base template specific parameters - # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md - artifacts: '' - enableMicrobuild: false - enablePublishBuildArtifacts: false - enablePublishBuildAssets: false - enablePublishTestResults: false - enablePublishUsingPipelines: false - mergeTestResults: false - testRunTitle: $(AgentOsName)-$(BuildConfiguration)-xunit - name: '' - preSteps: [] - runAsPublic: false - -jobs: -- job: ${{ parameters.name }} - - ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: - cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} - - ${{ if ne(parameters.condition, '') }}: - condition: ${{ parameters.condition }} - - ${{ if ne(parameters.container, '') }}: - container: ${{ parameters.container }} - - ${{ if ne(parameters.continueOnError, '') }}: - continueOnError: ${{ parameters.continueOnError }} - - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - - ${{ if ne(parameters.displayName, '') }}: - displayName: ${{ parameters.displayName }} - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - - ${{ if ne(parameters.strategy, '') }}: - strategy: ${{ parameters.strategy }} - - ${{ if ne(parameters.timeoutInMinutes, '') }}: - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - - variables: - - ${{ if ne(parameters.enableTelemetry, 'false') }}: - - name: DOTNET_CLI_TELEMETRY_PROFILE - value: '$(Build.Repository.Uri)' - - ${{ each variable in parameters.variables }}: - # handle name-value variable syntax - # example: - # - name: [key] - # value: [value] - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - # handle variable groups - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - - # handle key-value variable syntax. - # example: - # - [key]: [value] - - ${{ if and(eq(variable.name, ''), eq(variable.group, '')) }}: - - ${{ each pair in variable }}: - - name: ${{ pair.key }} - value: ${{ pair.value }} - - # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds - - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: DotNet-HelixApi-Access - - ${{ if ne(parameters.workspace, '') }}: - workspace: ${{ parameters.workspace }} - - steps: - - ${{ if ne(parameters.preSteps, '') }}: - - ${{ each preStep in parameters.preSteps }}: - - ${{ preStep }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@2 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - env: - TeamName: $(_TeamName) - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - - task: NuGetAuthenticate@0 - - - ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: current - artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} - targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} - itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} - - - ${{ each step in parameters.steps }}: - - ${{ step }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks - condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - env: - TeamName: $(_TeamName) - - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if or(eq(parameters.artifacts.publish.artifacts, 'true'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - task: CopyFiles@2 - displayName: Gather binaries for publish to artifacts - inputs: - SourceFolder: 'artifacts/bin' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' - - task: CopyFiles@2 - displayName: Gather packages for publish to artifacts - inputs: - SourceFolder: 'artifacts/packages' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' - - task: PublishBuildArtifacts@1 - displayName: Publish pipeline artifacts - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if or(eq(parameters.artifacts.publish.logs, 'true'), ne(parameters.artifacts.publish.logs, '')) }}: - - publish: artifacts/log - artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: Publish logs - continueOnError: true - condition: always() - - ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - - ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: CopyFiles@2 - displayName: Gather Asset Manifests - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' - TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests' - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - - task: PublishBuildArtifacts@1 - displayName: Push Asset Manifests - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests' - PublishLocation: Container - ArtifactName: AssetManifests - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} - continueOnError: true - condition: always() - - - ${{ if eq(parameters.enablePublishTestResults, 'true') }}: - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ parameters.testRunTitle }} - mergeTestResults: ${{ parameters.mergeTestResults }} - continueOnError: true - condition: always() - - - ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: CopyFiles@2 - displayName: Gather Asset Manifests - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' - TargetFolder: '$(Build.StagingDirectory)/AssetManifests' - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - - task: PublishBuildArtifacts@1 - displayName: Push Asset Manifests - inputs: - PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' - PublishLocation: Container - ArtifactName: AssetManifests - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/eng/common/templates/job/performance.yml b/eng/common/templates/job/performance.yml deleted file mode 100644 index f877fd7a898..00000000000 --- a/eng/common/templates/job/performance.yml +++ /dev/null @@ -1,95 +0,0 @@ -parameters: - steps: [] # optional -- any additional steps that need to happen before pulling down the performance repo and sending the performance benchmarks to helix (ie building your repo) - variables: [] # optional -- list of additional variables to send to the template - jobName: '' # required -- job name - displayName: '' # optional -- display name for the job. Will use jobName if not passed - pool: '' # required -- name of the Build pool - container: '' # required -- name of the container - osGroup: '' # required -- operating system for the job - extraSetupParameters: '' # optional -- extra arguments to pass to the setup script - frameworks: ['netcoreapp3.0'] # optional -- list of frameworks to run against - continueOnError: 'false' # optional -- determines whether to continue the build if the step errors - dependsOn: '' # optional -- dependencies of the job - timeoutInMinutes: 320 # optional -- timeout for the job - enableTelemetry: false # optional -- enable for telemetry - -jobs: -- template: ../jobs/jobs.yml - parameters: - dependsOn: ${{ parameters.dependsOn }} - enableTelemetry: ${{ parameters.enableTelemetry }} - enablePublishBuildArtifacts: true - continueOnError: ${{ parameters.continueOnError }} - - jobs: - - job: '${{ parameters.jobName }}' - - ${{ if ne(parameters.displayName, '') }}: - displayName: '${{ parameters.displayName }}' - ${{ if eq(parameters.displayName, '') }}: - displayName: '${{ parameters.jobName }}' - - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - - variables: - - - ${{ each variable in parameters.variables }}: - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - - - IsInternal: '' - - HelixApiAccessToken: '' - - HelixPreCommand: '' - - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq( parameters.osGroup, 'Windows_NT') }}: - - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' - - IsInternal: -Internal - - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' - - IsInternal: --internal - - - group: DotNet-HelixApi-Access - - group: dotnet-benchview - - workspace: - clean: all - pool: - ${{ parameters.pool }} - container: ${{ parameters.container }} - strategy: - matrix: - ${{ each framework in parameters.frameworks }}: - ${{ framework }}: - _Framework: ${{ framework }} - steps: - - checkout: self - clean: true - # Run all of the steps to setup repo - - ${{ each step in parameters.steps }}: - - ${{ step }} - - powershell: $(Build.SourcesDirectory)\eng\common\performance\performance-setup.ps1 $(IsInternal) -Framework $(_Framework) ${{ parameters.extraSetupParameters }} - displayName: Performance Setup (Windows) - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $(Build.SourcesDirectory)/eng/common/performance/performance-setup.sh $(IsInternal) --framework $(_Framework) ${{ parameters.extraSetupParameters }} - displayName: Performance Setup (Unix) - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments) - displayName: Run ci setup script - # Run perf testing in helix - - template: /eng/common/templates/steps/perf-send-to-helix.yml - parameters: - HelixSource: '$(HelixSourcePrefix)/$(Build.Repository.Name)/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'test/performance/$(Kind)/$(_Framework)/$(Architecture)' - HelixAccessToken: $(HelixApiAccessToken) - HelixTargetQueues: $(Queue) - HelixPreCommands: $(HelixPreCommand) - Creator: $(Creator) - WorkItemTimeout: 4:00 # 4 hours - WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy - CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions \ No newline at end of file diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml deleted file mode 100644 index 055304ad89b..00000000000 --- a/eng/common/templates/job/publish-build-assets.yml +++ /dev/null @@ -1,97 +0,0 @@ -parameters: - configuration: 'Debug' - - # Optional: condition for the job to run - condition: '' - - # Optional: 'true' if future jobs should run even if this job fails - continueOnError: false - - # Optional: dependencies of the job - dependsOn: '' - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: {} - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing - publishUsingPipelines: false - -jobs: -- job: Asset_Registry_Publish - - dependsOn: ${{ parameters.dependsOn }} - - displayName: Publish to Build Asset Registry - - pool: ${{ parameters.pool }} - - variables: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - name: _BuildConfig - value: ${{ parameters.configuration }} - - group: Publish-Build-Assets - # Skip component governance and codesign validation for SDL. These jobs - # create no content. - - name: skipComponentGovernanceDetection - value: true - - name: runCodesignValidationInjection - value: false - - steps: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: NuGetAuthenticate@0 - - - task: PowerShell@2 - displayName: Publish Build Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} - /p:Configuration=$(_BuildConfig) - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - task: powershell@2 - displayName: Create ReleaseConfigs Artifact - inputs: - targetType: inline - script: | - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - - - task: PublishBuildArtifacts@1 - displayName: Publish ReleaseConfigs Artifact - inputs: - PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_PublishBuildAssets - continueOnError: true - condition: always() diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml deleted file mode 100644 index c08225a9a97..00000000000 --- a/eng/common/templates/jobs/jobs.yml +++ /dev/null @@ -1,72 +0,0 @@ -parameters: - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md - continueOnError: false - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: Enable publishing using release pipelines - enablePublishUsingPipelines: false - - graphFileGeneration: - # Optional: Enable generating the graph files at the end of the build - enabled: false - # Optional: Include toolset dependencies in the generated graph files - includeToolset: false - - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - jobs: [] - - # Optional: Override automatically derived dependsOn value for "publish build assets" job - publishBuildAssetsDependsOn: '' - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - -jobs: -- ${{ each job in parameters.jobs }}: - - template: ../job/job.yml - parameters: - # pass along parameters - ${{ each parameter in parameters }}: - ${{ if ne(parameter.key, 'jobs') }}: - ${{ parameter.key }}: ${{ parameter.value }} - - # pass along job properties - ${{ each property in job }}: - ${{ if ne(property.key, 'job') }}: - ${{ property.key }}: ${{ property.value }} - - name: ${{ job.job }} - -- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - - template: ../job/publish-build-assets.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - dependsOn: - - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.publishBuildAssetsDependsOn }}: - - ${{ job.job }} - - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.jobs }}: - - ${{ job.job }} - pool: - vmImage: vs2017-win2016 - runAsPublic: ${{ parameters.runAsPublic }} - publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - - - ${{ if eq(parameters.graphFileGeneration.enabled, true) }}: - - template: ../job/generate-graph-files.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} - dependsOn: - - Asset_Registry_Publish - pool: - vmImage: vs2017-win2016 diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml deleted file mode 100644 index 0123cf43b16..00000000000 --- a/eng/common/templates/phases/base.yml +++ /dev/null @@ -1,130 +0,0 @@ -parameters: - # Optional: Clean sources before building - clean: true - - # Optional: Git fetch depth - fetchDepth: '' - - # Optional: name of the phase (not specifying phase name may cause name collisions) - name: '' - # Optional: display name of the phase - displayName: '' - - # Optional: condition for the job to run - condition: '' - - # Optional: dependencies of the phase - dependsOn: '' - - # Required: A defined YAML queue - queue: {} - - # Required: build steps - steps: [] - - # Optional: variables - variables: {} - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - ## Telemetry variables - - # Optional: enable sending telemetry - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixSource - Example: build/product - # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) - enableTelemetry: false - - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' - enableMicrobuild: false - -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - -phases: -- phase: ${{ parameters.name }} - - ${{ if ne(parameters.displayName, '') }}: - displayName: ${{ parameters.displayName }} - - ${{ if ne(parameters.condition, '') }}: - condition: ${{ parameters.condition }} - - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - - queue: ${{ parameters.queue }} - - ${{ if ne(parameters.variables, '') }}: - variables: - ${{ insert }}: ${{ parameters.variables }} - - steps: - - checkout: self - clean: ${{ parameters.clean }} - ${{ if ne(parameters.fetchDepth, '') }}: - fetchDepth: ${{ parameters.fetchDepth }} - - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-start.yml - parameters: - buildConfig: $(_HelixBuildConfig) - helixSource: $(_HelixSource) - helixType: $(_HelixType) - runAsPublic: ${{ parameters.runAsPublic }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - # Internal only resource, and Microbuild signing shouldn't be applied to PRs. - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildSigningPlugin@2 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - - env: - TeamName: $(_TeamName) - continueOnError: false - condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - # Run provided build steps - - ${{ parameters.steps }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - # Internal only resources - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks - condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - env: - TeamName: $(_TeamName) - - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-end.yml - parameters: - helixSource: $(_HelixSource) - helixType: $(_HelixType) - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: CopyFiles@2 - displayName: Gather Asset Manifests - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' - TargetFolder: '$(Build.StagingDirectory)/AssetManifests' - continueOnError: false - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - task: PublishBuildArtifacts@1 - displayName: Push Asset Manifests - inputs: - PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' - PublishLocation: Container - ArtifactName: AssetManifests - continueOnError: false - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml deleted file mode 100644 index a0a8074282a..00000000000 --- a/eng/common/templates/phases/publish-build-assets.yml +++ /dev/null @@ -1,51 +0,0 @@ -parameters: - dependsOn: '' - queue: {} - configuration: 'Debug' - condition: succeeded() - continueOnError: false - runAsPublic: false - publishUsingPipelines: false -phases: - - phase: Asset_Registry_Publish - displayName: Publish to Build Asset Registry - dependsOn: ${{ parameters.dependsOn }} - queue: ${{ parameters.queue }} - variables: - _BuildConfig: ${{ parameters.configuration }} - steps: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'DotNet-Engineering-Services_KeyVault' - KeyVaultName: EngKeyVault - SecretsFilter: 'MaestroAccessToken' - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: PowerShell@2 - displayName: Publish Build Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} - /p:Configuration=$(_BuildConfig) - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_Asset_Registry_Publish - continueOnError: true - condition: always() diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml deleted file mode 100644 index dde27800c3f..00000000000 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ /dev/null @@ -1,172 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - stageName: '' - channelName: '' - channelId: '' - transportFeed: '' - shippingFeed: '' - symbolsFeed: '' - -stages: -- stage: ${{ parameters.stageName }} - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: ${{ parameters.channelName }} Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: publish_symbols - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) - variables: - - group: DotNet-Symbol-Server-Pats - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Assets - continueOnError: true - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: 'specific' - itemPattern: | - PdbArtifacts/** - BlobArtifacts/** - downloadPath: '$(Build.ArtifactStagingDirectory)' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - /p:PublishToMSDL=false - ${{ parameters.symbolPublishingAdditionalParameters }} - - - template: ../../steps/publish-logs.yml - parameters: - StageLabel: '${{ parameters.stageName }}' - JobLabel: 'SymbolPublishing' - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - timeoutInMinutes: 120 - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Assets - continueOnError: true - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: 'specific' - itemPattern: | - PackageArtifacts/** - BlobArtifacts/** - AssetManifests/** - downloadPath: '$(Build.ArtifactStagingDirectory)' - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=true - /p:ChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey) - /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(InternalInstallersBlobFeedKey) - /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:PublishToMSDL=false - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/publish-logs.yml - parameters: - StageLabel: '${{ parameters.stageName }}' - JobLabel: 'AssetsPublishing' - - - template: ../../steps/add-build-to-channel.yml - parameters: - ChannelId: ${{ parameters.channelId }} diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml deleted file mode 100644 index 08853ec45e0..00000000000 --- a/eng/common/templates/post-build/channels/generic-public-channel.yml +++ /dev/null @@ -1,178 +0,0 @@ -parameters: - artifactsPublishingAdditionalParameters: '' - dependsOn: - - Validate - publishInstallersAndChecksums: false - symbolPublishingAdditionalParameters: '' - stageName: '' - channelName: '' - channelId: '' - transportFeed: '' - shippingFeed: '' - symbolsFeed: '' - # If the channel name is empty, no links will be generated - akaMSChannelName: '' - -stages: -- stage: ${{ parameters.stageName }} - dependsOn: ${{ parameters.dependsOn }} - variables: - - template: ../common-variables.yml - displayName: ${{ parameters.channelName }} Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: publish_symbols - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) - variables: - - group: DotNet-Symbol-Server-Pats - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Assets - continueOnError: true - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: 'specific' - itemPattern: | - PdbArtifacts/** - BlobArtifacts/** - downloadPath: '$(Build.ArtifactStagingDirectory)' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - template: ../../steps/publish-logs.yml - parameters: - StageLabel: '${{ parameters.stageName }}' - JobLabel: 'SymbolPublishing' - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - timeoutInMinutes: 120 - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - - name: ArtifactsCategory - value: ${{ coalesce(variables._DotNetArtifactsCategory, '.NETCore') }} - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Assets - continueOnError: true - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: 'specific' - itemPattern: | - PackageArtifacts/** - BlobArtifacts/** - AssetManifests/** - downloadPath: '$(Build.ArtifactStagingDirectory)' - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Publish Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(ArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:LatestLinkShortUrlPrefix=dotnet/'${{ parameters.akaMSChannelName }}' - /p:AkaMSClientId=$(akams-client-id) - /p:AkaMSClientSecret=$(akams-client-secret) - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/publish-logs.yml - parameters: - StageLabel: '${{ parameters.stageName }}' - JobLabel: 'AssetsPublishing' - - - template: ../../steps/add-build-to-channel.yml - parameters: - ChannelId: ${{ parameters.channelId }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml deleted file mode 100644 index 867f37cd875..00000000000 --- a/eng/common/templates/post-build/common-variables.yml +++ /dev/null @@ -1,99 +0,0 @@ -variables: - - group: AzureDevOps-Artifact-Feeds-Pats - - group: DotNet-Blob-Feed - - group: DotNet-DotNetCli-Storage - - group: DotNet-MSRC-Storage - - group: Publish-Build-Assets - - # .NET Core 3.1 Dev - - name: PublicDevRelease_31_Channel_Id - value: 128 - - # .NET 5 Dev - - name: Net_5_Dev_Channel_Id - value: 131 - - # .NET Eng - Validation - - name: Net_Eng_Validation_Channel_Id - value: 9 - - # .NET Eng - Latest - - name: Net_Eng_Latest_Channel_Id - value: 2 - - # .NET 3 Eng - Validation - - name: NET_3_Eng_Validation_Channel_Id - value: 390 - - # .NET 3 Eng - - name: NetCore_3_Tools_Channel_Id - value: 344 - - # .NET Core 3.0 Internal Servicing - - name: InternalServicing_30_Channel_Id - value: 184 - - # .NET Core 3.0 Release - - name: PublicRelease_30_Channel_Id - value: 19 - - # .NET Core 3.1 Release - - name: PublicRelease_31_Channel_Id - value: 129 - - # General Testing - - name: GeneralTesting_Channel_Id - value: 529 - - # .NET Core 3.1 Blazor Features - - name: NetCore_31_Blazor_Features_Channel_Id - value: 531 - - # .NET Core Experimental - - name: NetCore_Experimental_Channel_Id - value: 562 - - # Whether the build is internal or not - - name: IsInternalBuild - value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} - - # Default Maestro++ API Endpoint and API Version - - name: MaestroApiEndPoint - value: "https://maestro-prod.westus2.cloudapp.azure.com" - - name: MaestroApiAccessToken - value: $(MaestroAccessToken) - - name: MaestroApiVersion - value: "2019-01-16" - - - name: SourceLinkCLIVersion - value: 3.0.0 - - name: SymbolToolVersion - value: 1.0.1 - - # Feed Configurations - # These should include the suffix "/index.json" - - # Default locations for Installers and checksums - # Public Locations - - name: ChecksumsBlobFeedUrl - value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json - - name: InstallersBlobFeedUrl - value: https://dotnetcli.blob.core.windows.net/dotnet/index.json - - # Private Locations - - name: InternalChecksumsBlobFeedUrl - value: https://dotnetclichecksumsmsrc.blob.core.windows.net/dotnet/index.json - - name: InternalChecksumsBlobFeedKey - value: $(dotnetclichecksumsmsrc-storage-key) - - - name: InternalInstallersBlobFeedUrl - value: https://dotnetclimsrc.blob.core.windows.net/dotnet/index.json - - name: InternalInstallersBlobFeedKey - value: $(dotnetclimsrc-access-key) - - # Skip component governance and codesign validation for SDL. These jobs - # create no content. - - name: skipComponentGovernanceDetection - value: true - - name: runCodesignValidationInjection - value: false diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml deleted file mode 100644 index fbab4cb5dce..00000000000 --- a/eng/common/templates/post-build/post-build.yml +++ /dev/null @@ -1,382 +0,0 @@ -parameters: - enableSourceLinkValidation: false - enableSigningValidation: true - enableSymbolValidation: false - enableNugetValidation: true - publishInstallersAndChecksums: false - SDLValidationParameters: - enable: false - continueOnError: false - params: '' - artifactNames: '' - - # These parameters let the user customize the call to sdk-task.ps1 for publishing - # symbols & general artifacts as well as for signing validation - symbolPublishingAdditionalParameters: '' - artifactsPublishingAdditionalParameters: '' - signingValidationAdditionalParameters: '' - - # Which stages should finish execution before post-build stages start - validateDependsOn: - - build - publishDependsOn: - - Validate - - # Channel ID's instantiated in this file. - # When adding a new channel implementation the call to `check-channel-consistency.ps1` - # needs to be updated with the new channel ID - NetEngLatestChannelId: 2 - NetEngValidationChannelId: 9 - NetDev5ChannelId: 131 - GeneralTestingChannelId: 529 - NETCoreToolingDevChannelId: 548 - NETCoreToolingReleaseChannelId: 549 - NETInternalToolingChannelId: 551 - NETCoreExperimentalChannelId: 562 - NetEngServicesIntChannelId: 678 - NetEngServicesProdChannelId: 679 - Net5Preview2ChannelId: 738 - Net5Preview3ChannelId: 739 - NetCoreSDK313xxChannelId: 759 - NetCoreSDK313xxInternalChannelId: 760 - -stages: -- stage: Validate - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Validate - variables: - - template: common-variables.yml - jobs: - - template: setup-maestro-vars.yml - - - job: - displayName: Post-build Checks - dependsOn: setupMaestroVars - variables: - - name: InitialChannels - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'] ] - - name: PromoteToMaestroChannelId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Maestro Channels Consistency - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 - arguments: -PromoteToChannels "$(InitialChannels)[$(PromoteToMaestroChannelId)]" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview2ChannelId}},${{parameters.Net5Preview3ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}} - - - job: - displayName: NuGet Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableNugetValidation }}, 'true') - pool: - vmImage: 'windows-2019' - variables: - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - - - job: - displayName: Signing Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSigningValidation }}, 'true') - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine dotnet - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: ../steps/publish-logs.yml - parameters: - StageLabel: 'Validation' - JobLabel: 'Signing' - - - job: - displayName: SourceLink Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true - - - template: /eng/common/templates/job/execute-sdl.yml - parameters: - enable: ${{ parameters.SDLValidationParameters.enable }} - dependsOn: setupMaestroVars - additionalParameters: ${{ parameters.SDLValidationParameters.params }} - continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} - artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NetCore_Dev5_Publish' - channelName: '.NET 5 Dev' - akaMSChannelName: 'net5/dev' - channelId: ${{ parameters.NetDev5ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview2_Publish' - channelName: '.NET 5 Preview 2' - akaMSChannelName: 'net5/preview2' - channelId: ${{ parameters.Net5Preview2ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview3_Publish' - channelName: '.NET 5 Preview 3' - akaMSChannelName: 'net5/preview3' - channelId: ${{ parameters.Net5Preview3ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Latest_Publish' - channelName: '.NET Eng - Latest' - akaMSChannelName: 'eng/daily' - channelId: ${{ parameters.NetEngLatestChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Validation_Publish' - channelName: '.NET Eng - Validation' - akaMSChannelName: 'eng/validation' - channelId: ${{ parameters.NetEngValidationChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'General_Testing_Publish' - channelName: 'General Testing' - akaMSChannelName: 'generaltesting' - channelId: ${{ parameters.GeneralTestingChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Tooling_Dev_Publishing' - channelName: '.NET Core Tooling Dev' - channelId: ${{ parameters.NETCoreToolingDevChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Tooling_Release_Publishing' - channelName: '.NET Core Tooling Release' - channelId: ${{ parameters.NETCoreToolingReleaseChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NET_Internal_Tooling_Publishing' - channelName: '.NET Internal Tooling' - channelId: ${{ parameters.NETInternalToolingChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Experimental_Publishing' - channelName: '.NET Core Experimental' - channelId: ${{ parameters.NETCoreExperimentalChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Services_Int_Publish' - channelName: '.NET Eng Services - Int' - channelId: ${{ parameters.NetEngServicesIntChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Services_Prod_Publish' - channelName: '.NET Eng Services - Prod' - channelId: ${{ parameters.NetEngServicesProdChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_SDK_313xx_Publishing' - channelName: '.NET Core SDK 3.1.3xx' - channelId: ${{ parameters.NetCoreSDK313xxChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_SDK_313xx_Internal_Publishing' - channelName: '.NET Core SDK 3.1.3xx Internal' - channelId: ${{ parameters.NetCoreSDK313xxInternalChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml deleted file mode 100644 index 05e611edb68..00000000000 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ /dev/null @@ -1,81 +0,0 @@ -jobs: -- job: setupMaestroVars - displayName: Setup Maestro Vars - variables: - - template: common-variables.yml - - name: BuildId - value: $[ coalesce(variables.BARBuildId, 0) ] - - name: PromoteToChannelId - value: $[ coalesce(variables.PromoteToMaestroChannelId, 0) ] - pool: - vmImage: 'windows-2019' - steps: - - checkout: none - - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - condition: eq(variables.PromoteToChannelId, 0) - inputs: - buildType: current - artifactName: ReleaseConfigs - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars - inputs: - targetType: inline - script: | - try { - if ($Env:PromoteToChannelId -eq 0) { - $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt - - $BarId = $Content | Select -Index 0 - - $Channels = "" - $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } - - $IsStableBuild = $Content | Select -Index 2 - - $AzureDevOpsProject = $Env:System_TeamProject - $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId - $AzureDevOpsBuildId = $Env:Build_BuildId - $PromoteToMaestroChannelId = 0 - } - else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" - - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId - $Channels = 'None' - - #TODO: Fix this once this issue is done: https://github.com/dotnet/arcade/issues/3834 - $IsStableBuild = 'False' - - $AzureDevOpsProject = $buildInfo.azureDevOpsProject - $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId - $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - $PromoteToMaestroChannelId = $Env:PromoteToMaestroChannelId - } - - Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId" - Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels" - Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild" - - Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject" - Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId" - Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId" - Write-Host "##vso[task.setvariable variable=PromoteToMaestroChannelId;isOutput=true]$PromoteToMaestroChannelId" - } - catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - exit 1 - } - env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml deleted file mode 100644 index da669030daf..00000000000 --- a/eng/common/templates/post-build/trigger-subscription.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Triggering subscriptions - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 - arguments: -SourceRepo $(Build.Repository.Uri) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/steps/add-build-to-channel.yml b/eng/common/templates/steps/add-build-to-channel.yml deleted file mode 100644 index f67a210d62f..00000000000 --- a/eng/common/templates/steps/add-build-to-channel.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Add Build to Channel - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1 - arguments: -BuildId $(BARBuildId) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroApiAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/steps/build-reason.yml b/eng/common/templates/steps/build-reason.yml deleted file mode 100644 index eba58109b52..00000000000 --- a/eng/common/templates/steps/build-reason.yml +++ /dev/null @@ -1,12 +0,0 @@ -# build-reason.yml -# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons -# to include steps (',' separated). -parameters: - conditions: '' - steps: [] - -steps: - - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: - - ${{ parameters.steps }} - - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/perf-send-to-helix.yml b/eng/common/templates/steps/perf-send-to-helix.yml deleted file mode 100644 index b3ea9acf1f1..00000000000 --- a/eng/common/templates/steps/perf-send-to-helix.yml +++ /dev/null @@ -1,66 +0,0 @@ -# Please remember to update the documentation if you make changes to these parameters! -parameters: - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false - -steps: - - powershell: $(Build.SourcesDirectory)\eng\common\msbuild.ps1 $(Build.SourcesDirectory)\eng\common\performance\perfhelixpublish.proj /restore /t:Test /bl:$(Build.SourcesDirectory)\artifacts\log\$env:BuildConfig\SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Windows) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/performance/perfhelixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Unix) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml deleted file mode 100644 index f91751fe78e..00000000000 --- a/eng/common/templates/steps/publish-logs.yml +++ /dev/null @@ -1,23 +0,0 @@ -parameters: - StageLabel: '' - JobLabel: '' - -steps: -- task: Powershell@2 - displayName: Prepare Binlogs to Upload - inputs: - targetType: inline - script: | - New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - continueOnError: true - condition: always() - -- task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' - PublishLocation: Container - ArtifactName: PostBuildLogs - continueOnError: true - condition: always() diff --git a/eng/common/templates/steps/run-on-unix.yml b/eng/common/templates/steps/run-on-unix.yml deleted file mode 100644 index e1733814f65..00000000000 --- a/eng/common/templates/steps/run-on-unix.yml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - agentOs: '' - steps: [] - -steps: -- ${{ if ne(parameters.agentOs, 'Windows_NT') }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-on-windows.yml b/eng/common/templates/steps/run-on-windows.yml deleted file mode 100644 index 73e7e9c275a..00000000000 --- a/eng/common/templates/steps/run-on-windows.yml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - agentOs: '' - steps: [] - -steps: -- ${{ if eq(parameters.agentOs, 'Windows_NT') }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-script-ifequalelse.yml b/eng/common/templates/steps/run-script-ifequalelse.yml deleted file mode 100644 index 3d1242f5587..00000000000 --- a/eng/common/templates/steps/run-script-ifequalelse.yml +++ /dev/null @@ -1,33 +0,0 @@ -parameters: - # if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command - parameter1: '' - parameter2: '' - ifScript: '' - elseScript: '' - - # name of script step - name: Script - - # display name of script step - displayName: If-Equal-Else Script - - # environment - env: {} - - # conditional expression for step execution - condition: '' - -steps: -- ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}: - - script: ${{ parameters.ifScript }} - name: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - env: ${{ parameters.env }} - condition: ${{ parameters.condition }} - -- ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}: - - script: ${{ parameters.elseScript }} - name: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - env: ${{ parameters.env }} - condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml deleted file mode 100644 index 30becf01ea5..00000000000 --- a/eng/common/templates/steps/send-to-helix.yml +++ /dev/null @@ -1,94 +0,0 @@ -# Please remember to update the documentation if you make changes to these parameters! -parameters: - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixConfiguration: '' # optional -- additional property attached to a job - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects - WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true - XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects - XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects - XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner - XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set - HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting int) - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false - -steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' - displayName: ${{ parameters.DisplayNamePrefix }} (Windows) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Unix) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml deleted file mode 100644 index fadc04ca1b9..00000000000 --- a/eng/common/templates/steps/telemetry-end.yml +++ /dev/null @@ -1,102 +0,0 @@ -parameters: - maxRetries: 5 - retryDelay: 10 # in seconds - -steps: -- bash: | - if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then - errorCount=0 - else - errorCount=1 - fi - warningCount=0 - - curlStatus=1 - retryCount=0 - # retry loop to harden against spotty telemetry connections - # we don't retry successes and 4xx client errors - until [[ $curlStatus -eq 0 || ( $curlStatus -ge 400 && $curlStatus -le 499 ) || $retryCount -ge $MaxRetries ]] - do - if [ $retryCount -gt 0 ]; then - echo "Failed to send telemetry to Helix; waiting $RetryDelay seconds before retrying..." - sleep $RetryDelay - fi - - # create a temporary file for curl output - res=`mktemp` - - curlResult=` - curl --verbose --output $res --write-out "%{http_code}"\ - -H 'Content-Type: application/json' \ - -H "X-Helix-Job-Token: $Helix_JobToken" \ - -H 'Content-Length: 0' \ - -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ - --data-urlencode "errorCount=$errorCount" \ - --data-urlencode "warningCount=$warningCount"` - curlStatus=$? - - if [ $curlStatus -eq 0 ]; then - if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then - curlStatus=$curlResult - fi - fi - - let retryCount++ - done - - if [ $curlStatus -ne 0 ]; then - echo "Failed to Send Build Finish information after $retryCount retries" - vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus" - echo "##$vstsLogOutput" - exit 1 - fi - displayName: Send Unix Build End Telemetry - env: - # defined via VSTS variables in start-job.sh - Helix_JobToken: $(Helix_JobToken) - Helix_WorkItemId: $(Helix_WorkItemId) - MaxRetries: ${{ parameters.maxRetries }} - RetryDelay: ${{ parameters.retryDelay }} - condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) -- powershell: | - if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) { - $ErrorCount = 0 - } else { - $ErrorCount = 1 - } - $WarningCount = 0 - - # Basic retry loop to harden against server flakiness - $retryCount = 0 - while ($retryCount -lt $env:MaxRetries) { - try { - Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` - -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } - break - } - catch { - $statusCode = $_.Exception.Response.StatusCode.value__ - if ($statusCode -ge 400 -and $statusCode -le 499) { - Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix (status code $statusCode); not retrying (4xx client error)" - Write-Host "##vso[task.logissue]error ", $_.Exception.GetType().FullName, $_.Exception.Message - exit 1 - } - Write-Host "Failed to send telemetry to Helix (status code $statusCode); waiting $env:RetryDelay seconds before retrying..." - $retryCount++ - sleep $env:RetryDelay - continue - } - } - - if ($retryCount -ge $env:MaxRetries) { - Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix after $retryCount retries." - exit 1 - } - displayName: Send Windows Build End Telemetry - env: - # defined via VSTS variables in start-job.ps1 - Helix_JobToken: $(Helix_JobToken) - Helix_WorkItemId: $(Helix_WorkItemId) - MaxRetries: ${{ parameters.maxRetries }} - RetryDelay: ${{ parameters.retryDelay }} - condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml deleted file mode 100644 index 32c01ef0b55..00000000000 --- a/eng/common/templates/steps/telemetry-start.yml +++ /dev/null @@ -1,241 +0,0 @@ -parameters: - helixSource: 'undefined_defaulted_in_telemetry.yml' - helixType: 'undefined_defaulted_in_telemetry.yml' - buildConfig: '' - runAsPublic: false - maxRetries: 5 - retryDelay: 10 # in seconds - -steps: -- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'HelixProd_KeyVault' - KeyVaultName: HelixProdKV - SecretsFilter: 'HelixApiAccessToken' - condition: always() -- bash: | - # create a temporary file - jobInfo=`mktemp` - - # write job info content to temporary file - cat > $jobInfo < powershell invocations -# as dot sourcing isn't possible. -function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { - if (Test-Path variable:global:_DotNetInstallDir) { - return $global:_DotNetInstallDir - } - - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - $env:DOTNET_MULTILEVEL_LOOKUP=0 - - # Disable first run since we do not need all ASP.NET packages restored. - $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Disable telemetry on CI. - if ($ci) { - $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 - } - - # Source Build uses DotNetCoreSdkDir variable - if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir - } - - # Find the first path on %PATH% that contains the dotnet.exe - if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { - $dotnetCmd = Get-Command 'dotnet.exe' -ErrorAction SilentlyContinue - if ($dotnetCmd -ne $null) { - $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent - } - } - - $dotnetSdkVersion = $GlobalJson.tools.dotnet - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if ((-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { - $dotnetRoot = $env:DOTNET_INSTALL_DIR - } else { - $dotnetRoot = Join-Path $RepoRoot '.dotnet' - - if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { - if ($install) { - InstallDotNetSdk $dotnetRoot $dotnetSdkVersion - } else { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" - ExitWithExitCode 1 - } - } - - $env:DOTNET_INSTALL_DIR = $dotnetRoot - } - - # Creates a temporary file under the toolset dir. - # The following code block is protecting against concurrent access so that this function can - # be called in parallel. - if ($createSdkLocationFile) { - do { - $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) - } - until (!(Test-Path $sdkCacheFileTemp)) - Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot - - try { - Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' - } catch { - # Somebody beat us - Remove-Item -Path $sdkCacheFileTemp - } - } - - # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom - # build steps from using anything other than what we've downloaded. - # It also ensures that VS msbuild will use the downloaded sdk targets. - $env:PATH = "$dotnetRoot;$env:PATH" - - # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build - Write-PipelinePrependPath -Path $dotnetRoot - - Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' - Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' - - return $global:_DotNetInstallDir = $dotnetRoot -} - -function GetDotNetInstallScript([string] $dotnetRoot) { - $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' - if (!(Test-Path $installScript)) { - Create-Directory $dotnetRoot - $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - - $maxRetries = 5 - $retries = 1 - - $uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" - - while($true) { - try { - Write-Host "GET $uri" - Invoke-WebRequest $uri -OutFile $installScript - break - } - catch { - Write-Host "Failed to download '$uri'" - Write-Error $_.Exception.Message -ErrorAction Continue - } - - if (++$retries -le $maxRetries) { - $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff - Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." - Start-Sleep -Seconds $delayInSeconds - } - else { - throw "Unable to download file in $maxRetries attempts." - } - - } - } - - return $installScript -} - -function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '') { - InstallDotNet $dotnetRoot $version $architecture -} - -function InstallDotNet([string] $dotnetRoot, - [string] $version, - [string] $architecture = '', - [string] $runtime = '', - [bool] $skipNonVersionedFiles = $false, - [string] $runtimeSourceFeed = '', - [string] $runtimeSourceFeedKey = '') { - - $installScript = GetDotNetInstallScript $dotnetRoot - $installParameters = @{ - Version = $version - InstallDir = $dotnetRoot - } - - if ($architecture) { $installParameters.Architecture = $architecture } - if ($runtime) { $installParameters.Runtime = $runtime } - if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } - - try { - & $installScript @installParameters - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from public location." - - # Only the runtime can be installed from a custom [private] location. - if ($runtime -and ($runtimeSourceFeed -or $runtimeSourceFeedKey)) { - if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } - - if ($runtimeSourceFeedKey) { - $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) - $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) - $installParameters.FeedCredential = $decodedString - } - - try { - & $installScript @installParameters - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." - ExitWithExitCode 1 - } - } else { - ExitWithExitCode 1 - } - } -} - -# -# Locates Visual Studio MSBuild installation. -# The preference order for MSBuild to use is as follows: -# -# 1. MSBuild from an active VS command prompt -# 2. MSBuild from a compatible VS installation -# 3. MSBuild from the xcopy tool package -# -# Returns full path to msbuild.exe. -# Throws on failure. -# -function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { - if (Test-Path variable:global:_MSBuildExe) { - return $global:_MSBuildExe - } - - if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { '15.9' } - $vsMinVersion = [Version]::new($vsMinVersionStr) - - # Try msbuild command available in the environment. - if ($env:VSINSTALLDIR -ne $null) { - $msbuildCmd = Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue - if ($msbuildCmd -ne $null) { - # Workaround for https://github.com/dotnet/roslyn/issues/35793 - # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ - $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0]) - - if ($msbuildVersion -ge $vsMinVersion) { - return $global:_MSBuildExe = $msbuildCmd.Path - } - - # Report error - the developer environment is initialized with incompatible VS version. - throw "Developer Command Prompt for VS $($env:VisualStudioVersion) is not recent enough. Please upgrade to $vsMinVersionStr or build from a plain CMD window" - } - } - - # Locate Visual Studio installation or download x-copy msbuild. - $vsInfo = LocateVisualStudio $vsRequirements - if ($vsInfo -ne $null) { - $vsInstallDir = $vsInfo.installationPath - $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] - - InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion - } else { - - if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { - $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' - $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] - } else { - $vsMajorVersion = $vsMinVersion.Major - $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha" - } - - $vsInstallDir = $null - if ($xcopyMSBuildVersion.Trim() -ine "none") { - $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install - } - if ($vsInstallDir -eq $null) { - throw 'Unable to find Visual Studio that has required version and components installed' - } - } - - $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } - return $global:_MSBuildExe = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe" -} - -function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { - $env:VSINSTALLDIR = $vsInstallDir - Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") - - $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" - if (Test-Path $vsSdkInstallDir) { - Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir - $env:VSSDKInstall = $vsSdkInstallDir - } -} - -function InstallXCopyMSBuild([string]$packageVersion) { - return InitializeXCopyMSBuild $packageVersion -install $true -} - -function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { - $packageName = 'RoslynTools.MSBuild' - $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" - $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" - - if (!(Test-Path $packageDir)) { - if (!$install) { - return $null - } - - Create-Directory $packageDir - Write-Host "Downloading $packageName $packageVersion" - $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - Invoke-WebRequest "https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile $packagePath - Unzip $packagePath $packageDir - } - - return Join-Path $packageDir 'tools' -} - -# -# Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. -# -# The following properties of tools.vs are recognized: -# "version": "{major}.{minor}" -# Two part minimal VS version, e.g. "15.9", "16.0", etc. -# "components": ["componentId1", "componentId2", ...] -# Array of ids of workload components that must be available in the VS instance. -# See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 -# -# Returns JSON describing the located VS instance (same format as returned by vswhere), -# or $null if no instance meeting the requirements is found on the machine. -# -function LocateVisualStudio([object]$vsRequirements = $null){ - if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { - $vswhereVersion = $GlobalJson.tools.vswhere - } else { - $vswhereVersion = '2.5.2' - } - - $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion" - $vsWhereExe = Join-Path $vsWhereDir 'vswhere.exe' - - if (!(Test-Path $vsWhereExe)) { - Create-Directory $vsWhereDir - Write-Host 'Downloading vswhere' - try { - Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ - } - } - - if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $args = @('-latest', '-prerelease', '-format', 'json', '-requires', 'Microsoft.Component.MSBuild', '-products', '*') - - if (Get-Member -InputObject $vsRequirements -Name 'version') { - $args += '-version' - $args += $vsRequirements.version - } - - if (Get-Member -InputObject $vsRequirements -Name 'components') { - foreach ($component in $vsRequirements.components) { - $args += '-requires' - $args += $component - } - } - - $vsInfo =& $vsWhereExe $args | ConvertFrom-Json - - if ($lastExitCode -ne 0) { - return $null - } - - # use first matching instance - return $vsInfo[0] -} - -function InitializeBuildTool() { - if (Test-Path variable:global:_BuildTool) { - return $global:_BuildTool - } - - if (-not $msbuildEngine) { - $msbuildEngine = GetDefaultMSBuildEngine - } - - # Initialize dotnet cli if listed in 'tools' - $dotnetRoot = $null - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { - $dotnetRoot = InitializeDotNetCli -install:$restore - } - - if ($msbuildEngine -eq 'dotnet') { - if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." - ExitWithExitCode 1 - } - $buildTool = @{ Path = Join-Path $dotnetRoot 'dotnet.exe'; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } - } elseif ($msbuildEngine -eq "vs") { - try { - $msbuildPath = InitializeVisualStudioMSBuild -install:$restore - } catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ - ExitWithExitCode 1 - } - - $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" } - } else { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." - ExitWithExitCode 1 - } - - return $global:_BuildTool = $buildTool -} - -function GetDefaultMSBuildEngine() { - # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. - if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { - return 'vs' - } - - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { - return 'dotnet' - } - - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." - ExitWithExitCode 1 -} - -function GetNuGetPackageCachePath() { - if ($env:NUGET_PACKAGES -eq $null) { - # Use local cache on CI to ensure deterministic build, - # use global cache in dev builds to avoid cost of downloading packages. - if ($useGlobalNuGetCache) { - $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages' - } else { - $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages' - } - } - - return $env:NUGET_PACKAGES -} - -# Returns a full path to an Arcade SDK task project file. -function GetSdkTaskProject([string]$taskName) { - return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj" -} - -function InitializeNativeTools() { - if (-Not (Test-Path variable:DisableNativeToolsetInstalls) -And (Get-Member -InputObject $GlobalJson -Name "native-tools")) { - $nativeArgs= @{} - if ($ci) { - $nativeArgs = @{ - InstallDirectory = "$ToolsDir" - } - } - & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs - } -} - -function InitializeToolset() { - if (Test-Path variable:global:_ToolsetBuildProj) { - return $global:_ToolsetBuildProj - } - - $nugetCache = GetNuGetPackageCachePath - - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' - $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" - - if (Test-Path $toolsetLocationFile) { - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (Test-Path $path) { - return $global:_ToolsetBuildProj = $path - } - } - - if (-not $restore) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Toolset version $toolsetVersion has not been restored." - ExitWithExitCode 1 - } - - $buildTool = InitializeBuildTool - - $proj = Join-Path $ToolsetDir 'restore.proj' - $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' } - - '' | Set-Content $proj - - MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile - - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (!(Test-Path $path)) { - throw "Invalid toolset path: $path" - } - - return $global:_ToolsetBuildProj = $path -} - -function ExitWithExitCode([int] $exitCode) { - if ($ci -and $prepareMachine) { - Stop-Processes - } - exit $exitCode -} - -function Stop-Processes() { - Write-Host 'Killing running build processes...' - foreach ($processName in $processesToStopOnExit) { - Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process - } -} - -# -# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. -# The arguments are automatically quoted. -# Terminates the script if the build fails. -# -function MSBuild() { - if ($pipelinesLog) { - $buildTool = InitializeBuildTool - - # Work around issues with Azure Artifacts credential provider - # https://github.com/dotnet/arcade/issues/3932 - if ($ci -and $buildTool.Tool -eq 'dotnet') { - dotnet nuget locals http-cache -c - - $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 - $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' - } - - $toolsetBuildProject = InitializeToolset - $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') - $args += "/logger:$path" - } - - MSBuild-Core @args -} - -# -# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. -# The arguments are automatically quoted. -# Terminates the script if the build fails. -# -function MSBuild-Core() { - if ($ci) { - if (!$binaryLog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.' - ExitWithExitCode 1 - } - - if ($nodeReuse) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Node reuse must be disabled in CI build.' - ExitWithExitCode 1 - } - } - - $buildTool = InitializeBuildTool - - $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - - if ($warnAsError) { - $cmdArgs += ' /warnaserror /p:TreatWarningsAsErrors=true' - } - else { - $cmdArgs += ' /p:TreatWarningsAsErrors=false' - } - - foreach ($arg in $args) { - if ($arg -ne $null -and $arg.Trim() -ne "") { - $cmdArgs += " `"$arg`"" - } - } - - $exitCode = Exec-Process $buildTool.Path $cmdArgs - - if ($exitCode -ne 0) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Build failed.' - - $buildLog = GetMSBuildBinaryLogCommandLineArgument $args - if ($buildLog -ne $null) { - Write-Host "See log: $buildLog" -ForegroundColor DarkGray - } - - ExitWithExitCode $exitCode - } -} - -function GetMSBuildBinaryLogCommandLineArgument($arguments) { - foreach ($argument in $arguments) { - if ($argument -ne $null) { - $arg = $argument.Trim() - if ($arg.StartsWith('/bl:', "OrdinalIgnoreCase")) { - return $arg.Substring('/bl:'.Length) - } - - if ($arg.StartsWith('/binaryLogger:', 'OrdinalIgnoreCase')) { - return $arg.Substring('/binaryLogger:'.Length) - } - } - } - - return $null -} - -. $PSScriptRoot\pipeline-logging-functions.ps1 - -$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..') -$EngRoot = Resolve-Path (Join-Path $PSScriptRoot '..') -$ArtifactsDir = Join-Path $RepoRoot 'artifacts' -$ToolsetDir = Join-Path $ArtifactsDir 'toolset' -$ToolsDir = Join-Path $RepoRoot '.tools' -$LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration -$TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration -$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json -# true if global.json contains a "runtimes" section -$globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } - -Create-Directory $ToolsetDir -Create-Directory $TempDir -Create-Directory $LogDir - -Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir -Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir -Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir -Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir -Write-PipelineSetVariable -Name 'TMP' -Value $TempDir - -# Import custom tools configuration, if present in the repo. -# Note: Import in global scope so that the script set top-level variables without qualification. -if (!$disableConfigureToolsetImport) { - $configureToolsetScript = Join-Path $EngRoot 'configure-toolset.ps1' - if (Test-Path $configureToolsetScript) { - . $configureToolsetScript - if ((Test-Path variable:failOnConfigureToolsetError) -And $failOnConfigureToolsetError) { - if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { - Write-PipelineTelemetryError -Category 'Build' -Message 'configure-toolset.ps1 returned a non-zero exit code' - ExitWithExitCode $LastExitCode - } - } - } -} diff --git a/eng/common/tools.sh b/eng/common/tools.sh deleted file mode 100755 index caae1dbdb27..00000000000 --- a/eng/common/tools.sh +++ /dev/null @@ -1,475 +0,0 @@ -#!/usr/bin/env bash - -# Initialize variables if they aren't already defined. - -# CI mode - set to true on CI server for PR validation build or official build. -ci=${ci:-false} - -# Set to true to use the pipelines logger which will enable Azure logging output. -# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md -# This flag is meant as a temporary opt-opt for the feature while validate it across -# our consumers. It will be deleted in the future. -if [[ "$ci" == true ]]; then - pipelines_log=${pipelines_log:-true} -else - pipelines_log=${pipelines_log:-false} -fi - -# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. -configuration=${configuration:-'Debug'} - -# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -# Binary log must be enabled on CI. -binary_log=${binary_log:-$ci} - -# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). -prepare_machine=${prepare_machine:-false} - -# True to restore toolsets and dependencies. -restore=${restore:-true} - -# Adjusts msbuild verbosity level. -verbosity=${verbosity:-'minimal'} - -# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. -if [[ "$ci" == true ]]; then - node_reuse=${node_reuse:-false} -else - node_reuse=${node_reuse:-true} -fi - -# Configures warning treatment in msbuild. -warn_as_error=${warn_as_error:-true} - -# True to attempt using .NET Core already that meets requirements specified in global.json -# installed on the machine instead of downloading one. -use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} - -# Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dot.net/v1/dotnet-install.sh -dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} - -# True to use global NuGet cache instead of restoring packages to repository-local directory. -if [[ "$ci" == true ]]; then - use_global_nuget_cache=${use_global_nuget_cache:-false} -else - use_global_nuget_cache=${use_global_nuget_cache:-true} -fi - -# Resolve any symlinks in the given path. -function ResolvePath { - local path=$1 - - while [[ -h $path ]]; do - local dir="$( cd -P "$( dirname "$path" )" && pwd )" - path="$(readlink "$path")" - - # if $path was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $path != /* ]] && path="$dir/$path" - done - - # return value - _ResolvePath="$path" -} - -# ReadVersionFromJson [json key] -function ReadGlobalVersion { - local key=$1 - - local line=$(awk "/$key/ {print; exit}" "$global_json_file") - local pattern="\"$key\" *: *\"(.*)\"" - - if [[ ! $line =~ $pattern ]]; then - Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" - ExitWithExitCode 1 - fi - - # return value - _ReadGlobalVersion=${BASH_REMATCH[1]} -} - -function InitializeDotNetCli { - if [[ -n "${_InitializeDotNetCli:-}" ]]; then - return - fi - - local install=$1 - - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - export DOTNET_MULTILEVEL_LOOKUP=0 - - # Disable first run since we want to control all package sources - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Disable telemetry on CI - if [[ $ci == true ]]; then - export DOTNET_CLI_TELEMETRY_OPTOUT=1 - fi - - # LTTNG is the logging infrastructure used by Core CLR. Need this variable set - # so it doesn't output warnings to the console. - export LTTNG_HOME="$HOME" - - # Source Build uses DotNetCoreSdkDir variable - if [[ -n "${DotNetCoreSdkDir:-}" ]]; then - export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" - fi - - # Find the first path on $PATH that contains the dotnet.exe - if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then - local dotnet_path=`command -v dotnet` - if [[ -n "$dotnet_path" ]]; then - ResolvePath "$dotnet_path" - export DOTNET_INSTALL_DIR=`dirname "$_ResolvePath"` - fi - fi - - ReadGlobalVersion "dotnet" - local dotnet_sdk_version=$_ReadGlobalVersion - local dotnet_root="" - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then - dotnet_root="$DOTNET_INSTALL_DIR" - else - dotnet_root="$repo_root/.dotnet" - - export DOTNET_INSTALL_DIR="$dotnet_root" - - if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then - if [[ "$install" == true ]]; then - InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" - else - Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'" - ExitWithExitCode 1 - fi - fi - fi - - # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom - # build steps from using anything other than what we've downloaded. - Write-PipelinePrependPath -path "$dotnet_root" - - Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" - Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1" - - # return value - _InitializeDotNetCli="$dotnet_root" -} - -function InstallDotNetSdk { - local root=$1 - local version=$2 - local architecture="" - if [[ $# == 3 ]]; then - architecture=$3 - fi - InstallDotNet "$root" "$version" $architecture -} - -function InstallDotNet { - local root=$1 - local version=$2 - - GetDotNetInstallScript "$root" - local install_script=$_GetDotNetInstallScript - - local archArg='' - if [[ -n "${3:-}" ]]; then - archArg="--architecture $3" - fi - local runtimeArg='' - if [[ -n "${4:-}" ]]; then - runtimeArg="--runtime $4" - fi - - local skipNonVersionedFilesArg="" - if [[ "$#" -ge "5" ]]; then - skipNonVersionedFilesArg="--skip-non-versioned-files" - fi - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." - - if [[ -n "$runtimeArg" ]]; then - local runtimeSourceFeed='' - if [[ -n "${6:-}" ]]; then - runtimeSourceFeed="--azure-feed $6" - fi - - local runtimeSourceFeedKey='' - if [[ -n "${7:-}" ]]; then - decodedFeedKey=`echo $7 | base64 --decode` - runtimeSourceFeedKey="--feed-credential $decodedFeedKey" - fi - - if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - ExitWithExitCode $exit_code - fi - fi - } -} - -function with_retries { - local maxRetries=5 - local retries=1 - echo "Trying to run '$@' for maximum of $maxRetries attempts." - while [[ $((retries++)) -le $maxRetries ]]; do - "$@" - - if [[ $? == 0 ]]; then - echo "Ran '$@' successfully." - return 0 - fi - - timeout=$((2**$retries-1)) - echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2 - sleep $timeout - done - - echo "Failed to execute '$@' for $maxRetries times." 1>&2 - - return 1 -} - -function GetDotNetInstallScript { - local root=$1 - local install_script="$root/dotnet-install.sh" - local install_script_url="https://dot.net/$dotnetInstallScriptVersion/dotnet-install.sh" - - if [[ ! -a "$install_script" ]]; then - mkdir -p "$root" - - echo "Downloading '$install_script_url'" - - # Use curl if available, otherwise use wget - if command -v curl > /dev/null; then - with_retries curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - with_retries wget -v -O "$install_script" "$install_script_url" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - fi - fi - # return value - _GetDotNetInstallScript="$install_script" -} - -function InitializeBuildTool { - if [[ -n "${_InitializeBuildTool:-}" ]]; then - return - fi - - InitializeDotNetCli $restore - - # return values - _InitializeBuildTool="$_InitializeDotNetCli/dotnet" - _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="netcoreapp2.1" -} - -function GetNuGetPackageCachePath { - if [[ -z ${NUGET_PACKAGES:-} ]]; then - if [[ "$use_global_nuget_cache" == true ]]; then - export NUGET_PACKAGES="$HOME/.nuget/packages" - else - export NUGET_PACKAGES="$repo_root/.packages" - fi - fi - - # return value - _GetNuGetPackageCachePath=$NUGET_PACKAGES -} - -function InitializeNativeTools() { - if [[ -n "${DisableNativeToolsetInstalls:-}" ]]; then - return - fi - if grep -Fq "native-tools" $global_json_file - then - local nativeArgs="" - if [[ "$ci" == true ]]; then - nativeArgs="--installDirectory $tools_dir" - fi - "$_script_dir/init-tools-native.sh" $nativeArgs - fi -} - -function InitializeToolset { - if [[ -n "${_InitializeToolset:-}" ]]; then - return - fi - - GetNuGetPackageCachePath - - ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" - - local toolset_version=$_ReadGlobalVersion - local toolset_location_file="$toolset_dir/$toolset_version.txt" - - if [[ -a "$toolset_location_file" ]]; then - local path=`cat "$toolset_location_file"` - if [[ -a "$path" ]]; then - # return value - _InitializeToolset="$path" - return - fi - fi - - if [[ "$restore" != true ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Toolset version $toolset_version has not been restored." - ExitWithExitCode 2 - fi - - local proj="$toolset_dir/restore.proj" - - local bl="" - if [[ "$binary_log" == true ]]; then - bl="/bl:$log_dir/ToolsetRestore.binlog" - fi - - echo '' > "$proj" - MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" - - local toolset_build_proj=`cat "$toolset_location_file"` - - if [[ ! -a "$toolset_build_proj" ]]; then - Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj" - ExitWithExitCode 3 - fi - - # return value - _InitializeToolset="$toolset_build_proj" -} - -function ExitWithExitCode { - if [[ "$ci" == true && "$prepare_machine" == true ]]; then - StopProcesses - fi - exit $1 -} - -function StopProcesses { - echo "Killing running build processes..." - pkill -9 "dotnet" || true - pkill -9 "vbcscompiler" || true - return 0 -} - -function MSBuild { - local args=$@ - if [[ "$pipelines_log" == true ]]; then - InitializeBuildTool - InitializeToolset - - # Work around issues with Azure Artifacts credential provider - # https://github.com/dotnet/arcade/issues/3932 - if [[ "$ci" == true ]]; then - "$_InitializeBuildTool" nuget locals http-cache -c - - export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 - export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 - Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" - Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - fi - - local toolset_dir="${_InitializeToolset%/*}" - local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" - args=( "${args[@]}" "-logger:$logger_path" ) - fi - - MSBuild-Core ${args[@]} -} - -function MSBuild-Core { - if [[ "$ci" == true ]]; then - if [[ "$binary_log" != true ]]; then - Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build." - ExitWithExitCode 1 - fi - - if [[ "$node_reuse" == true ]]; then - Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build." - ExitWithExitCode 1 - fi - fi - - InitializeBuildTool - - local warnaserror_switch="" - if [[ $warn_as_error == true ]]; then - warnaserror_switch="/warnaserror" - fi - - "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'Build' "Build failed (exit code '$exit_code')." - ExitWithExitCode $exit_code - } -} - -ResolvePath "${BASH_SOURCE[0]}" -_script_dir=`dirname "$_ResolvePath"` - -. "$_script_dir/pipeline-logging-functions.sh" - -eng_root=`cd -P "$_script_dir/.." && pwd` -repo_root=`cd -P "$_script_dir/../.." && pwd` -artifacts_dir="$repo_root/artifacts" -toolset_dir="$artifacts_dir/toolset" -tools_dir="$repo_root/.tools" -log_dir="$artifacts_dir/log/$configuration" -temp_dir="$artifacts_dir/tmp/$configuration" - -global_json_file="$repo_root/global.json" -# determine if global.json contains a "runtimes" entry -global_json_has_runtimes=false -dotnetlocal_key=$(awk "/runtimes/ {print; exit}" "$global_json_file") || true -if [[ -n "$dotnetlocal_key" ]]; then - global_json_has_runtimes=true -fi - -# HOME may not be defined in some scenarios, but it is required by NuGet -if [[ -z $HOME ]]; then - export HOME="$repo_root/artifacts/.home/" - mkdir -p "$HOME" -fi - -mkdir -p "$toolset_dir" -mkdir -p "$temp_dir" -mkdir -p "$log_dir" - -Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir" -Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" -Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir" -Write-PipelineSetVariable -name "Temp" -value "$temp_dir" -Write-PipelineSetVariable -name "TMP" -value "$temp_dir" - -# Import custom tools configuration, if present in the repo. -if [ -z "${disable_configure_toolset_import:-}" ]; then - configure_toolset_script="$eng_root/configure-toolset.sh" - if [[ -a "$configure_toolset_script" ]]; then - . "$configure_toolset_script" - fi -fi - -# TODO: https://github.com/dotnet/arcade/issues/1468 -# Temporary workaround to avoid breaking change. -# Remove once repos are updated. -if [[ -n "${useInstalledDotNetCli:-}" ]]; then - use_installed_dotnet_cli="$useInstalledDotNetCli" -fi diff --git a/eng/empty.csproj b/eng/empty.csproj deleted file mode 100644 index 0bd280da02f..00000000000 --- a/eng/empty.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - netcoreapp2.0 - - - diff --git a/external/helix-binaries b/external/helix-binaries deleted file mode 160000 index 64b3a67631a..00000000000 --- a/external/helix-binaries +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 64b3a67631ac8a08ff82d61087cfbfc664eb4af8 diff --git a/global.json b/global.json deleted file mode 100644 index ef5ddfce280..00000000000 --- a/global.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "tools": { - "dotnet": "5.0.100-alpha1-015772" - }, - "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20201.2", - "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20201.2" - } -} diff --git a/mcs/Makefile b/mcs/Makefile index 829e6b59fd4..d153c76b1d3 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -29,7 +29,6 @@ orbis_SUBDIRS := build class unreal_SUBDIRS := build class wasm_SUBDIRS := build class wasm_tools_SUBDIRS := build class tools -netcore_SUBDIRS := build class include build/rules.make diff --git a/mcs/build/common/Consts.cs.in b/mcs/build/common/Consts.cs.in index cedbdaab9f5..2d5e112cdc1 100644 --- a/mcs/build/common/Consts.cs.in +++ b/mcs/build/common/Consts.cs.in @@ -33,8 +33,6 @@ static partial class Consts public const string MonoCorlibVersion = "@MONO_CORLIB_VERSION@"; } -#if !NETCORE - static partial class Consts { // @@ -68,13 +66,6 @@ static partial class Consts public const string VsVersion = "0.0.0.0"; // Useless ? public const string VsFileVersion = "11.0.0.0"; // TODO: -#elif NETCORE - public const string FxVersion = ""; - public const string FxFileVersion = ""; - public const string EnvironmentVersion = FxFileVersion; - - public const string VsVersion = ""; - public const string VsFileVersion = ""; #elif NET_4_0 #error Profile NET_4_0 is not supported. #elif NET_3_5 @@ -132,5 +123,3 @@ static partial class Consts public const string AssemblyPresentationFramework_3_5 = "PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblySystemServiceModel_3_0 = "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } - -#endif \ No newline at end of file diff --git a/mcs/build/profiles/netcore.make b/mcs/build/profiles/netcore.make deleted file mode 100644 index ba523172934..00000000000 --- a/mcs/build/profiles/netcore.make +++ /dev/null @@ -1,16 +0,0 @@ -# -*- makefile -*- - -BOOTSTRAP_PROFILE = build - -BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) -MCS = $(BOOTSTRAP_MCS) - -PLATFORMS = macos linux win32 unix - -profile-check: - @: - -DEFAULT_REFERENCES = -PROFILE_MCS_FLAGS = -d:NETCORE -nostdlib $(PLATFORM_DEBUG_FLAGS) - -ENFORCE_LIBRARY_WARN_AS_ERROR = yes diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 52df09fc01c..10cef9b26d0 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -1,6 +1,6 @@ thisdir = class -NO_FACADES_PROFILE := $(filter monodroid_tools monotouch_tools wasm_tools binary_reference_assemblies xbuild_12 xbuild_14 netcore, $(PROFILE)) +NO_FACADES_PROFILE := $(filter monodroid_tools monotouch_tools wasm_tools binary_reference_assemblies xbuild_12 xbuild_14, $(PROFILE)) ifndef NO_FACADES_PROFILE FACADES_FOLDER := Facades @@ -452,15 +452,12 @@ wasm_PARALLEL_SUBDIRS := $(wasm_dirs_parallel) wasm_tools_SUBDIRS := wasm_tools_PARALLEL_SUBDIRS := $(wasm_tools_dirs_parallel) -netcore_SUBDIRS := -netcore_PARALLEL_SUBDIRS := - include ../build/rules.make DIST_SUBDIRS = $(testing_aot_full_dirs_parallel) $(testing_aot_hybrid_dirs_parallel) $(monotouch_dirs_parallel) $(monotouch_tools_dirs_parallel) \ $(monodroid_dirs_parallel) $(monodroid_tools_dirs_parallel) $(xammac_dirs_parallel) $(net_4_x_dirs) $(net_4_x_parallel_dirs) \ $(xammac_4_5_dirs_parallel) $(unreal_dirs_parallel) $(wasm_dirs_parallel) $(wasm_tools_dirs_parallel) $(xbuild_14_SUBDIRS) \ -$(testing_aot_full_interp_dirs_parallel) $(netcore_SUBDIRS) dlr aot-compiler reference-assemblies Facades +$(testing_aot_full_interp_dirs_parallel) dlr aot-compiler reference-assemblies Facades # No new makefiles for: System.Messaging, System.Web.Mobile, # System.ServiceProcess diff --git a/mcs/class/System/Test/System.Net.NetworkInformation/PingTest.cs b/mcs/class/System/Test/System.Net.NetworkInformation/PingTest.cs index 6b759a06b8c..192c409c3fe 100644 --- a/mcs/class/System/Test/System.Net.NetworkInformation/PingTest.cs +++ b/mcs/class/System/Test/System.Net.NetworkInformation/PingTest.cs @@ -13,6 +13,7 @@ namespace MonoTests.System.Net.NetworkInformation partial void AndroidShouldPingWork (ref bool shouldWork); [Test] + [Category("AndroidNotWorking")] // fails on CI for some reason public void PingFail() { #if MONOTOUCH @@ -65,6 +66,7 @@ namespace MonoTests.System.Net.NetworkInformation } [Test] + [Category("AndroidNotWorking")] // fails on CI for some reason #if MONOTOUCH [Ignore("Ping implementation is broken on MT (requires sudo access)")] #endif @@ -109,6 +111,7 @@ namespace MonoTests.System.Net.NetworkInformation [Test] [Category("MultiThreaded")] + [Category("AndroidNotWorking")] // fails on CI for some reason #if MONOTOUCH [Ignore("Ping implementation is broken on MT (requires sudo access)")] #endif diff --git a/mcs/class/corlib/Mono/RuntimeStructs.cs b/mcs/class/corlib/Mono/RuntimeStructs.cs index ae0255124d4..00b0b15c2cc 100644 --- a/mcs/class/corlib/Mono/RuntimeStructs.cs +++ b/mcs/class/corlib/Mono/RuntimeStructs.cs @@ -63,11 +63,7 @@ namespace Mono { internal uint hash_alg; internal uint hash_len; internal uint flags; -#if NETCORE - internal int major, minor, build, revision; -#else internal ushort major, minor, build, revision; -#endif internal ushort arch; } diff --git a/mcs/class/corlib/ReferenceSources/Buffer.cs b/mcs/class/corlib/ReferenceSources/Buffer.cs index 5c83291cf5c..9a6edeab2eb 100644 --- a/mcs/class/corlib/ReferenceSources/Buffer.cs +++ b/mcs/class/corlib/ReferenceSources/Buffer.cs @@ -7,10 +7,6 @@ using nuint = System.UInt32; using System.Runtime.CompilerServices; using System.Runtime; -#if NETCORE -using Internal.Runtime.CompilerServices; -#endif - namespace System { partial class Buffer diff --git a/mcs/class/corlib/ReferenceSources/JitHelpers.cs b/mcs/class/corlib/ReferenceSources/JitHelpers.cs index 79f242e4fca..80038fdf94d 100644 --- a/mcs/class/corlib/ReferenceSources/JitHelpers.cs +++ b/mcs/class/corlib/ReferenceSources/JitHelpers.cs @@ -17,13 +17,5 @@ namespace System.Runtime.CompilerServices { { return Array.UnsafeMov (val); } - -#if NETCORE - [Intrinsic] - internal static bool EnumEquals(T x, T y) where T : struct, Enum => throw new NotImplementedException (); - - [Intrinsic] - internal static int EnumCompareTo(T x, T y) where T : struct, Enum => throw new NotImplementedException (); -#endif } } \ No newline at end of file diff --git a/mcs/class/corlib/ReferenceSources/RuntimeType.cs b/mcs/class/corlib/ReferenceSources/RuntimeType.cs index 677c97e67a6..5adefd237a1 100644 --- a/mcs/class/corlib/ReferenceSources/RuntimeType.cs +++ b/mcs/class/corlib/ReferenceSources/RuntimeType.cs @@ -159,11 +159,7 @@ namespace System { var ctor = GetDefaultConstructor (); if (!nonPublic && ctor != null && !ctor.IsPublic) { -#if NETCORE - throw new MissingMethodException(SR.Format(SR.Arg_NoDefCTor, FullName)); -#else ctor = null; -#endif } if (ctor == null) { @@ -432,11 +428,7 @@ namespace System public override StructLayoutAttribute StructLayoutAttribute { get { -#if NETCORE - return GetStructLayoutAttribute (); -#else return StructLayoutAttribute.GetCustomAttribute (this); -#endif } } @@ -716,11 +708,7 @@ namespace System var a = new RuntimeEventInfo[n]; for (int i = 0; i < n; i++) { var eh = new Mono.RuntimeEventHandle (h[i]); -#if NETCORE - a[i] = (RuntimeEventInfo) RuntimeEventInfo.GetEventFromHandle (eh, refh); -#else a[i] = (RuntimeEventInfo) EventInfo.GetEventFromHandle (eh, refh); -#endif } return a; } @@ -735,13 +723,8 @@ namespace System RuntimeType[] GetNestedTypes_internal (string displayName, BindingFlags bindingAttr, MemberListType listType) { string internalName = null; -#if NETCORE - if (displayName != null) - internalName = displayName; -#else if (displayName != null) internalName = TypeIdentifiers.FromDisplay (displayName).InternalName; -#endif using (var namePtr = new Mono.SafeStringMarshal (internalName)) using (var h = new Mono.SafeGPtrArrayHandle (GetNestedTypes_native (namePtr.Value, bindingAttr, listType))) { int n = h.Length; @@ -775,19 +758,7 @@ namespace System get; } -#if NETCORE - public override bool IsSecurityTransparent { - get { return false; } - } - - public override bool IsSecurityCritical { - get { return true; } - } - - public override bool IsSecuritySafeCritical { - get { return false; } - } -#elif MOBILE +#if MOBILE static int get_core_clr_security_level () { return 1; @@ -810,7 +781,6 @@ namespace System } #endif -#if !NETCORE public override int GetHashCode() { Type t = UnderlyingSystemType; @@ -818,7 +788,6 @@ namespace System return t.GetHashCode (); return (int)_impl.Value; } -#endif public override string FullName { get { @@ -874,44 +843,5 @@ namespace System } public override bool IsTypeDefinition => RuntimeTypeHandle.IsTypeDefinition (this); - -#if NETCORE - private const int DEFAULT_PACKING_SIZE = 8; - - internal StructLayoutAttribute GetStructLayoutAttribute () - { - if (IsInterface || HasElementType || IsGenericParameter) - return null; - - int pack = 0, size = 0; - LayoutKind layoutKind = LayoutKind.Auto; - switch (Attributes & TypeAttributes.LayoutMask) - { - case TypeAttributes.ExplicitLayout: layoutKind = LayoutKind.Explicit; break; - case TypeAttributes.AutoLayout: layoutKind = LayoutKind.Auto; break; - case TypeAttributes.SequentialLayout: layoutKind = LayoutKind.Sequential; break; - default: Contract.Assume(false); break; - } - - CharSet charSet = CharSet.None; - switch (Attributes & TypeAttributes.StringFormatMask) - { - case TypeAttributes.AnsiClass: charSet = CharSet.Ansi; break; - case TypeAttributes.AutoClass: charSet = CharSet.Auto; break; - case TypeAttributes.UnicodeClass: charSet = CharSet.Unicode; break; - default: Contract.Assume(false); break; - } - - GetPacking (out pack, out size); - - // Metadata parameter checking should not have allowed 0 for packing size. - // The runtime later converts a packing size of 0 to 8 so do the same here - // because it's more useful from a user perspective. - if (pack == 0) - pack = DEFAULT_PACKING_SIZE; - - return new StructLayoutAttribute (layoutKind) { Pack = pack, Size = size, CharSet = charSet }; - } -#endif // NETCORE } } diff --git a/mcs/class/corlib/ReferenceSources/Type.cs b/mcs/class/corlib/ReferenceSources/Type.cs index 28fbf135b2a..0ec84be383c 100644 --- a/mcs/class/corlib/ReferenceSources/Type.cs +++ b/mcs/class/corlib/ReferenceSources/Type.cs @@ -206,13 +206,11 @@ namespace System return !object.ReferenceEquals (left, right); } -#if !NETCORE [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Type ReflectionOnlyGetType (String typeName, bool throwIfNotFound, bool ignoreCase) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeType.GetType (typeName, throwIfNotFound, ignoreCase, true /*reflectionOnly*/, ref stackMark); } -#endif } } diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs index a70b0ae7d88..0b294661516 100644 --- a/mcs/class/corlib/System.Diagnostics/StackTrace.cs +++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs @@ -43,9 +43,7 @@ namespace System.Diagnostics { [Serializable] [ComVisible (true)] -#if !NETCORE [MonoTODO ("Serialized objects are not compatible with .NET")] -#endif public class StackTrace { // TraceFormat is Used to specify options for how the @@ -148,9 +146,7 @@ namespace System.Diagnostics { this.frames [0] = frame; } -#if !NETCORE [MonoLimitation ("Not possible to create StackTraces from other threads")] -#endif [Obsolete] public StackTrace (Thread targetThread, bool needFileInfo) { diff --git a/mcs/class/corlib/System.Globalization/CultureInfo.cs b/mcs/class/corlib/System.Globalization/CultureInfo.cs index b21a89a7162..26eff979c6b 100644 --- a/mcs/class/corlib/System.Globalization/CultureInfo.cs +++ b/mcs/class/corlib/System.Globalization/CultureInfo.cs @@ -313,9 +313,7 @@ namespace System.Globalization } } -#if !NETCORE [MonoLimitation ("Optional calendars are not supported only default calendar is returned")] -#endif public virtual Calendar[] OptionalCalendars { get { return new[] { Calendar }; @@ -788,9 +786,7 @@ namespace System.Globalization } } -#if !NETCORE [MonoTODO ("Currently it ignores the altName parameter")] -#endif public static CultureInfo GetCultureInfo (string name, string altName) { if (name == null) throw new ArgumentNullException ("null"); diff --git a/mcs/class/corlib/System.Reflection/AssemblyName.cs b/mcs/class/corlib/System.Reflection/AssemblyName.cs index abcd1664c60..d2a5e82bd91 100644 --- a/mcs/class/corlib/System.Reflection/AssemblyName.cs +++ b/mcs/class/corlib/System.Reflection/AssemblyName.cs @@ -40,7 +40,7 @@ using System.Runtime.CompilerServices; using System.IO; using Mono; -#if !MOBILE && !NETCORE +#if !MOBILE using Mono.Security.Cryptography; #endif @@ -51,13 +51,11 @@ namespace System.Reflection { // http://www.ietf.org/rfc/rfc2396.txt [ComVisible (true)] -#if !NETCORE [ComDefaultInterfaceAttribute (typeof (_AssemblyName))] [ClassInterfaceAttribute (ClassInterfaceType.None)] -#endif [Serializable] [StructLayout (LayoutKind.Sequential)] -#if MOBILE || NETCORE +#if MOBILE public sealed partial class AssemblyName : ICloneable, ISerializable, IDeserializationCallback { #else public sealed class AssemblyName : ICloneable, ISerializable, IDeserializationCallback, _AssemblyName { @@ -279,7 +277,7 @@ namespace System.Reflection { switch (publicKey [0]) { case 0x00: // public key inside a header if (publicKey.Length > 12 && publicKey [12] == 0x06) { -#if MOBILE || NETCORE +#if MOBILE return true; #else return CryptoConvert.TryImportCapiPublicKeyBlob (publicKey, 12); @@ -287,7 +285,7 @@ namespace System.Reflection { } break; case 0x06: // public key -#if MOBILE || NETCORE +#if MOBILE return true; #else return CryptoConvert.TryImportCapiPublicKeyBlob (publicKey, 0); @@ -419,7 +417,7 @@ namespace System.Reflection { return aname; } -#if !MOBILE && !NETCORE +#if !MOBILE void _AssemblyName.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) { throw new NotImplementedException (); @@ -473,13 +471,8 @@ namespace System.Reflection { this.major = native->major; this.minor = native->minor; -#if NETCORE - this.build = native->build == 65535 ? -1 : native->build; - this.revision = native->revision == 65535 ? -1 : native->revision; -#else this.build = native->build; this.revision = native->revision; -#endif this.flags = (AssemblyNameFlags)native->flags; @@ -488,29 +481,13 @@ namespace System.Reflection { this.versioncompat = AssemblyVersionCompatibility.SameMachine; this.processor_architecture = (ProcessorArchitecture)native->arch; -#if NETCORE - if (addVersion) { - if (this.build == -1) - this.version = new Version (this.major, this.minor); - else if (this.revision == -1) - this.version = new Version (this.major, this.minor, this.build); - else - this.version = new Version (this.major, this.minor, this.build, this.revision); - } -#else if (addVersion) this.version = new Version (this.major, this.minor, this.build, this.revision); -#endif this.codebase = codeBase; -#if NETCORE - if (native->culture != IntPtr.Zero) - this.cultureinfo = CultureInfo.GetCultureInfo (RuntimeMarshal.PtrToUtf8String (native->culture)); -#else if (native->culture != IntPtr.Zero) this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), assemblyRef); -#endif if (native->public_key != IntPtr.Zero) { this.publicKey = RuntimeMarshal.DecodeBlobArray (native->public_key); @@ -542,11 +519,5 @@ namespace System.Reflection { } return aname; } - -#if NETCORE - internal static string EscapeCodeBase (string codebase) { - throw new NotImplementedException (); - } -#endif } } diff --git a/mcs/class/corlib/System.Reflection/CustomAttributeData.cs b/mcs/class/corlib/System.Reflection/CustomAttributeData.cs index 069db8bf86a..f86eaf22773 100644 --- a/mcs/class/corlib/System.Reflection/CustomAttributeData.cs +++ b/mcs/class/corlib/System.Reflection/CustomAttributeData.cs @@ -144,9 +144,6 @@ namespace System.Reflection { return MonoCustomAttrs.GetCustomAttributesData (target); } -#if NETCORE - virtual -#endif public Type AttributeType { get { return ctorInfo.DeclaringType; } } @@ -188,9 +185,6 @@ namespace System.Reflection { public override bool Equals (object obj) { -#if NETCORE - return obj == (object)this; -#else CustomAttributeData other = obj as CustomAttributeData; if (other == null || other.ctorInfo != ctorInfo || other.ctorArgs.Count != ctorArgs.Count || @@ -210,14 +204,10 @@ namespace System.Reflection { return false; } return true; -#endif } public override int GetHashCode () { -#if NETCORE - return base.GetHashCode (); -#else int ret = ctorInfo == null ? 13 : (ctorInfo.GetHashCode () << 16); // argument order-dependent if (ctorArgs != null) { @@ -231,7 +221,6 @@ namespace System.Reflection { ret += (namedArgs [i].GetHashCode () << 5); } return ret; -#endif } } diff --git a/mcs/class/corlib/System.Reflection/RuntimeEventInfo.cs b/mcs/class/corlib/System.Reflection/RuntimeEventInfo.cs index 0d2a7ed3d4d..2770576edd2 100644 --- a/mcs/class/corlib/System.Reflection/RuntimeEventInfo.cs +++ b/mcs/class/corlib/System.Reflection/RuntimeEventInfo.cs @@ -54,9 +54,7 @@ namespace System.Reflection { [Serializable] [StructLayout (LayoutKind.Sequential)] internal sealed class RuntimeEventInfo : EventInfo -#if !NETCORE , ISerializable -#endif { #pragma warning disable 169 IntPtr klass; @@ -101,7 +99,6 @@ namespace System.Reflection { return GetDeclaringTypeInternal ().GetRuntimeModule (); } -#if !NETCORE #region ISerializable public void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -117,7 +114,6 @@ namespace System.Reflection { MemberTypes.Event); } #endregion -#endif internal BindingFlags GetBindingFlags () { @@ -235,20 +231,5 @@ namespace System.Reflection { [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int get_metadata_token (RuntimeEventInfo monoEvent); - -#if NETCORE - [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern EventInfo internal_from_handle_type (IntPtr event_handle, IntPtr type_handle); - - internal static EventInfo GetEventFromHandle (Mono.RuntimeEventHandle handle, RuntimeTypeHandle reflectedType) - { - if (handle.Value == IntPtr.Zero) - throw new ArgumentException ("The handle is invalid."); - EventInfo ei = internal_from_handle_type (handle.Value, reflectedType.Value); - if (ei == null) - throw new ArgumentException ("The event handle and the type handle are incompatible."); - return ei; - } -#endif } } diff --git a/mcs/class/corlib/System.Reflection/RuntimeFieldInfo.cs b/mcs/class/corlib/System.Reflection/RuntimeFieldInfo.cs index 97ade331674..858ce984e34 100644 --- a/mcs/class/corlib/System.Reflection/RuntimeFieldInfo.cs +++ b/mcs/class/corlib/System.Reflection/RuntimeFieldInfo.cs @@ -52,9 +52,7 @@ namespace System.Reflection { [Serializable] [StructLayout (LayoutKind.Sequential)] class RuntimeFieldInfo : RtFieldInfo -#if !NETCORE , ISerializable -#endif { #pragma warning disable 649 internal IntPtr klass; @@ -92,7 +90,6 @@ namespace System.Reflection { return GetDeclaringTypeInternal ().GetRuntimeModule (); } -#if !NETCORE #region ISerializable Implementation public void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -107,7 +104,6 @@ namespace System.Reflection { MemberTypes.Field); } #endregion -#endif [MethodImplAttribute(MethodImplOptions.InternalCall)] internal override extern object UnsafeGetValue (object obj); @@ -309,24 +305,6 @@ namespace System.Reflection { { return 1; } -#elif NETCORE - public override bool IsSecurityTransparent { - get { - return false; - } - } - - public override bool IsSecurityCritical { - get { - return true; - } - } - - public override bool IsSecuritySafeCritical { - get { - return false; - } - } #else //seclevel { transparent = 0, safe-critical = 1, critical = 2} [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs b/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs index 3cb1b43173d..370a2e58f44 100644 --- a/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs +++ b/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs @@ -46,41 +46,6 @@ using System.Diagnostics; namespace System.Reflection { -#if NETCORE - [Flags()] - internal enum PInvokeAttributes - { - NoMangle = 0x0001, - - CharSetMask = 0x0006, - CharSetNotSpec = 0x0000, - CharSetAnsi = 0x0002, - CharSetUnicode = 0x0004, - CharSetAuto = 0x0006, - - BestFitUseAssem = 0x0000, - BestFitEnabled = 0x0010, - BestFitDisabled = 0x0020, - BestFitMask = 0x0030, - - ThrowOnUnmappableCharUseAssem = 0x0000, - ThrowOnUnmappableCharEnabled = 0x1000, - ThrowOnUnmappableCharDisabled = 0x2000, - ThrowOnUnmappableCharMask = 0x3000, - - SupportsLastError = 0x0040, - - CallConvMask = 0x0700, - CallConvWinapi = 0x0100, - CallConvCdecl = 0x0200, - CallConvStdcall = 0x0300, - CallConvThiscall = 0x0400, - CallConvFastcall = 0x0500, - - MaxValue = 0xFFFF, - } -#endif - internal struct MonoMethodInfo { #pragma warning disable 649 @@ -153,9 +118,7 @@ namespace System.Reflection { [Serializable()] [StructLayout (LayoutKind.Sequential)] class RuntimeMethodInfo : MethodInfo -#if !NETCORE , ISerializable -#endif { #pragma warning disable 649 internal IntPtr mhandle; @@ -181,11 +144,7 @@ namespace System.Reflection { } } -#if NETCORE - string FormatNameAndSig (bool serialization) -#else internal override string FormatNameAndSig (bool serialization) -#endif { // Serialization uses ToString to resolve MethodInfo overloads. StringBuilder sbName = new StringBuilder(Name); @@ -224,7 +183,6 @@ namespace System.Reflection { return ((RuntimeType)DeclaringType).GetRuntimeModule(); } -#if !NETCORE #region ISerializable Implementation public void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -246,7 +204,6 @@ namespace System.Reflection { return ReturnType.FormatTypeName(true) + " " + FormatNameAndSig(true); } #endregion -#endif internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle) { @@ -259,11 +216,7 @@ namespace System.Reflection { } [MethodImplAttribute (MethodImplOptions.InternalCall)] -#if NETCORE - [PreserveDependency(".ctor(System.Reflection.ExceptionHandlingClause[],System.Reflection.LocalVariableInfo[],System.Byte[],System.Boolean,System.Int32,System.Int32)", "System.Reflection.RuntimeMethodBody")] -#else [PreserveDependency(".ctor(System.Reflection.ExceptionHandlingClause[],System.Reflection.LocalVariableInfo[],System.Byte[],System.Boolean,System.Int32,System.Int32)", "System.Reflection.MethodBody")] -#endif internal extern static MethodBody GetMethodBodyInternal (IntPtr handle); internal static MethodBody GetMethodBody (IntPtr handle) @@ -398,10 +351,6 @@ namespace System.Reflection { #if MOBILE } catch (MethodAccessException) { throw; -#endif -#if NETCORE - } catch (Mono.NullByRefReturnException) { - throw new NullReferenceException (); #endif } catch (OverflowException) { throw; @@ -411,15 +360,7 @@ namespace System.Reflection { } else { -#if NETCORE - try { - o = InternalInvoke (obj, parameters, out exc); - } catch (Mono.NullByRefReturnException) { - throw new NullReferenceException (); - } -#else o = InternalInvoke (obj, parameters, out exc); -#endif } if (exc != null) @@ -525,62 +466,12 @@ namespace System.Reflection { if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0) attrs [count ++] = new PreserveSigAttribute (); if ((info.attrs & MethodAttributes.PinvokeImpl) != 0) { -#if NETCORE - attrs [count ++] = GetDllImportAttribute (); -#else attrs [count ++] = DllImportAttribute.GetCustomAttribute (this); -#endif } return attrs; } -#if NETCORE - Attribute GetDllImportAttribute () - { - string entryPoint, dllName = null; - int token = MetadataToken; - PInvokeAttributes flags = 0; - - GetPInvoke (out flags, out entryPoint, out dllName); - - CharSet charSet = CharSet.None; - - switch (flags & PInvokeAttributes.CharSetMask) { - case PInvokeAttributes.CharSetNotSpec: charSet = CharSet.None; break; - case PInvokeAttributes.CharSetAnsi: charSet = CharSet.Ansi; break; - case PInvokeAttributes.CharSetUnicode: charSet = CharSet.Unicode; break; - case PInvokeAttributes.CharSetAuto: charSet = CharSet.Auto; break; - - // Invalid: default to CharSet.None - default: break; - } - - CallingConvention callingConvention = InteropServicesCallingConvention.Cdecl; - - switch (flags & PInvokeAttributes.CallConvMask) { - case PInvokeAttributes.CallConvWinapi: callingConvention = InteropServicesCallingConvention.Winapi; break; - case PInvokeAttributes.CallConvCdecl: callingConvention = InteropServicesCallingConvention.Cdecl; break; - case PInvokeAttributes.CallConvStdcall: callingConvention = InteropServicesCallingConvention.StdCall; break; - case PInvokeAttributes.CallConvThiscall: callingConvention = InteropServicesCallingConvention.ThisCall; break; - case PInvokeAttributes.CallConvFastcall: callingConvention = InteropServicesCallingConvention.FastCall; break; - - // Invalid: default to CallingConvention.Cdecl - default: break; - } - - bool exactSpelling = (flags & PInvokeAttributes.NoMangle) != 0; - bool setLastError = (flags & PInvokeAttributes.SupportsLastError) != 0; - bool bestFitMapping = (flags & PInvokeAttributes.BestFitMask) == PInvokeAttributes.BestFitEnabled; - bool throwOnUnmappableChar = (flags & PInvokeAttributes.ThrowOnUnmappableCharMask) == PInvokeAttributes.ThrowOnUnmappableCharEnabled; - bool preserveSig = (GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0; - - return new DllImportAttribute (dllName) { EntryPoint = entryPoint, CharSet = charSet, SetLastError = setLastError, - ExactSpelling = exactSpelling, PreserveSig = preserveSig, BestFitMapping = bestFitMapping, - ThrowOnUnmappableChar = throwOnUnmappableChar, CallingConvention = callingConvention }; - } -#endif // NETCORE - internal CustomAttributeData[] GetPseudoCustomAttributesData () { int count = 0; @@ -835,9 +726,6 @@ namespace System.Reflection { { if (info == null) throw new ArgumentNullException("info"); -#if NETCORE - throw new NotImplementedException (); -#else MemberInfoSerializationHolder.GetSerializationInfo( info, Name, @@ -846,17 +734,12 @@ namespace System.Reflection { SerializationToString(), MemberTypes.Constructor, null); -#endif } internal string SerializationToString() { -#if NETCORE - throw new NotImplementedException (); -#else // We don't need the return type for constructors. return FormatNameAndSig(true); -#endif } internal void SerializationInvoke (Object target, SerializationInfo info, StreamingContext context) @@ -1019,20 +902,7 @@ namespace System.Reflection { } public override string ToString () { -#if NETCORE - StringBuilder sbName = new StringBuilder(Name); - sbName.Append ("Void "); - - TypeNameFormatFlags format = TypeNameFormatFlags.FormatBasic; - - sbName.Append("("); - RuntimeParameterInfo.FormatParameters (sbName, GetParametersNoCopy (), CallingConvention, false); - sbName.Append(")"); - - return sbName.ToString(); -#else return "Void " + FormatNameAndSig (false); -#endif } public override IList GetCustomAttributesData () { diff --git a/mcs/class/corlib/System.Reflection/RuntimeModule.cs b/mcs/class/corlib/System.Reflection/RuntimeModule.cs index 92caa4c8547..0defda647df 100644 --- a/mcs/class/corlib/System.Reflection/RuntimeModule.cs +++ b/mcs/class/corlib/System.Reflection/RuntimeModule.cs @@ -32,19 +32,15 @@ using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; -#if !NETCORE using System.Security.Cryptography.X509Certificates; using System.Security; using System.Security.Permissions; -#endif using System.Runtime.Serialization; namespace System.Reflection { [ComVisible (true)] -#if !NETCORE [ComDefaultInterfaceAttribute (typeof (_Module))] -#endif [Serializable] [ClassInterface(ClassInterfaceType.None)] [StructLayout (LayoutKind.Sequential)] @@ -105,7 +101,7 @@ namespace System.Reflection { public override string FullyQualifiedName { get { -#if !MOBILE && !NETCORE +#if !MOBILE if (SecurityManager.SecurityEnabled) { new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fqname).Demand (); } @@ -199,9 +195,7 @@ namespace System.Reflection { return (globalType != null) ? globalType.GetMethods (bindingFlags) : new MethodInfo [0]; } -#if !NETCORE internal override ModuleHandle GetModuleHandleImpl() => new ModuleHandle (_impl); -#endif public override void GetPEKind (out PortableExecutableKinds peKind, out ImageFileMachine machine) { @@ -320,7 +314,6 @@ namespace System.Reflection { return res; } -#if !NETCORE public override void GetObjectData (SerializationInfo info, StreamingContext context) { if (info == null) @@ -328,9 +321,8 @@ namespace System.Reflection { UnitySerializationHolder.GetUnitySerializationInfo (info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly ()); } -#endif -#if !MOBILE && !NETCORE +#if !MOBILE public override X509Certificate GetSignerCertificate () @@ -365,11 +357,7 @@ namespace System.Reflection { } } -#if NETCORE - internal Guid GetModuleVersionId () -#else internal override Guid GetModuleVersionId () -#endif { var guid = new byte [16]; GetGuidInternal (_impl, guid); diff --git a/mcs/class/corlib/System.Reflection/RuntimeParameterInfo.cs b/mcs/class/corlib/System.Reflection/RuntimeParameterInfo.cs index d57fbdecde9..f8404057b85 100644 --- a/mcs/class/corlib/System.Reflection/RuntimeParameterInfo.cs +++ b/mcs/class/corlib/System.Reflection/RuntimeParameterInfo.cs @@ -38,12 +38,10 @@ using System.Text; namespace System.Reflection { -#if !NETCORE [ComVisible (true)] [ComDefaultInterfaceAttribute (typeof (_ParameterInfo))] [Serializable] [ClassInterfaceAttribute (ClassInterfaceType.None)] -#endif class RuntimeParameterInfo : ParameterInfo { internal MarshalAsAttribute marshalAs; @@ -255,11 +253,7 @@ namespace System.Reflection attrs [count ++] = new OptionalAttribute (); if (marshalAs != null) { -#if NETCORE - attrs [count ++] = (MarshalAsAttribute)marshalAs.CloneInternal (); -#else attrs [count ++] = marshalAs.Copy (); -#endif } return attrs; diff --git a/mcs/class/corlib/System.Reflection/RuntimePropertyInfo.cs b/mcs/class/corlib/System.Reflection/RuntimePropertyInfo.cs index 65a222522b6..9e64e4b67d6 100644 --- a/mcs/class/corlib/System.Reflection/RuntimePropertyInfo.cs +++ b/mcs/class/corlib/System.Reflection/RuntimePropertyInfo.cs @@ -68,9 +68,7 @@ namespace System.Reflection { [Serializable] [StructLayout (LayoutKind.Sequential)] internal class RuntimePropertyInfo : PropertyInfo -#if !NETCORE , ISerializable -#endif { #pragma warning disable 649 internal IntPtr klass; @@ -90,41 +88,7 @@ namespace System.Reflection { [MethodImplAttribute (MethodImplOptions.InternalCall)] internal static extern object get_default_value (RuntimePropertyInfo prop); - -#if NETCORE - internal BindingFlags BindingFlags { - get { - CachePropertyInfo (PInfo.GetMethod | PInfo.SetMethod); - bool isPublic = info.set_method?.IsPublic == true || info.get_method?.IsPublic == true; - bool isStatic = info.set_method?.IsStatic == true || info.get_method?.IsStatic == true; - bool isInherited = DeclaringType != ReflectedType; - return FilterPreCalculate (isPublic, isInherited, isStatic); - } - } - - // Copied from https://github.com/dotnet/coreclr/blob/7a24a538cd265993e5864179f51781398c28ecdf/src/System.Private.CoreLib/src/System/RtType.cs#L2022 - static BindingFlags FilterPreCalculate (bool isPublic, bool isInherited, bool isStatic) - { - BindingFlags bindingFlags = isPublic ? BindingFlags.Public : BindingFlags.NonPublic; - if (isInherited) { - // We arrange things so the DeclaredOnly flag means "include inherited members" - bindingFlags |= BindingFlags.DeclaredOnly; - if (isStatic) - bindingFlags |= BindingFlags.Static | BindingFlags.FlattenHierarchy; - else - bindingFlags |= BindingFlags.Instance; - } - else { - if (isStatic) - bindingFlags |= BindingFlags.Static; - else - bindingFlags |= BindingFlags.Instance; - } - return bindingFlags; - } -#else internal BindingFlags BindingFlags => 0; -#endif public override Module Module { get { @@ -172,7 +136,6 @@ namespace System.Reflection { } #endregion -#if !NETCORE #region ISerializable Implementation public void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -195,7 +158,6 @@ namespace System.Reflection { return FormatNameAndSig(true); } #endregion -#endif void CachePropertyInfo (PInfo flags) { diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs index 292083a0bf7..068e74e2c51 100644 --- a/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs +++ b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs @@ -189,12 +189,10 @@ namespace System.Runtime.CompilerServices return !typeof (T).IsValueType || RuntimeTypeHandle.HasReferences ((typeof (T) as RuntimeType)); } -#if !NETCORE public static object GetUninitializedObject (Type type) { return FormatterServices.GetUninitializedObject (type); } -#endif /// /// GetSubArray helper method for the compiler to slice an array using a range. diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs index b564f4150d0..7c3b5399b7d 100644 --- a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs +++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs @@ -45,7 +45,7 @@ using System.Runtime.InteropServices.ComTypes; using System.Text; using System.Runtime.ConstrainedExecution; -#if !FULL_AOT_RUNTIME && !NETCORE && !DISABLE_REMOTING +#if !FULL_AOT_RUNTIME && !DISABLE_REMOTING using Mono.Interop; #endif @@ -298,7 +298,7 @@ namespace System.Runtime.InteropServices public static object CreateWrapperOfType (object o, Type t) { -#if FULL_AOT_RUNTIME || NETCORE || DISABLE_REMOTING +#if FULL_AOT_RUNTIME || DISABLE_REMOTING throw new PlatformNotSupportedException (); #else __ComObject co = o as __ComObject; @@ -430,7 +430,7 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !MOBILE && !NETCORE +#if !MOBILE [MethodImplAttribute (MethodImplOptions.InternalCall)] private extern static IntPtr GetCCW (object o, Type T); @@ -446,7 +446,7 @@ namespace System.Runtime.InteropServices public static IntPtr GetComInterfaceForObject (object o, Type T) { -#if MOBILE || NETCORE +#if MOBILE throw new PlatformNotSupportedException (); #else IntPtr pItf = GetComInterfaceForObjectInternal (o, T); @@ -456,18 +456,16 @@ namespace System.Runtime.InteropServices } -#if !NETCORE public static IntPtr GetComInterfaceForObject (object o, Type T, CustomQueryInterfaceMode mode) { throw new NotImplementedException (); } -#endif public static IntPtr GetComInterfaceForObject (T o) { return GetComInterfaceForObject ((object)o, typeof (T)); } -#if !FULL_AOT_RUNTIME && !NETCORE && !MONOTOUCH +#if !FULL_AOT_RUNTIME && !MONOTOUCH public static IntPtr GetComInterfaceForObjectInContext (object o, Type t) { @@ -622,7 +620,7 @@ namespace System.Runtime.InteropServices public static void GetNativeVariantForObject (object obj, IntPtr pDstNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = new Variant(); @@ -642,7 +640,7 @@ namespace System.Runtime.InteropServices public static object GetObjectForIUnknown (IntPtr pUnk) { -#if MOBILE || FULL_AOT_RUNTIME || NETCORE +#if MOBILE || FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else object obj = GetObjectForCCW (pUnk); @@ -657,7 +655,7 @@ namespace System.Runtime.InteropServices public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant)); @@ -667,7 +665,7 @@ namespace System.Runtime.InteropServices public static T GetObjectForNativeVariant (IntPtr pSrcNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant)); @@ -677,7 +675,7 @@ namespace System.Runtime.InteropServices public static object[] GetObjectsForNativeVariants (IntPtr aSrcNativeVariant, int cVars) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else if (cVars < 0) @@ -692,7 +690,7 @@ namespace System.Runtime.InteropServices public static T[] GetObjectsForNativeVariants (IntPtr aSrcNativeVariant, int cVars) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else if (cVars < 0) @@ -717,18 +715,15 @@ namespace System.Runtime.InteropServices #if !FULL_AOT_RUNTIME && !MONOTOUCH -#if !NETCORE - [Obsolete ("This method has been deprecated")] public static Thread GetThreadFromFiberCookie (int cookie) { throw new NotImplementedException (); } -#endif public static object GetTypedObjectForIUnknown (IntPtr pUnk, Type t) { -#if NETCORE || DISABLE_REMOTING +#if DISABLE_REMOTING throw new NotImplementedException (); #else ComInteropProxy proxy = new ComInteropProxy (pUnk, t); @@ -749,7 +744,6 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static string GetTypeInfoName (UCOMITypeInfo pTI) @@ -763,7 +757,6 @@ namespace System.Runtime.InteropServices { throw new NotImplementedException (); } -#endif public static Guid GetTypeLibGuid (ITypeLib typelib) @@ -777,14 +770,12 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static int GetTypeLibLcid (UCOMITypeLib pTLB) { throw new NotImplementedException (); } -#endif public static int GetTypeLibLcid (ITypeLib typelib) @@ -792,14 +783,12 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static string GetTypeLibName (UCOMITypeLib pTLB) { throw new NotImplementedException (); } -#endif public static string GetTypeLibName (ITypeLib typelib) @@ -838,12 +827,10 @@ namespace System.Runtime.InteropServices throw new PlatformNotSupportedException (); } -#if !NETCORE public static string GetTypeInfoName (ITypeInfo typeInfo) { throw new PlatformNotSupportedException (); } -#endif public static object GetUniqueObjectForIUnknown (IntPtr unknown) { @@ -1272,9 +1259,6 @@ namespace System.Runtime.InteropServices if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToBSTR (); -#else byte[] buffer = s.GetBuffer (); int len = s.Length; @@ -1289,7 +1273,6 @@ namespace System.Runtime.InteropServices } fixed (byte* fixed_buffer = buffer) return BufferToBSTR ((char*)fixed_buffer, len); -#endif } internal delegate IntPtr SecureStringAllocator(int len); @@ -1309,9 +1292,6 @@ namespace System.Runtime.InteropServices if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (false, false); -#else int len = s.Length; IntPtr ctm = allocator (len + 1); byte [] copy = new byte [len+1]; @@ -1334,16 +1314,12 @@ namespace System.Runtime.InteropServices } } return ctm; -#endif } internal static IntPtr SecureStringToUnicode (SecureString s, SecureStringAllocator allocator) { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (false, true); -#else int len = s.Length; IntPtr ctm = allocator (len * 2 + 2); byte [] buffer = null; @@ -1360,8 +1336,6 @@ namespace System.Runtime.InteropServices } } return ctm; -#endif - } public static IntPtr SecureStringToCoTaskMemAnsi (SecureString s) @@ -1378,22 +1352,14 @@ namespace System.Runtime.InteropServices { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (true, false); -#else return SecureStringToAnsi (s, SecureStringGlobalAllocator); -#endif } public static IntPtr SecureStringToGlobalAllocUnicode (SecureString s) { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (true, true); -#else return SecureStringToUnicode (s, SecureStringGlobalAllocator); -#endif } [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.MayFail)] @@ -1646,9 +1612,6 @@ namespace System.Runtime.InteropServices //const int COR_E_WEAKREFERENCE = unchecked ((int)?); //const int COR_E_VTABLECALLSNOTSUPPORTED = unchecked ((int)); -#if NETCORE - return new COMException ("", errorCode); -#else switch (errorCode) { case MSEE_E_APPDOMAINUNLOADED: return new AppDomainUnloadedException (); @@ -1792,7 +1755,6 @@ namespace System.Runtime.InteropServices if (errorCode < 0) return new COMException ("", errorCode); return null; -#endif } #if FEATURE_COMINTEROP @@ -1939,18 +1901,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SetLastWin32Error (int error); -#if NETCORE - internal static IntPtr AllocBSTR (int length) - { - throw new NotImplementedException (); - } - - internal static bool IsPinnable (object obj) - { - throw new NotImplementedException (); - } -#endif - #if FEATURE_COMINTEROP || MONO_COM // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs //==================================================================== diff --git a/mcs/class/corlib/System.Threading/Monitor.cs b/mcs/class/corlib/System.Threading/Monitor.cs index 3113ce05ba7..7572af26002 100644 --- a/mcs/class/corlib/System.Threading/Monitor.cs +++ b/mcs/class/corlib/System.Threading/Monitor.cs @@ -116,9 +116,5 @@ namespace System.Threading { return Monitor_test_owner (obj); } - -#if NETCORE - public static long LockContentionCount => throw new PlatformNotSupportedException (); -#endif } } diff --git a/mcs/class/corlib/System.Threading/NativeEventCalls.cs b/mcs/class/corlib/System.Threading/NativeEventCalls.cs index 715b51cd307..28b57c640c0 100644 --- a/mcs/class/corlib/System.Threading/NativeEventCalls.cs +++ b/mcs/class/corlib/System.Threading/NativeEventCalls.cs @@ -35,7 +35,7 @@ using System; using System.Runtime.CompilerServices; using Microsoft.Win32.SafeHandles; -#if !MOBILE && !NETCORE +#if !MOBILE using System.Security.AccessControl; using System.IO; #endif @@ -87,7 +87,7 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void CloseEvent_internal (IntPtr handle); -#if !MOBILE && !NETCORE +#if !MOBILE public unsafe static IntPtr OpenEvent_internal (string name, EventWaitHandleRights rights, out int errorCode) { // FIXME check for embedded nuls in name diff --git a/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs index 6069bf116d4..62c6078e3e8 100644 --- a/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs +++ b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs @@ -84,12 +84,8 @@ namespace System.Threading lock (this) { _unregistered = true; if (_callsInProcess == 0 && _finalEvent != null) { -#if NETCORE - throw new NotImplementedException (); -#else NativeEventCalls.SetEvent (_finalEvent.SafeWaitHandle); _finalEvent = null; -#endif } } } catch (ObjectDisposedException) { @@ -112,11 +108,7 @@ namespace System.Threading { _callsInProcess--; if (_unregistered && _callsInProcess == 0 && _finalEvent != null) { -#if NETCORE - EventWaitHandle.Set (_finalEvent.SafeWaitHandle); -#else NativeEventCalls.SetEvent (_finalEvent.SafeWaitHandle); -#endif _finalEvent = null; } } diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 7e2db6cff11..c520115ea1e 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -38,11 +38,9 @@ using System.Security; using System.Diagnostics; using System.Runtime.ConstrainedExecution; -#if !NETCORE using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Remoting.Contexts; using System.Security.Principal; -#endif namespace System.Threading { [StructLayout (LayoutKind.Sequential)] @@ -116,9 +114,7 @@ namespace System.Threading { } [StructLayout (LayoutKind.Sequential)] -#if !NETCORE public -#endif sealed partial class Thread { #pragma warning disable 414 #region Sync with metadata/object-internals.h @@ -164,7 +160,6 @@ namespace System.Threading { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static byte[] ByteArrayToCurrentDomain (byte[] arr); -#if !NETCORE #if !DISABLE_REMOTING public static Context CurrentContext { get { @@ -303,7 +298,6 @@ namespace System.Threading { public static AppDomain GetDomain() { return AppDomain.CurrentDomain; } -#endif [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static void GetCurrentThread_icall (ref Thread thread); diff --git a/mcs/class/corlib/System/ArgIterator.cs b/mcs/class/corlib/System/ArgIterator.cs index 1a9a56d854e..677a0c65b4c 100644 --- a/mcs/class/corlib/System/ArgIterator.cs +++ b/mcs/class/corlib/System/ArgIterator.cs @@ -38,9 +38,6 @@ namespace System { [StructLayout (LayoutKind.Auto)] public -#if NETCORE - ref -#endif struct ArgIterator { #pragma warning disable 169, 414 diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs index 1ab627110a5..b9415e980e0 100644 --- a/mcs/class/corlib/System/Array.cs +++ b/mcs/class/corlib/System/Array.cs @@ -681,20 +681,12 @@ namespace System static int IndexOfImpl(T[] array, T value, int startIndex, int count) { -#if NETCORE - throw new NotImplementedException (); -#else return EqualityComparer.Default.IndexOf (array, value, startIndex, count); -#endif } static int LastIndexOfImpl(T[] array, T value, int startIndex, int count) { -#if NETCORE - throw new NotImplementedException (); -#else return EqualityComparer.Default.LastIndexOf (array, value, startIndex, count); -#endif } static void SortImpl (Array keys, Array items, int index, int length, IComparer comparer) diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs index 5761df5fa63..7bb4716dad8 100644 --- a/mcs/class/corlib/System/MonoCustomAttrs.cs +++ b/mcs/class/corlib/System/MonoCustomAttrs.cs @@ -154,11 +154,6 @@ namespace System if (attributeType == typeof (MonoCustomAttrs)) attributeType = null; -#if NETCORE - if (attributeType == typeof (Attribute)) - attributeType = null; -#endif - object[] r; object[] res = GetCustomAttributesBase (obj, attributeType, false); // shortcut diff --git a/mcs/class/corlib/System/MulticastDelegate.cs b/mcs/class/corlib/System/MulticastDelegate.cs index 50f312941a4..6a67652037b 100644 --- a/mcs/class/corlib/System/MulticastDelegate.cs +++ b/mcs/class/corlib/System/MulticastDelegate.cs @@ -286,12 +286,5 @@ namespace System return !d1.Equals (d2); } - -#if NETCORE - internal override object GetTarget() - { - return delegates?.Length > 0 ? delegates [delegates.Length - 1].GetTarget () : base.GetTarget (); - } -#endif } } diff --git a/mcs/class/corlib/System/RuntimeTypeHandle.cs b/mcs/class/corlib/System/RuntimeTypeHandle.cs index c308ba2e487..a9322eabe61 100644 --- a/mcs/class/corlib/System/RuntimeTypeHandle.cs +++ b/mcs/class/corlib/System/RuntimeTypeHandle.cs @@ -224,11 +224,7 @@ namespace System internal static bool IsContextful (RuntimeType type) { -#if NETCORE - return false; -#else return typeof (ContextBoundObject).IsAssignableFrom (type); -#endif } internal static bool IsEquivalentTo (RuntimeType rtType1, RuntimeType rtType2) diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index 7f297438f6c..c0efa94072b 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -52,7 +52,7 @@ net_4_5_dirs := \ gacutil build_SUBDIRS = -build_PARALLEL_SUBDIRS := resgen gacutil security culevel upload-to-sentry mono-helix-client commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html +build_PARALLEL_SUBDIRS := resgen gacutil security culevel commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html monodroid_tools_SUBDIRS = monodroid_tools_PARALLEL_SUBDIRS = aprofutil cil-strip linker-analyzer mkbundle mdoc mono-symbolicate corcompare mono-api-diff mono-api-html pdb2mdb nunit-lite monodroid_SUBDIRS = nunit-lite @@ -68,7 +68,7 @@ net_4_x_PARALLEL_SUBDIRS = $(net_4_5_dirs) wasm_tools_SUBDIRS = wasm_tools_PARALLEL_SUBDIRS = linker wasm-tuner cil-strip -DIST_SUBDIRS = $(net_4_5_dirs) cil-stringreplacer commoncryptogenerator resx2sr gensources upload-to-sentry mono-helix-client +DIST_SUBDIRS = $(net_4_5_dirs) cil-stringreplacer commoncryptogenerator resx2sr gensources include ../build/rules.make diff --git a/mcs/tools/mono-helix-client/HelixBase.cs b/mcs/tools/mono-helix-client/HelixBase.cs deleted file mode 100644 index cd5fe2d9f04..00000000000 --- a/mcs/tools/mono-helix-client/HelixBase.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -// HelixBase.cs -// -// Authors: -// Alexander Köplinger -// -// Copyright (C) 2018 Microsoft -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Threading.Tasks; -using Microsoft.DotNet.Helix.Client; - -public class HelixBase -{ - protected IHelixApi _api; - - public HelixBase () - { - _api = ApiFactory.GetAuthenticated (GetEnvironmentVariable ("MONO_HELIX_API_KEY")); - } - - protected string GetEnvironmentVariable (string variable) - { - return Environment.GetEnvironmentVariable (variable) ?? throw new ArgumentException ($"No value for '{variable}'."); - } - - protected string McUrlEncode (string input) - { - // encodes the URL in a way Mission Control understands (% replaced with ~) - var result = WebUtility.UrlEncode (input); - return result.Replace ("%", "~"); - } - - public async Task WaitForJobCompletion (string correlationId) - { - bool success = false; - bool printedMcLink = false; - - Console.WriteLine ($"Waiting for job '{correlationId}' to finish..."); - - int sleepTime = 0; - - while (true) - { - await Task.Delay (sleepTime); - sleepTime = Math.Min (30000, sleepTime + 10000); - - var statusContent = await _api.Job.DetailsAsync (correlationId); - if (String.IsNullOrEmpty (statusContent.JobList)) - { - Console.WriteLine ("Job list isn't available yet."); - continue; - } - - if (!printedMcLink) - { - var mcResultsUrl = $"https://mc.dot.net/#/user/{McUrlEncode (statusContent.Creator)}/{McUrlEncode (statusContent.Source)}/{McUrlEncode (statusContent.Type)}/{McUrlEncode (statusContent.Build)}"; - Console.WriteLine ($"View test results on Mission Control: {mcResultsUrl}"); - printedMcLink = true; - } - - var isFinished = statusContent.WorkItems.Unscheduled == 0 && - statusContent.WorkItems.Waiting == 0 && - statusContent.WorkItems.Running == 0; - - if (isFinished) - { - Console.WriteLine ("Job finished, fetching results..."); - - var resultsContent = (await _api.Aggregate.JobSummaryMethodAsync (new List { "job.name" }, maxResultSets: 1, filtername: correlationId)); - - if (resultsContent.Count != 1) - throw new InvalidOperationException ("No results found for job."); - - resultsContent[0].Validate (); - - var resultData = resultsContent[0].Data; - var workItemStatus = resultData.WorkItemStatus; - var analyses = resultData.Analysis; - - if (workItemStatus.ContainsKey ("none")) - { - Console.WriteLine ($"Still processing xunit data from {workItemStatus["none"]} work items. Stay tuned."); - continue; - } - - if (analyses.Count > 0) - { - if (analyses.Count > 1) - throw new InvalidOperationException ("Job contains multiple analyses, this shouldn't happen."); - - var analysis = analyses[0]; - - if (analysis.Name != "xunit") - throw new InvalidOperationException ($"Job contains unknown analysis '{analysis.Name}', this shouldn't happen."); - - if (analysis.Status == null) - throw new InvalidOperationException ($"Job contains no status for analysis '{analysis.Name}', this shouldn't happen."); - - analysis.Status.TryGetValue ("pass", out int? pass); - analysis.Status.TryGetValue ("skip", out int? skip); - analysis.Status.TryGetValue ("fail", out int? fail); - int? total = pass + skip + fail; - - if (total == null || total == 0) - throw new InvalidOperationException ($"Job contains no test results, this shouldn't happen."); - - Console.WriteLine (""); - Console.WriteLine ($"Tests run: {total}, Passed: {pass ?? 0}, Errors: 0, Failures: {fail ?? 0}, Inconclusive: 0"); - Console.WriteLine ($" Not run: {skip ?? 0}, Invalid: 0, Ignored: 0, Skipped: {skip ?? 0}"); - Console.WriteLine (""); - - success = (fail == 0); - } - - if (workItemStatus.ContainsKey ("fail")) - { - success = false; - Console.WriteLine ($"{workItemStatus["fail"]} work items failed."); - } - } - else - { - Console.WriteLine ($"Waiting for work items to finish: Unscheduled: {statusContent.WorkItems.Unscheduled}, Waiting: {statusContent.WorkItems.Waiting}, Running: {statusContent.WorkItems.Running}"); - continue; - } - - Console.WriteLine ($"Job {(success ? "SUCCEEDED" : "FAILED")}."); - return success; - } - } -} diff --git a/mcs/tools/mono-helix-client/HelixTestBase.cs b/mcs/tools/mono-helix-client/HelixTestBase.cs deleted file mode 100644 index 57e3dcde9ef..00000000000 --- a/mcs/tools/mono-helix-client/HelixTestBase.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// HelixTestBase.cs -// -// Authors: -// Alexander Köplinger -// -// Copyright (C) 2018 Microsoft -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Threading.Tasks; -using Microsoft.DotNet.Helix.Client; - -public abstract class HelixTestBase : HelixBase -{ - IJobDefinition _job; - - protected HelixTestBase (string helixType) : base () - { - var helixSource = GetEnvironmentVariable ("MONO_HELIX_SOURCE"); - - if (helixSource.StartsWith ("pr/")) - { - // workaround for https://github.com/dotnet/arcade/issues/1392 - var storage = new Storage ((HelixApi)_api); - var anonymousApi = ApiFactory.GetAnonymous (); - typeof (HelixApi).GetProperty ("Storage").SetValue (anonymousApi, storage, null); - _api = anonymousApi; - } - - var build = _api.Job.Define () - .WithSource (helixSource) - .WithType (helixType) - .WithBuild (GetEnvironmentVariable ("MONO_HELIX_BUILD_MONIKER")); - - _job = build - .WithTargetQueue (GetEnvironmentVariable ("MONO_HELIX_TARGET_QUEUE")) - .WithCreator (GetEnvironmentVariable ("MONO_HELIX_CREATOR")) - .WithCorrelationPayloadDirectory (GetEnvironmentVariable ("MONO_HELIX_TEST_PAYLOAD_DIRECTORY")) - .WithCorrelationPayloadFiles (GetEnvironmentVariable ("MONO_HELIX_XUNIT_REPORTER_PATH")) - // these are well-known properties used by Mission Control - .WithProperty ("architecture", GetEnvironmentVariable ("MONO_HELIX_ARCHITECTURE")) - .WithProperty ("operatingSystem", GetEnvironmentVariable ("MONO_HELIX_OPERATINGSYSTEM")); - } - - protected void CreateWorkItem (string name, string command, int timeoutInSeconds) - { - _job.DefineWorkItem (name) - .WithCommand ($"chmod +x $HELIX_CORRELATION_PAYLOAD/mono-test.sh; $HELIX_CORRELATION_PAYLOAD/mono-test.sh {command}; exit_code=$1; $HELIX_PYTHONPATH $HELIX_CORRELATION_PAYLOAD/xunit-reporter.py; exit $exit_code") - .WithEmptyPayload () - .WithTimeout (TimeSpan.FromSeconds (timeoutInSeconds)) - .AttachToJob (); - } - - protected void CreateCustomWorkItem (string suite, int timeoutInSeconds = 900) - { - CreateWorkItem (suite, $"--{suite}", timeoutInSeconds); - } - - protected void CreateNunitWorkItem (string assembly, string profile = "net_4_x", int timeoutInSeconds = 900) - { - var flakyTestRetries = Environment.GetEnvironmentVariable ("MONO_FLAKY_TEST_RETRIES") ?? "0"; - CreateWorkItem (assembly, $"--nunit {profile}/tests/{assembly} --flaky-test-retries={flakyTestRetries}", timeoutInSeconds); - } - - protected void CreateXunitWorkItem (string assembly, string profile = "net_4_x", int timeoutInSeconds = 900) - { - CreateWorkItem (assembly, $"--xunit {profile}/tests/{assembly}", timeoutInSeconds); - } - - public async Task SendJob () - { - Console.WriteLine ($"Sending job to Helix..."); - var sentJob = await _job.SendAsync (); - - Console.WriteLine ($"Job '{sentJob.CorrelationId}' created."); - - return sentJob.CorrelationId; - } -} diff --git a/mcs/tools/mono-helix-client/MainlineTests.cs b/mcs/tools/mono-helix-client/MainlineTests.cs deleted file mode 100644 index 190dc4fdfd3..00000000000 --- a/mcs/tools/mono-helix-client/MainlineTests.cs +++ /dev/null @@ -1,161 +0,0 @@ -// -// MainlineTests.cs -// -// Authors: -// Alexander Köplinger -// -// Copyright (C) 2018 Microsoft -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -public class MainlineTests : HelixTestBase -{ - public MainlineTests (string type) : base ($"test/{type}/") - { - } - - public HelixTestBase CreateJob () - { - // xunit tests - CreateXunitWorkItem ("net_4_x_corlib_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Xml_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Xml.Linq_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Threading.Tasks.Dataflow_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Security_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Runtime.Serialization_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Runtime.CompilerServices.Unsafe_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Numerics_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Json_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Drawing_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Data_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Core_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.ComponentModel.Composition_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Net.Http.FunctionalTests_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_System.Net.Http.UnitTests_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_Mono.Profiler.Log_xunit-test.dll"); - CreateXunitWorkItem ("net_4_x_Microsoft.CSharp_xunit-test.dll"); - - // NUnit tests - CreateNunitWorkItem ("net_4_x_corlib_test.dll"); - CreateNunitWorkItem ("net_4_x_WindowsBase_test.dll"); - CreateNunitWorkItem ("net_4_x_WebMatrix.Data_test.dll"); - CreateNunitWorkItem ("net_4_x_System_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Xml_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Xml.Linq_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Xaml_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Windows.Forms_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Windows.Forms.DataVisualization_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web.Services_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web.Routing_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web.Extensions_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web.DynamicData_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Web.Abstractions_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Transactions_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Threading.Tasks.Dataflow_test.dll"); - CreateNunitWorkItem ("net_4_x_System.ServiceProcess_test.dll"); - CreateNunitWorkItem ("net_4_x_System.ServiceModel_test.dll"); - CreateNunitWorkItem ("net_4_x_System.ServiceModel.Web_test.dll"); - CreateNunitWorkItem ("net_4_x_System.ServiceModel.Discovery_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Security_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Runtime.Serialization_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Runtime.Serialization.Formatters.Soap_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Runtime.Remoting_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Runtime.DurableInstancing_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Runtime.Caching_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Numerics_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Net.Http_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Net.Http.WebRequest_test.dll"); - //CreateNunitWorkItem ("net_4_x_System.Messaging_test.dll"); // needs RabbitMQ installed and hangs on process exit - CreateNunitWorkItem ("net_4_x_System.Json_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Json.Microsoft_test.dll"); - CreateNunitWorkItem ("net_4_x_System.IdentityModel_test.dll"); - CreateNunitWorkItem ("net_4_x_System.IO.Compression_test.dll"); - CreateNunitWorkItem ("net_4_x_System.IO.Compression.FileSystem_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Drawing_test.dll"); - CreateNunitWorkItem ("net_4_x_System.DirectoryServices_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Design_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Data_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Data.Services_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Data.OracleClient_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Data.Linq_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Data.DataSetExtensions_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Core_test.dll"); - CreateNunitWorkItem ("net_4_x_System.Configuration_test.dll"); - CreateNunitWorkItem ("net_4_x_System.ComponentModel.DataAnnotations_test.dll"); - //CreateNunitWorkItem("net_4_x_monodoc_test.dll"); // fails one test and needs to get rid of CallerFilePath to locate test resources - CreateNunitWorkItem ("net_4_x_Novell.Directory.Ldap_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.XBuild.Tasks_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Tasklets_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Security_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Runtime.Tests_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Posix_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Parallel_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Options_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Messaging_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Messaging.RabbitMQ_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Debugger.Soft_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Data.Tds_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.Data.Sqlite_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.CodeContracts_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.CSharp_test.dll"); - CreateNunitWorkItem ("net_4_x_Mono.C5_test.dll"); - CreateNunitWorkItem ("net_4_x_I18N.West_test.dll"); - CreateNunitWorkItem ("net_4_x_I18N.Rare_test.dll"); - CreateNunitWorkItem ("net_4_x_I18N.Other_test.dll"); - CreateNunitWorkItem ("net_4_x_I18N.MidEast_test.dll"); - CreateNunitWorkItem ("net_4_x_I18N.CJK_test.dll"); - CreateNunitWorkItem ("net_4_x_Cscompmgd_test.dll"); - CreateNunitWorkItem ("net_4_x_Commons.Xml.Relaxng_test.dll"); - CreateNunitWorkItem ("net_4_x_Microsoft.Build_test.dll"); - CreateNunitWorkItem ("net_4_x_Microsoft.Build.Utilities_test.dll"); - CreateNunitWorkItem ("net_4_x_Microsoft.Build.Tasks_test.dll"); - CreateNunitWorkItem ("net_4_x_Microsoft.Build.Framework_test.dll"); - CreateNunitWorkItem ("net_4_x_Microsoft.Build.Engine_test.dll"); - CreateNunitWorkItem ("BinarySerializationOverVersionsTest.dll"); - CreateNunitWorkItem ("xbuild_12_Microsoft.Build_test.dll", profile: "xbuild_12"); - CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Utilities_test.dll", profile: "xbuild_12"); - CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Tasks_test.dll", profile: "xbuild_12"); - CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Framework_test.dll", profile: "xbuild_12"); - CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Engine_test.dll", profile: "xbuild_12"); - CreateNunitWorkItem ("xbuild_14_Microsoft.Build_test.dll", profile: "xbuild_14"); - CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Utilities_test.dll", profile: "xbuild_14"); - CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Tasks_test.dll", profile: "xbuild_14"); - CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Framework_test.dll", profile: "xbuild_14"); - CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Engine_test.dll", profile: "xbuild_14"); - - // custom test suites - CreateCustomWorkItem ("mcs", timeoutInSeconds: 1800); - CreateCustomWorkItem ("mcs-errors", timeoutInSeconds: 1800); - CreateCustomWorkItem ("verify"); - CreateCustomWorkItem ("aot-test", timeoutInSeconds: 1800); - CreateCustomWorkItem ("mini"); - CreateCustomWorkItem ("symbolicate"); - CreateCustomWorkItem ("csi"); - CreateCustomWorkItem ("profiler"); - CreateCustomWorkItem ("runtime", timeoutInSeconds: 1800); - - return this; - } -} diff --git a/mcs/tools/mono-helix-client/Makefile b/mcs/tools/mono-helix-client/Makefile deleted file mode 100644 index 97ea981de2b..00000000000 --- a/mcs/tools/mono-helix-client/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -thisdir = tools/mono-helix-client -SUBDIRS = -include ../../build/rules.make - -PROGRAM = mono-helix-client.exe -NO_INSTALL = yes - -LIB_REFS = System System.Net.Http Facades/netstandard Facades/System.Runtime Facades/System.Threading.Tasks -helix_binaries = $(topdir)/../external/helix-binaries -LOCAL_MCS_FLAGS = -r:$(helix_binaries)/Microsoft.DotNet.Helix.Client.dll -r:$(helix_binaries)/Microsoft.DotNet.Helix.JobSender.dll -r:$(helix_binaries)/Microsoft.Rest.ClientRuntime.dll - -with_helix_client = MONO_PATH="$(helix_binaries)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/mono-helix-client.exe - -upload-to-helix: - MONO_HELIX_XUNIT_REPORTER_PATH="$(abspath $(helix_binaries)/xunit-reporter.py)" $(with_helix_client) --tests="$(MONO_HELIX_TYPE)" --correlationIdFile="$(MONO_HELIX_CORRELATION_ID_FILE)" - -wait-for-job-completion: - $(with_helix_client) --wait="$(MONO_HELIX_CORRELATION_ID)" - -include ../../build/executable.make diff --git a/mcs/tools/mono-helix-client/mono-helix-client.cs b/mcs/tools/mono-helix-client/mono-helix-client.cs deleted file mode 100644 index 1566216317d..00000000000 --- a/mcs/tools/mono-helix-client/mono-helix-client.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// mono-helix-client.cs -// -// Authors: -// Alexander Köplinger -// -// Copyright (C) 2018 Microsoft -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Threading.Tasks; - -public class Program -{ - public static int Main (string[] args) - { - return MainAsync (args).GetAwaiter ().GetResult (); - } - - public static async Task MainAsync (string[] args) - { - string tests = ""; - string correlationId = ""; - string correlationIdFile = ""; - bool waitForJobCompletion = false; - - var options = new Mono.Options.OptionSet { - { "tests=", "Tests to run", param => { if (param != null) tests = param; } }, - { "correlationIdFile=", "File to write correlation ID to", param => { if (param != null) correlationIdFile = param; } }, - { "wait=", "Wait for job to complete", param => { if (param != null) { correlationId = param; waitForJobCompletion = true; } } }, - }; - - try { - options.Parse (args); - } catch (Mono.Options.OptionException e) { - Console.WriteLine ("Option error: {0}", e.Message); - return 1; - } - - if (tests == "mainline" || tests == "mainline-cxx") { - var t = new MainlineTests (tests); - correlationId = await t.CreateJob ().SendJob (); - - if (!String.IsNullOrEmpty (correlationIdFile)) - File.WriteAllText (correlationIdFile, correlationId); - - return 0; - } - - if (waitForJobCompletion) { - var success = await new HelixBase ().WaitForJobCompletion (correlationId); - return success ? 0 : 1; - } - - Console.Error.WriteLine ("Error: Invalid arguments."); - return 1; - } -} diff --git a/mcs/tools/mono-helix-client/mono-helix-client.exe.sources b/mcs/tools/mono-helix-client/mono-helix-client.exe.sources deleted file mode 100644 index a83bb208718..00000000000 --- a/mcs/tools/mono-helix-client/mono-helix-client.exe.sources +++ /dev/null @@ -1,5 +0,0 @@ -HelixBase.cs -HelixTestBase.cs -MainlineTests.cs -mono-helix-client.cs -../../class/Mono.Options/Mono.Options/Options.cs diff --git a/mcs/tools/upload-to-sentry/Makefile b/mcs/tools/upload-to-sentry/Makefile deleted file mode 100644 index 1a034f1b4bf..00000000000 --- a/mcs/tools/upload-to-sentry/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -thisdir = tools/upload-to-sentry -SUBDIRS = -include ../../build/rules.make - -PROGRAM = upload-to-sentry.exe -LIB_REFS = \ - System \ - System.Core \ - System.Data \ - System.Runtime.Serialization \ - System.Xml \ - System.Xml.Linq \ - Mono.Posix \ - System Mono.Cecil - -NO_INSTALL = yes - -upload-crashes: - MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/upload-to-sentry.exe - -# It can be run using system .net during boostrap -TARGET_NET_REFERENCE = v4.6 -# Trick to make it work during boostrap where it has to run with system -# assemblies not the ones in lib/basic folder -PROGRAM_USE_INTERMEDIATE_FILE = 1 - -ifdef MCS_MODE -LIB_REFS += Mono.Cecil.Mdb -endif - -include ../../build/executable.make diff --git a/mcs/tools/upload-to-sentry/UploadToSentry.cs b/mcs/tools/upload-to-sentry/UploadToSentry.cs deleted file mode 100644 index c5a5c165cec..00000000000 --- a/mcs/tools/upload-to-sentry/UploadToSentry.cs +++ /dev/null @@ -1,636 +0,0 @@ -/** - * \file UploadToSentry.cs - * Support for reading verbose unmanaged crash dumps - * - * Author: - * Alexander Kyte (alkyte@microsoft.com) - * - * (C) 2018 Microsoft, Inc. - * - */ - -using System; - -using System.IO; -using System.Linq; -using System.Collections.Generic; -using Mono.Collections.Generic; - -using System.Text; -using System.Text.RegularExpressions; - -using Newtonsoft.Json.Linq; - -using System.Reflection; -using Mono.Cecil; -using Mono.Cecil.Cil; - -using System.Net; - -[assembly: CLSCompliant (false)] - -namespace UploadToSentry -{ - // Modeled after https://github.com/getsentry/raven-csharp/blob/develop/src/app/SharpRaven/Dsn.cs - class Dsn { - public readonly string PrivateKey; - public readonly string PublicKey; - public readonly string ProjectID; - - private readonly string path; - private readonly int port; - private readonly string sentryUriString; - private readonly Uri uri; - - public Dsn (string dsn) { - this.uri = new Uri(dsn); - this.PrivateKey = GetPrivateKey(this.uri); - this.PublicKey = GetPublicKey(this.uri) ?? throw new ArgumentException("A publicKey is required.", nameof(dsn)); - this.port = this.uri.Port; - this.ProjectID = GetProjectID(this.uri); - this.path = GetPath(this.uri); - this.sentryUriString = String.Format("{0}://{1}:{2}{3}/api/{4}/store/", this.uri.Scheme, this.uri.DnsSafeHost, this.port, this.path, this.ProjectID); - } - - private static string GetPath(Uri uri) - { - int lastSlash = uri.AbsolutePath.LastIndexOf("/", StringComparison.Ordinal); - return uri.AbsolutePath.Substring(0, lastSlash); - } - - private static string GetProjectID(Uri uri) - { - int lastSlash = uri.AbsoluteUri.LastIndexOf("/", StringComparison.Ordinal); - return uri.AbsoluteUri.Substring(lastSlash + 1); - } - - public Uri SentryUri { - get { - return new Uri (sentryUriString); - } - } - - private static string GetPrivateKey(Uri uri) - { - var parts = uri.UserInfo.Split(':'); - return parts.Length == 2 ? parts[1] : null; - } - - private static string GetPublicKey(Uri uri) - { - var publicKey = uri.UserInfo.Split(':')[0]; - return publicKey != string.Empty ? publicKey : null; - } - } - - class CodeCollection - { - Dictionary, Collection> Lookup; - Dictionary, Tuple> Types; - - public void Add (string assembly, string klass, string function, string mvid, uint token, Collection seqs) - { - var key = new Tuple(mvid, token); - Lookup[key] = seqs; - Types[key] = new Tuple(assembly, klass, function); - } - - public CodeCollection(string [] assemblies) - { - Lookup = new Dictionary, Collection>(); - Types = new Dictionary, Tuple>(); - - foreach (string assembly in assemblies) - { - if (assembly.EndsWith(".dll") || assembly.EndsWith(".exe")) - { - // Console.WriteLine("Reading {0}", assembly); - var readerParameters = new ReaderParameters { ReadSymbols = true, InMemory = true }; - AssemblyDefinition myLibrary = null; - try - { - myLibrary = AssemblyDefinition.ReadAssembly(assembly, readerParameters); - string mvid = myLibrary.MainModule.Mvid.ToString().ToUpper(); - Console.WriteLine("\t-- Success Parsing {0}: {1}", assembly, mvid); - - foreach (var ty in myLibrary.MainModule.Types) - { - for (int i = 0; i < ty.Methods.Count; i++) - { - string klass = ty.FullName; - string function = ty.Methods[i].FullName; - uint token = Convert.ToUInt32(ty.Methods[i].MetadataToken.ToInt32()); - this.Add(assembly, klass, function, mvid, token, ty.Methods[i].DebugInformation.SequencePoints); - } - } - } - catch (SymbolsNotFoundException) - { - // ignore assemblies without debug symbols - continue; - } - catch (Exception e) - { - Console.WriteLine("\t-- Error Parsing {0}: {1}", assembly, e.Message); - } - } - } - } - - public JObject Find (string mvid, uint token, uint goal) - { - var method_idx = new Tuple(mvid, token); - if (!Lookup.ContainsKey(method_idx)) - return null; - - var seqs = Lookup[method_idx]; - - var accum = new JObject(); - foreach (var seq in seqs) - { - if (goal != seq.Offset) - continue; - - accum.Add (new JProperty("lineno", seq.StartLine)); - accum.Add (new JProperty("filename", seq.Document.Url)); - break; - } - - var typ = Types[method_idx]; - var assembly = typ.Item1; - var klass = typ.Item2; - accum.Add (new JProperty("module", String.Format("{0} {1}", assembly, klass))); - accum.Add (new JProperty("function", typ.Item3)); - - return accum; - } - } - - - class Uploader - { - CodeCollection codebase; - - public JObject Format_0_0_3 (string fileName, JObject payload, string hash) - { - var event_id = new JProperty("event_id", Guid.NewGuid().ToString("n")); - var timestamp = new JProperty("timestamp", DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture)); - var exc_objs = new List (); - var thread_objs = new List (); - - var stackTraces = payload["threads"] as JArray; - - var path = Path.GetDirectoryName (fileName); // Best differentiator in-tree for files is where they are run from - - foreach (var st in stackTraces) { - var thread_id = st["native_thread_id"]?.ToString(); - - var unmanaged_frames = new List(); - var managed_frames = new List(); - var exceptions = new List(); - - var thread_name = st["thread_name"]?.ToString (); - if (thread_name == null || thread_name?.Length == 0) - thread_name = "Unnamed thread"; - - var payload_unmanaged_frames = st["unmanaged_frames"] as JArray; - for (int fr=0; payload_unmanaged_frames != null && fr < payload_unmanaged_frames.Count; fr++) - { - var frame = payload_unmanaged_frames [fr] as JObject; - var native_address = frame["native_address"]; - var unmanaged_name = frame["unmanaged_name"] != null ? frame["unmanaged_name"].ToString() : ""; - - var fn_filename = new JProperty("filename", ""); - var function = new JProperty("function", unmanaged_name); - var module = new JProperty("module", "mono-sgen"); - var vars = new JProperty("vars", new JObject(new JProperty ("native_address", native_address))); - var blob = new JObject(fn_filename, function, module, vars); - - unmanaged_frames.Add (blob); - } - - var payload_managed_frames = st["managed_frames"] as JArray; - for (int fr = 0; payload_managed_frames != null && fr < payload_managed_frames.Count; fr++) - { - var frame = payload_managed_frames [fr] as JObject; - if (frame["is_managed"] != null && frame["is_managed"].ToString ().ToUpper () == "TRUE") - { - var guid_val = frame["guid"].ToString (); - var token_val = Convert.ToUInt32(frame["token"].ToString (), 16); - var offset_val = Convert.ToUInt32(frame["il_offset"].ToString (), 16); - - var output_frame = codebase.Find (guid_val, token_val, offset_val); - if (output_frame == null) - continue; - - var guid = new JProperty("guid", guid_val); - var token = new JProperty("token", token_val); - var il_offset = new JProperty("il_offset", offset_val); - - output_frame.Add (new JProperty("vars", new JObject(guid, token, il_offset))); - - managed_frames.Add(output_frame); - } else { - var native_address = frame["native_address"]; - var unmanaged_name = frame["unmanaged_name"] != null ? frame["unmanaged_name"].ToString() : ""; - - var fn_filename = new JProperty("filename", "mono-sgen"); - var function = new JProperty("function", unmanaged_name); - var module = new JProperty("module", ""); - var vars = new JProperty("vars", frame); - var blob = new JObject(fn_filename, function, module, vars); - - managed_frames.Add (blob); - } - } - - var payload_exceptions = st["exceptions"] as JArray; - for (int exc=0; payload_exceptions != null && exc < payload_exceptions.Count; exc++) - { - var exception_obj = payload_exceptions [exc] as JObject; - var exc_managed_frames = new List(); - var payload_exception_frames = exception_obj ["managed_frames"] as JArray; - for (int fr = 0; payload_exception_frames != null && fr < payload_exception_frames.Count; fr++) - { - var frame = payload_exception_frames [fr] as JObject; - if (frame["is_managed"] != null && frame["is_managed"].ToString ().ToUpper () == "TRUE") - { - var guid_val = frame["guid"].ToString (); - var token_val = Convert.ToUInt32(frame["token"].ToString (), 16); - var offset_val = Convert.ToUInt32(frame["il_offset"].ToString (), 16); - - var output_frame = codebase.Find (guid_val, token_val, offset_val); - if (output_frame == null) - continue; - - var guid = new JProperty("guid", guid_val); - var token = new JProperty("token", token_val); - var il_offset = new JProperty("il_offset", offset_val); - - output_frame.Add (new JProperty("vars", new JObject(guid, token, il_offset))); - - exc_managed_frames.Add(output_frame); - } else { - var native_address = frame["native_address"]; - var unmanaged_name = frame["unmanaged_name"] != null ? frame["unmanaged_name"].ToString() : ""; - - var fn_filename = new JProperty("filename", "mono-sgen"); - var function = new JProperty("function", unmanaged_name); - var module = new JProperty("module", ""); - var vars = new JProperty("vars", frame); - var blob = new JObject(fn_filename, function, module, vars); - - exc_managed_frames.Add (blob); - } - } - - var type = new JProperty ("type", exception_obj ["type"].ToString ()); - var managed_st = new JProperty("frames", new JArray(exc_managed_frames.ToArray())); - var exc_blob = new JObject(type, managed_st); - - exceptions.Add (exc_blob); - } - - if (unmanaged_frames.Count > 0) { - var unmanaged_st = new JObject(new JProperty("frames", new JArray(unmanaged_frames.ToArray ()))); - var id = String.Format ("{0}_unmanaged", st ["native_thread_id"]); - var active = new JProperty ("active", "true"); - - if (st["crashed"]?.ToString ().ToUpper () == "TRUE") { - var unmanaged_thread = new JObject (active, new JProperty ("crashed", "true"), new JProperty ("name", String.Format ("{0} unmanaged", thread_name)), new JProperty ("id", id)); - var unmanaged_exc = new JObject(new JProperty("module", String.Format("{0}_managed_frames", thread_id)), - new JProperty("type", path), - new JProperty("value", ""), - new JProperty("stacktrace", unmanaged_st), new JProperty("thread_id", id)); - - thread_objs.Add(unmanaged_thread); - exc_objs.Add (unmanaged_exc); - } else { - var unmanaged_thread = new JObject (active, new JProperty ("name", String.Format ("{0} Unmanaged", thread_name)), - new JProperty ("id", id), new JProperty ("stacktrace", unmanaged_st)); - thread_objs.Add(unmanaged_thread); - } - } - - if (managed_frames.Count > 0) { - var managed_st = new JObject(new JProperty("frames", new JArray(managed_frames.ToArray()))); - // If we are the crashing thread, set the exception object to the - // managed stacktrace and the thread object to the managed thread - // - // If we aren't, add the thread + st to - var id = String.Format ("{0}_managed", st["native_thread_id"]); - var active = new JProperty ("active", "true"); - - if (unmanaged_frames.Count == 0 && st["crashed"]?.ToString ().ToUpper () == "TRUE") { - var managed_thread = new JObject (active, new JProperty ("crashed", "true"), new JProperty ("name", String.Format ("{0} managed", thread_name)), new JProperty ("id", id)); - var managed_exc = new JObject(new JProperty("module", String.Format("{0}_managed_frames", thread_id)), - new JProperty("type", path), - new JProperty("value", ""), - new JProperty("stacktrace", managed_st), new JProperty("thread_id", id)); - - thread_objs.Add(managed_thread); - exc_objs.Add (managed_exc); - } else { - var managed_thread = new JObject (active, new JProperty ("name", String.Format ("{0} managed", thread_name)), - new JProperty ("id", id), new JProperty ("stacktrace", managed_st)); - thread_objs.Add(managed_thread); - } - } - - bool first_exception = true; - foreach (var exc_input in exceptions) { - // The 0.0.3 managed exception only has one thread, so we want it to be active and set crashed to true. - var active = new JProperty ("active", first_exception ? "true" : "false"); - first_exception = false; - - var name = "Caught Managed Exception"; - - var exception_thread = new JObject (active, new JProperty ("crashed", "true"), new JProperty ("name", name), new JProperty ("id", name), new JProperty ("exception", exc_input)); - var exception_exc = new JObject(new JProperty("module", name), - new JProperty("type", path), - new JProperty("value", ""), - new JProperty("stacktrace", exc_input ["frames"])); - - thread_objs.Add (exception_thread); - exc_objs.Add (exception_exc); - } - } - - var exception = new JProperty("exception", new JObject (new JProperty ("values", new JArray(exc_objs.ToArray ())))); - var threads = new JProperty("threads", new JObject (new JProperty ("values", new JArray(thread_objs.ToArray ())))); - // Bake in the whole blob - var embedded = new JProperty("extra", payload); - var fingerprint = new JProperty ("fingerprint", new JArray (new JValue (hash))); - - var sentry_message = new JObject (timestamp, event_id, exception, embedded, threads, fingerprint); - - return sentry_message; - } - - public JObject Format_0_0_2 (string fileName, JObject payload, string hash) - { - var event_id = new JProperty("event_id", Guid.NewGuid().ToString("n")); - var timestamp = new JProperty("timestamp", DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture)); - var exc_objs = new List (); - var thread_objs = new List (); - - var stackTraces = payload["threads"] as JArray; - - var path = Path.GetDirectoryName (fileName); // Best differentiator in-tree for files is where they are run from - - for (int i=0; i < stackTraces.Count; i++){ - var thread_id = stackTraces[i]["native_thread_id"]?.ToString(); - - var unmanaged_frames = new List(); - var managed_frames = new List(); - - var thread_name = stackTraces [i]["thread_name"].ToString (); - if (thread_name == null || thread_name.Length == 0) - thread_name = "Unnamed thread"; - - var payload_unmanaged_frames = stackTraces[i]["unmanaged_frames"] as JArray; - for (int fr=0; payload_unmanaged_frames != null && fr < payload_unmanaged_frames.Count; fr++) - { - var frame = payload_unmanaged_frames [fr] as JObject; - var native_address = frame["native_address"]; - var unmanaged_name = frame["unmanaged_name"] != null ? frame["unmanaged_name"].ToString() : ""; - - var fn_filename = new JProperty("filename", ""); - var function = new JProperty("function", unmanaged_name); - var module = new JProperty("module", "mono-sgen"); - var vars = new JProperty("vars", new JObject(new JProperty ("native_address", native_address))); - var blob = new JObject(fn_filename, function, module, vars); - - unmanaged_frames.Add (blob); - } - - var payload_managed_frames = stackTraces[i]["managed_frames"] as JArray; - for (int fr = 0; payload_managed_frames != null && fr < payload_managed_frames.Count; fr++) - { - var frame = payload_managed_frames [fr] as JObject; - if (frame["is_managed"] != null && frame["is_managed"].ToString ().ToUpper () == "TRUE") - { - var guid_val = frame["guid"].ToString (); - var token_val = Convert.ToUInt32(frame["token"].ToString (), 16); - var offset_val = Convert.ToUInt32(frame["il_offset"].ToString (), 16); - - var output_frame = codebase.Find (guid_val, token_val, offset_val); - if (output_frame == null) - continue; - - var guid = new JProperty("guid", guid_val); - var token = new JProperty("token", token_val); - var il_offset = new JProperty("il_offset", offset_val); - - output_frame.Add (new JProperty("vars", new JObject(guid, token, il_offset))); - - managed_frames.Add(output_frame); - } else { - var native_address = frame["native_address"]; - var unmanaged_name = frame["unmanaged_name"] != null ? frame["unmanaged_name"].ToString() : ""; - - var fn_filename = new JProperty("filename", "mono-sgen"); - var function = new JProperty("function", unmanaged_name); - var module = new JProperty("module", ""); - var vars = new JProperty("vars", frame); - var blob = new JObject(fn_filename, function, module, vars); - - managed_frames.Add (blob); - } - } - - if (unmanaged_frames.Count > 0) { - var unmanaged_st = new JObject(new JProperty("frames", new JArray(unmanaged_frames.ToArray ()))); - var id = String.Format ("{0}_unmanaged", stackTraces[i]["native_thread_id"]); - var active = new JProperty ("active", "true"); - - if (stackTraces[i]["crashed"].ToString ().ToUpper () == "TRUE") { - var unmanaged_thread = new JObject (active, new JProperty ("crashed", "true"), new JProperty ("name", String.Format ("{0} unmanaged", thread_name)), new JProperty ("id", id)); - var unmanaged_exc = new JObject(new JProperty("module", String.Format("{0}_managed_frames", thread_id)), - new JProperty("type", path), - new JProperty("value", ""), - new JProperty("stacktrace", unmanaged_st), new JProperty("thread_id", id)); - - thread_objs.Add(unmanaged_thread); - exc_objs.Add (unmanaged_exc); - } else { - var unmanaged_thread = new JObject (active, new JProperty ("name", String.Format ("{0} Unmanaged", thread_name)), - new JProperty ("id", id), new JProperty ("stacktrace", unmanaged_st)); - thread_objs.Add(unmanaged_thread); - } - } - - if (managed_frames.Count > 0) { - var managed_st = new JObject(new JProperty("frames", new JArray(managed_frames.ToArray()))); - // If we are the crashing thread, set the exception object to the - // managed stacktrace and the thread object to the managed thread - // - // If we aren't, add the thread + st to - var id = String.Format ("{0}_managed", stackTraces[i]["native_thread_id"]); - var active = new JProperty ("active", "true"); - - if (unmanaged_frames.Count == 0 && stackTraces[i]["crashed"].ToString ().ToUpper () == "TRUE") { - var managed_thread = new JObject (active, new JProperty ("crashed", "true"), new JProperty ("name", String.Format ("{0} managed", thread_name)), new JProperty ("id", id)); - var managed_exc = new JObject(new JProperty("module", String.Format("{0}_managed_frames", thread_id)), - new JProperty("type", path), - new JProperty("value", ""), - new JProperty("stacktrace", managed_st), new JProperty("thread_id", id)); - - thread_objs.Add(managed_thread); - exc_objs.Add (managed_exc); - } else { - var managed_thread = new JObject (active, new JProperty ("name", String.Format ("{0} managed", thread_name)), - new JProperty ("id", id), new JProperty ("stacktrace", managed_st)); - thread_objs.Add(managed_thread); - } - } - } - - var exception = new JProperty("exception", new JObject (new JProperty ("values", new JArray(exc_objs.ToArray ())))); - var threads = new JProperty("threads", new JObject (new JProperty ("values", new JArray(thread_objs.ToArray ())))); - // Bake in the whole blob - var embedded = new JProperty("extra", payload); - var fingerprint = new JProperty ("fingerprint", new JArray (new JValue (hash))); - - var sentry_message = new JObject (timestamp, event_id, exception, embedded, threads, fingerprint); - - return sentry_message; - } - - public void SendMessage (JObject sentry_message, Dsn url) - { - // Console.WriteLine ("Sending {0}", sentry_message.ToString ()); - - var request = (HttpWebRequest) WebRequest.Create (url.SentryUri); - request.Method = "POST"; - request.ContentType = "application/json"; - request.UserAgent = "MonoSentryUploader/1.0.0.0"; - - var sentryVersion = 7; - var time = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - var key = url.PrivateKey != null ? ", sentry_secret=" + url.PrivateKey : null; - var header = String.Format("Sentry sentry_version={0}" + - ", sentry_client={1}, sentry_timestamp={2}, sentry_key={3}{4}", - sentryVersion, request.UserAgent, time, url.PublicKey, key); - request.Headers ["X-Sentry-Auth"] = header; - - byte[] byteArray = Encoding.UTF8.GetBytes(sentry_message.ToString ()); - request.ContentLength = byteArray.Length; - - Stream dataStream = request.GetRequestStream(); - dataStream.Write(byteArray, 0, byteArray.Length); - dataStream.Close(); - - try { - WebResponse response = request.GetResponse (); - // Display the status. - // Console.WriteLine(((HttpWebResponse)response).StatusDescription); - - StreamReader reader = new StreamReader(response.GetResponseStream()); - // Read the content. - string responseFromServer = reader.ReadToEnd(); - // Display the content. - Console.WriteLine("\t-- HTTP POST Success {0}", responseFromServer); - // Clean up the streams. - } catch (WebException ex) { - Console.WriteLine("\t-- HTTP POST Error:", ex.Response.Headers [""]); - for (int i=0; i < ex.Response.Headers.Count; i++) - Console.WriteLine("\t\t {0} : {1}", ex.Response.Headers.Keys [i], ex.Response.Headers [i]); - } - } - - public void Upload (string filePath, string os_tag, Dsn url) - { - if (!File.Exists(filePath)) - throw new Exception(String.Format("Json file not found {0}", filePath)); - - var dump = File.ReadAllText(filePath); - //var message = new SentryMessage(dump); - // var blob = new SentryEvent(message); - var payload = JObject.Parse(dump); - - // Try to extract a test name - var fileName = Path.GetFileName (filePath); - var extract = Regex.Match(fileName, @"mono_crash\.([A-Za-z0-9]+)\.(\d)\.json"); - if (!extract.Success) - throw new Exception ("File name does not match correct format"); - - var groups = extract.Groups; - var hash = groups[1].Value; - // var increment = groups[2].Value; - - var version_string = payload["protocol_version"].ToString(); - JObject sentry_message = null; - if (version_string == "0.0.4") { - // Same for now - sentry_message = Format_0_0_3 (filePath, payload, hash); - } else if (version_string == "0.0.3") { - sentry_message = Format_0_0_3 (filePath, payload, hash); - } else if (version_string == "0.0.2") { - sentry_message = Format_0_0_2 (filePath, payload, hash); - } else { - Console.WriteLine ("ERROR: Crash reporting version mismatch"); - return; - } - - // sent to url via post? - // Console.WriteLine (sentry_message); - - SendMessage (sentry_message, url); - } - - public Uploader (CodeCollection assemblies) - { - this.codebase = assemblies; - } - - static string[] GetAssemblies (string fileRoot) { - var dlls = Directory.GetFiles (fileRoot, "*.dll", SearchOption.AllDirectories); - var exes = Directory.GetFiles (fileRoot, "*.exe", SearchOption.AllDirectories); - - return dlls.Concat (exes).ToArray (); - } - - static string[] GetFiles (string fileRoot) { - return Directory.GetFiles (fileRoot, "mono_crash.*.json", SearchOption.AllDirectories); - } - - public static void Main (string[] args) - { - var url = System.Environment.GetEnvironmentVariable ("MONO_SENTRY_URL"); - if (url == null) { - Console.WriteLine ("MONO_SENTRY_URL missing"); - return; - } - - var fileRoot = System.Environment.GetEnvironmentVariable ("MONO_SENTRY_ROOT"); - if (fileRoot == null) { - Console.WriteLine ("MONO_SENTRY_ROOT missing"); - return; - } - - var os_tag = System.Environment.GetEnvironmentVariable ("MONO_SENTRY_OS"); - if (os_tag == null) { - Console.WriteLine ("MONO_SENTRY_OS missing"); - return; - } - - var dsn = new Dsn(url); - - var files = GetFiles (fileRoot); - - if (files.Length == 0) - return; - - // Find all of the assemblies in tree that could have made the crash dump - var assemblies = GetAssemblies (fileRoot); - var codebase = new CodeCollection (assemblies); - - foreach (var file in files) { - Console.WriteLine ($"Processing {file} ..."); - var state = new Uploader (codebase); - state.Upload (file, os_tag, dsn); - } - } - } -} diff --git a/mcs/tools/upload-to-sentry/upload-to-sentry.exe.sources b/mcs/tools/upload-to-sentry/upload-to-sentry.exe.sources deleted file mode 100644 index e069eacc6f3..00000000000 --- a/mcs/tools/upload-to-sentry/upload-to-sentry.exe.sources +++ /dev/null @@ -1,156 +0,0 @@ -UploadToSentry.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryType.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonToken.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonType.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonObjectId.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BinaryConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataSetConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataTableConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/KeyValuePairConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BsonObjectIdConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/RegexConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ConstructorHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/VersionConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateFormatHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateTimeZoneHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Formatting.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConstructorAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPosition.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxy.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPath.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JRaw.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Required.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDynamicContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonLinqContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPrimitiveContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorEventArgs.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultReferenceResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/PreserveReferencesHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/IJsonLineInfo.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonArrayAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonContainerAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DefaultValueHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonObjectAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializerSettings.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonValidatingReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/IJEnumerable.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenEqualityComparer.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MemberSerialization.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ObjectCreationHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPropertyAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriterException.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReaderException.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterCollection.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConvert.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializationException.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializer.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/Extensions.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JConstructor.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JContainer.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JEnumerable.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JObject.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JArray.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JToken.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JProperty.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenType.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JValue.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/Extensions.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModel.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModelBuilder.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNodeCollection.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNode.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/UndefinedSchemaIdHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventArgs.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventHandler.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CamelCasePropertyNamesContractResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorContext.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IContractResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IValueProvider.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonProperty.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MissingMemberHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/NullValueHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ReferenceLoopHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchema.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaConstants.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IReferenceResolver.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaType.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonStringContract.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CachedAttributeGetter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/OnErrorAttribute.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/Base64Encoder.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxyMetaObject.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ObjectConstructor.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionDelegateFactory.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/LateBoundReflectionDelegateFactory.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MethodCall.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringReference.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/TypeNameHandling.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/BidirectionalDictionary.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionWrapper.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DictionaryWrapper.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValue.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValues.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonToken.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriter.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringBuffer.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ListWrapper.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MathUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs -../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/WriteState.cs diff --git a/mono/Makefile.am b/mono/Makefile.am index 7e3be9d7047..257c5bb2209 100644 --- a/mono/Makefile.am +++ b/mono/Makefile.am @@ -12,20 +12,9 @@ if MONO_NATIVE native_dirs = native endif -if ENABLE_NETCORE -btls_dirs = -managed_unit_test_dirs = -native_unit_test_dirs = -culture_dirs = -else managed_unit_test_dirs = tests native_unit_test_dirs = unit-tests culture_dirs = culture -endif - -if ENABLE_NETCORE -SUBDIRS = eglib arch utils sgen zlib metadata mini profiler $(native_unit_test_dirs) -else if CROSS_COMPILING SUBDIRS = $(btls_dirs) $(culture_dirs) eglib arch utils cil zlib $(sgen_dirs) metadata mini dis profiler $(native_dirs) @@ -36,6 +25,5 @@ else SUBDIRS = $(btls_dirs) $(culture_dirs) eglib arch utils cil zlib $(sgen_dirs) metadata mini dis $(managed_unit_test_dirs) $(native_unit_test_dirs) benchmark profiler $(native_dirs) endif endif -endif DIST_SUBDIRS = btls $(culture_dirs) native eglib arch utils cil zlib $(sgen_dirs) metadata mini dis $(managed_unit_test_dirs) $(native_unit_test_dirs) benchmark profiler diff --git a/mono/culture/locales.c b/mono/culture/locales.c index ca0fbd21e9d..005ccd9cf28 100644 --- a/mono/culture/locales.c +++ b/mono/culture/locales.c @@ -16,7 +16,6 @@ #include -#if !ENABLE_NETCORE #include #include @@ -791,4 +790,3 @@ ves_icall_System_Text_Normalization_load_normalization_resource (guint8 **argPro #endif } -#endif /* !ENABLE_NETCORE */ diff --git a/mono/culture/w32process-unix-language.c b/mono/culture/w32process-unix-language.c index da8a4e6c452..e9f8d403a5d 100644 --- a/mono/culture/w32process-unix-language.c +++ b/mono/culture/w32process-unix-language.c @@ -8,7 +8,7 @@ #include #include -#if !defined(ENABLE_NETCORE) && !defined(DISABLE_PROCESSES) +#if !defined(DISABLE_PROCESSES) static guint32 copy_lang (gunichar2 *lang_out, guint32 lang_len, const gchar *text) @@ -791,6 +791,6 @@ mono_w32process_ver_language_name (guint32 lang, gunichar2 *lang_out, guint32 la return copy_lang (lang_out, lang_len, name); } -#endif /* ENABLE_NETCORE && DISABLE_PROCESSES */ +#endif /* !defined(DISABLE_PROCESSES) */ MONO_EMPTY_SOURCE_FILE (culture_w32_process_unix_language); diff --git a/mono/eglib/glib.h b/mono/eglib/glib.h index 7bdace935e9..dbcc3997eff 100644 --- a/mono/eglib/glib.h +++ b/mono/eglib/glib.h @@ -959,14 +959,6 @@ GUnicodeBreakType g_unichar_break_type (gunichar c); #define g_assert_not_reached() G_STMT_START { mono_assertion_message_unreachable (__FILE__, __LINE__); eg_unreachable(); } G_STMT_END -#if ENABLE_NETCORE -#define g_assert_netcore() /* nothing */ -#define g_assert_not_netcore() g_assert (!"This function should only be called on mono-notnetcore.") -#else -#define g_assert_netcore() g_assert (!"This function should only be called on mono-netcore.") -#define g_assert_not_netcore() /* nothing */ -#endif - /* f is format -- like printf and scanf * Where you might have said: * if (!(expr)) diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 45392bbed42..d033b460270 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -129,41 +129,7 @@ libmonoruntime_support_la_SOURCES = support.c libmonoruntime_support_la_LDFLAGS = $(Z_LIBS) libmonoruntime_support_la_CFLAGS = $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @ZLIB_CFLAGS@ -if ENABLE_NETCORE -if HAVE_SYS_ICU - -# symlink ICU sources to a local dir so automake puts intermediates into the target-specific folder -icushim/%.c: @ICU_SHIM_PATH@/%.c - $(LN_S) $^ $@ - -shim_libraries = libmonoruntime-shimglobalization.la - -nodist_libmonoruntime_shimglobalization_la_SOURCES = \ - icushim/pal_calendarData.c \ - icushim/pal_casing.c \ - icushim/pal_collation.c \ - icushim/pal_idna.c \ - icushim/pal_locale.c \ - icushim/pal_localeNumberData.c \ - icushim/pal_localeStringData.c \ - icushim/pal_normalization.c \ - icushim/pal_timeZoneInfo.c \ - icushim/entrypoints.c - -libmonoruntime_shimglobalization_la_CFLAGS = @ICU_CFLAGS@ -I$(top_srcdir)/../libraries/Native/Unix/System.Globalization.Native/ -I$(top_srcdir)/../libraries/Native/Unix/Common/ - -if STATIC_ICU -nodist_libmonoruntime_shimglobalization_la_SOURCES += icushim/pal_icushim_static.c -else -nodist_libmonoruntime_shimglobalization_la_SOURCES += icushim/pal_icushim.c -endif # STATIC_ICU - -endif # HAVE_SYS_ICU -endif # ENABLE_NETCORE - -if !ENABLE_NETCORE culture_libraries = ../culture/libmono-culture.la -endif # # This library contains the icall tables if the runtime was configured with --disable-icall-tables @@ -297,7 +263,6 @@ common_sources = \ loaded-images-internals.h \ loaded-images.c \ loaded-images-global.c \ - loaded-images-netcore.c \ locales.h \ lock-tracer.c \ lock-tracer.h \ @@ -460,12 +425,12 @@ if !ENABLE_MSVC_ONLY libmonoruntime_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources) # Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. -libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES) $(GLOBALIZATION_SHIM_DEFINES) @CXX_ADD_CFLAGS@ +libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES) @CXX_ADD_CFLAGS@ libmonoruntime_la_LIBADD = libmonoruntime-config.la $(culture_libraries) $(support_libraries) $(shim_libraries) libmonoruntimesgen_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(sgen_sources) # Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. -libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES) $(GLOBALIZATION_SHIM_DEFINES) @CXX_ADD_CFLAGS@ +libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES) @CXX_ADD_CFLAGS@ libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la $(culture_libraries) $(support_libraries) $(shim_libraries) endif # !ENABLE_MSVC_ONLY diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 92888ed7863..f2d62d217a6 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -93,18 +93,11 @@ typedef struct gchar *filename; } RuntimeConfig; -#ifndef ENABLE_NETCORE static gunichar2 process_guid [36]; static gboolean process_guid_set = FALSE; -#endif static gboolean no_exec = FALSE; -#ifdef ENABLE_NETCORE -static int n_appctx_props; -static gunichar2 **appctx_keys; -static gunichar2 **appctx_values; -#endif static const char * mono_check_corlib_version_internal (void); @@ -135,21 +128,13 @@ mono_domain_asmctx_from_path (const char *fname, MonoAssembly *requesting_assemb static void add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht); -#if ENABLE_NETCORE - -static void -add_assembly_to_alc (MonoAssemblyLoadContext *alc, MonoAssembly *ass); - -#endif -#ifndef ENABLE_NETCORE static MonoAppDomainHandle mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHandle setup, MonoError *error); static MonoDomain * mono_domain_create_appdomain_checked (char *friendly_name, char *configuration_file, MonoError *error); -#endif static void mono_context_set_default_context (MonoDomain *domain); @@ -161,20 +146,9 @@ static MonoLoadFunc load_function = NULL; /* Lazy class loading functions */ static GENERATE_GET_CLASS_WITH_CACHE (assembly, "System.Reflection", "Assembly"); -#ifdef ENABLE_NETCORE -static GENERATE_GET_CLASS_WITH_CACHE (app_context, "System", "AppContext"); -#endif -#ifndef ENABLE_NETCORE GENERATE_GET_CLASS_WITH_CACHE (appdomain, MONO_APPDOMAIN_CLASS_NAME_SPACE, MONO_APPDOMAIN_CLASS_NAME); GENERATE_GET_CLASS_WITH_CACHE (appdomain_setup, MONO_APPDOMAIN_SETUP_CLASS_NAME_SPACE, MONO_APPDOMAIN_SETUP_CLASS_NAME); -#else -MonoClass* -mono_class_get_appdomain_class (void) -{ - return mono_defaults.object_class; -} -#endif static MonoDomain * @@ -335,36 +309,28 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT mono_install_assembly_search_hook_v2 (mono_domain_assembly_postload_search, GUINT_TO_POINTER (FALSE), FALSE, TRUE, FALSE); mono_install_assembly_load_hook_v2 (mono_domain_fire_assembly_load, NULL, FALSE); -#ifndef ENABLE_NETCORE // refonly hooks mono_install_assembly_preload_hook_v2 (mono_domain_assembly_preload, GUINT_TO_POINTER (TRUE), TRUE, FALSE); mono_install_assembly_search_hook_v2 (mono_domain_assembly_search, GUINT_TO_POINTER (TRUE), TRUE, FALSE, FALSE); mono_install_assembly_search_hook_v2 (mono_domain_assembly_postload_search, GUINT_TO_POINTER (TRUE), TRUE, TRUE, FALSE); mono_install_assembly_asmctx_from_path_hook (mono_domain_asmctx_from_path, NULL); -#endif mono_thread_init (start_cb, attach_cb); if (!mono_runtime_get_no_exec ()) { MonoClass *klass; -#ifndef ENABLE_NETCORE klass = mono_class_get_appdomain_setup_class (); MonoAppDomainSetupHandle setup; setup = MONO_HANDLE_CAST (MonoAppDomainSetup, mono_object_new_pinned_handle (domain, klass, error)); goto_if_nok (error, exit); -#endif klass = mono_class_get_appdomain_class (); ad = MONO_HANDLE_CAST (MonoAppDomain, mono_object_new_pinned_handle (domain, klass, error)); goto_if_nok (error, exit); -#ifndef ENABLE_NETCORE MONO_HANDLE_SETVAL (ad, data, MonoDomain*, domain); -#endif domain->domain = MONO_HANDLE_RAW (ad); -#ifndef ENABLE_NETCORE domain->setup = MONO_HANDLE_RAW (setup); -#endif } mono_thread_internal_attach (domain); @@ -388,16 +354,10 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT mono_gc_init (); /* contexts use GC handles, so they must be initialized after the GC */ -#ifndef ENABLE_NETCORE mono_context_init_checked (domain, error); goto_if_nok (error, exit); mono_context_set_default_context (domain); -#endif -#ifdef ENABLE_NETCORE - if (!mono_runtime_get_no_exec ()) - mono_runtime_install_appctx_properties (); -#endif mono_network_init (); mono_console_init (); @@ -608,7 +568,6 @@ mono_runtime_quit_internal (void) quit_function (mono_get_root_domain (), NULL); } -#ifndef ENABLE_NETCORE /** * mono_domain_create_appdomain: @@ -644,7 +603,6 @@ mono_domain_create_appdomain_checked (char *friendly_name, char *configuration_f error_init (error); MonoDomain *result = NULL; -#ifndef ENABLE_NETCORE MonoClass *klass = mono_class_get_appdomain_setup_class (); MonoAppDomainSetupHandle setup = MONO_HANDLE_CAST (MonoAppDomainSetup, mono_object_new_handle (mono_domain_get (), klass, error)); goto_if_nok (error, leave); @@ -656,14 +614,9 @@ mono_domain_create_appdomain_checked (char *friendly_name, char *configuration_f config_file = MONO_HANDLE_NEW (MonoString, NULL); } MONO_HANDLE_SET (setup, configuration_file, config_file); -#endif MonoAppDomainHandle ad; -#ifndef ENABLE_NETCORE ad = mono_domain_create_appdomain_internal (friendly_name, setup, error); -#else - ad = MONO_HANDLE_CAST (MonoAppDomain, NULL_HANDLE); -#endif goto_if_nok (error, leave); result = mono_domain_from_appdomain_handle (ad); @@ -671,7 +624,6 @@ leave: HANDLE_FUNCTION_RETURN_VAL (result); } -#endif /** * mono_domain_set_config: @@ -688,7 +640,6 @@ leave: void mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *config_file_name) { -#ifndef ENABLE_NETCORE HANDLE_FUNCTION_ENTER (); MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); @@ -696,12 +647,8 @@ mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *co mono_error_cleanup (error); MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN (); -#else - g_assert_not_reached (); -#endif } -#ifndef ENABLE_NETCORE gboolean mono_domain_set_config_checked (MonoDomain *domain, const char *base_dir, const char *config_file_name, MonoError *error) { @@ -717,9 +664,7 @@ mono_domain_set_config_checked (MonoDomain *domain, const char *base_dir, const leave: return is_ok (error); } -#endif -#ifndef ENABLE_NETCORE static MonoAppDomainSetupHandle copy_app_domain_setup (MonoDomain *domain, MonoAppDomainSetupHandle setup, MonoError *error) { @@ -781,9 +726,7 @@ copy_app_domain_setup (MonoDomain *domain, MonoAppDomainSetupHandle setup, MonoE leave: HANDLE_FUNCTION_RETURN_REF (MonoAppDomainSetup, result); } -#endif -#ifndef ENABLE_NETCORE static MonoAppDomainHandle mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHandle setup, MonoError *error) { @@ -856,7 +799,6 @@ mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHa leave: HANDLE_FUNCTION_RETURN_REF (MonoAppDomain, result); } -#endif /** * mono_domain_has_type_resolve: @@ -871,9 +813,6 @@ mono_domain_has_type_resolve (MonoDomain *domain) if (!domain->domain) return FALSE; -#ifdef ENABLE_NETCORE - return TRUE; -#else MonoObject *o; MONO_STATIC_POINTER_INIT (MonoClassField, field) @@ -885,7 +824,6 @@ mono_domain_has_type_resolve (MonoDomain *domain) mono_field_get_value_internal ((MonoObject*)(domain->domain), field, &o); return o != NULL; -#endif } /** @@ -917,13 +855,8 @@ mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *typebu goto_if_nok (error, exit); ret = mono_domain_try_type_resolve_name (domain, NULL, name_handle, error); } else { -#ifndef ENABLE_NETCORE MONO_HANDLE_DCL (MonoObject, typebuilder); ret = mono_domain_try_type_resolve_typebuilder (domain, MONO_HANDLE_CAST (MonoReflectionTypeBuilder, typebuilder), error); -#else - // TODO: make this work on netcore when working on SRE.TypeBuilder - g_assert_not_reached (); -#endif } exit: @@ -931,58 +864,6 @@ exit: HANDLE_FUNCTION_RETURN_OBJ (ret); } -#ifdef ENABLE_NETCORE -MonoReflectionAssemblyHandle -mono_domain_try_type_resolve_name (MonoDomain *domain, MonoAssembly *assembly, MonoStringHandle name, MonoError *error) -{ - MonoObjectHandle ret; - MonoReflectionAssemblyHandle assembly_handle; - - HANDLE_FUNCTION_ENTER (); - - MONO_STATIC_POINTER_INIT (MonoMethod, method) - - static gboolean inited; - // avoid repeatedly calling mono_class_get_method_from_name_checked - if (!inited) { - ERROR_DECL (local_error); - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - method = mono_class_get_method_from_name_checked (alc_class, "OnTypeResolve", -1, 0, local_error); - mono_error_cleanup (local_error); - inited = TRUE; - } - - MONO_STATIC_POINTER_INIT_END (MonoMethod, method) - - if (!method) - goto return_null; - - g_assert (domain); - g_assert (MONO_HANDLE_BOOL (name)); - - if (mono_runtime_get_no_exec ()) - goto return_null; - - if (assembly) { - assembly_handle = mono_assembly_get_object_handle (domain, assembly, error); - goto_if_nok (error, return_null); - } - - gpointer args [2]; - args [0] = assembly ? MONO_HANDLE_RAW (assembly_handle) : NULL; - args [1] = MONO_HANDLE_RAW (name); - ret = mono_runtime_try_invoke_handle (method, NULL_HANDLE, args, error); - goto_if_nok (error, return_null); - goto exit; - -return_null: - ret = NULL_HANDLE; - -exit: - HANDLE_FUNCTION_RETURN_REF (MonoReflectionAssembly, MONO_HANDLE_CAST (MonoReflectionAssembly, ret)); -} -#else /** * mono_class_get_appdomain_do_type_resolve_method: * @@ -1102,7 +983,6 @@ return_null: exit: HANDLE_FUNCTION_RETURN_REF (MonoReflectionAssembly, MONO_HANDLE_CAST (MonoReflectionAssembly, ret)); } -#endif /** * mono_domain_owns_vtable_slot: @@ -1131,7 +1011,6 @@ mono_domain_set_fast (MonoDomain *domain, gboolean force) return TRUE; } -#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_AppDomain_GetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoError *error) { @@ -1201,7 +1080,6 @@ ves_icall_System_AppDomain_SetData (MonoAppDomainHandle ad, MonoStringHandle nam mono_domain_unlock (add); } -#ifndef ENABLE_NETCORE MonoAppDomainSetupHandle ves_icall_System_AppDomain_getSetup (MonoAppDomainHandle ad, MonoError *error) { @@ -1212,7 +1090,6 @@ ves_icall_System_AppDomain_getSetup (MonoAppDomainHandle ad, MonoError *error) return MONO_HANDLE_NEW (MonoAppDomainSetup, domain->setup); } -#endif MonoStringHandle ves_icall_System_AppDomain_getFriendlyName (MonoAppDomainHandle ad, MonoError *error) @@ -1250,9 +1127,7 @@ ves_icall_System_CLRConfig_CheckThrowUnobservedTaskExceptions (MonoError *error) return domain->throw_unobserved_task_exceptions; } -#endif -#ifndef ENABLE_NETCORE static char* get_attribute_value (const gchar **attribute_names, const gchar **attribute_values, @@ -1391,9 +1266,7 @@ mono_domain_set_options_from_config (MonoDomain *domain) g_free (config_file_name); g_free (config_file_path); } -#endif -#ifndef ENABLE_NETCORE MonoAppDomainHandle ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoAppDomainSetupHandle setup, MonoError *error) { @@ -1412,7 +1285,6 @@ ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoApp #endif return ad; } -#endif static gboolean add_assembly_to_array (MonoDomain *domain, MonoArrayHandle dest, int dest_idx, MonoAssembly* assm, MonoError *error) @@ -1446,21 +1318,12 @@ leave: return res; } -#ifdef ENABLE_NETCORE -MonoArrayHandle -ves_icall_System_Runtime_Loader_AssemblyLoadContext_InternalGetLoadedAssemblies (MonoError *error) -{ - MonoDomain *domain = mono_domain_get (); - return get_assembly_array_from_domain (domain, FALSE, error); -} -#else MonoArrayHandle ves_icall_System_AppDomain_GetAssemblies (MonoAppDomainHandle ad, MonoBoolean refonly, MonoError *error) { MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data); return get_assembly_array_from_domain (domain, refonly, error); } -#endif MonoAssembly* mono_try_assembly_resolve (MonoAssemblyLoadContext *alc, const char *fname_raw, MonoAssembly *requesting, gboolean refonly, MonoError *error) @@ -1486,7 +1349,6 @@ mono_try_assembly_resolve_handle (MonoAssemblyLoadContext *alc, MonoStringHandle if (mono_runtime_get_no_exec ()) goto leave; -#ifndef ENABLE_NETCORE static MonoMethod *method; MonoBoolean isrefonly; @@ -1526,42 +1388,6 @@ mono_try_assembly_resolve_handle (MonoAssemblyLoadContext *alc, MonoStringHandle ret = NULL; goto leave; } -#else - MONO_STATIC_POINTER_INIT (MonoMethod, method) - - ERROR_DECL (local_error); - static gboolean inited; - if (!inited) { - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - method = mono_class_get_method_from_name_checked (alc_class, "OnAssemblyResolve", -1, 0, local_error); - inited = TRUE; - } - mono_error_cleanup (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, method) - - if (!method) { - ret = NULL; - goto leave; - } - - MonoReflectionAssemblyHandle requesting_handle; - if (requesting) { - requesting_handle = mono_assembly_get_object_handle (domain, requesting, error); - goto_if_nok (error, leave); - } - - gpointer params [2]; - params [0] = requesting ? MONO_HANDLE_RAW (requesting_handle) : NULL; - params [1] = MONO_HANDLE_RAW (fname); - MonoReflectionAssemblyHandle result; - result = MONO_HANDLE_CAST (MonoReflectionAssembly, mono_runtime_try_invoke_handle (method, NULL_HANDLE, params, error)); - goto_if_nok (error, leave); - - if (MONO_HANDLE_BOOL (result)) - ret = MONO_HANDLE_GETVAL (result, assembly); -#endif leave: g_free (filename); @@ -1619,7 +1445,6 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht) mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly %s[%p] added to domain %s, ref_count=%d", ass->aname.name, ass, domain->friendly_name, ass->ref_count); } -#ifndef ENABLE_NETCORE if (ass->image->references) { for (int i = 0; i < ass->image->nreferences; i++) { MonoAssembly *ref = ass->image->references [i]; @@ -1629,7 +1454,6 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht) } } } -#endif if (destroy_ht) g_hash_table_destroy (ht); @@ -1638,30 +1462,6 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht) /* * LOCKING: assumes the ALC's assemblies lock is taken */ -#ifdef ENABLE_NETCORE -static void -add_assembly_to_alc (MonoAssemblyLoadContext *alc, MonoAssembly *ass) -{ - GSList *tmp; - - g_assert (ass != NULL); - - if (!ass->aname.name) - return; - - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - if (tmp->data == ass) { - return; - } - } - - mono_assembly_addref (ass); - // Prepending here will break the test suite with frequent InvalidCastExceptions, so we have to append - alc->loaded_assemblies = g_slist_append (alc->loaded_assemblies, ass); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly %s[%p] added to ALC (%p), ref_count=%d", ass->aname.name, ass, (gpointer)alc, ass->ref_count); - -} -#endif static void mono_domain_fire_assembly_load_event (MonoDomain *domain, MonoAssembly *assembly, MonoError *error) @@ -1671,31 +1471,6 @@ mono_domain_fire_assembly_load_event (MonoDomain *domain, MonoAssembly *assembly g_assert (domain); g_assert (assembly); -#ifdef ENABLE_NETCORE - MONO_STATIC_POINTER_INIT (MonoMethod, method) - - static gboolean inited; - if (!inited) { - ERROR_DECL (local_error); - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - method = mono_class_get_method_from_name_checked (alc_class, "OnAssemblyLoad", -1, 0, local_error); - mono_error_cleanup (local_error); - inited = TRUE; - } - - MONO_STATIC_POINTER_INIT_END (MonoMethod, method) - if (!method) - goto exit; - - MonoReflectionAssemblyHandle assembly_handle; - assembly_handle = mono_assembly_get_object_handle (domain, assembly, error); - goto_if_nok (error, exit); - - gpointer args [1]; - args [0] = MONO_HANDLE_RAW (assembly_handle); - mono_runtime_try_invoke_handle (method, NULL_HANDLE, args, error); -#else MonoObjectHandle appdomain = MONO_HANDLE_NEW (MonoObject, &domain->domain->mbr.obj); MonoClass *klass = mono_handle_class (appdomain); @@ -1723,7 +1498,6 @@ mono_domain_fire_assembly_load_event (MonoDomain *domain, MonoAssembly *assembly void *params [1]; params [0] = MONO_HANDLE_RAW (reflection_assembly); mono_runtime_invoke_handle_void (assembly_load_method, appdomain, params, error); -#endif exit: HANDLE_FUNCTION_RETURN (); @@ -1747,14 +1521,7 @@ mono_domain_fire_assembly_load (MonoAssemblyLoadContext *alc, MonoAssembly *asse mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Loading assembly %s (%p) into domain %s (%p) and ALC %p", assembly->aname.name, assembly, domain->friendly_name, domain, alc); mono_domain_assemblies_lock (domain); -#ifdef ENABLE_NETCORE - mono_alc_assemblies_lock (alc); -#endif add_assemblies_to_domain (domain, assembly, NULL); -#ifdef ENABLE_NETCORE - add_assembly_to_alc (alc, assembly); - mono_alc_assemblies_unlock (alc); -#endif mono_domain_assemblies_unlock (domain); if (assembly->context.kind != MONO_ASMCTX_INTERNAL) @@ -1779,7 +1546,6 @@ mono_domain_asmctx_from_path (const char *fname, MonoAssembly *requesting_assemb return FALSE; } -#ifndef ENABLE_NETCORE /* * LOCKING: Acquires the domain assemblies lock. */ @@ -1930,7 +1696,6 @@ exit: mono_domain_assemblies_unlock (domain); HANDLE_FUNCTION_RETURN (); } -#endif #ifdef DISABLE_SHADOW_COPY gboolean @@ -2273,9 +2038,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) char *shadow_dir; gint32 copy_error; -#ifndef ENABLE_NETCORE set_domain_search_path (domain); -#endif if (!mono_is_shadow_copy_enabled (domain, dir_name)) { g_free (dir_name); @@ -2398,7 +2161,6 @@ mono_domain_from_appdomain (MonoAppDomain *appdomain_raw) MonoDomain * mono_domain_from_appdomain_handle (MonoAppDomainHandle appdomain) { -#ifndef ENABLE_NETCORE HANDLE_FUNCTION_ENTER (); MonoDomain *dom = NULL; if (MONO_HANDLE_IS_NULL (appdomain)) @@ -2414,9 +2176,6 @@ mono_domain_from_appdomain_handle (MonoAppDomainHandle appdomain) leave: HANDLE_FUNCTION_RETURN_VAL (dom); -#else - return mono_get_root_domain (); -#endif } @@ -2499,28 +2258,6 @@ real_load (gchar **search_path, const gchar *culture, const gchar *name, const M return result; } -#ifdef ENABLE_NETCORE -static char * -get_app_context_base_directory (MonoError *error) -{ - MONO_STATIC_POINTER_INIT (MonoMethod, get_basedir) - - ERROR_DECL (local_error); - MonoClass *app_context = mono_class_get_app_context_class (); - g_assert (app_context); - get_basedir = mono_class_get_method_from_name_checked (app_context, "get_BaseDirectory", -1, 0, local_error); - mono_error_assert_ok (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, get_basedir) - - HANDLE_FUNCTION_ENTER (); - - MonoStringHandle result = MONO_HANDLE_CAST (MonoString, mono_runtime_try_invoke_handle (get_basedir, NULL_HANDLE, NULL, error)); - char *base_dir = mono_string_handle_to_utf8 (result, error); - - HANDLE_FUNCTION_RETURN_VAL (base_dir); -} -#endif /* * Try loading the assembly from ApplicationBase and PrivateBinPath @@ -2538,14 +2275,8 @@ mono_domain_assembly_preload (MonoAssemblyLoadContext *alc, { MonoDomain *domain = mono_alc_domain (alc); MonoAssembly *result = NULL; -#ifdef ENABLE_NETCORE - g_assert (alc); - g_assert (domain == mono_domain_get ()); -#endif -#ifndef ENABLE_NETCORE set_domain_search_path (domain); -#endif MonoAssemblyCandidatePredicate predicate = NULL; void* predicate_ud = NULL; @@ -2558,20 +2289,6 @@ mono_domain_assembly_preload (MonoAssemblyLoadContext *alc, req.request.predicate = predicate; req.request.predicate_ud = predicate_ud; -#ifdef ENABLE_NETCORE - if (!mono_runtime_get_no_exec ()) { - char *search_path [2]; - search_path [1] = NULL; - - char *base_dir = get_app_context_base_directory (error); - search_path [0] = base_dir; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Domain (%p) ApplicationBase is %s", domain, base_dir); - - result = real_load (search_path, aname->culture, aname->name, &req); - - g_free (base_dir); - } -#else if (domain->search_path && domain->search_path [0] != NULL) { if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY)) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Domain %s search path is:", domain->friendly_name); @@ -2583,7 +2300,6 @@ mono_domain_assembly_preload (MonoAssemblyLoadContext *alc, } result = real_load (domain->search_path, aname->culture, aname->name, &req); } -#endif if (result == NULL && assemblies_path && assemblies_path [0] != NULL) { result = real_load (assemblies_path, aname->culture, aname->name, &req); @@ -2607,22 +2323,6 @@ mono_domain_assembly_search (MonoAssemblyLoadContext *alc, MonoAssembly *request GSList *tmp; MonoAssembly *ass; -#ifdef ENABLE_NETCORE - const MonoAssemblyNameEqFlags eq_flags = MONO_ANAME_EQ_IGNORE_PUBKEY | MONO_ANAME_EQ_IGNORE_VERSION | MONO_ANAME_EQ_IGNORE_CASE; - - mono_alc_assemblies_lock (alc); - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - ass = (MonoAssembly *)tmp->data; - g_assert (ass != NULL); - // FIXME: Can dynamic assemblies match here for netcore? - if (assembly_is_dynamic (ass) || !mono_assembly_names_equal_flags (aname, &ass->aname, eq_flags)) - continue; - - mono_alc_assemblies_unlock (alc); - return ass; - } - mono_alc_assemblies_unlock (alc); -#else MonoDomain *domain = mono_alc_domain (alc); const gboolean strong_name = aname->public_key_token[0] != 0; @@ -2645,77 +2345,11 @@ mono_domain_assembly_search (MonoAssemblyLoadContext *alc, MonoAssembly *request return ass; } mono_domain_assemblies_unlock (domain); -#endif return NULL; } -#if ENABLE_NETCORE -MonoReflectionAssemblyHandle -ves_icall_System_Reflection_Assembly_InternalLoad (MonoStringHandle name_handle, MonoStackCrawlMark *stack_mark, gpointer load_Context, MonoError *error) -{ - error_init (error); - MonoAssembly *ass = NULL; - MonoAssemblyName aname; - MonoAssemblyByNameRequest req; - MonoAssemblyContextKind asmctx; - MonoImageOpenStatus status = MONO_IMAGE_OK; - gboolean parsed; - char *name; - - MonoAssembly *requesting_assembly = mono_runtime_get_caller_from_stack_mark (stack_mark); - MonoAssemblyLoadContext *alc = (MonoAssemblyLoadContext *)load_Context; - if (!alc) - alc = mono_assembly_get_alc (requesting_assembly); - if (!alc) - g_assert_not_reached (); - - MonoDomain *domain = mono_alc_domain (alc); - g_assert (alc); - asmctx = MONO_ASMCTX_DEFAULT; - mono_assembly_request_prepare_byname (&req, asmctx, alc); - req.basedir = NULL; - /* Everything currently goes through this function, and the postload hook (aka the AppDomain.AssemblyResolve event) - * is triggered under some scenarios. It's not completely obvious to me in what situations (if any) this should be disabled, - * other than for corlib satellite assemblies (which I've dealt with further down the call stack). - */ - //req.no_postload_search = TRUE; - req.requesting_assembly = requesting_assembly; - - name = mono_string_handle_to_utf8 (name_handle, error); - goto_if_nok (error, fail); - parsed = mono_assembly_name_parse (name, &aname); - g_free (name); - if (!parsed) - goto fail; - - MonoAssemblyCandidatePredicate predicate; - void* predicate_ud; - predicate = NULL; - predicate_ud = NULL; - if (mono_loader_get_strict_assembly_name_check ()) { - predicate = &mono_assembly_candidate_predicate_sn_same_name; - predicate_ud = &aname; - } - req.request.predicate = predicate; - req.request.predicate_ud = predicate_ud; - - ass = mono_assembly_request_byname (&aname, &req, &status); - if (!ass) - goto fail; - - MonoReflectionAssemblyHandle refass; - refass = mono_assembly_get_object_handle (domain, ass, error); - goto_if_nok (error, fail); - return refass; - -fail: - return MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); -} -#endif - -#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoolean refOnly, MonoStackCrawlMark *stack_mark, MonoError *error) { @@ -2760,7 +2394,6 @@ leave: g_free (name); return result; } -#endif static MonoAssembly * @@ -2799,7 +2432,6 @@ leave: HANDLE_FUNCTION_RETURN_VAL (ass); } -#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_LoadFile_internal (MonoStringHandle fname, MonoStackCrawlMark *stack_mark, MonoError *error) { @@ -2814,46 +2446,10 @@ ves_icall_System_Reflection_Assembly_LoadFile_internal (MonoStringHandle fname, leave: return result; } -#else -MonoReflectionAssemblyHandle -ves_icall_System_Runtime_Loader_AssemblyLoadContext_InternalLoadFile (gpointer alc_ptr, MonoStringHandle fname, MonoStackCrawlMark *stack_mark, MonoError *error) -{ - MonoReflectionAssemblyHandle result = MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); - MonoAssemblyLoadContext *alc = (MonoAssemblyLoadContext *)alc_ptr; - MonoDomain *domain = mono_alc_domain (alc); - - MonoAssembly *executing_assembly; - executing_assembly = mono_runtime_get_caller_from_stack_mark (stack_mark); - MonoAssembly *ass = mono_alc_load_file (alc, fname, executing_assembly, mono_alc_is_default (alc) ? MONO_ASMCTX_LOADFROM : MONO_ASMCTX_INDIVIDUAL, error); - goto_if_nok (error, leave); - - result = mono_assembly_get_object_handle (domain, ass, error); - -leave: - return result; -} -#endif static MonoAssembly* mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *raw_assembly, guint32 raw_assembly_len, guint8 *raw_symbol_data, guint32 raw_symbol_len, gboolean refonly, MonoError *error); -#ifdef ENABLE_NETCORE -MonoReflectionAssemblyHandle -ves_icall_System_Runtime_Loader_AssemblyLoadContext_InternalLoadFromStream (gpointer native_alc, gpointer raw_assembly_ptr, gint32 raw_assembly_len, gpointer raw_symbols_ptr, gint32 raw_symbols_len, MonoError *error) -{ - MonoAssemblyLoadContext *alc = (MonoAssemblyLoadContext *)native_alc; - MonoDomain *domain = mono_alc_domain (alc); - MonoReflectionAssemblyHandle result = MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); - MonoAssembly *assm = NULL; - assm = mono_alc_load_raw_bytes (alc, (guint8 *)raw_assembly_ptr, raw_assembly_len, (guint8 *)raw_symbols_ptr, raw_symbols_len, FALSE, error); - goto_if_nok (error, leave); - - result = mono_assembly_get_object_handle (domain, assm, error); - -leave: - return result; -} -#else MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, MonoArrayHandle raw_assembly, @@ -2886,7 +2482,6 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, leave: return refass; } -#endif /* ENABLE_NETCORE */ static MonoAssembly* mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, guint32 raw_assembly_len, guint8 *raw_symbol_data, guint32 raw_symbol_len, gboolean refonly, MonoError *error) @@ -2903,7 +2498,6 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu if (raw_symbol_data) mono_debug_open_image_from_memory (image, raw_symbol_data, raw_symbol_len); -#ifndef ENABLE_NETCORE MonoAssembly* redirected_asm = NULL; MonoImageOpenStatus new_status = MONO_IMAGE_OK; // http://blogs.microsoft.co.il/sasha/2010/06/09/assemblyreflectiononlyload-ignores-assembly-binding-redirects/ @@ -2916,7 +2510,6 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu mono_error_set_bad_image_by_name (error, "In Memory assembly", "0x%p was assembly binding redirected to another assembly that failed to load", assembly_data); return ass; } -#endif MonoAssemblyLoadRequest req; mono_assembly_request_prepare_load (&req, refonly? MONO_ASMCTX_REFONLY : MONO_ASMCTX_INDIVIDUAL, alc); @@ -2934,7 +2527,6 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu return ass; } -#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandle assRef, MonoObjectHandle evidence, MonoBoolean refOnly, MonoStackCrawlMark *stack_mark, MonoError *error) { @@ -3189,7 +2781,6 @@ ves_icall_System_AppDomain_InternalGetProcessGuid (MonoStringHandle newguid, Mon mono_domain_unlock (mono_root_domain); return newguid; } -#endif /** * mono_domain_is_unloading: @@ -3203,7 +2794,6 @@ mono_domain_is_unloading (MonoDomain *domain) return FALSE; } -#ifndef ENABLE_NETCORE static void clear_cached_vtable (MonoVTable *vtable) @@ -3531,55 +3121,4 @@ exit: HANDLE_FUNCTION_RETURN (); } -#endif /* ENABLE_NETCORE */ - -#ifdef ENABLE_NETCORE - -/* Remember properties so they can be be installed in AppContext during runtime init */ -void -mono_runtime_register_appctx_properties (int nprops, const char **keys, const char **values) -{ - n_appctx_props = nprops; - appctx_keys = g_new0 (gunichar2*, nprops); - appctx_values = g_new0 (gunichar2*, nprops); - for (int i = 0; i < nprops; ++i) { - appctx_keys [i] = g_utf8_to_utf16 (keys [i], strlen (keys [i]), NULL, NULL, NULL); - appctx_values [i] = g_utf8_to_utf16 (values [i], strlen (values [i]), NULL, NULL, NULL); - } -} - -static GENERATE_GET_CLASS_WITH_CACHE (appctx, "System", "AppContext") - -/* Install properties into AppContext */ -void -mono_runtime_install_appctx_properties (void) -{ - ERROR_DECL (error); - gpointer args [3]; - - MonoMethod *setup = mono_class_get_method_from_name_checked (mono_class_get_appctx_class (), "Setup", 3, 0, error); - g_assert (setup); - - // FIXME: TRUSTED_PLATFORM_ASSEMBLIES is very large - - /* internal static unsafe void Setup(char** pNames, char** pValues, int count) */ - args [0] = appctx_keys; - args [1] = appctx_values; - args [2] = &n_appctx_props; - - mono_runtime_invoke_checked (setup, NULL, args, error); - mono_error_assert_ok (error); - - /* No longer needed */ - for (int i = 0; i < n_appctx_props; ++i) { - g_free (appctx_keys [i]); - g_free (appctx_values [i]); - } - g_free (appctx_keys); - g_free (appctx_values); - appctx_keys = NULL; - appctx_values = NULL; -} - -#endif diff --git a/mono/metadata/assembly-internals.h b/mono/metadata/assembly-internals.h index 5b317165ec7..8a0f75dba1c 100644 --- a/mono/metadata/assembly-internals.h +++ b/mono/metadata/assembly-internals.h @@ -11,11 +11,7 @@ #include #include -#ifndef ENABLE_NETCORE #define MONO_ASSEMBLY_CORLIB_NAME "mscorlib" -#else -#define MONO_ASSEMBLY_CORLIB_NAME "System.Private.CoreLib" -#endif #define MONO_ASSEMBLY_RESOURCE_SUFFIX ".resources" #define MONO_ASSEMBLY_CORLIB_RESOURCE_NAME (MONO_ASSEMBLY_CORLIB_NAME MONO_ASSEMBLY_RESOURCE_SUFFIX) @@ -139,10 +135,8 @@ mono_assembly_candidate_predicate_sn_same_name (MonoAssembly *candidate, gpointe gboolean mono_assembly_check_name_match (MonoAssemblyName *wanted_name, MonoAssemblyName *candidate_name); -#ifndef ENABLE_NETCORE MonoAssembly* mono_assembly_binding_applies_to_image (MonoAssemblyLoadContext *alc, MonoImage* image, MonoImageOpenStatus *status); -#endif MonoAssembly * mono_assembly_loaded_internal (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, gboolean refonly); diff --git a/mono/metadata/assembly-load-context.c b/mono/metadata/assembly-load-context.c index 3f5066dbed7..00c48712ea3 100644 --- a/mono/metadata/assembly-load-context.c +++ b/mono/metadata/assembly-load-context.c @@ -1,416 +1,5 @@ #include "config.h" #include "mono/utils/mono-compiler.h" -#ifdef ENABLE_NETCORE // MonoAssemblyLoadContext support only in netcore Mono - -#include "mono/metadata/assembly.h" -#include "mono/metadata/domain-internals.h" -#include "mono/metadata/exception-internals.h" -#include "mono/metadata/icall-decl.h" -#include "mono/metadata/loader-internals.h" -#include "mono/metadata/loaded-images-internals.h" -#include "mono/metadata/mono-private-unstable.h" -#include "mono/utils/mono-error-internals.h" -#include "mono/utils/mono-logger-internals.h" - -GENERATE_GET_CLASS_WITH_CACHE (assembly_load_context, "System.Runtime.Loader", "AssemblyLoadContext"); - -static void -mono_alc_init (MonoAssemblyLoadContext *alc, MonoDomain *domain, gboolean collectible) -{ - MonoLoadedImages *li = g_new0 (MonoLoadedImages, 1); - mono_loaded_images_init (li, alc); - alc->domain = domain; - alc->loaded_images = li; - alc->loaded_assemblies = NULL; - alc->memory_manager = mono_mem_manager_create_singleton (alc, domain, collectible); - alc->generic_memory_managers = g_ptr_array_new (); - mono_coop_mutex_init (&alc->memory_managers_lock); - alc->unloading = FALSE; - alc->collectible = collectible; - alc->pinvoke_scopes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - mono_coop_mutex_init (&alc->assemblies_lock); - mono_coop_mutex_init (&alc->pinvoke_lock); -} - -static MonoAssemblyLoadContext * -mono_alc_create (MonoDomain *domain, gboolean is_default, gboolean collectible) -{ - MonoAssemblyLoadContext *alc = NULL; - - mono_domain_alcs_lock (domain); - if (is_default && domain->default_alc) - goto leave; - - alc = g_new0 (MonoAssemblyLoadContext, 1); - mono_alc_init (alc, domain, collectible); - - domain->alcs = g_slist_prepend (domain->alcs, alc); - if (is_default) - domain->default_alc = alc; - -leave: - mono_domain_alcs_unlock (domain); - return alc; -} - -void -mono_alc_create_default (MonoDomain *domain) -{ - if (domain->default_alc) - return; - mono_alc_create (domain, TRUE, FALSE); -} - -MonoAssemblyLoadContext * -mono_alc_create_individual (MonoDomain *domain, MonoGCHandle this_gchandle, gboolean collectible, MonoError *error) -{ - MonoAssemblyLoadContext *alc = mono_alc_create (domain, FALSE, collectible); - - alc->gchandle = this_gchandle; - - return alc; -} - -static void -mono_alc_cleanup_assemblies (MonoAssemblyLoadContext *alc) -{ - // The minimum refcount on assemblies is 2: one for the domain and one for the ALC. - // The domain refcount might be less than optimal on netcore, but its removal is too likely to cause issues for now. - GSList *tmp; - MonoDomain *domain = alc->domain; - - // Remove the assemblies from domain_assemblies - mono_domain_assemblies_lock (domain); - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - MonoAssembly *assembly = (MonoAssembly *)tmp->data; - domain->domain_assemblies = g_slist_remove (domain->domain_assemblies, assembly); - mono_assembly_decref (assembly); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Unloading ALC [%p], removing assembly %s[%p] from domain_assemblies, ref_count=%d\n", alc, assembly->aname.name, assembly, assembly->ref_count); - } - mono_domain_assemblies_unlock (domain); - - // Release the GC roots - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - MonoAssembly *assembly = (MonoAssembly *)tmp->data; - mono_assembly_release_gc_roots (assembly); - } - - // Close dynamic assemblies - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - MonoAssembly *assembly = (MonoAssembly *)tmp->data; - if (!assembly->image || !image_is_dynamic (assembly->image)) - continue; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Unloading ALC [%p], dynamic assembly %s[%p], ref_count=%d", domain, assembly->aname.name, assembly, assembly->ref_count); - if (!mono_assembly_close_except_image_pools (assembly)) - tmp->data = NULL; - } - - // Close the remaining assemblies - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - MonoAssembly *assembly = (MonoAssembly *)tmp->data; - if (!assembly) - continue; - if (!assembly->image || image_is_dynamic (assembly->image)) - continue; - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Unloading ALC [%p], non-dynamic assembly %s[%p], ref_count=%d", domain, assembly->aname.name, assembly, assembly->ref_count); - if (!mono_assembly_close_except_image_pools (assembly)) - tmp->data = NULL; - } - - // Complete the second closing pass on lingering assemblies - for (tmp = alc->loaded_assemblies; tmp; tmp = tmp->next) { - MonoAssembly *assembly = (MonoAssembly *)tmp->data; - if (assembly) - mono_assembly_close_finish (assembly); - } - - // Free the loaded_assemblies - g_slist_free (alc->loaded_assemblies); - alc->loaded_assemblies = NULL; - - mono_coop_mutex_destroy (&alc->assemblies_lock); - - mono_loaded_images_free (alc->loaded_images); - alc->loaded_images = NULL; - - // TODO: free mempool stuff/jit info tables, see domain freeing for an example -} - -static void -mono_alc_cleanup (MonoAssemblyLoadContext *alc) -{ - MonoDomain *domain = alc->domain; - - g_assert (alc != mono_domain_default_alc (domain)); - g_assert (alc->collectible == TRUE); - - // TODO: alc unloading profiler event - - // Remove from domain list - mono_domain_alcs_lock (domain); - domain->alcs = g_slist_remove (domain->alcs, alc); - mono_domain_alcs_unlock (domain); - - mono_alc_cleanup_assemblies (alc); - - mono_mem_manager_free_singleton (alc->memory_manager, FALSE); - alc->memory_manager = NULL; - - /*for (int i = 0; i < alc->generic_memory_managers->len; i++) { - MonoGenericMemoryManager *memory_manager = (MonoGenericMemoryManager *)alc->generic_memory_managers->pdata [i]; - mono_mem_manager_free_generic (memory_manager, FALSE); - }*/ - g_ptr_array_free (alc->generic_memory_managers, TRUE); - mono_coop_mutex_destroy (&alc->memory_managers_lock); - - mono_gchandle_free_internal (alc->gchandle); - alc->gchandle = NULL; - - g_hash_table_destroy (alc->pinvoke_scopes); - alc->pinvoke_scopes = NULL; - mono_coop_mutex_destroy (&alc->pinvoke_lock); - - // TODO: alc unloaded profiler event -} - -static void -mono_alc_free (MonoAssemblyLoadContext *alc) -{ - mono_alc_cleanup (alc); - g_free (alc); -} - -void -mono_alc_assemblies_lock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_lock (&alc->assemblies_lock); -} - -void -mono_alc_assemblies_unlock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_unlock (&alc->assemblies_lock); -} - -void -mono_alc_memory_managers_lock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_lock (&alc->memory_managers_lock); -} - -void -mono_alc_memory_managers_unlock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_unlock (&alc->memory_managers_lock); -} - -gpointer -ves_icall_System_Runtime_Loader_AssemblyLoadContext_InternalInitializeNativeALC (gpointer this_gchandle_ptr, MonoBoolean is_default_alc, MonoBoolean collectible, MonoError *error) -{ - /* If the ALC is collectible, this_gchandle is weak, otherwise it's strong. */ - MonoGCHandle this_gchandle = (MonoGCHandle)this_gchandle_ptr; - - MonoDomain *domain = mono_domain_get (); - MonoAssemblyLoadContext *alc = NULL; - - if (is_default_alc) { - alc = mono_domain_default_alc (domain); - g_assert (alc); - if (!alc->gchandle) - alc->gchandle = this_gchandle; - } else - alc = mono_alc_create_individual (domain, this_gchandle, collectible, error); - - return alc; -} - -void -ves_icall_System_Runtime_Loader_AssemblyLoadContext_PrepareForAssemblyLoadContextRelease (gpointer alc_pointer, gpointer strong_gchandle_ptr, MonoError *error) -{ - MonoGCHandle strong_gchandle = (MonoGCHandle)strong_gchandle_ptr; - MonoAssemblyLoadContext *alc = (MonoAssemblyLoadContext *)alc_pointer; - - g_assert (alc->collectible); - g_assert (!alc->unloading); - g_assert (alc->gchandle); - - alc->unloading = TRUE; - - // Replace the weak gchandle with the new strong one to keep the managed ALC alive - MonoGCHandle weak_gchandle = alc->gchandle; - alc->gchandle = strong_gchandle; - mono_gchandle_free_internal (weak_gchandle); -} - -gpointer -ves_icall_System_Runtime_Loader_AssemblyLoadContext_GetLoadContextForAssembly (MonoReflectionAssemblyHandle assm_obj, MonoError *error) -{ - MonoAssembly *assm = MONO_HANDLE_GETVAL (assm_obj, assembly); - MonoAssemblyLoadContext *alc = mono_assembly_get_alc (assm); - - return (gpointer)alc->gchandle; -} - -gboolean -mono_alc_is_default (MonoAssemblyLoadContext *alc) -{ - return alc == mono_alc_domain (alc)->default_alc; -} - -MonoAssemblyLoadContext * -mono_alc_from_gchandle (MonoGCHandle alc_gchandle) -{ - HANDLE_FUNCTION_ENTER (); - MonoManagedAssemblyLoadContextHandle managed_alc = MONO_HANDLE_CAST (MonoManagedAssemblyLoadContext, mono_gchandle_get_target_handle (alc_gchandle)); - MonoAssemblyLoadContext *alc = MONO_HANDLE_GETVAL (managed_alc, native_assembly_load_context); - HANDLE_FUNCTION_RETURN_VAL (alc); -} - -MonoGCHandle -mono_alc_get_default_gchandle (void) -{ - // Because the default domain is never unloadable, this should be a strong handle and never change - return mono_domain_default_alc (mono_domain_get ())->gchandle; -} - -static MonoAssembly* -invoke_resolve_method (MonoMethod *resolve_method, MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, MonoError *error) -{ - MonoAssembly *result = NULL; - char* aname_str = NULL; - - if (mono_runtime_get_no_exec ()) - return NULL; - - HANDLE_FUNCTION_ENTER (); - - aname_str = mono_stringify_assembly_name (aname); - - MonoStringHandle aname_obj = mono_string_new_handle (mono_alc_domain (alc), aname_str, error); - goto_if_nok (error, leave); - - MonoReflectionAssemblyHandle assm; - gpointer gchandle; - gchandle = (gpointer)alc->gchandle; - gpointer args [2]; - args [0] = &gchandle; - args [1] = MONO_HANDLE_RAW (aname_obj); - assm = MONO_HANDLE_CAST (MonoReflectionAssembly, mono_runtime_try_invoke_handle (resolve_method, NULL_HANDLE, args, error)); - goto_if_nok (error, leave); - - if (MONO_HANDLE_BOOL (assm)) - result = MONO_HANDLE_GETVAL (assm, assembly); - -leave: - g_free (aname_str); - HANDLE_FUNCTION_RETURN_VAL (result); -} - -static MonoAssembly* -mono_alc_invoke_resolve_using_load (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, MonoError *error) -{ - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUsingLoad", -1, 0, local_error); - mono_error_assert_ok (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - - g_assert (resolve); - - return invoke_resolve_method (resolve, alc, aname, error); -} - -MonoAssembly* -mono_alc_invoke_resolve_using_load_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname) -{ - MonoAssembly *result = NULL; - ERROR_DECL (error); - - result = mono_alc_invoke_resolve_using_load (alc, aname, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Error while invoking ALC Load(\"%s\") method: '%s'", aname->name, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -static MonoAssembly* -mono_alc_invoke_resolve_using_resolving_event (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, MonoError *error) -{ - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - static gboolean inited; - if (!inited) { - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUsingResolvingEvent", -1, 0, local_error); - inited = TRUE; - } - mono_error_cleanup (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - - if (!resolve) - return NULL; - - return invoke_resolve_method (resolve, alc, aname, error); -} - -MonoAssembly* -mono_alc_invoke_resolve_using_resolving_event_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname) -{ - MonoAssembly *result = NULL; - ERROR_DECL (error); - - result = mono_alc_invoke_resolve_using_resolving_event (alc, aname, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Error while invoking ALC Resolving(\"%s\") event: '%s'", aname->name, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -static MonoAssembly* -mono_alc_invoke_resolve_using_resolve_satellite (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, MonoError *error) -{ - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUsingResolveSatelliteAssembly", -1, 0, local_error); - mono_error_assert_ok (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - - g_assert (resolve); - - return invoke_resolve_method (resolve, alc, aname, error); -} - -MonoAssembly* -mono_alc_invoke_resolve_using_resolve_satellite_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname) -{ - MonoAssembly *result = NULL; - ERROR_DECL (error); - - result = mono_alc_invoke_resolve_using_resolve_satellite (alc, aname, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Error while invoking ALC ResolveSatelliteAssembly(\"%s\") method: '%s'", aname->name, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -#endif /* ENABLE_NETCORE */ MONO_EMPTY_SOURCE_FILE (assembly_load_context) diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index 8421df9f501..5a2ddad4e75 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -386,10 +386,6 @@ static GSList *loaded_assembly_bindings = NULL; static GENERATE_TRY_GET_CLASS_WITH_CACHE (internals_visible, "System.Runtime.CompilerServices", "InternalsVisibleToAttribute") static MonoAssembly* mono_assembly_invoke_search_hook_internal (MonoAssemblyLoadContext *alc, MonoAssembly *requesting, MonoAssemblyName *aname, gboolean refonly, gboolean postload); -#ifdef ENABLE_NETCORE -static MonoAssembly* -mono_assembly_request_byname_nosearch (MonoAssemblyName *aname, const MonoAssemblyByNameRequest *req, MonoImageOpenStatus *status); -#endif static MonoAssembly* mono_assembly_load_full_gac_base_default (MonoAssemblyName *aname, const char *basedir, MonoAssemblyLoadContext *alc, MonoAssemblyContextKind asmctx, MonoImageOpenStatus *status); static MonoAssembly* @@ -402,10 +398,8 @@ invoke_assembly_preload_hook (MonoAssemblyLoadContext *alc, MonoAssemblyName *an static MonoBoolean mono_assembly_is_in_gac (const gchar *filanem); -#ifndef ENABLE_NETCORE static MonoAssemblyName* mono_assembly_apply_binding (MonoAssemblyName *aname, MonoAssemblyName *dest_name); -#endif static MonoAssembly* prevent_reference_assembly_from_running (MonoAssembly* candidate, gboolean refonly); @@ -1553,7 +1547,6 @@ mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *an } } -#ifndef ENABLE_NETCORE static MonoAssembly* load_reference_by_aname_refonly_asmctx (MonoAssemblyName *aname, MonoAssemblyLoadContext *alc, MonoAssembly *assm, MonoImageOpenStatus *status) { @@ -1666,179 +1659,6 @@ load_reference_by_aname_individual_asmctx (MonoAssemblyName *aname, MonoAssembly reference = (MonoAssembly*)REFERENCE_MISSING; return reference; } -#else -static MonoAssembly * -search_bundle_for_assembly (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname) -{ - if (bundles == NULL && satellite_bundles == NULL) - return NULL; - - MonoImageOpenStatus status; - MonoImage *image; - MonoAssemblyLoadRequest req; - image = mono_assembly_open_from_bundle (alc, aname->name, &status, FALSE, aname->culture); - if (!image && !g_str_has_suffix (aname->name, ".dll")) { - char *name = g_strdup_printf ("%s.dll", aname->name); - image = mono_assembly_open_from_bundle (alc, name, &status, FALSE, aname->culture); - } - if (image) { - mono_assembly_request_prepare_load (&req, MONO_ASMCTX_DEFAULT, alc); - return mono_assembly_request_load_from (image, aname->name, &req, &status); - } - return NULL; -} - -static MonoAssembly* -netcore_load_reference (MonoAssemblyName *aname, MonoAssemblyLoadContext *alc, MonoAssembly *requesting, gboolean postload) -{ - g_assert (alc != NULL); - - MonoAssemblyName mapped_aname; - - aname = mono_assembly_remap_version (aname, &mapped_aname); - - MonoAssembly *reference = NULL; - - gboolean is_satellite = !mono_assembly_name_culture_is_neutral (aname); - gboolean is_default = mono_alc_is_default (alc); - - /* - * Try these until one of them succeeds (by returning a non-NULL reference): - * 1. Check if it's already loaded by the ALC. - * - * 2. If it's a non-default ALC, call the Load() method. - * - * 3. If the ALC is not the default and this is not a satellite request, - * check if it's already loaded by the default ALC. - * - * 4. If we have a bundle registered and this is not a satellite request, - * search the images for a matching name. - * - * 5. If we have a satellite bundle registered and this is a satellite request, - * find the parent ALC and search the images for a matching name and culture. - * - * 6. If the ALC is the default or this is not a satellite request, - * check the TPA list, APP_PATHS, and ApplicationBase. - * - * 7. If this is a satellite request, call the ALC ResolveSatelliteAssembly method. - * - * 8. Call the ALC Resolving event. - * - * 9. Call the ALC AssemblyResolve event (except for corlib satellite assemblies). - * - * 10. Return NULL. - */ - - reference = mono_assembly_loaded_internal (alc, aname, FALSE); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly already loaded in the active ALC: '%s'.", aname->name); - goto leave; - } - - if (!is_default) { - reference = mono_alc_invoke_resolve_using_load_nofail (alc, aname); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found using Load method: '%s'.", aname->name); - goto leave; - } - } - - if (!is_default && !is_satellite) { - reference = mono_assembly_loaded_internal (mono_domain_default_alc (mono_alc_domain (alc)), aname, FALSE); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly already loaded in the default ALC: '%s'.", aname->name); - goto leave; - } - } - - if (bundles != NULL && !is_satellite) { - reference = search_bundle_for_assembly (mono_domain_default_alc (mono_alc_domain (alc)), aname); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found in the bundle: '%s'.", aname->name); - goto leave; - } - } - - if (satellite_bundles != NULL && is_satellite) { - // Satellite assembly byname requests should be loaded in the same ALC as their parent assembly - size_t name_len = strlen (aname->name); - char *parent_name = NULL; - MonoAssemblyLoadContext *parent_alc = NULL; - if (g_str_has_suffix (aname->name, MONO_ASSEMBLY_RESOURCE_SUFFIX)) - parent_name = g_strdup_printf ("%s.dll", g_strndup (aname->name, name_len - strlen (MONO_ASSEMBLY_RESOURCE_SUFFIX))); - - if (parent_name) { - MonoAssemblyOpenRequest req; - mono_assembly_request_prepare_open (&req, MONO_ASMCTX_DEFAULT, alc); - MonoAssembly *parent_assembly = mono_assembly_request_open (parent_name, &req, NULL); - parent_alc = mono_assembly_get_alc (parent_assembly); - } - - if (parent_alc) - reference = search_bundle_for_assembly (parent_alc, aname); - - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found in the satellite bundle: '%s'.", aname->name); - goto leave; - } - } - - if (is_default || !is_satellite) { - reference = invoke_assembly_preload_hook (mono_domain_default_alc (mono_alc_domain (alc)), aname, assemblies_path); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with the filesystem probing logic: '%s'.", aname->name); - goto leave; - } - } - - if (is_satellite) { - reference = mono_alc_invoke_resolve_using_resolve_satellite_nofail (alc, aname); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with ResolveSatelliteAssembly method: '%s'.", aname->name); - goto leave; - } - } - - reference = mono_alc_invoke_resolve_using_resolving_event_nofail (alc, aname); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with the Resolving event: '%s'.", aname->name); - goto leave; - } - - // Looking up corlib resources here can cause an infinite loop - // See: https://github.com/dotnet/coreclr/blob/0a762eb2f3a299489c459da1ddeb69e042008f07/src/vm/appdomain.cpp#L5178-L5239 - if (!(strcmp (aname->name, MONO_ASSEMBLY_CORLIB_RESOURCE_NAME) == 0 && is_satellite) && postload) { - reference = mono_assembly_invoke_search_hook_internal (alc, requesting, aname, FALSE, TRUE); - if (reference) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with AssemblyResolve event: '%s'.", aname->name); - goto leave; - } - } - -leave: - return reference; -} - -static MonoImage * -open_from_satellite_bundle (MonoAssemblyLoadContext *alc, const char *filename, MonoImageOpenStatus *status, gboolean refonly, const char *culture) -{ - if (!satellite_bundles) - return NULL; - - MonoImage *image = NULL; - char *name = g_strdup (filename); - for (int i = 0; !image && satellite_bundles [i]; ++i) { - if (strcmp (satellite_bundles [i]->name, name) == 0 && strcmp (satellite_bundles [i]->culture, culture) == 0) { - image = mono_image_open_from_data_internal (alc, (char *)satellite_bundles [i]->data, satellite_bundles [i]->size, FALSE, status, refonly, FALSE, name, NULL); - break; - } - } - - g_free (name); - return image; -} - -#endif /* ENABLE_NETCORE */ /** * mono_assembly_get_assemblyref_checked: @@ -1946,7 +1766,6 @@ mono_assembly_load_reference (MonoImage *image, int index) aname_str); g_free (aname_str); } -#ifndef ENABLE_NETCORE switch (mono_asmctx_get_kind (&image->assembly->context)) { case MONO_ASMCTX_DEFAULT: reference = load_reference_by_aname_default_asmctx (&aname, mono_image_get_alc (image), image->assembly, &status); @@ -1964,20 +1783,9 @@ mono_assembly_load_reference (MonoImage *image, int index) g_error ("Unexpected assembly load context kind %d for image %s.", mono_asmctx_get_kind (&image->assembly->context), image->name); break; } -#else - MonoAssemblyByNameRequest req; - mono_assembly_request_prepare_byname (&req, MONO_ASMCTX_DEFAULT, mono_image_get_alc (image)); - req.requesting_assembly = image->assembly; - //req.no_postload_search = TRUE; // FIXME: should this be set? - reference = mono_assembly_request_byname (&aname, &req, NULL); -#endif } else { -#ifndef ENABLE_NETCORE /* FIXME: can we establish that image->assembly is never NULL and this code is dead? */ reference = load_reference_by_aname_default_asmctx (&aname, mono_image_get_alc (image), image->assembly, &status); -#else - g_assertf (image->assembly, "While loading reference %d MonoImage %s doesn't have a MonoAssembly", index, image->name); -#endif } if (reference == NULL){ @@ -2310,13 +2118,7 @@ invoke_assembly_preload_hook (MonoAssemblyLoadContext *alc, MonoAssemblyName *an if (hook->version == 2) assembly = hook->func.v2 (alc, aname, apath, FALSE, hook->user_data, error); else { // v3 -#ifdef ENABLE_NETCORE - MonoGCHandle strong_gchandle = mono_gchandle_from_handle (mono_gchandle_get_target_handle (alc->gchandle), TRUE); - assembly = hook->func.v3 (strong_gchandle, aname, apath, hook->user_data, error); - mono_gchandle_free_internal (strong_gchandle); -#else assembly = hook->func.v3 (NULL, aname, apath, hook->user_data, error); -#endif } /* TODO: propagage error out to callers */ mono_error_assert_ok (error); @@ -2593,12 +2395,7 @@ open_from_bundle_internal (MonoAssemblyLoadContext *alc, const char *filename, M char *name = is_satellite ? g_strdup (filename) : g_path_get_basename (filename); for (int i = 0; !image && bundles [i]; ++i) { if (strcmp (bundles [i]->name, name) == 0) { -#ifdef ENABLE_NETCORE - // Since bundled images don't exist on disk, don't give them a legit filename - image = mono_image_open_from_data_internal (alc, (char*)bundles [i]->data, bundles [i]->size, FALSE, status, refonly, FALSE, name, NULL); -#else image = mono_image_open_from_data_internal (alc, (char*)bundles [i]->data, bundles [i]->size, FALSE, status, refonly, FALSE, name, name); -#endif break; } } @@ -2624,7 +2421,6 @@ mono_assembly_open_from_bundle (MonoAssemblyLoadContext *alc, const char *filena * purpose assembly loading mechanism. */ MonoImage *image = NULL; -#ifndef ENABLE_NETCORE if (!bundles) return NULL; @@ -2632,13 +2428,6 @@ mono_assembly_open_from_bundle (MonoAssemblyLoadContext *alc, const char *filena gboolean is_satellite = g_str_has_suffix (lowercase_filename, ".resources.dll"); g_free (lowercase_filename); image = open_from_bundle_internal (alc, filename, status, refonly, is_satellite); -#else - gboolean is_satellite = culture && culture [0] != 0;; - if (is_satellite) - image = open_from_satellite_bundle (alc, filename, status, refonly, culture); - else - image = open_from_bundle_internal (alc, filename, status, refonly, FALSE); -#endif if (image) { mono_image_addref (image); @@ -2857,10 +2646,8 @@ mono_assembly_request_open (const char *filename, const MonoAssemblyOpenRequest if (!loaded_from_bundle) mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly Loader loaded assembly from location: '%s'.", filename); -#ifndef ENABLE_NETCORE // no XML file loading on netcore if (!refonly) mono_config_for_assembly_internal (ass->image); -#endif } /* Clear the reference added by mono_image_open */ @@ -3034,13 +2821,11 @@ chain_redirections_loadfrom (MonoAssemblyLoadContext *alc, MonoImage *image, Mon MonoImageOpenStatus status = MONO_IMAGE_OK; MonoAssembly *redirected = NULL; -#ifndef ENABLE_NETCORE redirected = mono_assembly_binding_applies_to_image (alc, image, &status); if (redirected || status != MONO_IMAGE_OK) { *out_status = status; return redirected; } -#endif redirected = mono_problematic_image_reprobe (alc, image, &status); if (redirected || status != MONO_IMAGE_OK) { @@ -3052,7 +2837,6 @@ chain_redirections_loadfrom (MonoAssemblyLoadContext *alc, MonoImage *image, Mon return NULL; } -#ifndef ENABLE_NETCORE /** * mono_assembly_binding_applies_to_image: * \param alc AssemblyLoadContext to load into @@ -3116,7 +2900,6 @@ mono_assembly_binding_applies_to_image (MonoAssemblyLoadContext *alc, MonoImage* mono_assembly_name_free_internal (&probed_aname); return result_ass; } -#endif /** * mono_problematic_image_reprobe: @@ -3547,48 +3330,6 @@ build_assembly_name (const char *name, const char *version, const char *culture, memset (aname, 0, sizeof (MonoAssemblyName)); if (version) { -#ifdef ENABLE_NETCORE - int parts [4]; - int i; - int part_len; - - parts [2] = -1; - parts [3] = -1; - const char *s = version; - version_parts = 0; - for (i = 0; i < 4; ++i) { - int n = sscanf (s, "%u%n", &parts [i], &part_len); - if (n != 1) - return FALSE; - if (parts [i] < 0 || parts [i] > 65535) - return FALSE; - if (i < 2 && parts [i] == 65535) - return FALSE; - version_parts ++; - s += part_len; - if (s [0] == '\0') - break; - if (i < 3) { - if (s [0] != '.') - return FALSE; - s ++; - } - } - if (s [0] != '\0') - return FALSE; - if (version_parts < 2 || version_parts > 4) - return FALSE; - aname->major = parts [0]; - aname->minor = parts [1]; - if (version_parts >= 3) - aname->build = parts [2]; - else - aname->build = -1; - if (version_parts == 4) - aname->revision = parts [3]; - else - aname->revision = -1; -#else gint major, minor, build, revision; version_parts = sscanf (version, "%u.%u.%u.%u", &major, &minor, &build, &revision); @@ -3608,7 +3349,6 @@ build_assembly_name (const char *name, const char *version, const char *culture, aname->revision = revision; else aname->revision = 0; -#endif } aname->flags = flags; @@ -3838,9 +3578,6 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole goto cleanup_and_fail; } -#ifdef ENABLE_NETCORE - flags |= arch << 4; -#endif g_free (procarch_uq); tmp++; @@ -4492,7 +4229,6 @@ mono_domain_parse_assembly_bindings (MonoDomain *domain, int amajor, int aminor, mono_domain_unlock (domain); } -#ifndef ENABLE_NETCORE static MonoAssemblyName* mono_assembly_apply_binding (MonoAssemblyName *aname, MonoAssemblyName *dest_name) { @@ -4605,7 +4341,6 @@ return_aname: exit: HANDLE_FUNCTION_RETURN_VAL (result); } -#endif #ifndef DISABLE_GAC /** @@ -4699,24 +4434,6 @@ mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus * return corlib; } -#ifdef ENABLE_NETCORE - aname = mono_assembly_name_new (MONO_ASSEMBLY_CORLIB_NAME); - corlib = invoke_assembly_preload_hook (req.request.alc, aname, NULL); - /* MonoCore preload hook should know how to find it */ - /* FIXME: AOT compiler comes here without an installed hook. */ - if (!corlib) { - if (assemblies_path) { // Custom assemblies path set via MONO_PATH or mono_set_assemblies_path - char *corlib_name = g_strdup_printf ("%s.dll", MONO_ASSEMBLY_CORLIB_NAME); - corlib = load_in_path (corlib_name, (const char**)assemblies_path, &req, status); - } - } - if (!corlib) { - /* Maybe its in a bundle */ - char *corlib_name = g_strdup_printf ("%s.dll", MONO_ASSEMBLY_CORLIB_NAME); - corlib = mono_assembly_request_open (corlib_name, &req, status); - } - g_assert (corlib); -#else // A nonstandard preload hook may provide a special mscorlib assembly aname = mono_assembly_name_new ("mscorlib.dll"); corlib = invoke_assembly_preload_hook (req.request.alc, aname, assemblies_path); @@ -4748,7 +4465,6 @@ mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus * return_corlib_and_facades: if (corlib) // FIXME: stop hardcoding 4.5 here default_path [1] = g_strdup_printf ("%s/Facades", corlib->basedir); -#endif /*!ENABLE_NETCORE*/ return corlib; } @@ -4785,9 +4501,6 @@ mono_assembly_candidate_predicate_sn_same_name (MonoAssembly *candidate, gpointe g_free (s); } -#ifdef ENABLE_NETCORE - return mono_assembly_check_name_match (wanted_name, candidate_name); -#else /* Wanted name has no token, not strongly named: always matches. */ if (0 == wanted_name->public_key_token [0]) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Predicate: wanted has no token, returning TRUE"); @@ -4802,19 +4515,12 @@ mono_assembly_candidate_predicate_sn_same_name (MonoAssembly *candidate, gpointe return mono_assembly_check_name_match (wanted_name, candidate_name) || framework_assembly_sn_match (wanted_name, candidate_name); -#endif } gboolean mono_assembly_check_name_match (MonoAssemblyName *wanted_name, MonoAssemblyName *candidate_name) { -#if ENABLE_NETCORE - gboolean result = mono_assembly_names_equal_flags (wanted_name, candidate_name, MONO_ANAME_EQ_IGNORE_VERSION | MONO_ANAME_EQ_IGNORE_PUBKEY); - if (result && assembly_names_compare_versions (wanted_name, candidate_name, -1) > 0) - result = FALSE; -#else gboolean result = mono_assembly_names_equal_flags (wanted_name, candidate_name, MONO_ANAME_EQ_NONE); -#endif mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Predicate: candidate and wanted names %s", result ? "match, returning TRUE" : "don't match, returning FALSE"); @@ -4856,7 +4562,6 @@ framework_assembly_sn_match (MonoAssemblyName *wanted_name, MonoAssemblyName *ca return FALSE; } -#ifndef ENABLE_NETCORE static MonoAssembly* mono_assembly_request_byname_nosearch (MonoAssemblyName *aname, const MonoAssemblyByNameRequest *req, @@ -4887,7 +4592,6 @@ mono_assembly_request_byname_nosearch (MonoAssemblyName *aname, result = mono_assembly_load_full_gac_base_default (aname, req->basedir, req->request.alc, req->request.asmctx, status); return result; } -#endif /* Like mono_assembly_request_byname_nosearch, but don't ask the preload look (ie, * the appdomain) to run. Just looks in the gac, the specified base dir or the @@ -4987,7 +4691,6 @@ mono_assembly_request_byname (MonoAssemblyName *aname, const MonoAssemblyByNameR MonoAssembly *result; if (status) *status = MONO_IMAGE_OK; -#ifndef ENABLE_NETCORE result = mono_assembly_request_byname_nosearch (aname, req, status); const gboolean refonly = req->request.asmctx == MONO_ASMCTX_REFONLY; @@ -4996,9 +4699,6 @@ mono_assembly_request_byname (MonoAssemblyName *aname, const MonoAssemblyByNameR result = mono_assembly_invoke_search_hook_internal (req->request.alc, req->requesting_assembly, aname, refonly, TRUE); result = prevent_reference_assembly_from_running (result, refonly); } -#else - result = netcore_load_reference (aname, req->request.alc, req->requesting_assembly, !req->no_postload_search); -#endif return result; } @@ -5008,11 +4708,7 @@ mono_assembly_load_full_alc (MonoGCHandle alc_gchandle, MonoAssemblyName *aname, MonoAssembly *res; MONO_ENTER_GC_UNSAFE; MonoAssemblyByNameRequest req; -#ifdef ENABLE_NETCORE - MonoAssemblyLoadContext *alc = mono_alc_from_gchandle (alc_gchandle); -#else MonoAssemblyLoadContext *alc = mono_domain_default_alc (mono_domain_get ()); -#endif mono_assembly_request_prepare_byname (&req, MONO_ASMCTX_DEFAULT, alc); req.requesting_assembly = NULL; req.basedir = basedir; @@ -5416,9 +5112,6 @@ mono_create_new_bundled_satellite_assembly (const char *name, const char *cultur void mono_register_bundled_satellite_assemblies (const MonoBundledSatelliteAssembly **assemblies) { -#ifdef ENABLE_NETCORE - satellite_bundles = assemblies; -#endif } #define MONO_DECLSEC_FORMAT_10 0x3C diff --git a/mono/metadata/class-init.c b/mono/metadata/class-init.c index b849dca6b4e..9e0036d63d6 100644 --- a/mono/metadata/class-init.c +++ b/mono/metadata/class-init.c @@ -34,16 +34,9 @@ #undef REALLY_INCLUDE_CLASS_DEF #endif -#ifdef ENABLE_NETCORE -#define FEATURE_COVARIANT_RETURNS -#endif gboolean mono_print_vtable = FALSE; gboolean mono_align_small_structs = FALSE; -#ifdef ENABLE_NETCORE -/* Set by the EE */ -gint32 mono_simd_register_size; -#endif /* Statistics */ static gint32 classes_size; @@ -298,12 +291,6 @@ mono_class_setup_fields (MonoClass *klass) if (explicit_size) instance_size += real_size; -#ifdef ENABLE_NETCORE - if (mono_is_corlib_image (klass->image) && !strcmp (klass->name_space, "System.Numerics") && !strcmp (klass->name, "Register")) { - if (mono_simd_register_size) - instance_size += mono_simd_register_size; - } -#endif /* * This function can recursively call itself. @@ -643,11 +630,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError /* reserve space to store vector pointer in arrays */ if (mono_is_corlib_image (image) && !strcmp (nspace, "System") && !strcmp (name, "Array")) { klass->instance_size += 2 * TARGET_SIZEOF_VOID_P; -#ifndef ENABLE_NETCORE g_assert (mono_class_get_field_count (klass) == 0); -#else - /* TODO: check that array has 0 non-const fields */ -#endif } if (klass->enumtype) { @@ -865,14 +848,6 @@ mono_class_create_generic_inst (MonoGenericClass *gclass) if (mono_type_is_primitive (gclass->context.class_inst->type_argv [0])) klass->simd_type = 1; } -#ifdef ENABLE_NETCORE - if (mono_is_corlib_image (gklass->image) && - (!strcmp (gklass->name, "Vector`1") || !strcmp (gklass->name, "Vector128`1") || !strcmp (gklass->name, "Vector256`1"))) { - MonoType *etype = gclass->context.class_inst->type_argv [0]; - if (mono_type_is_primitive (etype) && etype->type != MONO_TYPE_CHAR && etype->type != MONO_TYPE_BOOLEAN) - klass->simd_type = 1; - } -#endif klass->is_array_special_interface = gklass->is_array_special_interface; @@ -2165,34 +2140,6 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_ } /* check for incorrectly aligned or overlapped by a non-object field */ -#ifdef ENABLE_NETCORE - guint8 *layout_check; - if (has_references) { - layout_check = g_new0 (guint8, real_size); - for (i = 0; i < top && !mono_class_has_failure (klass); i++) { - field = &klass->fields [i]; - if (!field) - continue; - if (mono_field_is_deleted (field)) - continue; - if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) - continue; - int align = 0; - int size = mono_type_size (field->type, &align); - MonoType *ftype = mono_type_get_underlying_type (field->type); - ftype = mono_type_get_basic_type_from_generic (ftype); - guint8 type = type_has_references (klass, ftype) ? 1 : 2; - for (int j = 0; j < size; j++) { - if (layout_check [field_offsets [i] + j] != 0 && layout_check [field_offsets [i] + j] != type) { - mono_class_set_type_load_failure (klass, "Could not load type '%s' because it contains an object field at offset %d that is incorrectly aligned or overlapped by a non-object field.", klass->name, field->offset); - break; - } - layout_check [field_offsets [i] + j] = type; - } - } - g_free (layout_check); - } -#endif instance_size = MAX (real_size, instance_size); if (!((layout == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) && explicit_size)) { diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index 0e9c76afb9f..8512770fc0d 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -1004,9 +1004,7 @@ typedef struct { MonoClass *iremotingtypeinfo_class; #endif MonoClass *mono_method_message_class; -#ifndef ENABLE_NETCORE MonoClass *appdomain_class; -#endif MonoClass *field_info_class; MonoClass *method_info_class; MonoClass *stack_frame_class; @@ -1021,13 +1019,7 @@ typedef struct { MonoClass *critical_finalizer_object; /* MAYBE NULL */ MonoClass *generic_ireadonlylist_class; MonoClass *generic_ienumerator_class; -#ifdef ENABLE_NETCORE - MonoClass *alc_class; - MonoClass *appcontext_class; -#endif -#ifndef ENABLE_NETCORE MonoMethod *threadpool_perform_wait_callback_method; -#endif } MonoDefaults; #ifdef DISABLE_REMOTING @@ -1101,9 +1093,7 @@ GENERATE_GET_CLASS_WITH_CACHE_DECL (variant) #endif MonoClass* mono_class_get_appdomain_class (void); -#ifndef ENABLE_NETCORE GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_setup); -#endif GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception) GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception) @@ -1112,10 +1102,6 @@ GENERATE_GET_CLASS_WITH_CACHE_DECL (valuetype) GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(handleref) -#ifdef ENABLE_NETCORE -GENERATE_GET_CLASS_WITH_CACHE_DECL (assembly_load_context) -GENERATE_GET_CLASS_WITH_CACHE_DECL (native_library) -#endif /* If you need a MonoType, use one of the mono_get_*_type () functions in class-inlines.h */ extern MonoDefaults mono_defaults; @@ -1614,12 +1600,7 @@ m_field_get_offset (MonoClassField *field) static inline MonoMemoryManager* m_class_get_mem_manager (MonoDomain *domain, MonoClass *klass) { -#ifdef ENABLE_NETCORE - // FIXME: return mono_domain_memory_manager (domain); -#else - return mono_domain_memory_manager (domain); -#endif } static inline void * @@ -1637,12 +1618,7 @@ m_class_alloc0 (MonoDomain *domain, MonoClass *klass, guint size) static inline MonoMemoryManager* m_method_get_mem_manager (MonoDomain *domain, MonoMethod *method) { -#ifdef ENABLE_NETCORE - // FIXME: return mono_domain_memory_manager (domain); -#else - return mono_domain_memory_manager (domain); -#endif } static inline void * diff --git a/mono/metadata/class-setup-vtable.c b/mono/metadata/class-setup-vtable.c index 486fed9f60c..4017e73fea6 100644 --- a/mono/metadata/class-setup-vtable.c +++ b/mono/metadata/class-setup-vtable.c @@ -23,9 +23,6 @@ #undef REALLY_INCLUDE_CLASS_DEF #endif -#ifdef ENABLE_NETCORE -#define FEATURE_COVARIANT_RETURNS -#endif static void mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup); diff --git a/mono/metadata/class.c b/mono/metadata/class.c index 7835e5ad11e..c2abf0e582d 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -6286,10 +6286,6 @@ gboolean mono_type_is_valid_enum_basetype (MonoType * type) { case MONO_TYPE_U8: case MONO_TYPE_I: case MONO_TYPE_U: -#if ENABLE_NETCORE - case MONO_TYPE_R8: - case MONO_TYPE_R4: -#endif return TRUE; default: return FALSE; diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c index e80cca9f292..9cb93585cc9 100644 --- a/mono/metadata/cominterop.c +++ b/mono/metadata/cominterop.c @@ -3160,17 +3160,11 @@ default_ptr_to_bstr (const gunichar2* ptr, int slen) // The allocation pre-string is pointer-sized, and then only 4 bytes are used for the length regardless. Additionally, // the total length is also aligned to a 16-byte boundary. This preserves the old behavior on legacy and fixes it for // netcore moving forward. -#ifdef ENABLE_NETCORE - mono_bstr const s = (mono_bstr)mono_bstr_alloc ((slen + 1) * sizeof (gunichar2)); - if (s == NULL) - return NULL; -#else /* allocate len + 1 utf16 characters plus 4 byte integer for length*/ guint32 * const ret = (guint32 *)g_malloc ((slen + 1) * sizeof (gunichar2) + sizeof (guint32)); if (ret == NULL) return NULL; mono_bstr const s = (mono_bstr)(ret + 1); -#endif mono_bstr_set_length (s, slen); if (ptr) memcpy (s, ptr, slen * sizeof (gunichar2)); @@ -3286,11 +3280,7 @@ mono_free_bstr (/*mono_bstr_const*/gpointer bstr) #ifndef DISABLE_COM if (com_provider == MONO_COM_DEFAULT) { #endif -#ifdef ENABLE_NETCORE - g_free (((char *)bstr) - SIZEOF_VOID_P); -#else // In Mono, historically BSTR was allocated with a guaranteed size prefix of 4 bytes regardless of platform g_free (((char *)bstr) - 4); -#endif #ifndef DISABLE_COM } else if (com_provider == MONO_COM_MS && init_com_provider_ms ()) { sys_free_string_ms ((mono_bstr_const)bstr); @@ -4205,7 +4195,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (MonoIUn #endif /* HOST_WIN32 */ #endif /* DISABLE_COM */ -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (mono_bstr_const ptr, MonoError *error) { @@ -4215,7 +4204,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (mono_bstr_cons } return mono_string_from_bstr_checked (ptr, error); } -#endif mono_bstr ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR (const gunichar2* ptr, int len) diff --git a/mono/metadata/console-unix.c b/mono/metadata/console-unix.c index 908b2d60aa4..52c2117e8bb 100644 --- a/mono/metadata/console-unix.c +++ b/mono/metadata/console-unix.c @@ -40,7 +40,6 @@ #include #include "icall-decl.h" -#ifndef ENABLE_NETCORE /* On solaris, curses.h must come before both termios.h and term.h */ #ifdef HAVE_CURSES_H @@ -511,16 +510,3 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoStringHandle keypad, MonoStringHand return TRUE; } -#else /* ENABLE_NETCORE */ - -void -mono_console_init (void) -{ -} - -void -mono_console_handle_async_ops (void) -{ -} - -#endif diff --git a/mono/metadata/custom-attrs.c b/mono/metadata/custom-attrs.c index fe3165f1690..2b21524a76d 100644 --- a/mono/metadata/custom-attrs.c +++ b/mono/metadata/custom-attrs.c @@ -1435,16 +1435,11 @@ ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoRe } MONO_HANDLE_ASSIGN_RAW (minfo_h, minfo); -#if ENABLE_NETCORE - namedarg = create_cattr_named_arg (minfo, obj, error); - MONO_HANDLE_ASSIGN_RAW (namedarg_h, namedarg); -#else MonoObject* typedarg = create_cattr_typed_arg (arginfo [i].type, obj, error); MONO_HANDLE_ASSIGN_RAW (typedarg_h, typedarg); goto_if_nok (error, leave); namedarg = create_cattr_named_arg (minfo, typedarg, error); MONO_HANDLE_ASSIGN_RAW (namedarg_h, namedarg); -#endif goto_if_nok (error, leave); mono_array_setref_internal (named_args, i, namedarg); @@ -2219,15 +2214,10 @@ mono_reflection_get_custom_attrs_info_checked (MonoObjectHandle obj, MonoError * MonoArrayHandle cattrs = MONO_HANDLE_NEW_GET (MonoArray, mb, cattrs); cinfo = mono_custom_attrs_from_builders_handle (NULL, &dynamic_image->image, cattrs); } else if (strcmp ("ConstructorBuilder", klass_name) == 0) { -#ifdef ENABLE_NETCORE - mono_error_set_not_supported (error, ""); - goto leave; -#else MonoReflectionCtorBuilderHandle cb = MONO_HANDLE_CAST (MonoReflectionCtorBuilder, obj); MonoMethod *mhandle = MONO_HANDLE_GETVAL (cb, mhandle); MonoArrayHandle cattrs = MONO_HANDLE_NEW_GET (MonoArray, cb, cattrs); cinfo = mono_custom_attrs_from_builders_handle (NULL, m_class_get_image (mhandle->klass), cattrs); -#endif } else if (strcmp ("MethodBuilder", klass_name) == 0) { MonoReflectionMethodBuilderHandle mb = MONO_HANDLE_CAST (MonoReflectionMethodBuilder, obj); MonoMethod *mhandle = MONO_HANDLE_GETVAL (mb, mhandle); diff --git a/mono/metadata/domain-internals.h b/mono/metadata/domain-internals.h index b33b88e2a46..4adffe49d89 100644 --- a/mono/metadata/domain-internals.h +++ b/mono/metadata/domain-internals.h @@ -27,20 +27,10 @@ * So we move it to Mono.MonoDomain * */ -#ifndef ENABLE_NETCORE #define MONO_APPDOMAIN_CLASS_NAME_SPACE "System" #define MONO_APPDOMAIN_CLASS_NAME "AppDomain" #define MONO_APPDOMAIN_SETUP_CLASS_NAME_SPACE "System" #define MONO_APPDOMAIN_SETUP_CLASS_NAME "AppDomainSetup" -#else -/* We don't care anymore about the managed appdomain representation - * so we just use a sentinel System.Object in the parts of the code that still care - */ -/* -#define MONO_APPDOMAIN_CLASS_NAME_SPACE "System" -#define MONO_APPDOMAIN_CLASS_NAME "Object" -*/ -#endif G_BEGIN_DECLS @@ -52,7 +42,6 @@ G_BEGIN_DECLS */ extern gboolean mono_dont_free_domains; -#ifndef ENABLE_NETCORE /* This is a copy of System.AppDomainSetup */ typedef struct { MonoObject object; @@ -79,7 +68,6 @@ typedef struct { MonoArray *configuration_bytes; MonoArray *serialized_non_primitives; } MonoAppDomainSetup; -#endif typedef struct _MonoJitInfoTable MonoJitInfoTable; typedef struct _MonoJitInfoTableChunk MonoJitInfoTableChunk; @@ -349,12 +337,8 @@ struct _MonoDomain { * keep all the managed objects close to each other for the precise GC * For the Boehm GC we additionally keep close also other GC-tracked pointers. */ -#ifndef ENABLE_NETCORE #define MONO_DOMAIN_FIRST_OBJECT setup MonoAppDomainSetup *setup; -#else -#define MONO_DOMAIN_FIRST_OBJECT domain -#endif MonoAppDomain *domain; MonoAppContext *default_context; MonoException *out_of_memory_ex; @@ -465,16 +449,9 @@ struct _MonoDomain { guint32 execution_context_field_offset; -#ifdef ENABLE_NETCORE - GSList *alcs; - MonoAssemblyLoadContext *default_alc; - MonoCoopMutex alcs_lock; /* Used when accessing 'alcs' */ -#endif -#ifndef ENABLE_NETCORE // Holds domain code memory MonoMemoryManager *memory_manager; -#endif }; typedef struct { @@ -570,8 +547,6 @@ mono_make_shadow_copy (const char *filename, MonoError *error); gboolean mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name); -// TODO: remove these on netcore, we should always be explicit about allocating from ALCs -//#ifndef ENABLE_NETCORE gpointer mono_domain_alloc (MonoDomain *domain, guint size); @@ -582,8 +557,6 @@ mono_domain_alloc0 (MonoDomain *domain, guint size); #define mono_domain_alloc0(domain, size) (g_cast (mono_domain_alloc0 ((domain), (size)))) -//#endif - gpointer mono_domain_alloc0_lock_free (MonoDomain *domain, guint size); @@ -595,10 +568,8 @@ mono_domain_unset (void); void mono_domain_set_internal_with_options (MonoDomain *domain, gboolean migrate_exception); -#ifndef ENABLE_NETCORE gboolean mono_domain_set_config_checked (MonoDomain *domain, const char *base_dir, const char *config_file_name, MonoError *error); -#endif MonoTryBlockHoleTableJitInfo* mono_jit_info_get_try_block_hole_table_info (MonoJitInfo *ji); @@ -655,9 +626,7 @@ mono_try_assembly_resolve (MonoAssemblyLoadContext *alc, const char *fname, Mono MonoAssembly * mono_domain_assembly_postload_search (MonoAssemblyLoadContext *alc, MonoAssembly *requesting, MonoAssemblyName *aname, gboolean refonly, gboolean postload, gpointer user_data, MonoError *error); -#ifndef ENABLE_NETCORE void mono_domain_set_options_from_config (MonoDomain *domain); -#endif int mono_framework_version (void); @@ -696,19 +665,6 @@ mono_domain_set_fast (MonoDomain *domain, gboolean force); MonoAssemblyLoadContext * mono_domain_default_alc (MonoDomain *domain); -#ifdef ENABLE_NETCORE -static inline void -mono_domain_alcs_lock (MonoDomain *domain) -{ - mono_coop_mutex_lock (&domain->alcs_lock); -} - -static inline void -mono_domain_alcs_unlock (MonoDomain *domain) -{ - mono_coop_mutex_unlock (&domain->alcs_lock); -} -#endif static inline MonoAssemblyLoadContext * @@ -724,11 +680,7 @@ mono_domain_ambient_alc (MonoDomain *domain) static inline MonoMemoryManager * mono_domain_memory_manager (MonoDomain *domain) { -#ifdef ENABLE_NETCORE - return (MonoMemoryManager *)mono_domain_default_alc (domain)->memory_manager; -#else return domain->memory_manager; -#endif } static inline MonoMemoryManager * diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 4af4b21702d..6d455e4fa77 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -66,13 +66,8 @@ mono_thread_info_tls_set (info, TLS_KEY_DOMAIN, (x)); \ } while (FALSE) -#ifndef ENABLE_NETCORE #define GET_APPCONTEXT() (mono_thread_internal_current ()->current_appcontext) #define SET_APPCONTEXT(x) MONO_OBJECT_SETREF_INTERNAL (mono_thread_internal_current (), current_appcontext, (x)) -#else -#define GET_APPCONTEXT() NULL -#define SET_APPCONTEXT(x) -#endif static guint16 appdomain_list_size = 0; static guint16 appdomain_next = 0; @@ -432,17 +427,13 @@ mono_domain_create (void) domain->shadow_serial = shadow_serial; domain->domain = NULL; -#ifndef ENABLE_NETCORE domain->setup = NULL; -#endif domain->friendly_name = NULL; domain->search_path = NULL; MONO_PROFILER_RAISE (domain_loading, (domain)); -#ifndef ENABLE_NETCORE domain->memory_manager = (MonoMemoryManager *)mono_mem_manager_create_singleton (NULL, domain, TRUE); -#endif domain->lock_free_mp = lock_free_mempool_new (); domain->env = mono_g_hash_table_new_type_internal ((GHashFunc)mono_string_hash_internal, (GCompareFunc)mono_string_equal_internal, MONO_HASH_KEY_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain Environment Variable Table"); @@ -464,9 +455,6 @@ mono_domain_create (void) mono_os_mutex_init_recursive (&domain->jit_code_hash_lock); mono_os_mutex_init_recursive (&domain->finalizable_objects_hash_lock); -#ifdef ENABLE_NETCORE - mono_coop_mutex_init (&domain->alcs_lock); -#endif mono_appdomains_lock (); domain_id_alloc (domain); @@ -479,9 +467,6 @@ mono_domain_create (void) mono_debug_domain_create (domain); -#ifdef ENABLE_NETCORE - mono_alc_create_default (domain); -#endif if (create_domain_hook) create_domain_hook (domain); @@ -705,10 +690,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.multicastdelegate_class = mono_class_load_from_name ( mono_defaults.corlib, "System", "MulticastDelegate"); -#ifndef ENABLE_NETCORE mono_defaults.manualresetevent_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "ManualResetEvent"); -#endif mono_defaults.typehandle_class = mono_class_load_from_name ( mono_defaults.corlib, "System", "RuntimeTypeHandle"); @@ -731,20 +714,13 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.thread_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "Thread"); -#ifdef ENABLE_NETCORE - /* There is only one thread class */ - mono_defaults.internal_thread_class = mono_defaults.thread_class; -#else mono_defaults.internal_thread_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "InternalThread"); mono_defaults.threadabortexception_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "ThreadAbortException"); -#endif -#ifndef ENABLE_NETCORE mono_defaults.appdomain_class = mono_class_get_appdomain_class (); -#endif #ifndef DISABLE_REMOTING mono_defaults.transparent_proxy_class = mono_class_load_from_name ( @@ -762,10 +738,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * #endif /* FIXME pretty sure this is wrong and netcore has messages... */ -#ifndef ENABLE_NETCORE mono_defaults.mono_method_message_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Runtime.Remoting.Messaging", "MonoMethodMessage"); -#endif mono_defaults.field_info_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Reflection", "FieldInfo"); @@ -773,13 +747,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.method_info_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Reflection", "MethodInfo"); -#ifdef ENABLE_NETCORE - mono_defaults.stack_frame_class = mono_class_load_from_name ( - mono_defaults.corlib, "System.Diagnostics", "MonoStackFrame"); -#else mono_defaults.stack_frame_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Diagnostics", "StackFrame"); -#endif mono_defaults.marshal_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Runtime.InteropServices", "Marshal"); @@ -813,12 +782,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.generic_ienumerator_class = mono_class_try_load_from_name ( mono_defaults.corlib, "System.Collections.Generic", "IEnumerator`1"); -#ifdef ENABLE_NETCORE - mono_defaults.alc_class = mono_class_get_assembly_load_context_class (); - mono_defaults.appcontext_class = mono_class_try_load_from_name (mono_defaults.corlib, "System", "AppContext"); -#endif -#ifndef ENABLE_NETCORE MonoClass *threadpool_wait_callback_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "_ThreadPoolWaitCallback"); @@ -826,7 +790,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name_checked ( threadpool_wait_callback_class, "PerformWaitCallback", 0, 0, error); mono_error_assert_ok (error); -#endif domain->friendly_name = g_path_get_basename (filename); @@ -1036,7 +999,6 @@ mono_domain_ensure_entry_assembly (MonoDomain *domain, MonoAssembly *assembly) if (!mono_runtime_get_no_exec () && !domain->entry_assembly && assembly) { domain->entry_assembly = assembly; -#ifndef ENABLE_NETCORE gchar *str; ERROR_DECL (error); /* Domains created from another domain already have application_base and configuration_file set */ @@ -1054,7 +1016,6 @@ mono_domain_ensure_entry_assembly (MonoDomain *domain, MonoAssembly *assembly) g_free (str); mono_domain_set_options_from_config (domain); } -#endif } } @@ -1097,9 +1058,6 @@ mono_domain_assembly_open_internal (MonoDomain *domain, MonoAssemblyLoadContext // On netcore, this is necessary because we check the AppContext.BaseDirectory property as part of the assembly lookup algorithm // AppContext.BaseDirectory can sometimes fall back to checking the location of the entry_assembly, which should be non-null -#ifdef ENABLE_NETCORE - mono_domain_ensure_entry_assembly (domain, ass); -#endif return ass; } @@ -1118,7 +1076,6 @@ mono_domain_assembly_open_internal (MonoDomain *domain, MonoAssemblyLoadContext void mono_domain_free (MonoDomain *domain, gboolean force) { -#ifndef ENABLE_NETCORE int code_size, code_alloc; GSList *tmp; gpointer *p; @@ -1290,9 +1247,6 @@ mono_domain_free (MonoDomain *domain, gboolean force) if (domain == mono_root_domain) mono_root_domain = NULL; -#else - g_assert_not_reached (); -#endif } /** @@ -1961,9 +1915,5 @@ mono_domain_get_assemblies (MonoDomain *domain, gboolean refonly) MonoAssemblyLoadContext * mono_domain_default_alc (MonoDomain *domain) { -#ifndef ENABLE_NETCORE return NULL; -#else - return domain->default_alc; -#endif } diff --git a/mono/metadata/environment.c b/mono/metadata/environment.c index cabd09543fb..5bec6e3452a 100644 --- a/mono/metadata/environment.c +++ b/mono/metadata/environment.c @@ -62,7 +62,6 @@ mono_get_os_cmd_line (void) return mono_runtime_get_cmd_line (mini_argc, mini_argv); } -#ifndef ENABLE_NETCORE /* note: we better manipulate the string in managed code (easier and safer) */ MonoStringHandle ves_icall_System_Environment_GetOSVersionString (MonoError *error) @@ -108,4 +107,3 @@ ves_icall_System_Environment_GetOSVersionString (MonoError *error) #endif return mono_string_new_handle (mono_domain_get (), "0.0.0.0", error); } -#endif diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c index db668d23f65..e74df53cc4a 100644 --- a/mono/metadata/exception.c +++ b/mono/metadata/exception.c @@ -680,22 +680,11 @@ mono_get_exception_argument (const char *arg, const char *msg) return mono_get_exception_argument_internal ("ArgumentException", arg, msg); } -#ifndef ENABLE_NETCORE TYPED_HANDLE_DECL (MonoArgumentException); -#endif static MonoExceptionHandle mono_exception_new_argument_internal (const char *type, const char *arg, const char *msg, MonoError *error) { -#ifdef ENABLE_NETCORE - MonoStringHandle arg_str = arg ? mono_string_new_handle (mono_domain_get (), arg, error) : NULL_HANDLE_STRING; - MonoStringHandle msg_str = msg ? mono_string_new_handle (mono_domain_get (), msg, error) : NULL_HANDLE_STRING; - - if (!strcmp (type, "ArgumentException")) - return mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", type, msg_str, arg_str, error); - else - return mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", type, arg_str, msg_str, error); -#else MonoExceptionHandle ex = mono_exception_new_by_name_msg (mono_get_corlib (), "System", type, msg, error); if (arg && !MONO_HANDLE_IS_NULL (ex)) { @@ -704,7 +693,6 @@ mono_exception_new_argument_internal (const char *type, const char *arg, const c MONO_HANDLE_SET (argex, param_name, arg_str); } return ex; -#endif } MonoExceptionHandle diff --git a/mono/metadata/filewatcher.c b/mono/metadata/filewatcher.c index cf1646114cd..c1bb7574c70 100644 --- a/mono/metadata/filewatcher.c +++ b/mono/metadata/filewatcher.c @@ -12,7 +12,6 @@ #include #include -#if !ENABLE_NETCORE #ifdef HAVE_SYS_TYPES_H #include @@ -187,8 +186,3 @@ ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq_ptr, gpointer change #endif /* #if HAVE_KQUEUE */ -#else - -MONO_EMPTY_SOURCE_FILE (filewatcher); - -#endif /* !ENABLE_NETCORE */ diff --git a/mono/metadata/filewatcher.h b/mono/metadata/filewatcher.h index 3d484b92f61..b37ff30c08d 100644 --- a/mono/metadata/filewatcher.h +++ b/mono/metadata/filewatcher.h @@ -20,7 +20,6 @@ #include #endif -#if !ENABLE_NETCORE ICALL_EXPORT gint ves_icall_System_IO_FSW_SupportsFSW (void); @@ -28,7 +27,6 @@ gint ves_icall_System_IO_FSW_SupportsFSW (void); ICALL_EXPORT int ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq, gpointer changelist, int nchanges, gpointer eventlist, int nevents); -#endif #ifdef HOST_IOS // This will obsoleted by System.Native as soon as it's ported to iOS MONO_API char* SystemNative_RealPath(const char* path); diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index f81963be552..6914262b4a6 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -650,51 +650,6 @@ ves_icall_System_GC_get_ephemeron_tombstone (MonoError *error) return MONO_HANDLE_NEW (MonoObject, mono_domain_get ()->ephemeron_tombstone); } -#if ENABLE_NETCORE - -MonoGCHandle -ves_icall_System_GCHandle_InternalAlloc (MonoObjectHandle obj, gint32 type, MonoError *error) -{ - MonoGCHandle handle = NULL; - - switch (type) { - case HANDLE_WEAK: - handle = mono_gchandle_new_weakref_from_handle (obj); - break; - case HANDLE_WEAK_TRACK: - handle = mono_gchandle_new_weakref_from_handle_track_resurrection (obj); - break; - case HANDLE_NORMAL: - handle = mono_gchandle_from_handle (obj, FALSE); - break; - case HANDLE_PINNED: - handle = mono_gchandle_from_handle (obj, TRUE); - break; - default: - g_assert_not_reached (); - } - return handle; -} - -void -ves_icall_System_GCHandle_InternalFree (MonoGCHandle handle, MonoError *error) -{ - mono_gchandle_free_internal (handle); -} - -MonoObjectHandle -ves_icall_System_GCHandle_InternalGet (MonoGCHandle handle, MonoError *error) -{ - return mono_gchandle_get_target_handle (handle); -} - -void -ves_icall_System_GCHandle_InternalSet (MonoGCHandle handle, MonoObjectHandle obj, MonoError *error) -{ - mono_gchandle_set_target_handle (handle, obj); -} - -#else MonoObjectHandle ves_icall_System_GCHandle_GetTarget (MonoGCHandle handle, MonoError *error) @@ -774,7 +729,6 @@ ves_icall_System_GCHandle_CheckCurrentDomain (MonoGCHandle gchandle) return mono_gchandle_is_in_domain (gchandle, mono_domain_get ()); } -#endif static MonoCoopSem finalizer_sem; static volatile gboolean finished; diff --git a/mono/metadata/icall-decl.h b/mono/metadata/icall-decl.h index b00b1aa36e5..6ca080535bb 100644 --- a/mono/metadata/icall-decl.h +++ b/mono/metadata/icall-decl.h @@ -136,20 +136,9 @@ ICALL_EXPORT float ves_icall_System_MathF_Sqrt (float); ICALL_EXPORT float ves_icall_System_MathF_Tan (float); ICALL_EXPORT float ves_icall_System_MathF_Tanh (float); ICALL_EXPORT float ves_icall_System_Math_Abs_single (float); -#if ENABLE_NETCORE -ICALL_EXPORT gint32 ves_icall_System_Math_ILogB (double); -ICALL_EXPORT double ves_icall_System_Math_Log2 (double); -ICALL_EXPORT double ves_icall_System_Math_FusedMultiplyAdd (double, double, double); -ICALL_EXPORT gint32 ves_icall_System_MathF_ILogB (float); -ICALL_EXPORT float ves_icall_System_MathF_Log2 (float); -ICALL_EXPORT float ves_icall_System_MathF_FusedMultiplyAdd (float, float, float); -#endif ICALL_EXPORT gint ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void); ICALL_EXPORT gint32 ves_icall_System_Environment_get_ProcessorCount (void); ICALL_EXPORT gint32 ves_icall_System_Environment_get_TickCount (void); -#if ENABLE_NETCORE -ICALL_EXPORT gint64 ves_icall_System_Environment_get_TickCount64 (void); -#endif ICALL_EXPORT gint64 ves_icall_System_DateTime_GetSystemTimeAsFileTime (void); ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int, gint32, MonoProcessError*); ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Stopwatch_GetTimestamp (void); @@ -157,9 +146,7 @@ ICALL_EXPORT gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollect ICALL_EXPORT gint64 ves_icall_System_Threading_Timer_GetTimeMonotonic (void); ICALL_EXPORT gpointer ves_icall_System_GCHandle_GetAddrOfPinnedObject (MonoGCHandle handle); ICALL_EXPORT int ves_icall_Interop_Sys_DoubleToString (double, char*, char*, int); -#if !ENABLE_NETCORE ICALL_EXPORT int ves_icall_System_Environment_get_Platform (void); -#endif ICALL_EXPORT int ves_icall_System_GC_GetCollectionCount (int); ICALL_EXPORT int ves_icall_System_GC_GetMaxGeneration (void); ICALL_EXPORT gint64 ves_icall_System_GC_GetAllocatedBytesForCurrentThread (void); @@ -177,25 +164,13 @@ ICALL_EXPORT void ves_icall_System_GC_RecordPressure (gint64); ICALL_EXPORT void ves_icall_System_GC_WaitForPendingFinalizers (void); ICALL_EXPORT void ves_icall_System_GC_GetGCMemoryInfo (gint64*, gint64*, gint64*, gint64*, gint64*); -#if !ENABLE_NETCORE ICALL_EXPORT void ves_icall_System_IO_LogcatTextWriter_Log (const char*, gint32, const char*); -#endif ICALL_EXPORT void ves_icall_System_NumberFormatter_GetFormatterTables (guint64 const**, gint32 const**, gunichar2 const**, gunichar2 const**, gint64 const**, gint32 const**); -#if ENABLE_NETCORE -ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, size_t); -ICALL_EXPORT void ves_icall_System_Buffer_BulkMoveWithWriteBarrier (guint8 *, guint8 *, size_t, MonoType *); -#else ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, guint); ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier (guint8*, guint8*, guint, MonoType*); -#endif -#if ENABLE_NETCORE -ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, size_t); -#else ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, guint); -#endif ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ecvt_s(char*, size_t, double, int, int*, int*); -#if !defined(ENABLE_NETCORE) #if defined(ENABLE_MONODROID) || defined(ENABLE_MONOTOUCH) || defined(TARGET_WASM) ICALL_EXPORT gpointer ves_icall_System_IO_Compression_DeflateStreamNative_CreateZStream (gint32 compress, MonoBoolean gzip, gpointer feeder, gpointer data); ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_CloseZStream (gpointer stream); @@ -213,7 +188,6 @@ ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange ICALL_EXPORT gint32 ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size); ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CloseNLSocket (gpointer sock); #endif -#endif ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle); ICALL_EXPORT gpointer ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void); @@ -241,18 +215,6 @@ ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Debugger_IsAttached_intern ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Debugger_IsLogging (void); ICALL_EXPORT void ves_icall_System_Diagnostics_Debugger_Log (int level, MonoString *volatile* category, MonoString *volatile* message); -#ifdef ENABLE_NETCORE -ICALL_EXPORT intptr_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DefineEvent (intptr_t prov_handle, uint32_t event_id, int64_t keywords, uint32_t event_version, uint32_t level, const uint8_t *metadata, uint32_t metadata_len); -ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DeleteProvider (intptr_t prov_handle); -ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Disable (uint64_t session_id); -ICALL_EXPORT uint64_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Enable (const_gunichar2_ptr output_file, int32_t format, uint32_t circular_buffer_size_mb, const void *providers, uint32_t num_providers); -ICALL_EXPORT int32_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_EventActivityIdControl (uint32_t control_code, uint8_t *activity_id); -ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetNextEvent (uint64_t session_id, void *instance); -ICALL_EXPORT intptr_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetProvider (const_gunichar2_ptr provider_name); -ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetSessionInfo (uint64_t session_id, void *session_info); -ICALL_EXPORT intptr_t ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetWaitHandle (uint64_t session_id); -ICALL_EXPORT void ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData (intptr_t event_handle, void *event_data, uint32_t event_data_len, const uint8_t *activity_id, const uint8_t *related_activity_id); -#endif ICALL_EXPORT void ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array); ICALL_EXPORT void ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname, MonoBoolean free_struct); @@ -295,19 +257,7 @@ ICALL_EXPORT gpointer ves_icall_System_Threading_Semaphore_CreateSemaphore_ic ICALL_EXPORT gpointer ves_icall_System_Threading_Semaphore_OpenSemaphore_icall (const gunichar2 *name, gint32 name_length, gint32 rights, gint32 *win32error); ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount); -#ifdef ENABLE_NETCORE -ICALL_EXPORT gpointer ves_icall_System_Threading_LowLevelLifoSemaphore_InitInternal (void); -ICALL_EXPORT void ves_icall_System_Threading_LowLevelLifoSemaphore_DeleteInternal (gpointer sem_ptr); -ICALL_EXPORT gint32 ves_icall_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal (gpointer sem_ptr, gint32 timeout_ms); -ICALL_EXPORT void ves_icall_System_Threading_LowLevelLifoSemaphore_ReleaseInternal (gpointer sem_ptr, gint32 count); -#endif -#if defined(ENABLE_NETCORE) && defined(TARGET_AMD64) -ICALL_EXPORT void ves_icall_System_Runtime_Intrinsics_X86_X86Base___cpuidex (int abcd[4], int function_id, int subfunction_id); -#endif -#if defined(ENABLE_NETCORE) && defined(ENABLE_METADATA_UPDATE) -ICALL_EXPORT void ves_icall_Mono_Runtime_LoadMetadataUpdate (MonoAssembly *assm, gconstpointer dmeta_bytes, int32_t dmeta_len, gconstpointer dil_bytes, int32_t dil_len); -#endif #endif // __MONO_METADATA_ICALL_DECL_H__ diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index 56dd99bccb5..19995156fa3 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -107,9 +107,6 @@ // "HandleIn" is the default for managed types, and is just called "Handle". // -#if ENABLE_NETCORE -#include "icall-def-netcore.h" -#else ICALL_TYPE(CLR_INTEROP_SYS, "Interop/Sys", CLR_INTEROP_SYS_1) NOHANDLES(ICALL(CLR_INTEROP_SYS_1, "DoubleToString", ves_icall_Interop_Sys_DoubleToString)) @@ -1136,7 +1133,6 @@ HANDLES(COMOBJ_2, "GetInterfaceInternal", ves_icall_System_ComObject_GetInterfac HANDLES(COMOBJ_3, "ReleaseInterfaces", ves_icall_System_ComObject_ReleaseInterfaces, void, 1, (MonoComObject)) #endif -#endif // This is similar to HANDLES() but is for icalls passed to register_jit_icall. // There is no metadata for these. No signature matching. diff --git a/mono/metadata/icall-eventpipe.c b/mono/metadata/icall-eventpipe.c index 87098b566b3..75768d30608 100644 --- a/mono/metadata/icall-eventpipe.c +++ b/mono/metadata/icall-eventpipe.c @@ -2,1086 +2,5 @@ #include #include -#ifdef ENABLE_NETCORE -#include - -#if defined(ENABLE_PERFTRACING) && !defined(DISABLE_EVENTPIPE) -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Rundown flags. -#define METHOD_FLAGS_DYNAMIC_METHOD 0x1 -#define METHOD_FLAGS_GENERIC_METHOD 0x2 -#define METHOD_FLAGS_SHARED_GENERIC_METHOD 0x4 -#define METHOD_FLAGS_JITTED_METHOD 0x8 -#define METHOD_FLAGS_JITTED_HELPER_METHOD 0x10 - -#define MODULE_FLAGS_NATIVE_MODULE 0x2 -#define MODULE_FLAGS_DYNAMIC_MODULE 0x4 -#define MODULE_FLAGS_MANIFEST_MODULE 0x8 - -#define ASSEMBLY_FLAGS_DYNAMIC_ASSEMBLY 0x2 -#define ASSEMBLY_FLAGS_NATIVE_ASSEMBLY 0x4 -#define ASSEMBLY_FLAGS_COLLECTIBLE_ASSEMBLY 0x8 - -#define DOMAIN_FLAGS_DEFAULT_DOMAIN 0x1 -#define DOMAIN_FLAGS_EXECUTABLE_DOMAIN 0x2 - -typedef enum _EventPipeActivityControlCode { - EP_ACTIVITY_CONTROL_GET_ID = 1, - EP_ACTIVITY_CONTROL_SET_ID = 2, - EP_ACTIVITY_CONTROL_CREATE_ID = 3, - EP_ACTIVITY_CONTROL_GET_SET_ID = 4, - EP_ACTIVITY_CONTROL_CREATE_SET_ID = 5 -} EventPipeActivityControlCode; - -typedef struct _EventPipeProviderConfigurationNative { - gunichar2 *provider_name; - uint64_t keywords; - uint32_t logging_level; - gunichar2 *filter_data; -} EventPipeProviderConfigurationNative; - -typedef struct _EventPipeSessionInfo { - int64_t starttime_as_utc_filetime; - int64_t start_timestamp; - int64_t timestamp_frequency; -} EventPipeSessionInfo; - -typedef struct _EventPipeEventInstanceData { - intptr_t provider_id; - uint32_t event_id; - uint32_t thread_id; - int64_t timestamp; - uint8_t activity_id [EP_ACTIVITY_ID_SIZE]; - uint8_t related_activity_id [EP_ACTIVITY_ID_SIZE]; - const uint8_t *payload; - uint32_t payload_len; -} EventPipeEventInstanceData; - -typedef struct _EventPipeFireMethodEventsData{ - MonoDomain *domain; - uint8_t *buffer; - size_t buffer_size; - ep_rt_mono_fire_method_rundown_events_func method_events_func; -} EventPipeFireMethodEventsData; - -gboolean ep_rt_mono_initialized; -MonoNativeTlsKey ep_rt_mono_thread_holder_tls_id; -gpointer ep_rt_mono_rand_provider; - -static ep_rt_thread_holder_alloc_func thread_holder_alloc_callback_func; -static ep_rt_thread_holder_free_func thread_holder_free_callback_func; - -/* - * Forward declares of all static functions. - */ - -static -gboolean -rand_try_get_bytes_func ( - guchar *buffer, - gssize buffer_size, - MonoError *error); - -static -EventPipeThread * -eventpipe_thread_get (void); - -static -EventPipeThread * -eventpipe_thread_get_or_create (void); - -static -void -eventpipe_thread_exited (void); - -static -void -profiler_eventpipe_thread_exited ( - MonoProfiler *prof, - uintptr_t tid); - -static -gpointer -eventpipe_thread_attach (gboolean background_thread); - -static -void -eventpipe_thread_detach (void); - -static -void -eventpipe_fire_method_events ( - MonoJitInfo *ji, - EventPipeFireMethodEventsData *events_data); - -static -void -eventpipe_fire_method_events_func ( - MonoJitInfo *ji, - gpointer user_data); - -static -void -eventpipe_fire_assembly_events ( - MonoDomain *domain, - MonoAssembly *assembly, - ep_rt_mono_fire_assembly_rundown_events_func assembly_events_func); - -static -gboolean -eventpipe_execute_rundown ( - ep_rt_mono_fire_domain_rundown_events_func domain_events_func, - ep_rt_mono_fire_assembly_rundown_events_func assembly_events_func, - ep_rt_mono_fire_method_rundown_events_func methods_events_func); - -static -gboolean -eventpipe_walk_managed_stack_for_thread_func ( - MonoStackFrameInfo *frame, - MonoContext *ctx, - gpointer data); - -static -gboolean -eventpipe_walk_managed_stack_for_thread ( - ep_rt_thread_handle_t thread, - EventPipeStackContents *stack_contents); - -static -gboolean -eventpipe_method_get_simple_assembly_name ( - ep_rt_method_desc_t *method, - ep_char8_t *name, - size_t name_len); - -static -gboolean -evetpipe_method_get_full_name ( - ep_rt_method_desc_t *method, - ep_char8_t *name, - size_t name_len); - -static -void -delegate_callback_data_free_func ( - EventPipeCallback callback_func, - void *callback_data); - -static -void -delegate_callback_func ( - const uint8_t *source_id, - unsigned long is_enabled, - uint8_t level, - uint64_t match_any_keywords, - uint64_t match_all_keywords, - EventFilterDescriptor *filter_data, - void *callback_context); - -static -gboolean -rand_try_get_bytes_func ( - guchar *buffer, - gssize buffer_size, - MonoError *error) -{ - g_assert (ep_rt_mono_rand_provider != NULL); - return mono_rand_try_get_bytes (&ep_rt_mono_rand_provider, buffer, buffer_size, error); -} - -static -EventPipeThread * -eventpipe_thread_get (void) -{ - EventPipeThreadHolder *thread_holder = (EventPipeThreadHolder *)mono_native_tls_get_value (ep_rt_mono_thread_holder_tls_id); - return thread_holder ? ep_thread_holder_get_thread (thread_holder) : NULL; -} - -static -EventPipeThread * -eventpipe_thread_get_or_create (void) -{ - EventPipeThreadHolder *thread_holder = (EventPipeThreadHolder *)mono_native_tls_get_value (ep_rt_mono_thread_holder_tls_id); - if (!thread_holder && thread_holder_alloc_callback_func) { - thread_holder = thread_holder_alloc_callback_func (); - mono_native_tls_set_value (ep_rt_mono_thread_holder_tls_id, thread_holder); - } - return ep_thread_holder_get_thread (thread_holder); -} - -static -void -eventpipe_thread_exited (void) -{ - if (ep_rt_mono_initialized) { - EventPipeThreadHolder *thread_holder = (EventPipeThreadHolder *)mono_native_tls_get_value (ep_rt_mono_thread_holder_tls_id); - if (thread_holder && thread_holder_free_callback_func) - thread_holder_free_callback_func (thread_holder); - mono_native_tls_set_value (ep_rt_mono_thread_holder_tls_id, NULL); - } -} - -static -void -profiler_eventpipe_thread_exited ( - MonoProfiler *prof, - uintptr_t tid) -{ - eventpipe_thread_exited (); -} - -static -gpointer -eventpipe_thread_attach (gboolean background_thread) -{ - MonoThread *thread = NULL; - - // NOTE, under netcore, only root domain exists. - if (!mono_thread_current ()) { - thread = mono_thread_internal_attach (mono_get_root_domain ()); - if (background_thread && thread) { - mono_thread_set_state (thread, ThreadState_Background); - mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NO_SAMPLE); - } - } - - return thread; -} - -static -void -eventpipe_thread_detach (void) -{ - MonoThread *current_thread = mono_thread_current (); - if (current_thread) - mono_thread_internal_detach (current_thread); -} - -static -void -eventpipe_fire_method_events ( - MonoJitInfo *ji, - EventPipeFireMethodEventsData *events_data) -{ - g_assert_checked (ji != NULL); - g_assert_checked (events_data->domain != NULL); - g_assert_checked (events_data->method_events_func != NULL); - - uint64_t method_id = 0; - uint64_t module_id = 0; - uint64_t method_code_start = (uint64_t)ji->code_start; - uint32_t method_code_size = (uint32_t)ji->code_size; - uint32_t method_token = 0; - uint32_t method_flags = 0; - uint8_t kind = MONO_CLASS_DEF; - char *method_namespace = NULL; - const char *method_name = NULL; - char *method_signature = NULL; - - //TODO: Optimize string formatting into functions accepting GString to reduce heap alloc. - - MonoMethod *method = jinfo_get_method (ji); - if (method) { - method_id = (uint64_t)method; - method_token = method->token; - - if (mono_jit_info_get_generic_sharing_context (ji)) - method_flags |= METHOD_FLAGS_SHARED_GENERIC_METHOD; - - if (method->dynamic) - method_flags |= METHOD_FLAGS_DYNAMIC_METHOD; - - if (!ji->from_aot && !ji->from_llvm) { - method_flags |= METHOD_FLAGS_JITTED_METHOD; - if (method->wrapper_type != MONO_WRAPPER_NONE) - method_flags |= METHOD_FLAGS_JITTED_HELPER_METHOD; - } - - if (method->is_generic || method->is_inflated) - method_flags |= METHOD_FLAGS_GENERIC_METHOD; - - method_name = method->name; - method_signature = mono_signature_full_name (method->signature); - - if (method->klass) { - module_id = (uint64_t)m_class_get_image (method->klass); - kind = m_class_get_class_kind (method->klass); - if (kind == MONO_CLASS_GTD || kind == MONO_CLASS_GINST) - method_flags |= METHOD_FLAGS_GENERIC_METHOD; - method_namespace = mono_type_get_name_full (m_class_get_byval_arg (method->klass), MONO_TYPE_NAME_FORMAT_IL); - } - } - - uint16_t offset_entries = 0; - uint32_t *il_offsets = NULL; - uint32_t *native_offsets = NULL; - - MonoDebugMethodJitInfo *debug_info = method ? mono_debug_find_method (method, events_data->domain) : NULL; - if (debug_info) { - offset_entries = debug_info->num_line_numbers; - size_t needed_size = (offset_entries * sizeof (uint32_t) * 2); - if (!events_data->buffer || needed_size > events_data->buffer_size) { - g_free (events_data->buffer); - events_data->buffer_size = (size_t)(needed_size * 1.5); - events_data->buffer = g_new (uint8_t, events_data->buffer_size); - } - - if (events_data->buffer) { - il_offsets = (uint32_t*)events_data->buffer; - native_offsets = il_offsets + offset_entries; - - for (int offset_count = 0; offset_count < offset_entries; ++offset_count) { - il_offsets [offset_count] = debug_info->line_numbers [offset_count].il_offset; - native_offsets [offset_count] = debug_info->line_numbers [offset_count].native_offset; - } - } - - mono_debug_free_method_jit_info (debug_info); - } - - if (events_data->buffer && !il_offsets && !native_offsets) { - // No IL offset -> Native offset mapping available. Put all code on IL offset 0. - g_assert_checked (events_data->buffer_size >= sizeof (uint32_t) * 2); - offset_entries = 1; - il_offsets = (uint32_t*)events_data->buffer; - native_offsets = il_offsets + offset_entries; - il_offsets [0] = 0; - native_offsets [0] = (uint32_t)ji->code_size; - } - - events_data->method_events_func ( - method_id, - module_id, - method_code_start, - method_code_size, - method_token, - method_flags, - (ep_char8_t *)method_namespace, - (ep_char8_t *)method_name, - (ep_char8_t *)method_signature, - offset_entries, - il_offsets, - native_offsets, - NULL); - - g_free (method_namespace); - g_free (method_signature); -} - -static -void -eventpipe_fire_method_events_func ( - MonoJitInfo *ji, - gpointer user_data) -{ - EventPipeFireMethodEventsData *events_data = (EventPipeFireMethodEventsData *)user_data; - g_assert_checked (events_data != NULL); - - if (ji && !ji->is_trampoline && !ji->async) - eventpipe_fire_method_events (ji, events_data); -} - -static -void -eventpipe_fire_assembly_events ( - MonoDomain *domain, - MonoAssembly *assembly, - ep_rt_mono_fire_assembly_rundown_events_func assembly_events_func) -{ - g_assert_checked (domain != NULL); - g_assert_checked (assembly != NULL); - g_assert_checked (assembly_events_func != NULL); - - uint64_t domain_id = (uint64_t)domain; - uint64_t module_id = (uint64_t)assembly->image; - uint64_t assembly_id = (uint64_t)assembly; - - // TODO: Extract all module IL/Native paths and pdb metadata when available. - const char *module_il_path = ""; - const char *module_il_pdb_path = ""; - const char *module_native_path = ""; - const char *module_native_pdb_path = ""; - uint8_t signature [EP_GUID_SIZE] = { 0 }; - uint32_t module_il_pdb_age = 0; - uint32_t module_native_pdb_age = 0; - - uint32_t reserved_flags = 0; - uint64_t binding_id = 0; - - // Native methods are part of JIT table and already emitted. - // TODO: FireEtwMethodDCEndVerbose_V1_or_V2 for all native methods in module as well? - - // Netcore has a 1:1 between assemblies and modules, so its always a manifest module. - uint32_t module_flags = MODULE_FLAGS_MANIFEST_MODULE; - if (assembly->image) { - if (assembly->image->dynamic) - module_flags |= MODULE_FLAGS_DYNAMIC_MODULE; - if (assembly->image->aot_module) - module_flags |= MODULE_FLAGS_NATIVE_MODULE; - - module_il_path = assembly->image->filename ? assembly->image->filename : ""; - } - - uint32_t assembly_flags = 0; - if (assembly->dynamic) - assembly_flags |= ASSEMBLY_FLAGS_DYNAMIC_ASSEMBLY; - - if (assembly->image && assembly->image->aot_module) { - assembly_flags |= ASSEMBLY_FLAGS_NATIVE_ASSEMBLY; - } - - char *assembly_name = mono_stringify_assembly_name (&assembly->aname); - - assembly_events_func ( - domain_id, - assembly_id, - assembly_flags, - binding_id, - (const ep_char8_t*)assembly_name, - module_id, - module_flags, - reserved_flags, - (const ep_char8_t *)module_il_path, - (const ep_char8_t *)module_native_path, - signature, - module_il_pdb_age, - (const ep_char8_t *)module_il_pdb_path, - signature, - module_native_pdb_age, - (const ep_char8_t *)module_native_pdb_path, - NULL); - - g_free (assembly_name); -} - -static -gboolean -eventpipe_execute_rundown ( - ep_rt_mono_fire_domain_rundown_events_func domain_events_func, - ep_rt_mono_fire_assembly_rundown_events_func assembly_events_func, - ep_rt_mono_fire_method_rundown_events_func method_events_func) -{ - g_assert_checked (domain_events_func != NULL); - g_assert_checked (assembly_events_func != NULL); - g_assert_checked (method_events_func != NULL); - - // Under netcore we only have root domain. - MonoDomain *root_domain = mono_get_root_domain (); - if (root_domain) { - uint64_t domain_id = (uint64_t)root_domain; - - // Iterate all functions in use (both JIT and AOT). - EventPipeFireMethodEventsData events_data; - events_data.domain = root_domain; - events_data.buffer_size = 1024 * sizeof(uint32_t); - events_data.buffer = g_new (uint8_t, events_data.buffer_size); - events_data.method_events_func = method_events_func; - mono_jit_info_table_foreach_internal (root_domain, eventpipe_fire_method_events_func, &events_data); - g_free (events_data.buffer); - - // Iterate all assemblies in domain. - GPtrArray *assemblies = mono_domain_get_assemblies (root_domain, FALSE); - if (assemblies) { - for (int i = 0; i < assemblies->len; ++i) { - MonoAssembly *assembly = (MonoAssembly *)g_ptr_array_index (assemblies, i); - if (assembly) - eventpipe_fire_assembly_events (root_domain, assembly, assembly_events_func); - } - g_ptr_array_free (assemblies, TRUE); - } - - uint32_t domain_flags = DOMAIN_FLAGS_DEFAULT_DOMAIN | DOMAIN_FLAGS_EXECUTABLE_DOMAIN; - const char *domain_name = root_domain->friendly_name ? root_domain->friendly_name : ""; - uint32_t domain_index = 1; - - domain_events_func ( - domain_id, - domain_flags, - (const ep_char8_t *)domain_name, - domain_index, - NULL); - } - - return TRUE; -} - -static -gboolean -eventpipe_walk_managed_stack_for_thread_func ( - MonoStackFrameInfo *frame, - MonoContext *ctx, - gpointer data) -{ - g_assert_checked (frame != NULL); - g_assert_checked (data != NULL); - - switch (frame->type) { - case FRAME_TYPE_DEBUGGER_INVOKE: - case FRAME_TYPE_MANAGED_TO_NATIVE: - case FRAME_TYPE_TRAMPOLINE: - case FRAME_TYPE_INTERP_TO_MANAGED: - case FRAME_TYPE_INTERP_TO_MANAGED_WITH_CTX: - return FALSE; - case FRAME_TYPE_MANAGED: - case FRAME_TYPE_INTERP: - if (!frame->ji) - return FALSE; - MonoMethod *method = frame->ji->async ? NULL : frame->actual_method; - ep_stack_contents_append ((EventPipeStackContents *)data, (uintptr_t)((uint8_t*)frame->ji->code_start + frame->native_offset), method); - return ep_stack_contents_get_length ((EventPipeStackContents *)data) >= EP_MAX_STACK_DEPTH; - default: - g_assert_not_reached (); - return FALSE; - } -} - -static -gboolean -eventpipe_walk_managed_stack_for_thread ( - ep_rt_thread_handle_t thread, - EventPipeStackContents *stack_contents) -{ - g_assert (thread != NULL && stack_contents != NULL); - - if (thread == ep_rt_thread_get_handle ()) - mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (eventpipe_walk_managed_stack_for_thread_func, NULL, MONO_UNWIND_SIGNAL_SAFE, stack_contents); - else - mono_get_eh_callbacks ()->mono_walk_stack_with_state (eventpipe_walk_managed_stack_for_thread_func, mono_thread_info_get_suspend_state (thread), MONO_UNWIND_SIGNAL_SAFE, stack_contents); - - return TRUE; -} - -static -gboolean -eventpipe_method_get_simple_assembly_name ( - ep_rt_method_desc_t *method, - ep_char8_t *name, - size_t name_len) -{ - g_assert_checked (method != NULL); - g_assert_checked (name != NULL); - - MonoClass *method_class = mono_method_get_class (method); - MonoImage *method_image = method_class ? mono_class_get_image (method_class) : NULL; - const ep_char8_t *assembly_name = method_image ? mono_image_get_name (method_image) : NULL; - - if (!assembly_name) - return FALSE; - - g_strlcpy (name, assembly_name, name_len); - return TRUE; -} - -static -gboolean -evetpipe_method_get_full_name ( - ep_rt_method_desc_t *method, - ep_char8_t *name, - size_t name_len) -{ - g_assert_checked (method != NULL); - g_assert_checked (name != NULL); - - char *full_method_name = mono_method_get_name_full (method, TRUE, TRUE, MONO_TYPE_NAME_FORMAT_IL); - if (!full_method_name) - return FALSE; - - g_strlcpy (name, full_method_name, name_len); - - g_free (full_method_name); - return TRUE; -} - -void -mono_eventpipe_init ( - EventPipeMonoFuncTable *table, - ep_rt_thread_holder_alloc_func thread_holder_alloc_func, - ep_rt_thread_holder_free_func thread_holder_free_func) -{ - if (table != NULL) { - table->ep_rt_mono_cpu_count = mono_cpu_count; - table->ep_rt_mono_process_current_pid = mono_process_current_pid; - table->ep_rt_mono_native_thread_id_get = mono_native_thread_id_get; - table->ep_rt_mono_native_thread_id_equals = mono_native_thread_id_equals; - table->ep_rt_mono_runtime_is_shutting_down = mono_runtime_is_shutting_down; - table->ep_rt_mono_rand_try_get_bytes = rand_try_get_bytes_func; - table->ep_rt_mono_thread_get = eventpipe_thread_get; - table->ep_rt_mono_thread_get_or_create = eventpipe_thread_get_or_create; - table->ep_rt_mono_thread_exited = eventpipe_thread_exited; - table->ep_rt_mono_thread_info_sleep = mono_thread_info_sleep; - table->ep_rt_mono_thread_info_yield = mono_thread_info_yield; - table->ep_rt_mono_w32file_close = mono_w32file_close; - table->ep_rt_mono_w32file_create = mono_w32file_create; - table->ep_rt_mono_w32file_write = mono_w32file_write; - table->ep_rt_mono_w32event_create = mono_w32event_create; - table->ep_rt_mono_w32event_close = mono_w32event_close; - table->ep_rt_mono_w32event_set = mono_w32event_set; - table->ep_rt_mono_w32hadle_wait_one = mono_w32handle_wait_one; - table->ep_rt_mono_valloc = mono_valloc; - table->ep_rt_mono_vfree = mono_vfree; - table->ep_rt_mono_valloc_granule = mono_valloc_granule; - table->ep_rt_mono_thread_platform_create_thread = mono_thread_platform_create_thread; - table->ep_rt_mono_thread_attach = eventpipe_thread_attach; - table->ep_rt_mono_thread_detach = eventpipe_thread_detach; - table->ep_rt_mono_get_os_cmd_line = mono_get_os_cmd_line; - table->ep_rt_mono_get_managed_cmd_line = mono_runtime_get_managed_cmd_line; - table->ep_rt_mono_execute_rundown = eventpipe_execute_rundown; - table->ep_rt_mono_walk_managed_stack_for_thread = eventpipe_walk_managed_stack_for_thread; - table->ep_rt_mono_method_get_simple_assembly_name = eventpipe_method_get_simple_assembly_name; - table->ep_rt_mono_method_get_full_name = evetpipe_method_get_full_name; - } - - thread_holder_alloc_callback_func = thread_holder_alloc_func; - thread_holder_free_callback_func = thread_holder_free_func; - mono_native_tls_alloc (&ep_rt_mono_thread_holder_tls_id, NULL); - - mono_100ns_ticks (); - mono_rand_open (); - ep_rt_mono_rand_provider = mono_rand_init (NULL, 0); - - ep_rt_mono_initialized = TRUE; - - MonoProfilerHandle profiler = mono_profiler_create (NULL); - mono_profiler_set_thread_stopped_callback (profiler, profiler_eventpipe_thread_exited); -} - -void -mono_eventpipe_fini (void) -{ - if (ep_rt_mono_initialized) - mono_rand_close (ep_rt_mono_rand_provider); - - ep_rt_mono_rand_provider = NULL; - thread_holder_alloc_callback_func = NULL; - thread_holder_free_callback_func = NULL; - ep_rt_mono_initialized = FALSE; -} - -static -void -delegate_callback_data_free_func ( - EventPipeCallback callback_func, - void *callback_data) -{ - if (callback_data) - mono_gchandle_free_internal ((MonoGCHandle)callback_data); -} - -static -void -delegate_callback_func ( - const uint8_t *source_id, - unsigned long is_enabled, - uint8_t level, - uint64_t match_any_keywords, - uint64_t match_all_keywords, - EventFilterDescriptor *filter_data, - void *callback_context) -{ - - /*internal unsafe delegate void EtwEnableCallback( - in Guid sourceId, - int isEnabled, - byte level, - long matchAnyKeywords, - long matchAllKeywords, - EVENT_FILTER_DESCRIPTOR* filterData, - void* callbackContext);*/ - - MonoGCHandle delegate_object_handle = (MonoGCHandle)callback_context; - MonoObject *delegate_object = delegate_object_handle ? mono_gchandle_get_target_internal (delegate_object_handle) : NULL; - if (delegate_object) { - void *params [7]; - params [0] = (void *)source_id; - params [1] = (void *)&is_enabled; - params [2] = (void *)&level; - params [3] = (void *)&match_any_keywords; - params [4] = (void *)&match_all_keywords; - params [5] = (void *)filter_data; - params [6] = NULL; - - ERROR_DECL (error); - mono_runtime_delegate_invoke_checked (delegate_object, params, error); - } -} - -gconstpointer -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_CreateProvider ( - MonoStringHandle provider_name, - MonoDelegateHandle callback_func, - MonoError *error) -{ - EventPipeProvider *provider = NULL; - void *callback_data = NULL; - - if (MONO_HANDLE_IS_NULL (provider_name)) { - mono_error_set_argument_null (error, "providerName", ""); - return NULL; - } - - if (!MONO_HANDLE_IS_NULL (callback_func)) - callback_data = (void *)mono_gchandle_new_weakref_internal (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, callback_func)), FALSE); - - char *provider_name_utf8 = mono_string_handle_to_utf8 (provider_name, error); - if (is_ok (error) && provider_name_utf8) { - provider = ep_create_provider (provider_name_utf8, delegate_callback_func, delegate_callback_data_free_func, callback_data); - } - - g_free (provider_name_utf8); - return provider; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DefineEvent ( - intptr_t provider_handle, - uint32_t event_id, - int64_t keywords, - uint32_t event_version, - uint32_t level, - const uint8_t *metadata, - uint32_t metadata_len) -{ - g_assert (provider_handle != 0); - - EventPipeProvider *provider = (EventPipeProvider *)provider_handle; - EventPipeEvent *ep_event = ep_provider_add_event (provider, event_id, (uint64_t)keywords, event_version, (EventPipeEventLevel)level, /* needStack = */ true, metadata, metadata_len); - - g_assert (ep_event != NULL); - return (intptr_t)ep_event; -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DeleteProvider (intptr_t provider_handle) -{ - if (provider_handle) { - ep_delete_provider ((EventPipeProvider *)provider_handle); - } -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Disable (uint64_t session_id) -{ - ep_disable (session_id); -} - -uint64_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Enable ( - const gunichar2 *output_file, - /* EventPipeSerializationFormat */int32_t format, - uint32_t circular_buffer_size_mb, - /* EventPipeProviderConfigurationNative[] */const void *providers, - uint32_t providers_len) -{ - ERROR_DECL (error); - EventPipeSessionID session_id = 0; - char *output_file_utf8 = NULL; - - if (circular_buffer_size_mb == 0 || format > EP_SERIALIZATION_FORMAT_COUNT || providers_len == 0 || providers == NULL) - return 0; - - if (output_file) - output_file_utf8 = mono_utf16_to_utf8 (output_file, g_utf16_len (output_file), error); - - EventPipeProviderConfigurationNative *native_config_providers = (EventPipeProviderConfigurationNative *)providers; - EventPipeProviderConfiguration *config_providers = g_new0 (EventPipeProviderConfiguration, providers_len); - - if (config_providers) { - for (int i = 0; i < providers_len; ++i) { - ep_provider_config_init ( - &config_providers[i], - native_config_providers[i].provider_name ? mono_utf16_to_utf8 (native_config_providers[i].provider_name, g_utf16_len (native_config_providers[i].provider_name), error) : NULL, - native_config_providers [i].keywords, - (EventPipeEventLevel)native_config_providers [i].logging_level, - native_config_providers[i].filter_data ? mono_utf16_to_utf8 (native_config_providers[i].filter_data, g_utf16_len (native_config_providers[i].filter_data), error) : NULL); - } - } - - session_id = ep_enable ( - output_file_utf8, - circular_buffer_size_mb, - config_providers, - providers_len, - output_file != NULL ? EP_SESSION_TYPE_FILE : EP_SESSION_TYPE_LISTENER, - (EventPipeSerializationFormat)format, - true, - NULL, - NULL); - ep_start_streaming (session_id); - - if (config_providers) { - for (int i = 0; i < providers_len; ++i) { - ep_provider_config_fini (&config_providers[i]); - g_free ((ep_char8_t *)ep_provider_config_get_provider_name (&config_providers[i])); - g_free ((ep_char8_t *)ep_provider_config_get_filter_data (&config_providers[i])); - } - } - - g_free (output_file_utf8); - return session_id; -} - -int32_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_EventActivityIdControl ( - uint32_t control_code, - /* GUID * */uint8_t *activity_id) -{ - int32_t result = 0; - ep_rt_thread_activity_id_handle_t activity_id_handle = ep_thread_get_activity_id_handle (); - - if (activity_id_handle == NULL) - return 1; - - uint8_t current_activity_id [EP_ACTIVITY_ID_SIZE]; - EventPipeActivityControlCode activity_control_code = (EventPipeActivityControlCode)control_code; - switch (activity_control_code) { - case EP_ACTIVITY_CONTROL_GET_ID: - ep_thread_get_activity_id (activity_id_handle, activity_id, EP_ACTIVITY_ID_SIZE); - break; - case EP_ACTIVITY_CONTROL_SET_ID: - ep_thread_set_activity_id (activity_id_handle, activity_id, EP_ACTIVITY_ID_SIZE); - break; - case EP_ACTIVITY_CONTROL_CREATE_ID: - ep_thread_create_activity_id (activity_id, EP_ACTIVITY_ID_SIZE); - break; - case EP_ACTIVITY_CONTROL_GET_SET_ID: - ep_thread_get_activity_id (activity_id_handle, current_activity_id, EP_ACTIVITY_ID_SIZE); - ep_thread_set_activity_id (activity_id_handle, activity_id, EP_ACTIVITY_ID_SIZE); - memcpy (activity_id, current_activity_id, EP_ACTIVITY_ID_SIZE); - break; - case EP_ACTIVITY_CONTROL_CREATE_SET_ID: - ep_thread_get_activity_id (activity_id_handle, activity_id, EP_ACTIVITY_ID_SIZE); - ep_thread_create_activity_id (current_activity_id, EP_ACTIVITY_ID_SIZE); - ep_thread_set_activity_id (activity_id_handle, current_activity_id, EP_ACTIVITY_ID_SIZE); - break; - default: - result = 1; - break; - } - - return result; -} - -MonoBoolean -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetNextEvent ( - uint64_t session_id, - /* EventPipeEventInstanceData * */void *instance) -{ - g_assert (instance != NULL); - - EventPipeEventInstance *const next_instance = ep_get_next_event (session_id); - EventPipeEventInstanceData *const data = (EventPipeEventInstanceData *)instance; - if (next_instance && data) { - const EventPipeEvent *const ep_event = ep_event_instance_get_ep_event (next_instance); - if (ep_event) { - data->provider_id = (intptr_t)ep_event_get_provider (ep_event); - data->event_id = ep_event_get_event_id (ep_event); - } - data->thread_id = ep_event_instance_get_thread_id (next_instance); - data->timestamp = ep_event_instance_get_timestamp (next_instance); - memcpy (&data->activity_id, ep_event_instance_get_activity_id_cref (next_instance), EP_ACTIVITY_ID_SIZE); - memcpy (&data->related_activity_id, ep_event_instance_get_related_activity_id_cref (next_instance), EP_ACTIVITY_ID_SIZE); - data->payload = ep_event_instance_get_data (next_instance); - data->payload_len = ep_event_instance_get_data_len (next_instance); - } - - return next_instance != NULL; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetProvider (const gunichar2 *provider_name) -{ - ERROR_DECL (error); - char * provider_name_utf8 = NULL; - EventPipeProvider *provider = NULL; - - if (provider_name) { - provider_name_utf8 = mono_utf16_to_utf8 (provider_name, g_utf16_len (provider_name), error); - provider = ep_get_provider (provider_name_utf8); - } - - g_free (provider_name_utf8); - return (intptr_t)provider; -} - -MonoBoolean -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetSessionInfo ( - uint64_t session_id, - /* EventPipeSessionInfo * */void *session_info) -{ - bool result = false; - if (session_info) { - EventPipeSession *session = ep_get_session ((EventPipeSessionID)session_id); - if (session) { - EventPipeSessionInfo *instance = (EventPipeSessionInfo *)session_info; - instance->starttime_as_utc_filetime = ep_session_get_session_start_time (session); - instance->start_timestamp = ep_session_get_session_start_timestamp (session); - instance->timestamp_frequency = ep_perf_frequency_query (); - result = true; - } - } - - return result; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetWaitHandle (uint64_t session_id) -{ - return (intptr_t)ep_get_wait_handle (session_id); -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData ( - intptr_t event_handle, - /* EventData[] */void *event_data, - uint32_t event_data_len, - /* GUID * */const uint8_t *activity_id, - /* GUID * */const uint8_t *related_activity_id) -{ - g_assert (event_handle); - EventPipeEvent *ep_event = (EventPipeEvent *)event_handle; - ep_write_event_2 (ep_event, (EventData *)event_data, event_data_len, activity_id, related_activity_id); -} - -#else /* ENABLE_PERFTRACING */ - -gconstpointer -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_CreateProvider ( - MonoStringHandle provider_name, - MonoDelegateHandle callback_func, - MonoError *error) -{ - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.CreateProvider"); - return NULL; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DefineEvent ( - intptr_t provider_handle, - uint32_t event_id, - int64_t keywords, - uint32_t event_version, - uint32_t level, - const uint8_t *metadata, - uint32_t metadata_len) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.DefineEvent"); - mono_error_set_pending_exception (error); - return 0; -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_DeleteProvider (intptr_t provider_handle) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.DeleteProvider"); - mono_error_set_pending_exception (error); -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Disable (uint64_t session_id) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.Disable"); - mono_error_set_pending_exception (error); -} - -uint64_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Enable ( - const gunichar2 *output_file, - /* EventPipeSerializationFormat */int32_t format, - uint32_t circular_buffer_size_mb, - /* EventPipeProviderConfigurationNative[] */const void *providers, - uint32_t providers_len) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.Enable"); - mono_error_set_pending_exception (error); - return 0; -} - -int32_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_EventActivityIdControl ( - uint32_t control_code, - /* GUID * */uint8_t *activity_id) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.EventActivityIdControl"); - mono_error_set_pending_exception (error); - return 0; -} - -MonoBoolean -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetNextEvent ( - uint64_t session_id, - /* EventPipeEventInstanceData * */void *instance) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.GetNextEvent"); - mono_error_set_pending_exception (error); - return FALSE; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetProvider (const gunichar2 *provider_name) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.GetProvider"); - mono_error_set_pending_exception (error); - return 0; -} - -MonoBoolean -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetSessionInfo ( - uint64_t session_id, - /* EventPipeSessionInfo * */void *session_info) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.GetSessionInfo"); - mono_error_set_pending_exception (error); - return FALSE; -} - -intptr_t -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_GetWaitHandle (uint64_t session_id) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.GetWaitHandle"); - mono_error_set_pending_exception (error); - return 0; -} - -void -ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData ( - intptr_t event_handle, - /* EventData[] */void *event_data, - uint32_t event_data_len, - /* GUID * */const uint8_t *activity_id, - /* GUID * */const uint8_t *related_activity_id) -{ - ERROR_DECL (error); - mono_error_set_not_implemented (error, "System.Diagnostics.Tracing.EventPipeInternal.WriteEventData"); - mono_error_set_pending_exception (error); -} - -#endif /* ENABLE_PERFTRACING */ -#endif /* ENABLE_NETCORE */ MONO_EMPTY_SOURCE_FILE (icall_eventpipe); diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index b265582c284..786c1099a07 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -201,12 +201,6 @@ ves_icall_System_Array_GetValueImpl (MonoArrayHandle array, guint32 pos, MonoErr MonoClass * const array_class = mono_handle_class (array); MonoClass * const element_class = m_class_get_element_class (array_class); -#ifdef ENABLE_NETCORE - if (m_class_is_native_pointer (element_class)) { - mono_error_set_not_supported (error, NULL); - return NULL_HANDLE; - } -#endif if (m_class_is_valuetype (element_class)) { gsize element_size = mono_array_element_size (array_class); @@ -278,93 +272,6 @@ set_invalid_cast (MonoError *error, MonoClass *src_class, MonoClass *dst_class) mono_error_set_invalid_cast (error); } -#if ENABLE_NETCORE -void -ves_icall_System_Array_SetValueRelaxedImpl (MonoArrayHandle arr, MonoObjectHandle value, guint32 pos, MonoError *error) -{ - array_set_value_impl (arr, value, pos, FALSE, FALSE, error); -} - -// Copied from CoreCLR: https://github.com/dotnet/coreclr/blob/d3e39bc2f81e3dbf9e4b96347f62b49d8700336c/src/vm/invokeutil.cpp#L33 -#define PT_Primitive 0x01000000 - -static const guint32 primitive_conversions [] = { - 0x00, // MONO_TYPE_END - 0x00, // MONO_TYPE_VOID - PT_Primitive | 0x0004, // MONO_TYPE_BOOLEAN - PT_Primitive | 0x3F88, // MONO_TYPE_CHAR (W = U2, CHAR, I4, U4, I8, U8, R4, R8) - PT_Primitive | 0x3550, // MONO_TYPE_I1 (W = I1, I2, I4, I8, R4, R8) - PT_Primitive | 0x3FE8, // MONO_TYPE_U1 (W = CHAR, U1, I2, U2, I4, U4, I8, U8, R4, R8) - PT_Primitive | 0x3540, // MONO_TYPE_I2 (W = I2, I4, I8, R4, R8) - PT_Primitive | 0x3F88, // MONO_TYPE_U2 (W = U2, CHAR, I4, U4, I8, U8, R4, R8) - PT_Primitive | 0x3500, // MONO_TYPE_I4 (W = I4, I8, R4, R8) - PT_Primitive | 0x3E00, // MONO_TYPE_U4 (W = U4, I8, R4, R8) - PT_Primitive | 0x3400, // MONO_TYPE_I8 (W = I8, R4, R8) - PT_Primitive | 0x3800, // MONO_TYPE_U8 (W = U8, R4, R8) - PT_Primitive | 0x3000, // MONO_TYPE_R4 (W = R4, R8) - PT_Primitive | 0x2000, // MONO_TYPE_R8 (W = R8) -}; - -// Copied from CoreCLR: https://github.com/dotnet/coreclr/blob/030a3ea9b8dbeae89c90d34441d4d9a1cf4a7de6/src/vm/invokeutil.h#L176 -static -gboolean can_primitive_widen (MonoTypeEnum src_type, MonoTypeEnum dest_type) -{ - if (dest_type > MONO_TYPE_R8 || src_type > MONO_TYPE_R8) { - return (MONO_TYPE_I == dest_type && MONO_TYPE_I == src_type) || (MONO_TYPE_U == dest_type && MONO_TYPE_U == src_type); - } - return ((1 << dest_type) & primitive_conversions [src_type]) != 0; -} - -// Copied from CoreCLR: https://github.com/dotnet/coreclr/blob/eafa8648ebee92de1380278b15cd5c2b6ef11218/src/vm/array.cpp#L1406 -static MonoTypeEnum -get_normalized_integral_array_element_type (MonoTypeEnum elementType) -{ - // Array Primitive types such as E_T_I4 and E_T_U4 are interchangeable - // Enums with interchangeable underlying types are interchangable - // BOOL is NOT interchangeable with I1/U1, neither CHAR -- with I2/U2 - - switch (elementType) { - case MONO_TYPE_U1: - case MONO_TYPE_U2: - case MONO_TYPE_U4: - case MONO_TYPE_U8: - case MONO_TYPE_U: - return (MonoTypeEnum) (elementType - 1); // normalize to signed type - } - - return elementType; -} - -MonoBoolean -ves_icall_System_Array_CanChangePrimitive (MonoReflectionType *volatile* ref_src_type_handle, MonoReflectionType *volatile* ref_dst_type_handle, MonoBoolean reliable) -{ - MonoReflectionType* const ref_src_type = *ref_src_type_handle; - MonoReflectionType* const ref_dst_type = *ref_dst_type_handle; - - MonoType *src_type = ref_src_type->type; - MonoType *dst_type = ref_dst_type->type; - - g_assert (mono_type_is_primitive (src_type)); - g_assert (mono_type_is_primitive (dst_type)); - - MonoTypeEnum normalized_src_type = get_normalized_integral_array_element_type (src_type->type); - MonoTypeEnum normalized_dst_type = get_normalized_integral_array_element_type (dst_type->type); - - // Allow conversions like int <-> uint - if (normalized_src_type == normalized_dst_type) { - return TRUE; - } - - // Widening is not allowed if reliable is true. - if (reliable) { - return FALSE; - } - - // NOTE we don't use normalized types here so int -> ulong will be false - // see https://github.com/dotnet/coreclr/pull/25209#issuecomment-505952295 - return can_primitive_widen (src_type->type, dst_type->type); -} -#endif static void array_set_value_impl (MonoArrayHandle arr_handle, MonoObjectHandle value_handle, guint32 pos, gboolean strict_enums, gboolean strict_signs, MonoError *error) @@ -392,13 +299,6 @@ array_set_value_impl (MonoArrayHandle arr_handle, MonoObjectHandle value_handle, esize = mono_array_element_size (ac); if (mono_class_is_nullable (ec)) { -#ifdef ENABLE_NETCORE - if (vc && m_class_is_primitive (vc) && vc != m_class_get_nullable_elem_class (ec)) { - // T -> Nullable T must be exact - set_invalid_cast (error, vc, ec); - goto leave; - } -#endif MONO_ENTER_NO_SAFEPOINTS; ea = (gpointer*) mono_array_addr_with_size_internal (MONO_HANDLE_RAW (arr_handle), esize, pos); if (!MONO_HANDLE_IS_NULL (value_handle)) @@ -416,13 +316,8 @@ array_set_value_impl (MonoArrayHandle arr_handle, MonoObjectHandle value_handle, goto leave; } -#ifdef ENABLE_NETCORE -#define WIDENING_MSG NULL -#define WIDENING_ARG NULL -#else #define WIDENING_MSG "not a widening conversion" #define WIDENING_ARG "value" -#endif #define NO_WIDENING_CONVERSION G_STMT_START{ \ mono_error_set_argument (error, WIDENING_ARG, WIDENING_MSG); \ @@ -520,12 +415,6 @@ array_set_value_impl (MonoArrayHandle arr_handle, MonoObjectHandle value_handle, et_isenum = et == MONO_TYPE_VALUETYPE && m_class_is_enumtype (m_class_get_byval_arg (ec)->data.klass); vt_isenum = vt == MONO_TYPE_VALUETYPE && m_class_is_enumtype (m_class_get_byval_arg (vc)->data.klass); -#if ENABLE_NETCORE - if (strict_enums && et_isenum && !vt_isenum) { - INVALID_CAST; - goto leave; - } -#endif if (et_isenum) et = mono_class_enum_basetype_internal (m_class_get_byval_arg (ec)->data.klass)->type; @@ -533,16 +422,6 @@ array_set_value_impl (MonoArrayHandle arr_handle, MonoObjectHandle value_handle, if (vt_isenum) vt = mono_class_enum_basetype_internal (m_class_get_byval_arg (vc)->data.klass)->type; -#if ENABLE_NETCORE - // Treat MONO_TYPE_U/I as MONO_TYPE_U8/I8/U4/I4 -#if SIZEOF_VOID_P == 8 - vt = vt == MONO_TYPE_U ? MONO_TYPE_U8 : (vt == MONO_TYPE_I ? MONO_TYPE_I8 : vt); - et = et == MONO_TYPE_U ? MONO_TYPE_U8 : (et == MONO_TYPE_I ? MONO_TYPE_I8 : et); -#else - vt = vt == MONO_TYPE_U ? MONO_TYPE_U4 : (vt == MONO_TYPE_I ? MONO_TYPE_I4 : vt); - et = et == MONO_TYPE_U ? MONO_TYPE_U4 : (et == MONO_TYPE_I ? MONO_TYPE_I4 : et); -#endif -#endif #define ASSIGN_UNSIGNED(etype) G_STMT_START{\ switch (vt) { \ @@ -765,11 +644,7 @@ ves_icall_System_Array_SetValue (MonoArrayHandle arr, MonoObjectHandle value, error_init (error); if (MONO_HANDLE_IS_NULL (idxs)) { -#ifdef ENABLE_NETCORE - mono_error_set_argument_null (error, "indices", ""); -#else mono_error_set_argument_null (error, "idxs", ""); -#endif return; } @@ -778,11 +653,7 @@ ves_icall_System_Array_SetValue (MonoArrayHandle arr, MonoObjectHandle value, g_assert (m_class_get_rank (ic) == 1); if (mono_handle_array_has_bounds (idxs) || MONO_HANDLE_GETVAL (idxs, max_length) != m_class_get_rank (ac)) { -#ifdef ENABLE_NETCORE - mono_error_set_argument (error, NULL, ""); -#else mono_error_set_argument (error, "idxs", ""); -#endif return; } @@ -820,73 +691,7 @@ ves_icall_System_Array_SetValue (MonoArrayHandle arr, MonoObjectHandle value, array_set_value_impl (arr, value, pos, TRUE, TRUE, error); } -#ifdef ENABLE_NETCORE - -void -ves_icall_System_Array_InternalCreate (MonoArray *volatile* result, MonoType* type, gint32 rank, gint32* pLengths, gint32* pLowerBounds) -{ - ERROR_DECL (error); - - MonoClass* klass = mono_class_from_mono_type_internal (type); - if (!mono_class_init_checked (klass, error)) - goto exit; - - if (m_class_get_byval_arg (m_class_get_element_class (klass))->type == MONO_TYPE_VOID) { - mono_error_set_not_supported (error, "Arrays of System.Void are not supported."); - goto exit; - } - - if (type->byref || m_class_is_byreflike (klass)) { - mono_error_set_not_supported (error, NULL); - goto exit; - } - - MonoGenericClass *gklass; - gklass = mono_class_try_get_generic_class (klass); - if (is_generic_parameter (type) || mono_class_is_gtd (klass) || (gklass && gklass->context.class_inst->is_open)) { - mono_error_set_not_supported (error, NULL); - goto exit; - } - - /* vectors are not the same as one dimensional arrays with non-zero bounds */ - gboolean bounded; - bounded = pLowerBounds != NULL && rank == 1 && pLowerBounds [0] != 0; - - MonoClass* aklass; - aklass = mono_class_create_bounded_array (klass, rank, bounded); - - uintptr_t aklass_rank; - aklass_rank = m_class_get_rank (aklass); - - uintptr_t* sizes; - sizes = g_newa (uintptr_t, aklass_rank * 2); - - intptr_t* lower_bounds; - lower_bounds = (intptr_t*)(sizes + aklass_rank); - - // Copy lengths and lower_bounds from gint32 to [u]intptr_t. - for (uintptr_t i = 0; i < aklass_rank; ++i) { - if (pLowerBounds != NULL) { - lower_bounds [i] = pLowerBounds [i]; - if ((gint64) pLowerBounds [i] + (gint64) pLengths [i] > G_MAXINT32) { - mono_error_set_argument_out_of_range (error, NULL, "Length + bound must not exceed Int32.MaxValue."); - goto exit; - } - } else { - lower_bounds [i] = 0; - } - sizes [i] = pLengths [i]; - } - - *result = mono_array_new_full_checked (mono_domain_get (), aklass, sizes, lower_bounds, error); - -exit: - mono_error_set_pending_exception (error); -} - -#endif -#ifndef ENABLE_NETCORE MonoArrayHandle ves_icall_System_Array_CreateInstanceImpl (MonoReflectionTypeHandle type, MonoArrayHandle lengths, MonoArrayHandle bounds, MonoError *error) { @@ -954,22 +759,7 @@ ves_icall_System_Array_GetRank (MonoObjectHandle arr, MonoError *error) return result; } -#endif -#ifdef ENABLE_NETCORE -gint32 -ves_icall_System_Array_GetCorElementTypeOfElementType (MonoArrayHandle arr, MonoError *error) -{ - MonoType *type = mono_type_get_underlying_type (m_class_get_byval_arg (m_class_get_element_class (mono_handle_class (arr)))); - return type->type; -} - -gint32 -ves_icall_System_Array_IsValueOfElementType (MonoArrayHandle arr, MonoObjectHandle obj, MonoError *error) -{ - return m_class_get_element_class (mono_handle_class (arr)) == mono_handle_class (obj); -} -#endif static mono_array_size_t mono_array_get_length (MonoArrayHandle arr, gint32 dimension, MonoError *error) @@ -996,7 +786,6 @@ ves_icall_System_Array_GetLength (MonoArrayHandle arr, gint32 dimension, MonoErr return (gint32)length; } -#ifndef ENABLE_NETCORE gint64 ves_icall_System_Array_GetLongLength (MonoArrayHandle arr, gint32 dimension, MonoError *error) { @@ -1004,7 +793,6 @@ ves_icall_System_Array_GetLongLength (MonoArrayHandle arr, gint32 dimension, Mon return (gint64)mono_array_get_length (arr, dimension, error); } -#endif gint32 ves_icall_System_Array_GetLowerBound (MonoArrayHandle arr, gint32 dimension, MonoError *error) @@ -1020,7 +808,6 @@ ves_icall_System_Array_GetLowerBound (MonoArrayHandle arr, gint32 dimension, Mon : 0; } -#ifndef ENABLE_NETCORE void ves_icall_System_Array_ClearInternal (MonoArrayHandle arr, int idx, int length, MonoError *error) { @@ -1029,7 +816,6 @@ ves_icall_System_Array_ClearInternal (MonoArrayHandle arr, int idx, int length, int sz = mono_array_element_size (mono_handle_class (arr)); mono_gc_bzero_atomic (mono_array_addr_with_size_fast (MONO_HANDLE_RAW (arr), sz, idx), length * sz); } -#endif MonoBoolean ves_icall_System_Array_FastCopy (MonoArrayHandle source, int source_idx, MonoArrayHandle dest, int dest_idx, int length, MonoError *error) @@ -1145,25 +931,11 @@ ves_icall_System_Array_SetGenericValue_icall (MonoArray **arr, guint32 pos, gpoi } void -#if ENABLE_NETCORE -ves_icall_System_Runtime_RuntimeImports_Memmove (guint8 *destination, guint8 *source, size_t byte_count) -#else ves_icall_System_Runtime_RuntimeImports_Memmove (guint8 *destination, guint8 *source, guint byte_count) -#endif { mono_gc_memmove_atomic (destination, source, byte_count); } -#if ENABLE_NETCORE -void -ves_icall_System_Buffer_BulkMoveWithWriteBarrier (guint8 *destination, guint8 *source, size_t len, MonoType *type) -{ - if (MONO_TYPE_IS_REFERENCE (type)) - mono_gc_wbarrier_arrayref_copy_internal (destination, source, (guint)len); - else - mono_gc_wbarrier_value_copy_internal (destination, source, (guint)len, mono_class_from_mono_type_internal (type)); -} -#else void ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier (guint8 *destination, guint8 *source, guint len, MonoType *type) { @@ -1172,14 +944,9 @@ ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier (guint8 *destination, g else mono_gc_wbarrier_value_copy_internal (destination, source, len, mono_class_from_mono_type_internal (type)); } -#endif void -#if ENABLE_NETCORE -ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8 *p, size_t byte_length) -#else ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8 *p, guint byte_length) -#endif { memset (p, 0, byte_length); } @@ -1306,27 +1073,6 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor (M mono_runtime_class_init_full (vtable, error); } -#ifdef ENABLE_NETCORE -MonoBoolean -ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void) -{ - MonoThreadInfo *thread = mono_thread_info_current (); - void *current = &thread; - - // Stack upper/lower bound should have been calculated and set as part of register_thread. - // If not, we are optimistic and assume there is enough room. - if (!thread->stack_start_limit || !thread->stack_end) - return TRUE; - - // Stack start limit is stack lower bound. Make sure there is enough room left. - void *limit = ((uint8_t *)thread->stack_start_limit) + ALIGN_TO (MONO_STACK_OVERFLOW_GUARD_SIZE + MONO_MIN_EXECUTION_STACK_SIZE, ((gssize)mono_pagesize ())); - - if (current < limit) - return FALSE; - - return TRUE; -} -#else MonoBoolean ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void) { @@ -1365,81 +1111,7 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStac #endif return TRUE; } -#endif - -#ifdef ENABLE_NETCORE -MonoObjectHandle -ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetUninitializedObjectInternal (MonoType *handle, MonoError *error) -{ - MonoClass *klass; - MonoVTable *vtable; - - g_assert (handle); - - klass = mono_class_from_mono_type_internal (handle); - if (m_class_is_string (klass)) { - mono_error_set_argument (error, NULL, NULL); - return NULL_HANDLE; - } - - if (mono_class_is_array (klass) || mono_class_is_pointer (klass) || handle->byref) { - mono_error_set_argument (error, NULL, NULL); - return NULL_HANDLE; - } - - if (MONO_TYPE_IS_VOID (handle)) { - mono_error_set_argument (error, NULL, NULL); - return NULL_HANDLE; - } - - if (m_class_is_abstract (klass) || m_class_is_interface (klass) || m_class_is_gtd (klass)) { - mono_error_set_member_access (error, NULL, NULL); - return NULL_HANDLE; - } - - if (m_class_is_byreflike (klass)) { - mono_error_set_not_supported (error, NULL, NULL); - return NULL_HANDLE; - } - - if (!mono_class_is_before_field_init (klass)) { - vtable = mono_class_vtable_checked (mono_domain_get (), klass, error); - return_val_if_nok (error, NULL_HANDLE); - - mono_runtime_class_init_full (vtable, error); - return_val_if_nok (error, NULL_HANDLE); - } - - if (m_class_is_nullable (klass)) - return mono_object_new_handle (mono_domain_get (), m_class_get_nullable_elem_class (klass), error); - else - return mono_object_new_handle (mono_domain_get (), klass, error); -} -void -ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_PrepareMethod (MonoMethod *method, gpointer inst_types, int n_inst_types, MonoError *error) -{ - if (method->flags & METHOD_ATTRIBUTE_ABSTRACT) { - mono_error_set_argument (error, NULL, NULL); - return; - } - - MonoGenericContainer *container = NULL; - if (method->is_generic) - container = mono_method_get_generic_container (method); - else if (m_class_is_gtd (method->klass)) - container = mono_class_get_generic_container (method->klass); - if (container) { - int nparams = container->type_argc + (container->parent ? container->parent->type_argc : 0); - if (nparams != n_inst_types) { - mono_error_set_argument (error, NULL, NULL); - return; - } - } - - // FIXME: Implement -} -#endif MonoObjectHandle ves_icall_System_Object_MemberwiseClone (MonoObjectHandle this_obj, MonoError *error) @@ -1686,7 +1358,6 @@ ves_icall_System_ValueType_Equals (MonoObjectHandle this_obj, MonoObjectHandle t } } -#ifndef ENABLE_NETCORE MonoReflectionTypeHandle ves_icall_System_Object_GetType (MonoObjectHandle obj, MonoError *error) { @@ -1708,7 +1379,6 @@ ves_icall_System_Object_GetType (MonoObjectHandle obj, MonoError *error) #endif return mono_type_get_object_handle (domain, m_class_get_byval_arg (klass), error); } -#endif static gboolean get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) @@ -2017,7 +1687,6 @@ typedef enum { TYPECODE_STRING = 18 } TypeCode; -#ifndef ENABLE_NETCORE guint32 ves_icall_type_GetTypeCodeInternal (MonoReflectionTypeHandle ref_type, MonoError *error) { @@ -2103,7 +1772,6 @@ handle_enum: } return 0; } -#endif guint32 ves_icall_RuntimeTypeHandle_type_is_assignable_from (MonoReflectionTypeHandle ref_type, MonoReflectionTypeHandle ref_c, MonoError *error) @@ -2198,10 +1866,6 @@ ves_icall_RuntimeTypeHandle_GetAttributes (MonoReflectionTypeHandle ref_type, Mo { MonoType *type = MONO_HANDLE_GETVAL (ref_type, type); -#ifdef ENABLE_NETCORE - if (type->byref || type->type == MONO_TYPE_PTR || type->type == MONO_TYPE_FNPTR) - return TYPE_ATTRIBUTE_NOT_PUBLIC; -#endif MonoClass *klass = mono_class_from_mono_type_internal (type); return mono_class_get_flags (klass); @@ -3363,7 +3027,6 @@ leave: HANDLE_FUNCTION_RETURN_VAL (is_ok (error)); } -#ifndef ENABLE_NETCORE void ves_icall_RuntimeType_GetGUID (MonoReflectionTypeHandle type_handle, MonoArrayHandle guid_handle, MonoError *error) { @@ -3383,7 +3046,6 @@ ves_icall_RuntimeType_GetGUID (MonoReflectionTypeHandle type_handle, MonoArrayHa guint8 *data = (guint8*) mono_array_addr_with_size_internal (MONO_HANDLE_RAW (guid_handle), 1, 0); mono_metadata_get_class_guid (klass, data, error); } -#endif MonoArrayHandle ves_icall_RuntimeType_GetGenericArguments (MonoReflectionTypeHandle ref_type, MonoBoolean runtimeTypeArray, MonoError *error) @@ -3609,7 +3271,6 @@ leave: return ret; } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime (MonoError *error) { @@ -3625,7 +3286,6 @@ ves_icall_System_RuntimeType_IsWindowsRuntimeObjectType (MonoError *error) mono_error_set_not_implemented (error, "%s", "System.RuntimeType.IsWindowsRuntimeObjectType"); return FALSE; } -#endif /* ENABLE_NETCORE */ void ves_icall_RuntimeMethodInfo_GetPInvoke (MonoReflectionMethodHandle ref_method, int* flags, MonoStringHandleOut entry_point, MonoStringHandleOut dll_name, MonoError *error) @@ -3720,87 +3380,6 @@ ves_icall_RuntimeMethodInfo_GetGenericMethodDefinition (MonoReflectionMethodHand return mono_method_get_object_handle (MONO_HANDLE_DOMAIN (ref_method), result, NULL, error); } -#ifdef ENABLE_NETCORE -static GENERATE_TRY_GET_CLASS_WITH_CACHE (stream, "System.IO", "Stream") -static int io_stream_begin_read_slot = -1; -static int io_stream_begin_write_slot = -1; -static int io_stream_end_read_slot = -1; -static int io_stream_end_write_slot = -1; -static gboolean io_stream_slots_set = FALSE; - -static void -init_io_stream_slots (void) -{ - MonoClass* klass = mono_class_try_get_stream_class (); - mono_class_setup_vtable (klass); - MonoMethod **klass_methods = m_class_get_methods (klass); - if (!klass_methods) { - mono_class_setup_methods (klass); - klass_methods = m_class_get_methods (klass); - } - int method_count = mono_class_get_method_count (klass); - int methods_found = 0; - for (int i = 0; i < method_count; i++) { - // find slots for Begin(End)Read and Begin(End)Write - MonoMethod* m = klass_methods [i]; - if (m->slot == -1) - continue; - - if (!strcmp (m->name, "BeginRead")) { - methods_found++; - io_stream_begin_read_slot = m->slot; - } else if (!strcmp (m->name, "BeginWrite")) { - methods_found++; - io_stream_begin_write_slot = m->slot; - } else if (!strcmp (m->name, "EndRead")) { - methods_found++; - io_stream_end_read_slot = m->slot; - } else if (!strcmp (m->name, "EndWrite")) { - methods_found++; - io_stream_end_write_slot = m->slot; - } - } - g_assert (methods_found <= 4); // some of them can be linked out - io_stream_slots_set = TRUE; -} - -MonoBoolean -ves_icall_System_IO_Stream_HasOverriddenBeginEndRead (MonoObjectHandle stream, MonoError *error) -{ - MonoClass* curr_klass = MONO_HANDLE_GET_CLASS (stream); - MonoClass* base_klass = mono_class_try_get_stream_class (); - - if (!io_stream_slots_set) - init_io_stream_slots (); - - // slots can still be -1 and it means Linker removed the methods from the base class (Stream) - // in this case we can safely assume the methods are not overridden - // otherwise - check vtable - MonoMethod **curr_klass_vtable = m_class_get_vtable (curr_klass); - gboolean begin_read_is_overriden = io_stream_begin_read_slot != -1 && curr_klass_vtable [io_stream_begin_read_slot]->klass != base_klass; - gboolean end_read_is_overriden = io_stream_end_read_slot != -1 && curr_klass_vtable [io_stream_end_read_slot]->klass != base_klass; - - // return true if BeginRead or EndRead were overriden - return begin_read_is_overriden || end_read_is_overriden; -} - -MonoBoolean -ves_icall_System_IO_Stream_HasOverriddenBeginEndWrite (MonoObjectHandle stream, MonoError *error) -{ - MonoClass* curr_klass = MONO_HANDLE_GETVAL (stream, vtable)->klass; - MonoClass* base_klass = mono_class_try_get_stream_class (); - - if (!io_stream_slots_set) - init_io_stream_slots (); - - MonoMethod **curr_klass_vtable = m_class_get_vtable (curr_klass); - gboolean begin_write_is_overriden = curr_klass_vtable [io_stream_begin_write_slot]->klass != base_klass; - gboolean end_write_is_overriden = curr_klass_vtable [io_stream_end_write_slot]->klass != base_klass; - - // return true if BeginWrite or EndWrite were overriden - return begin_write_is_overriden || end_write_is_overriden; -} -#endif MonoBoolean ves_icall_RuntimeMethodInfo_get_IsGenericMethod (MonoReflectionMethodHandle ref_method, MonoError *erro) @@ -3947,24 +3526,10 @@ ves_icall_InternalInvoke (MonoReflectionMethodHandle method_handle, MonoObjectHa exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "NotSupportedException", "Cannot invoke method with stack pointers via reflection"); goto return_null; } -#if ENABLE_NETCORE - if (sig->ret->byref) { - MonoType* ret_byval = m_class_get_byval_arg (mono_class_from_mono_type_internal (sig->ret)); - if (ret_byval->type == MONO_TYPE_VOID) { - exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "NotSupportedException", "ByRef to void return values are not supported in reflection invocation"); - goto return_null; - } - if (m_class_is_byreflike (mono_class_from_mono_type_internal (ret_byval))) { - exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "NotSupportedException", "Cannot invoke method returning ByRef to ByRefLike type via reflection"); - goto return_null; - } - } -#else if (sig->ret->byref) { exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "NotSupportedException", "Cannot invoke method returning ByRef type via reflection"); goto return_null; } -#endif pcount = params? mono_array_length_internal (params): 0; if (pcount != sig->param_count) { @@ -4348,7 +3913,6 @@ ves_icall_System_Enum_InternalHasFlag (MonoObjectHandle a, MonoObjectHandle b, M return (a_val & b_val) == b_val; } -#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_Enum_get_value (MonoObjectHandle ehandle, MonoError *error) { @@ -4372,7 +3936,6 @@ ves_icall_System_Enum_get_value (MonoObjectHandle ehandle, MonoError *error) return_null: return MONO_HANDLE_NEW (MonoObject, NULL); } -#endif MonoReflectionTypeHandle ves_icall_System_Enum_get_underlying_type (MonoReflectionTypeHandle type, MonoError *error) @@ -4404,7 +3967,6 @@ ves_icall_System_Enum_InternalGetCorElementType (MonoObjectHandle this_handle, M return (int)m_class_get_byval_arg (m_class_get_element_class (klass))->type; } -#ifndef ENABLE_NETCORE int ves_icall_System_Enum_compare_value_to (MonoObjectHandle enumHandle, MonoObjectHandle otherHandle, MonoError *error) { @@ -4469,9 +4031,7 @@ ves_icall_System_Enum_compare_value_to (MonoObjectHandle enumHandle, MonoObjectH /* indicates that the enum was of an unsupported underlying type */ return 3; } -#endif -#ifndef ENABLE_NETCORE int ves_icall_System_Enum_get_hashcode (MonoObjectHandle enumHandle, MonoError *error) { @@ -4519,7 +4079,6 @@ ves_icall_System_Enum_get_hashcode (MonoObjectHandle enumHandle, MonoError *erro } return 0; } -#endif static void get_enum_field (MonoDomain *domain, MonoArrayHandle names, MonoArrayHandle values, int base_type, MonoClassField *field, guint* j, guint64 *previous_value, gboolean *sorted, MonoError *error) @@ -4573,11 +4132,7 @@ ves_icall_System_Enum_GetEnumValuesAndNames (MonoReflectionTypeHandle type, Mono return_val_if_nok (error, FALSE); if (!m_class_is_enumtype (enumc)) { -#if ENABLE_NETCORE - mono_error_set_argument (error, NULL, "Type provided must be an Enum."); -#else mono_error_set_argument (error, "enumType", "Type provided must be an Enum."); -#endif return TRUE; } @@ -4951,10 +4506,6 @@ property_accessor_nonpublic (MonoMethod* accessor, gboolean start_klass) GPtrArray* ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionTypeHandle ref_type, gchar *propname, guint32 bflags, guint32 mlisttype, MonoError *error) { -#if ENABLE_NETCORE - // Fetch non-public properties as well because they can hide public properties with the same name in base classes - bflags |= BFLAGS_NonPublic; -#endif MonoType *type = MONO_HANDLE_GETVAL (ref_type, type); if (type->byref) { @@ -5029,10 +4580,6 @@ handle_parent: g_hash_table_insert (properties, prop, prop); } if (!(bflags & BFLAGS_DeclaredOnly) && (klass = m_class_get_parent (klass))) { -#if ENABLE_NETCORE - // BFLAGS_NonPublic should be excluded for base classes - bflags &= ~BFLAGS_NonPublic; -#endif goto handle_parent; } @@ -5229,11 +4776,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssemblyHand mono_reflection_free_type_info (&info); mono_error_cleanup (parse_error); if (throwOnError) { -#if ENABLE_NETCORE - mono_error_set_argument (error, "typeName@0", "failed to parse the type"); -#else mono_error_set_argument (error, "typeName", "failed to parse the type"); -#endif goto fail; } /*g_print ("failed parse\n");*/ @@ -5415,7 +4958,6 @@ ves_icall_System_Reflection_RuntimeAssembly_get_code_base (MonoReflectionAssembl return res; } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Reflection_RuntimeAssembly_get_global_assembly_cache (MonoReflectionAssemblyHandle assembly, MonoError *error) { @@ -5444,7 +4986,6 @@ ves_icall_System_Reflection_Assembly_load_with_partial_name (MonoStringHandle mn leave: return result; } -#endif MonoStringHandle ves_icall_System_Reflection_RuntimeAssembly_get_location (MonoReflectionAssemblyHandle refassembly, MonoError *error) @@ -5455,14 +4996,12 @@ ves_icall_System_Reflection_RuntimeAssembly_get_location (MonoReflectionAssembly return mono_string_new_handle (domain, image_name != NULL ? image_name : "", error); } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Reflection_RuntimeAssembly_get_ReflectionOnly (MonoReflectionAssemblyHandle assembly_h, MonoError *error) { MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly); return mono_asmctx_get_kind (&assembly->context) == MONO_ASMCTX_REFONLY; } -#endif MonoStringHandle ves_icall_System_Reflection_RuntimeAssembly_InternalImageRuntimeVersion (MonoReflectionAssemblyHandle refassembly, MonoError *error) @@ -5532,7 +5071,6 @@ fail: return NULL_HANDLE_ARRAY; } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Reflection_RuntimeAssembly_GetAotIdInternal (MonoArrayHandle guid_h, MonoError *error) { @@ -5549,7 +5087,6 @@ ves_icall_System_Reflection_RuntimeAssembly_GetAotIdInternal (MonoArrayHandle gu return TRUE; } } -#endif static MonoAssemblyName* create_referenced_assembly_name (MonoDomain *domain, MonoImage *image, int i, MonoError *error) @@ -5620,51 +5157,6 @@ g_concat_dir_and_file (const char *dir, const char *file) return g_strconcat (dir, file, (const char*)NULL); } -#ifdef ENABLE_NETCORE -static MonoReflectionAssemblyHandle -try_resource_resolve_name (MonoReflectionAssemblyHandle assembly_handle, MonoStringHandle name_handle) -{ - MonoObjectHandle ret; - - ERROR_DECL (error); - - HANDLE_FUNCTION_ENTER (); - - if (mono_runtime_get_no_exec ()) - goto return_null; - - MONO_STATIC_POINTER_INIT (MonoMethod, resolve_method) - - static gboolean inited; - if (!inited) { - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve_method = mono_class_get_method_from_name_checked (alc_class, "OnResourceResolve", -1, 0, error); - inited = TRUE; - } - mono_error_cleanup (error); - error_init_reuse (error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve_method) - - if (!resolve_method) - goto return_null; - - gpointer args [2]; - args [0] = MONO_HANDLE_RAW (assembly_handle); - args [1] = MONO_HANDLE_RAW (name_handle); - ret = mono_runtime_try_invoke_handle (resolve_method, NULL_HANDLE, args, error); - goto_if_nok (error, return_null); - - goto exit; - -return_null: - ret = NULL_HANDLE; - -exit: - HANDLE_FUNCTION_RETURN_REF (MonoReflectionAssembly, MONO_HANDLE_CAST (MonoReflectionAssembly, ret)); -} -#endif static void * get_manifest_resource_internal (MonoReflectionAssemblyHandle assembly_h, MonoStringHandle name, gint32 *size, MonoReflectionModuleHandleOut ref_module, MonoError *error) @@ -5720,13 +5212,6 @@ ves_icall_System_Reflection_RuntimeAssembly_GetManifestResourceInternal (MonoRef { gpointer ret = get_manifest_resource_internal (assembly_h, name, size, ref_module, error); -#ifdef ENABLE_NETCORE - if (!ret) { - MonoReflectionAssemblyHandle event_assembly_h = try_resource_resolve_name (assembly_h, name); - if (MONO_HANDLE_BOOL (event_assembly_h)) - ret = get_manifest_resource_internal (event_assembly_h, name, size, ref_module, error); - } -#endif return ret; } @@ -6061,16 +5546,6 @@ ves_icall_System_Reflection_RuntimeMethodInfo_GetMethodBodyInternal (MonoMethod return mono_method_body_get_object_handle (mono_domain_get (), method, error); } -#if ENABLE_NETCORE -MonoReflectionAssemblyHandle -ves_icall_System_Reflection_Assembly_GetExecutingAssembly (MonoStackCrawlMark *stack_mark, MonoError *error) -{ - MonoAssembly *assembly; - assembly = mono_runtime_get_caller_from_stack_mark (stack_mark); - g_assert (assembly); - return mono_assembly_get_object_handle (mono_domain_get (), assembly, error); -} -#else MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_GetExecutingAssembly (MonoError *error) { @@ -6079,7 +5554,6 @@ ves_icall_System_Reflection_Assembly_GetExecutingAssembly (MonoError *error) g_assert (dest); return mono_assembly_get_object_handle (mono_domain_get (), m_class_get_image (dest->klass)->assembly, error); } -#endif MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_GetEntryAssembly (MonoError *error) @@ -6144,7 +5618,6 @@ ves_icall_System_RuntimeType_getFullName (MonoReflectionTypeHandle object, MonoB return res; } -#ifndef ENABLE_NETCORE int ves_icall_RuntimeType_get_core_clr_security_level (MonoReflectionTypeHandle rfield, MonoError *error) { @@ -6169,7 +5642,6 @@ ves_icall_RuntimeMethodInfo_get_core_clr_security_level (MonoReflectionMethodHan MonoMethod *method = MONO_HANDLE_GETVAL (rfield, method); return mono_security_core_clr_method_level (method, TRUE); } -#endif MonoStringHandle ves_icall_System_Reflection_RuntimeAssembly_get_fullname (MonoReflectionAssemblyHandle assembly, MonoError *error) @@ -6252,7 +5724,6 @@ ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoStringHandle f g_free (filename); } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Reflection_RuntimeAssembly_LoadPermissions (MonoReflectionAssemblyHandle assembly_h, char **minimum, guint32 *minLength, char **optional, guint32 *optLength, char **refused, guint32 *refLength, MonoError *error) @@ -6282,7 +5753,6 @@ ves_icall_System_Reflection_RuntimeAssembly_LoadPermissions (MonoReflectionAssem return result; } -#endif static gboolean mono_module_type_is_visible (MonoTableInfo *tdef, MonoImage *image, int type) @@ -6488,113 +5958,12 @@ assembly_get_types (MonoReflectionAssemblyHandle assembly_handle, MonoBoolean ex return res; } -#ifndef ENABLE_NETCORE MonoArrayHandle ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssemblyHandle assembly_handle, MonoBoolean exportedOnly, MonoError *error) { return assembly_get_types (assembly_handle, exportedOnly, error); } -#endif - -#if ENABLE_NETCORE -MonoArrayHandle -ves_icall_System_Reflection_RuntimeAssembly_GetExportedTypes (MonoReflectionAssemblyHandle assembly_handle, MonoError *error) -{ - return assembly_get_types (assembly_handle, TRUE, error); -} - -static void -get_top_level_forwarded_type (MonoImage *image, MonoTableInfo *table, int i, MonoArrayHandle types, MonoArrayHandle exceptions, int *aindex, int *exception_count) -{ - ERROR_DECL (local_error); - guint32 cols [MONO_EXP_TYPE_SIZE]; - MonoClass *klass; - MonoReflectionTypeHandle rt; - - mono_metadata_decode_row (table, i, cols, MONO_EXP_TYPE_SIZE); - if (!(cols [MONO_EXP_TYPE_FLAGS] & TYPE_ATTRIBUTE_FORWARDER)) - return; - guint32 impl = cols [MONO_EXP_TYPE_IMPLEMENTATION]; - const char *name = mono_metadata_string_heap (image, cols [MONO_EXP_TYPE_NAME]); - const char *nspace = mono_metadata_string_heap (image, cols [MONO_EXP_TYPE_NAMESPACE]); - - g_assert ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_ASSEMBLYREF); - guint32 assembly_idx = impl >> MONO_IMPLEMENTATION_BITS; - - mono_assembly_load_reference (image, assembly_idx - 1); - g_assert (image->references [assembly_idx - 1]); - - HANDLE_FUNCTION_ENTER (); - - if (image->references [assembly_idx - 1] == REFERENCE_MISSING) { - MonoExceptionHandle ex = MONO_HANDLE_NEW (MonoException, mono_get_exception_bad_image_format ("Invalid image")); - MONO_HANDLE_ARRAY_SETREF (types, *aindex, NULL_HANDLE); - MONO_HANDLE_ARRAY_SETREF (exceptions, *aindex, ex); - (*exception_count)++; (*aindex)++; - goto exit; - } - klass = mono_class_from_name_checked (image->references [assembly_idx - 1]->image, nspace, name, local_error); - if (!is_ok (local_error)) { - MonoExceptionHandle ex = mono_error_convert_to_exception_handle (local_error); - MONO_HANDLE_ARRAY_SETREF (types, *aindex, NULL_HANDLE); - MONO_HANDLE_ARRAY_SETREF (exceptions, *aindex, ex); - mono_error_cleanup (local_error); - (*exception_count)++; (*aindex)++; - goto exit; - } - rt = mono_type_get_object_handle (mono_domain_get (), m_class_get_byval_arg (klass), local_error); - if (!is_ok (local_error)) { - MonoExceptionHandle ex = mono_error_convert_to_exception_handle (local_error); - MONO_HANDLE_ARRAY_SETREF (types, *aindex, NULL_HANDLE); - MONO_HANDLE_ARRAY_SETREF (exceptions, *aindex, ex); - mono_error_cleanup (local_error); - (*exception_count)++; (*aindex)++; - goto exit; - } - MONO_HANDLE_ARRAY_SETREF (types, *aindex, rt); - MONO_HANDLE_ARRAY_SETREF (exceptions, *aindex, NULL_HANDLE); - (*aindex)++; - -exit: - HANDLE_FUNCTION_RETURN (); -} -MonoArrayHandle -ves_icall_System_Reflection_RuntimeAssembly_GetTopLevelForwardedTypes (MonoReflectionAssemblyHandle assembly_h, MonoError *error) -{ - MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly); - MonoImage *image = assembly->image; - int count = 0; - - g_assert (!assembly_is_dynamic (assembly)); - MonoTableInfo *table = &image->tables [MONO_TABLE_EXPORTEDTYPE]; - for (int i = 0; i < table->rows; ++i) { - if (mono_metadata_decode_row_col (table, i, MONO_EXP_TYPE_FLAGS) & TYPE_ATTRIBUTE_FORWARDER) - count ++; - } - - MonoArrayHandle types = mono_array_new_handle (mono_domain_get (), mono_defaults.runtimetype_class, count, error); - return_val_if_nok (error, NULL_HANDLE_ARRAY); - MonoArrayHandle exceptions = mono_array_new_handle (mono_domain_get (), mono_defaults.exception_class, count, error); - return_val_if_nok (error, NULL_HANDLE_ARRAY); - - int aindex = 0; - int exception_count = 0; - for (int i = 0; i < table->rows; ++i) { - get_top_level_forwarded_type (image, table, i, types, exceptions, &aindex, &exception_count); - } - - if (exception_count > 0) { - MonoExceptionHandle exc = MONO_HANDLE_NEW (MonoException, NULL); - MONO_HANDLE_ASSIGN (exc, mono_get_exception_reflection_type_load_checked (types, exceptions, error)); - return_val_if_nok (error, NULL_HANDLE_ARRAY); - mono_error_set_exception_handle (error, exc); - return NULL_HANDLE_ARRAY; - } - - return types; -} -#endif void ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname, MonoBoolean free_struct) @@ -6846,23 +6215,6 @@ ves_icall_Mono_Runtime_DumpStateTotal (guint64 *portable_hash, guint64 *unportab return result; } -#if defined (ENABLE_NETCORE) && defined (ENABLE_METADATA_UPDATE) -void -ves_icall_Mono_Runtime_LoadMetadataUpdate (MonoAssembly *assm, - gconstpointer dmeta_bytes, int32_t dmeta_len, - gconstpointer dil_bytes, int32_t dil_len) -{ - ERROR_DECL (error); - g_assert (assm); - g_assert (dmeta_len >= 0); - MonoImage *image_base = assm->image; - g_assert (image_base); - - MonoDomain *domain = mono_domain_get (); - mono_image_load_enc_delta (domain, image_base, dmeta_bytes, dmeta_len, dil_bytes, dil_len, error); - mono_error_set_pending_exception (error); -} -#endif MonoBoolean ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char *name, MonoAssemblyName *aname, MonoBoolean *is_version_defined_arg, MonoBoolean *is_token_defined_arg) @@ -6930,13 +6282,11 @@ mono_icall_module_get_hinstance (MonoImage *image) } #endif /* HOST_WIN32 */ -#ifndef ENABLE_NETCORE gpointer ves_icall_System_Reflection_RuntimeModule_GetHINSTANCE (MonoImage *image, MonoError *error) { return mono_icall_module_get_hinstance (image); } -#endif void ves_icall_System_Reflection_RuntimeModule_GetPEKind (MonoImage *image, gint32 *pe_kind, gint32 *machine, MonoError *error) @@ -7379,11 +6729,7 @@ check_for_invalid_array_type (MonoClass *klass, MonoError *error) static void check_for_invalid_byref_or_pointer_type (MonoClass *klass, MonoError *error) { -#ifdef ENABLE_NETCORE - return; -#else check_for_invalid_array_type (klass, error); -#endif } MonoReflectionTypeHandle @@ -7562,7 +6908,6 @@ mono_array_get_byte_length (MonoArrayHandle array) } } -#ifndef ENABLE_NETCORE gint32 ves_icall_System_Buffer_ByteLengthInternal (MonoArrayHandle array, MonoError* error) { @@ -7611,7 +6956,6 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArrayHandle src, gint32 src_offse return TRUE; } -#endif #ifndef DISABLE_REMOTING MonoObjectHandle @@ -7666,7 +7010,6 @@ ves_icall_Remoting_RealProxy_InternalGetProxyType (MonoTransparentProxyHandle tp /* System.Environment */ -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Environment_get_UserName (MonoError *error) { @@ -7750,7 +7093,6 @@ ves_icall_System_Environment_get_Platform (void) { return mono_icall_get_platform (); } -#endif /* !ENABLE_NETCORE */ #ifndef HOST_WIN32 static MonoStringHandle @@ -7760,13 +7102,11 @@ mono_icall_get_new_line (MonoError *error) } #endif /* !HOST_WIN32 */ -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Environment_get_NewLine (MonoError *error) { return mono_icall_get_new_line (error); } -#endif #ifndef HOST_WIN32 static inline MonoBoolean @@ -7893,7 +7233,6 @@ ves_icall_System_Environment_GetEnvironmentVariableNames (MonoError *error) return mono_icall_get_environment_variable_names (error); } -#ifndef ENABLE_NETCORE void ves_icall_System_Environment_InternalSetEnvironmentVariable (const gunichar2 *name, gint32 name_length, const gunichar2 *value, gint32 value_length, MonoError *error) @@ -7924,7 +7263,6 @@ exit: g_free (utf8_value); #endif } -#endif void ves_icall_System_Environment_Exit (int result) @@ -7934,10 +7272,8 @@ ves_icall_System_Environment_Exit (int result) if (!mono_runtime_try_shutdown ()) mono_thread_exit (); -#ifndef ENABLE_NETCORE /* Suspend all managed threads since the runtime is going away */ mono_thread_suspend_all_other_threads (); -#endif mono_runtime_quit_internal (); @@ -7973,13 +7309,11 @@ ves_icall_System_Environment_FailFast (MonoStringHandle message, MonoExceptionHa abort (); } -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Environment_GetGacPath (MonoError *error) { return mono_string_new_handle (mono_domain_get (), mono_assembly_getrootdir (), error); } -#endif #ifndef HOST_WIN32 static inline MonoStringHandle @@ -7991,13 +7325,11 @@ mono_icall_get_windows_folder_path (int folder, MonoError *error) } #endif /* !HOST_WIN32 */ -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Environment_GetWindowsFolderPath (int folder, MonoError *error) { return mono_icall_get_windows_folder_path (folder, error); } -#endif static MonoArrayHandle mono_icall_get_logical_drives (MonoError *error) @@ -8063,7 +7395,6 @@ leave: return result; } -#ifndef ENABLE_NETCORE MonoArrayHandle ves_icall_System_Environment_GetLogicalDrivesInternal (MonoError *error) { @@ -8171,7 +7502,6 @@ ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page, Mo return mono_string_new_handle (mono_domain_get (), cset, error); return NULL_HANDLE_STRING; } -#endif MonoBoolean ves_icall_System_Environment_get_HasShutdownStarted (void) @@ -8181,12 +7511,10 @@ ves_icall_System_Environment_get_HasShutdownStarted (void) #ifndef HOST_WIN32 -#ifndef ENABLE_NETCORE void ves_icall_System_Environment_BroadcastSettingChange (MonoError *error) { } -#endif #endif @@ -8197,21 +7525,12 @@ ves_icall_System_Environment_get_TickCount (void) return (gint32) (mono_msec_boottime () & 0xffffffff); } -#if ENABLE_NETCORE -gint64 -ves_icall_System_Environment_get_TickCount64 (void) -{ - return mono_msec_boottime (); -} -#endif -#ifndef ENABLE_NETCORE gint32 ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId (MonoError *error) { return 9; } -#endif #ifndef DISABLE_REMOTING MonoBoolean @@ -8296,17 +7615,14 @@ ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (Mo #else /* DISABLE_REMOTING */ -#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionTypeHandle type, MonoBoolean enable, MonoError *error) { g_assert_not_reached (); } -#endif #endif -#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionTypeHandle type, MonoError *error) { @@ -8413,7 +7729,6 @@ ves_icall_System_TimeZoneInfo_mono_timezone_get_local_name (MonoString **result) } #endif -#endif /* ENABLE_NETCORE */ #ifndef PLATFORM_NO_DRIVEINFO MonoBoolean @@ -8447,7 +7762,6 @@ ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method, MonoError return mono_compile_method_checked (method, error); } -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (MonoError *error) @@ -8592,7 +7906,6 @@ ves_icall_get_resources_ptr (MonoReflectionAssemblyHandle assembly, gpointer *re return TRUE; } -#endif /* ENABLE_NETCORE */ MonoBoolean ves_icall_System_Diagnostics_Debugger_IsAttached_internal (void) @@ -8622,13 +7935,11 @@ mono_icall_write_windows_debug_string (const gunichar2 *message) } #endif /* !HOST_WIN32 */ -#ifndef ENABLE_NETCORE void ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (const gunichar2 *message, MonoError *error) { mono_icall_write_windows_debug_string (message); } -#endif /* Only used for value types */ MonoObjectHandle @@ -8838,8 +8149,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeH void ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeHandle type, MonoError *error) { - g_assert_not_netcore (); - error_init (error); MonoClass *klass = mono_class_from_mono_type_internal (MONO_HANDLE_GETVAL (type, type)); MonoMethod* m; @@ -8854,7 +8163,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeH } } -#ifndef ENABLE_NETCORE /* * used by System.Runtime.InteropServices.RuntimeInformation.(OS|Process)Architecture; * which use them in different ways for filling in an enum @@ -8873,7 +8181,6 @@ ves_icall_System_Runtime_InteropServices_RuntimeInformation_GetOSName (MonoError { return mono_string_new_handle (mono_domain_get (), mono_config_get_os (), error); } -#endif /* ENABLE_NETCORE */ int ves_icall_Interop_Sys_DoubleToString(double value, char *format, char *buffer, int bufferLength) @@ -9157,7 +8464,6 @@ mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) } #endif /* !HOST_WIN32 */ -#ifndef ENABLE_NETCORE gint32 ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds) { @@ -9179,7 +8485,6 @@ ves_icall_Mono_TlsProviderFactory_IsBtlsSupported (void) return FALSE; #endif } -#endif /* ENABLE_NETCORE */ #ifndef DISABLE_COM @@ -9247,7 +8552,6 @@ ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_Wind #endif -#if !ENABLE_NETCORE void ves_icall_System_IO_LogcatTextWriter_Log (const char *appname, gint32 level, const char *message) @@ -9255,7 +8559,6 @@ ves_icall_System_IO_LogcatTextWriter_Log (const char *appname, gint32 level, con g_log (appname, (GLogLevelFlags)level, "%s", message); } -#endif static const MonoIcallTableCallbacks *icall_table; static mono_mutex_t icall_mutex; @@ -9838,13 +9141,6 @@ ves_icall_System_GC_GetAllocatedBytesForCurrentThread (void) return mono_gc_get_allocated_bytes_for_current_thread (); } -#ifdef ENABLE_NETCORE -guint64 -ves_icall_System_GC_GetTotalAllocatedBytes (MonoBoolean precise, MonoError* error) -{ - return mono_gc_get_total_allocated_bytes (precise); -} -#endif void ves_icall_System_GC_RecordPressure (gint64 value) @@ -9889,7 +9185,6 @@ ves_icall_System_Environment_get_ProcessorCount (void) return mono_cpu_count (); } -#if !defined(ENABLE_NETCORE) #if defined(ENABLE_MONODROID) G_EXTERN_C gpointer CreateNLSocket (void); @@ -9914,7 +9209,6 @@ ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CloseNLSocket (gpoint return CloseNLSocket (sock); } -#endif #endif // Generate wrappers. diff --git a/mono/metadata/image.c b/mono/metadata/image.c index b0733c7e14e..8b82bfa6333 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -260,9 +260,7 @@ mono_images_init (void) images_storage_hash = g_hash_table_new (g_str_hash, g_str_equal); -#ifndef ENABLE_NETCORE mono_loaded_images_init (mono_get_global_loaded_images (), NULL); -#endif debug_assembly_unload = g_hasenv ("MONO_DEBUG_ASSEMBLY_UNLOAD"); @@ -281,9 +279,7 @@ mono_images_cleanup (void) { mono_os_mutex_destroy (&images_mutex); -#ifndef ENABLE_NETCORE mono_loaded_images_cleanup (mono_get_global_loaded_images (), TRUE); -#endif g_hash_table_destroy (images_storage_hash); @@ -715,7 +711,6 @@ mono_image_check_for_module_cctor (MonoImage *image) image->checked_module_cctor = TRUE; } -#ifndef ENABLE_NETCORE static void load_modules (MonoImage *image) { @@ -729,7 +724,6 @@ load_modules (MonoImage *image) image->modules_loaded = g_new0 (gboolean, t->rows); image->module_count = t->rows; } -#endif /** * mono_image_load_module_checked: @@ -747,10 +741,6 @@ mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error) if (image->modules_loaded [idx - 1]) return image->modules [idx - 1]; -#ifdef ENABLE_NETCORE - /* SRE still uses image->modules, but they are not loaded from files, so the rest of this function is dead code for netcore */ - g_assert_not_reached (); -#else MonoTableInfo *t; MonoTableInfo *file_table; int i; @@ -821,7 +811,6 @@ mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error) g_list_free (valid_modules); return image->modules [idx - 1]; -#endif } /** @@ -1565,9 +1554,7 @@ do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status, mono_image_load_time_date_stamp (image); -#ifndef ENABLE_NETCORE load_modules (image); -#endif done: MONO_PROFILER_RAISE (image_loaded, (image)); @@ -1801,9 +1788,6 @@ do_mono_image_open (MonoAssemblyLoadContext *alc, const char *fname, MonoImageOp image->ref_count = 1; /* if MONO_SECURITY_MODE_CORE_CLR is set then determine if this image is platform code */ image->core_clr_platform_code = mono_security_core_clr_determine_platform_image (image); -#ifdef ENABLE_NETCORE - image->alc = alc; -#endif return do_mono_image_load (image, status, care_about_cli, care_about_pecoff); } @@ -1913,7 +1897,6 @@ mono_image_loaded_by_guid_full (const char *guid, gboolean refonly) static MonoImage * mono_image_loaded_by_guid_internal (const char *guid, gboolean refonly) { -#ifndef ENABLE_NETCORE GuidData data; GHashTable *loaded_images = mono_loaded_images_get_hash (mono_get_global_loaded_images (), refonly); data.res = NULL; @@ -1923,10 +1906,6 @@ mono_image_loaded_by_guid_internal (const char *guid, gboolean refonly) g_hash_table_foreach (loaded_images, find_by_guid, &data); mono_images_unlock (); return data.res; -#else - /* TODO: Maybe implement this for netcore by searching only the default ALC of the current domain */ - return NULL; -#endif } /** @@ -1973,13 +1952,6 @@ register_image (MonoLoadedImages *li, MonoImage *image, gboolean *problematic) { MonoImage *image2; char *name = image->name; -#ifdef ENABLE_NETCORE - /* Since we register cultures by file name, we need to make this culture aware for - satellite assemblies */ - char *name_with_culture = mono_image_get_name_with_culture_if_needed (image); - if (name_with_culture) - name = name_with_culture; -#endif GHashTable *loaded_images = mono_loaded_images_get_hash (li, image->ref_only); mono_images_lock (); @@ -1990,9 +1962,6 @@ register_image (MonoLoadedImages *li, MonoImage *image, gboolean *problematic) mono_image_addref (image2); mono_images_unlock (); mono_image_close (image); -#ifdef ENABLE_NETCORE - g_free (name_with_culture); -#endif return image2; } @@ -2007,9 +1976,6 @@ register_image (MonoLoadedImages *li, MonoImage *image, gboolean *problematic) if (problematic) *problematic = TRUE; } -#ifdef ENABLE_NETCORE - g_free (name_with_culture); -#endif return image; } @@ -2047,9 +2013,6 @@ mono_image_open_from_data_internal (MonoAssemblyLoadContext *alc, char *data, gu image->ref_only = refonly; image->metadata_only = metadata_only; image->ref_count = 1; -#ifdef ENABLE_NETCORE - image->alc = alc; -#endif image = do_mono_image_load (image, status, TRUE, TRUE); if (image == NULL) @@ -2063,11 +2026,7 @@ mono_image_open_from_data_alc (MonoAssemblyLoadContextGCHandle alc_gchandle, cha { MonoImage *result; MONO_ENTER_GC_UNSAFE; -#ifdef ENABLE_NETCORE - MonoAssemblyLoadContext *alc = mono_alc_from_gchandle (alc_gchandle); -#else MonoAssemblyLoadContext *alc = mono_domain_default_alc (mono_domain_get ()); -#endif result = mono_image_open_from_data_internal (alc, data, data_len, need_copy, status, FALSE, FALSE, name, name); MONO_EXIT_GC_UNSAFE; return result; @@ -2158,9 +2117,6 @@ mono_image_open_from_module_handle (MonoAssemblyLoadContext *alc, HMODULE module image->name = fname; image->filename = g_strdup (image->name); image->ref_count = has_entry_point ? 0 : 1; -#ifdef ENABLE_NETCORE - image->alc = alc; -#endif image = do_mono_image_load (image, status, TRUE, TRUE); if (image == NULL) @@ -2696,9 +2652,7 @@ mono_image_close_except_pools (MonoImage *image) if (image->mvar_gparam_cache) mono_conc_hashtable_destroy (image->mvar_gparam_cache); free_hash (image->wrapper_param_names); -#ifndef ENABLE_NETCORE free_hash (image->pinvoke_scopes); -#endif free_hash (image->native_func_wrapper_cache); mono_conc_hashtable_destroy (image->typespec_cache); free_hash (image->weak_field_indexes); diff --git a/mono/metadata/loaded-images-global.c b/mono/metadata/loaded-images-global.c index 645b0cd271c..dbcf79dc51b 100644 --- a/mono/metadata/loaded-images-global.c +++ b/mono/metadata/loaded-images-global.c @@ -3,7 +3,6 @@ #include "mono/metadata/loaded-images-internals.h" #include "mono/metadata/metadata-internals.h" -#ifndef ENABLE_NETCORE /* Global image hashes should not be in netcore Mono */ static MonoLoadedImages global_loaded_images; /* zero initalized is good enough */ @@ -62,4 +61,3 @@ mono_alc_get_loaded_images (MonoAssemblyLoadContext *alc) return mono_get_global_loaded_images (); } -#endif /* ENABLE_NETCORE */ diff --git a/mono/metadata/loaded-images-internals.h b/mono/metadata/loaded-images-internals.h index 7eb2b2833dd..e75093af295 100644 --- a/mono/metadata/loaded-images-internals.h +++ b/mono/metadata/loaded-images-internals.h @@ -50,10 +50,8 @@ mono_loaded_images_remove_image (MonoImage *image); MonoLoadedImages* mono_image_get_loaded_images_for_modules (MonoImage *image); -#ifndef ENABLE_NETCORE MonoLoadedImages* mono_get_global_loaded_images (void); -#endif MonoImage * mono_find_image_owner (void *ptr); diff --git a/mono/metadata/loaded-images-netcore.c b/mono/metadata/loaded-images-netcore.c deleted file mode 100644 index 3d15afd5b9b..00000000000 --- a/mono/metadata/loaded-images-netcore.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "config.h" - -#include "mono/metadata/loaded-images-internals.h" - -#ifdef ENABLE_NETCORE -/* Should be compiling loaded-images-netcore.c only for netcore Mono */ - -// This is support for the mempool reference tracking feature in checked-build, -// but lives in loaded-images-netcore.c due to use of static variables of this -// file. - -/** - * mono_find_image_owner: - * - * Find the image, if any, which a given pointer is located in the memory of. - */ -MonoImage * -mono_find_image_owner (void *ptr) -{ - /* FIXME: this function is a bit annoying to implement without a global - * table of all the loaded images. We need to traverse all the domains - * and each ALC in each domain. */ - return NULL; -} - -MonoLoadedImages * -mono_alc_get_loaded_images (MonoAssemblyLoadContext *alc) -{ - g_assert (alc); - g_assert (alc->loaded_images); - return alc->loaded_images; -} - -#else - -MONO_EMPTY_SOURCE_FILE (loaded_images_netcore); - -#endif /* ENABLE_NETCORE */ diff --git a/mono/metadata/loaded-images.c b/mono/metadata/loaded-images.c index c0fa0d5e6aa..9cb57828234 100644 --- a/mono/metadata/loaded-images.c +++ b/mono/metadata/loaded-images.c @@ -104,11 +104,6 @@ mono_loaded_images_remove_image (MonoImage *image) loaded_images_by_name = mono_loaded_images_get_by_name_hash (li, image->ref_only); name = image->name; -#ifdef ENABLE_NETCORE - char *name_with_culture = mono_image_get_name_with_culture_if_needed (image); - if (name_with_culture) - name = name_with_culture; -#endif image2 = (MonoImage *)g_hash_table_lookup (loaded_images, name); if (image == image2) { /* This is not true if we are called from mono_image_open () */ @@ -118,9 +113,6 @@ mono_loaded_images_remove_image (MonoImage *image) g_hash_table_remove (loaded_images_by_name, (char *) image->assembly_name); proceed = TRUE; -#ifdef ENABLE_NETCORE - g_free (name_with_culture); -#endif done: mono_images_unlock (); @@ -131,9 +123,5 @@ done: MonoLoadedImages* mono_image_get_loaded_images_for_modules (MonoImage *image) { -#ifndef ENABLE_NETCORE return mono_get_global_loaded_images (); -#else - g_assert_not_reached (); -#endif } diff --git a/mono/metadata/loader-internals.h b/mono/metadata/loader-internals.h index e0d67f22763..286a1f3b164 100644 --- a/mono/metadata/loader-internals.h +++ b/mono/metadata/loader-internals.h @@ -17,15 +17,6 @@ #include #include -#ifdef ENABLE_NETCORE -#if defined(TARGET_OSX) -#define MONO_LOADER_LIBRARY_NAME "libcoreclr.dylib" -#elif defined(TARGET_ANDROID) -#define MONO_LOADER_LIBRARY_NAME "libmonodroid.so" -#else -#define MONO_LOADER_LIBRARY_NAME "libcoreclr.so" -#endif -#endif G_BEGIN_DECLS @@ -33,9 +24,6 @@ typedef struct _MonoLoadedImages MonoLoadedImages; typedef struct _MonoAssemblyLoadContext MonoAssemblyLoadContext; typedef struct _MonoMemoryManager MonoMemoryManager; typedef struct _MonoSingletonMemoryManager MonoSingletonMemoryManager; -#ifdef ENABLE_NETCORE -typedef struct _MonoGenericMemoryManager MonoGenericMemoryManager; -#endif struct _MonoBundledSatelliteAssembly { const char *name; @@ -55,31 +43,6 @@ struct _MonoDllMap { }; #endif -#ifdef ENABLE_NETCORE -struct _MonoAssemblyLoadContext { - MonoDomain *domain; - MonoLoadedImages *loaded_images; - GSList *loaded_assemblies; - // If taking this with the domain assemblies_lock, always take this second - MonoCoopMutex assemblies_lock; - // Holds ALC-specific memory - MonoSingletonMemoryManager *memory_manager; - GPtrArray *generic_memory_managers; - // Protects generic_memory_managers; if taking this with the domain alcs_lock, always take this second - MonoCoopMutex memory_managers_lock; - // Handle of the corresponding managed object. If the ALC is - // collectible, the handle is weak, otherwise it's strong. - MonoGCHandle gchandle; - // Whether the ALC can be unloaded; should only be set at creation - gboolean collectible; - // Set to TRUE when the unloading process has begun - gboolean unloading; - // Used in native-library.c for the hash table below; do not access anywhere else - MonoCoopMutex pinvoke_lock; - // Maps malloc-ed char* pinvoke scope -> MonoDl* - GHashTable *pinvoke_scopes; -}; -#endif /* ENABLE_NETCORE */ struct _MonoMemoryManager { MonoDomain *domain; @@ -117,15 +80,6 @@ struct _MonoSingletonMemoryManager { MonoAssemblyLoadContext *alc; }; -#ifdef ENABLE_NETCORE -struct _MonoGenericMemoryManager { - MonoMemoryManager memory_manager; - - // Parent ALCs - int n_alcs; - MonoAssemblyLoadContext **alcs; -}; -#endif void mono_global_loader_data_lock (void); @@ -150,52 +104,11 @@ mono_global_loader_cache_init (void); void mono_global_loader_cache_cleanup (void); -#ifdef ENABLE_NETCORE -void -mono_set_pinvoke_search_directories (int dir_count, char **dirs); - -void -mono_alc_create_default (MonoDomain *domain); - -MonoAssemblyLoadContext * -mono_alc_create_individual (MonoDomain *domain, MonoGCHandle this_gchandle, gboolean collectible, MonoError *error); - -void -mono_alc_assemblies_lock (MonoAssemblyLoadContext *alc); - -void -mono_alc_assemblies_unlock (MonoAssemblyLoadContext *alc); - -void -mono_alc_memory_managers_lock (MonoAssemblyLoadContext *alc); - -void -mono_alc_memory_managers_unlock (MonoAssemblyLoadContext *alc); - -gboolean -mono_alc_is_default (MonoAssemblyLoadContext *alc); - -MonoAssembly* -mono_alc_invoke_resolve_using_load_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname); - -MonoAssembly* -mono_alc_invoke_resolve_using_resolving_event_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname); - -MonoAssembly* -mono_alc_invoke_resolve_using_resolve_satellite_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname); - -MonoAssemblyLoadContext * -mono_alc_from_gchandle (MonoGCHandle alc_gchandle); -#endif /* ENABLE_NETCORE */ static inline MonoDomain * mono_alc_domain (MonoAssemblyLoadContext *alc) { -#ifdef ENABLE_NETCORE - return alc->domain; -#else return mono_domain_get (); -#endif } MonoLoadedImages * diff --git a/mono/metadata/locales.h b/mono/metadata/locales.h index 8746cf98433..de806988ef2 100644 --- a/mono/metadata/locales.h +++ b/mono/metadata/locales.h @@ -16,7 +16,6 @@ #include #include -#if !ENABLE_NETCORE /* This is a copy of System.Globalization.CompareOptions */ typedef enum { @@ -53,7 +52,6 @@ ICALL_EXPORT gint32 ves_icall_System_Globalization_CompareInfo_internal_index (const gunichar2 *source, gint32 sindex, gint32 count, const gunichar2 *value, gint32 value_length, MonoBoolean first); -#endif /* !ENABLE_NETCORE */ #define MONO_LOCALE_INVARIANT (0x007F) diff --git a/mono/metadata/marshal-ilgen.c b/mono/metadata/marshal-ilgen.c index b72a45c007c..ea8880024fa 100644 --- a/mono/metadata/marshal-ilgen.c +++ b/mono/metadata/marshal-ilgen.c @@ -1645,13 +1645,6 @@ handle_enum: if (sig->ret->byref) { /* perform indirect load and return by value */ -#ifdef ENABLE_NETCORE - int pos; - mono_mb_emit_byte (mb, CEE_DUP); - pos = mono_mb_emit_branch (mb, CEE_BRTRUE); - mono_mb_emit_exception_full (mb, "Mono", "NullByRefReturnException", NULL); - mono_mb_patch_branch (mb, pos); -#endif int ldind_op; MonoType* ret_byval = m_class_get_byval_arg (mono_class_from_mono_type_internal (sig->ret)); @@ -2061,40 +2054,6 @@ emit_native_wrapper_ilgen (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSi if (need_gc_safe) gc_safe_transition_builder_add_locals (&gc_safe_transition_builder); -#ifdef ENABLE_NETCORE - if (!func && !aot && !func_param && !MONO_CLASS_IS_IMPORT (mb->method->klass)) { - /* - * On netcore, its possible to register pinvoke resolvers at runtime, so - * a pinvoke lookup can fail, and then succeed later. So if the - * original lookup failed, do a lookup every time until it - * succeeds. - * This adds some overhead, but only when the pinvoke lookup - * was not initially successful. - * FIXME: AOT case - */ - func_addr_local = mono_mb_add_local (mb, int_type); - - int cache_local = mono_mb_add_local (mb, int_type); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_op (mb, CEE_MONO_PINVOKE_ADDR_CACHE, &piinfo->method); - mono_mb_emit_stloc (mb, cache_local); - - mono_mb_emit_ldloc (mb, cache_local); - mono_mb_emit_byte (mb, CEE_LDIND_I); - int pos = mono_mb_emit_branch (mb, CEE_BRTRUE); - - mono_mb_emit_ldloc (mb, cache_local); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_op (mb, CEE_MONO_METHODCONST, &piinfo->method); - mono_mb_emit_icall (mb, mono_marshal_lookup_pinvoke); - mono_mb_emit_byte (mb, CEE_STIND_I); - - mono_mb_patch_branch (mb, pos); - mono_mb_emit_ldloc (mb, cache_local); - mono_mb_emit_byte (mb, CEE_LDIND_I); - mono_mb_emit_stloc (mb, func_addr_local); - } -#endif /* * cookie = mono_threads_enter_gc_safe_region_unbalanced (ref dummy); @@ -6513,11 +6472,7 @@ emit_create_string_hack_ilgen (MonoMethodBuilder *mb, MonoMethodSignature *csig, { int i; -#ifdef ENABLE_NETCORE - g_assert (!mono_method_signature_internal (res)->hasthis); -#else mono_mb_emit_byte (mb, CEE_LDARG_0); -#endif for (i = 1; i <= csig->param_count; i++) mono_mb_emit_ldarg (mb, i); mono_mb_emit_managed_call (mb, res, NULL); diff --git a/mono/metadata/marshal-windows.c b/mono/metadata/marshal-windows.c index 1220048c84b..8631a829393 100644 --- a/mono/metadata/marshal-windows.c +++ b/mono/metadata/marshal-windows.c @@ -83,8 +83,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const guni char* ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const gunichar2 *s, int length) { - g_assert_not_netcore (); - // FIXME pass mono_utf16_to_utf8 an allocator to avoid double alloc/copy. ERROR_DECL (error); diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index f75f843df03..e3ca84bc324 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -111,10 +111,6 @@ delegate_hash_table_remove (MonoDelegate *d); GENERATE_TRY_GET_CLASS_WITH_CACHE (stringbuilder, "System.Text", "StringBuilder"); static GENERATE_TRY_GET_CLASS_WITH_CACHE (unmanaged_function_pointer_attribute, "System.Runtime.InteropServices", "UnmanagedFunctionPointerAttribute"); -#ifdef ENABLE_NETCORE -static GENERATE_TRY_GET_CLASS_WITH_CACHE (suppress_gc_transition_attribute, "System.Runtime.InteropServices", "SuppressGCTransitionAttribute") -static GENERATE_TRY_GET_CLASS_WITH_CACHE (unmanaged_callers_only_attribute, "System.Runtime.InteropServices", "UnmanagedCallersOnlyAttribute") -#endif static gboolean type_is_blittable (MonoType *type); @@ -1230,10 +1226,6 @@ handle_enum: MonoAsyncResult * mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params) { -#ifdef ENABLE_NETCORE - mono_set_pending_exception (mono_exception_from_name (mono_defaults.corlib, "System", "PlatformNotSupportedException")); - return NULL; -#else ERROR_DECL (error); MonoMulticastDelegate *mcast_delegate; MonoClass *klass; @@ -1298,7 +1290,6 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params) MonoAsyncResult *result = mono_threadpool_begin_invoke (mono_domain_get (), (MonoObject*) delegate, method, params, error); mono_error_set_pending_exception (error); return result; -#endif } static char* @@ -1945,10 +1936,6 @@ mono_marshal_get_delegate_begin_invoke (MonoMethod *method) MonoObject * mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) { -#ifdef ENABLE_NETCORE - mono_set_pending_exception (mono_exception_from_name (mono_defaults.corlib, "System", "PlatformNotSupportedException")); - return NULL; -#else ERROR_DECL (error); MonoDomain *domain = mono_domain_get (); MonoAsyncResult *ares; @@ -2048,7 +2035,6 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) mono_method_return_message_restore (method, params, out_args, error); mono_error_set_pending_exception (error); return res; -#endif } /** @@ -3357,29 +3343,6 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, csig->pinvoke = 0; res = NULL; -#ifdef ENABLE_NETCORE - iter = NULL; - while ((m = mono_class_get_methods (mono_defaults.string_class, &iter))) { - /* - * Find the corresponding String::Ctor () method which has the same signature but its static - * and returns a string. - */ - if (!strcmp ("Ctor", m->name)) { - int i; - - MonoMethodSignature *rsig = mono_method_signature_internal (m); - if (csig->param_count == rsig->param_count) { - for (i = 0; i < csig->param_count; ++i) - if (!mono_metadata_type_equal (csig->params [i], rsig->params [i])) - break; - if (i == csig->param_count) { - res = m; - break; - } - } - } - } -#else iter = NULL; while ((m = mono_class_get_methods (mono_defaults.string_class, &iter))) { if (!strcmp ("CreateString", m->name) && @@ -3388,7 +3351,6 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, break; } } -#endif g_assert (res); WrapperInfo *info; @@ -3436,12 +3398,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, * In AOT mode and embedding scenarios, it is possible that the icall is not * registered in the runtime doing the AOT compilation. */ -#ifdef ENABLE_NETCORE - /* Handled at runtime */ - pinvoke_not_found = !pinvoke && !piinfo->addr && !aot; -#else pinvoke_not_found = !piinfo->addr && !aot; -#endif if (pinvoke_not_found) { /* if there's no code but the error isn't set, just use a fairly generic exception. */ if (is_ok (emitted_error)) @@ -3496,29 +3453,6 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1); mono_method_get_marshal_info (method, mspecs); -#ifdef ENABLE_NETCORE - if (mono_class_try_get_suppress_gc_transition_attribute_class ()) { - MonoCustomAttrInfo *cinfo; - ERROR_DECL (error); - - cinfo = mono_custom_attrs_from_method_checked (method, error); - mono_error_assert_ok (error); - gboolean found = FALSE; - if (cinfo) { - for (i = 0; i < cinfo->num_attrs; ++i) { - MonoClass *ctor_class = cinfo->attrs [i].ctor->klass; - if (ctor_class == mono_class_try_get_suppress_gc_transition_attribute_class ()) { - found = TRUE; - break; - } - } - } - if (found) - skip_gc_trans = TRUE; - if (cinfo && !cinfo->cached) - mono_custom_attrs_free (cinfo); - } -#endif MonoNativeWrapperFlags flags = aot ? EMIT_NATIVE_WRAPPER_AOT : (MonoNativeWrapperFlags)0; flags |= check_exceptions ? EMIT_NATIVE_WRAPPER_CHECK_EXCEPTIONS : (MonoNativeWrapperFlags)0; @@ -5042,8 +4976,6 @@ void ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArrayHandle src, gint32 start_index, gpointer dest, gint32 length, gconstpointer managed_source_addr, MonoError *error) { - g_assert_not_netcore (); - if (length != 0) { MonoGCHandle gchandle = 0; gsize const bytes = copy_managed_common (src, dest, start_index, length, (gpointer*)&managed_source_addr, &gchandle, error); @@ -5061,8 +4993,6 @@ void ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gconstpointer src, gint32 start_index, MonoArrayHandle dest, gint32 length, gpointer managed_dest_addr, MonoError *error) { - g_assert_not_netcore (); - if (length != 0) { MonoGCHandle gchandle = 0; gsize const bytes = copy_managed_common (dest, src, start_index, length, &managed_dest_addr, &gchandle, error); @@ -5078,8 +5008,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (const char *pt MonoStringHandle ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (const char *ptr, MonoError *error) { - g_assert_not_netcore (); - if (!ptr) return NULL_HANDLE_STRING; return mono_string_new_handle (mono_domain_get (), ptr, error); @@ -5091,8 +5019,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (const char MonoStringHandle ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (const char *ptr, gint32 len, MonoError *error) { - g_assert_not_netcore (); - if (!ptr) { mono_error_set_argument_null (error, "ptr", ""); return NULL_HANDLE_STRING; @@ -5106,8 +5032,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (const gunichar2 MonoStringHandle ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (const gunichar2 *ptr, MonoError *error) { - g_assert_not_netcore (); - gsize len = 0; const gunichar2 *t = ptr; @@ -5129,8 +5053,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (const gunic MonoStringHandle ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (const gunichar2 *ptr, gint32 len, MonoError *error) { - g_assert_not_netcore (); - if (!ptr) { mono_error_set_argument_null (error, "ptr", ""); return NULL_HANDLE_STRING; @@ -5190,17 +5112,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObjectHandl MONO_CHECK_ARG_NULL_HANDLE_NAMED (obj, "structure",); MONO_CHECK_ARG_NULL_NAMED (dst, "ptr",); -#ifdef ENABLE_NETCORE - MonoClass *klass = mono_handle_class (obj); - if (m_class_is_auto_layout (klass)) { - mono_error_set_argument (error, "structure", "The specified structure must be blittable or have layout information."); - return; - } - if (m_class_is_ginst (klass)) { - mono_error_set_argument (error, "structure", "The specified object must not be an instance of a generic type."); - return; - } -#endif MonoMethod *method = mono_marshal_get_struct_to_ptr (mono_handle_class (obj)); @@ -5220,30 +5131,6 @@ ptr_to_structure (gconstpointer src, MonoObjectHandle dst, MonoError *error) mono_runtime_invoke_checked (method, NULL, pa, error); } -#ifdef ENABLE_NETCORE - -void -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructureInternal (gconstpointer src, MonoObjectHandle dst, MonoBoolean allow_vtypes, MonoError *error) -{ - MonoType *t; - MonoClass *klass; - - t = m_class_get_byval_arg (mono_handle_class (dst)); - if (!allow_vtypes && MONO_TYPE_ISSTRUCT (t)) { - mono_error_set_argument (error, "structure", "The structure must not be a value class."); - return; - } - - klass = mono_class_from_mono_type_internal (t); - if (m_class_is_auto_layout (klass)) { - mono_error_set_argument (error, "structure", "The specified structure must be blittable or have layout information."); - return; - } - - ptr_to_structure (src, dst, error); -} - -#else void ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gconstpointer src, MonoObjectHandle dst, MonoError *error) @@ -5283,7 +5170,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gconstpoin return res; } -#endif // !NETCORE int ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHandle ref_type, MonoStringHandle field_name, MonoError *error) @@ -5294,20 +5180,12 @@ ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHan return 0; } if (MONO_HANDLE_IS_NULL (field_name)) { -#ifdef ENABLE_NETCORE - mono_error_set_argument_null (error, NULL, ""); -#else mono_error_set_argument_null (error, "fieldName", ""); -#endif return 0; } if (!m_class_is_runtime_type (MONO_HANDLE_GET_CLASS (ref_type))) { -#ifdef ENABLE_NETCORE - mono_error_set_argument (error, "fieldName", ""); -#else mono_error_set_argument (error, "type", ""); -#endif return 0; } @@ -5318,12 +5196,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHan MonoClass *klass = mono_class_from_mono_type_internal (type); if (!mono_class_init_checked (klass, error)) return 0; -#ifdef ENABLE_NETCORE - if (m_class_is_auto_layout (klass)) { - mono_error_set_argument (error, NULL, ""); - return 0; - } -#endif int match_index = -1; while (klass && match_index == -1) { MonoClassField* field; @@ -5365,8 +5237,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const guni char* ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const gunichar2 *utf16, int length) { - g_assert_not_netcore (); - ERROR_DECL (error); char * const utf8 = mono_utf16_to_utf8 (utf16, length, error); @@ -5390,8 +5260,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (const gunic gunichar2* ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (const gunichar2 *s, int length) { - g_assert_not_netcore (); - if (!s) return NULL; @@ -5475,13 +5343,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoClass *klass = mono_class_from_mono_type_handle (type); if (!mono_class_init_checked (klass, error)) return; -#ifdef ENABLE_NETCORE - if (m_class_is_auto_layout (klass)) { - mono_error_set_argument (error, "structureType", "The specified structure must be blittable or have layout information."); - return; - } - -#endif mono_struct_delete_old (klass, (char *)src); } @@ -5568,8 +5429,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gsize size) void* ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gsize size) { - g_assert_not_netcore (); - void *res = mono_marshal_alloc_co_task_mem (size); if (!res) { @@ -5610,14 +5469,12 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, return res; } -#ifndef ENABLE_NETCORE gpointer ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArrayHandle arrayobj, int index, MonoError *error) { int esize = mono_array_element_size (mono_handle_class (arrayobj)); return mono_array_addr_with_size_fast (MONO_HANDLE_RAW (arrayobj), esize, index); } -#endif MonoDelegateHandle ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionTypeHandle type, MonoError *error) @@ -6006,16 +5863,6 @@ mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align, *align = 16; return 16; } -#ifdef ENABLE_NETCORE - else if (strcmp (m_class_get_name_space (klass), "System") == 0 && - strcmp (m_class_get_name (klass), "Decimal") == 0) { - - // Special case: Managed Decimal consists of 4 int32 fields, the alignment should be 8 on x64 to follow - // https://github.com/dotnet/coreclr/blob/4450e5ca663b9e66c20e6f9751c941efa3716fde/src/vm/methodtablebuilder.cpp#L9753 - *align = MONO_ABI_ALIGNOF (gpointer); - return mono_class_native_size (klass, NULL); - } -#endif padded_size = mono_class_native_size (klass, align); if (padded_size == 0) padded_size = 1; @@ -6505,24 +6352,5 @@ get_marshal_cb (void) gboolean mono_method_has_unmanaged_callers_only_attribute (MonoMethod *method) { -#ifndef ENABLE_NETCORE return FALSE; -#else - ERROR_DECL (attr_error); - MonoClass *attr_klass = NULL; - attr_klass = mono_class_try_get_unmanaged_callers_only_attribute_class (); - if (!attr_klass) - return FALSE; - MonoCustomAttrInfo *cinfo; - cinfo = mono_custom_attrs_from_method_checked (method, attr_error); - if (!is_ok (attr_error) || !cinfo) { - mono_error_cleanup (attr_error); - return FALSE; - } - gboolean result; - result = mono_custom_attrs_has_attr (cinfo, attr_klass); - if (!cinfo->cached) - mono_custom_attrs_free (cinfo); - return result; -#endif } diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index 0e6bf2429ec..fe89dde8f5c 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -169,11 +169,7 @@ struct _MonoAssemblyName { uint32_t hash_alg; uint32_t hash_len; uint32_t flags; -#ifdef ENABLE_NETCORE - int32_t major, minor, build, revision, arch; -#else uint16_t major, minor, build, revision, arch; -#endif //Add members for correct work with mono_stringify_assembly_name MonoBoolean without_version; MonoBoolean without_culture; @@ -466,12 +462,6 @@ struct _MonoImage { */ MonoAssembly *assembly; -#ifdef ENABLE_NETCORE - /* - * The AssemblyLoadContext that this image was loaded into. - */ - MonoAssemblyLoadContext *alc; -#endif /* * Indexed by method tokens and typedef tokens. @@ -574,10 +564,8 @@ struct _MonoImage { MonoConcurrentHashTable *var_gparam_cache; MonoConcurrentHashTable *mvar_gparam_cache; -#ifndef ENABLE_NETCORE /* Maps malloc-ed char* pinvoke scope -> MonoDl* */ GHashTable *pinvoke_scopes; -#endif /* The loader used to load this image */ MonoImageLoader *loader; @@ -1320,11 +1308,7 @@ static inline MonoAssemblyLoadContext * mono_image_get_alc (MonoImage *image) { -#ifndef ENABLE_NETCORE return NULL; -#else - return image->alc; -#endif } static inline diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 2f19eabe3ea..6969182f0b9 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -8026,7 +8026,7 @@ mono_loader_set_strict_assembly_name_check (gboolean enabled) gboolean mono_loader_get_strict_assembly_name_check (void) { -#if !defined(DISABLE_DESKTOP_LOADER) || defined(ENABLE_NETCORE) +#if !defined(DISABLE_DESKTOP_LOADER) return check_assembly_names_strictly; #else return FALSE; diff --git a/mono/metadata/monitor.c b/mono/metadata/monitor.c index 86a25e9d0cd..694e29d59b0 100644 --- a/mono/metadata/monitor.c +++ b/mono/metadata/monitor.c @@ -795,9 +795,6 @@ signal_monitor (gpointer mon_untyped) mono_coop_mutex_unlock (mon->entry_mutex); } -#ifdef ENABLE_NETCORE -static gint64 thread_contentions; /* for Monitor.LockContentionCount, otherwise mono_perfcounters struct is used */ -#endif /* If allow_interruption==TRUE, the method will be interrupted if abort or suspend * is requested. In this case it returns -1. @@ -856,9 +853,6 @@ retry: #ifndef DISABLE_PERFCOUNTERS mono_atomic_inc_i32 (&mono_perfcounters->thread_contentions); #else -#ifdef ENABLE_NETCORE - mono_atomic_inc_i64 (&thread_contentions); -#endif #endif /* If ms is 0 we don't block, but just fail straight away */ @@ -1223,19 +1217,11 @@ mono_monitor_try_enter_loop_if_interrupted (MonoObject *obj, guint32 ms, return res; } -#ifdef ENABLE_NETCORE -void -ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObjectHandle obj, guint32 ms, MonoBoolean allow_interruption, MonoBoolean* lockTaken, MonoError* error) -{ - mono_monitor_try_enter_loop_if_interrupted (MONO_HANDLE_RAW (obj), ms, allow_interruption, lockTaken, error); -} -#else void ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObjectHandle obj, guint32 ms, MonoBoolean* lockTaken, MonoError* error) { mono_monitor_try_enter_loop_if_interrupted (MONO_HANDLE_RAW (obj), ms, TRUE, lockTaken, error); } -#endif /** * mono_monitor_enter_v4: @@ -1493,33 +1479,14 @@ mono_monitor_wait (MonoObjectHandle obj_handle, guint32 ms, MonoBoolean allow_in return success; } -#ifdef ENABLE_NETCORE -MonoBoolean -ves_icall_System_Threading_Monitor_Monitor_wait (MonoObjectHandle obj_handle, guint32 ms, MonoBoolean allow_interruption, MonoError* error) -{ - return mono_monitor_wait (obj_handle, ms, allow_interruption, error); -} -#else MonoBoolean ves_icall_System_Threading_Monitor_Monitor_wait (MonoObjectHandle obj_handle, guint32 ms, MonoError* error) { return mono_monitor_wait (obj_handle, ms, TRUE, error); } -#endif void ves_icall_System_Threading_Monitor_Monitor_Enter (MonoObjectHandle obj, MonoError* error) { mono_monitor_enter_internal (MONO_HANDLE_RAW (obj)); } -#ifdef ENABLE_NETCORE -gint64 -ves_icall_System_Threading_Monitor_Monitor_LockContentionCount (void) -{ -#ifndef DISABLE_PERFCOUNTERS - return mono_perfcounters->thread_contentions; -#else - return thread_contentions; -#endif -} -#endif diff --git a/mono/metadata/monitor.h b/mono/metadata/monitor.h index 6b95a3ed69e..7ab5c6f5ff7 100644 --- a/mono/metadata/monitor.h +++ b/mono/metadata/monitor.h @@ -130,10 +130,5 @@ mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset); #define MONO_THREADS_SYNC_MEMBER_OFFSET(o) ((o)>>8) #define MONO_THREADS_SYNC_MEMBER_SIZE(o) ((o)&0xff) -#if ENABLE_NETCORE -ICALL_EXPORT -gint64 -ves_icall_System_Threading_Monitor_Monitor_LockContentionCount (void); -#endif #endif /* _MONO_METADATA_MONITOR_H_ */ diff --git a/mono/metadata/mono-mlist.c b/mono/metadata/mono-mlist.c index f4389fdbfca..80bd991b92f 100644 --- a/mono/metadata/mono-mlist.c +++ b/mono/metadata/mono-mlist.c @@ -68,11 +68,7 @@ mono_mlist_alloc_checked (MonoObject *data, MonoError *error) error_init (error); MonoMList* res; if (!monolist_item_vtable) { -#ifdef ENABLE_NETCORE - MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "Mono", "MonoListItem"); -#else MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoListItem"); -#endif monolist_item_vtable = mono_class_vtable_checked (mono_get_root_domain (), klass, error); mono_error_assert_ok (error); } diff --git a/mono/metadata/mono-perfcounters.c b/mono/metadata/mono-perfcounters.c index 411ffe6f2f0..dec8563da7b 100644 --- a/mono/metadata/mono-perfcounters.c +++ b/mono/metadata/mono-perfcounters.c @@ -1822,7 +1822,6 @@ mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer data) #else -#ifndef ENABLE_NETCORE void* mono_perfcounter_get_impl (const gunichar2 *category, gint32 category_length, @@ -1903,7 +1902,6 @@ mono_perfcounter_instance_names (const gunichar2 *category, gint32 category_leng g_assert_not_reached (); } -#endif /* ENABLE_NETCORE */ void mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer data) diff --git a/mono/metadata/mono-route.c b/mono/metadata/mono-route.c index 2e0bf023097..ba7e38ebf07 100644 --- a/mono/metadata/mono-route.c +++ b/mono/metadata/mono-route.c @@ -9,7 +9,6 @@ #include "config.h" -#ifndef ENABLE_NETCORE #if HOST_DARWIN || HOST_BSD #include @@ -168,7 +167,6 @@ ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInf #endif -#endif extern const char mono_route_empty_file_no_warning; const char mono_route_empty_file_no_warning = 0; diff --git a/mono/metadata/mono-security.c b/mono/metadata/mono-security.c index b360d820e27..dc743ec6bf2 100644 --- a/mono/metadata/mono-security.c +++ b/mono/metadata/mono-security.c @@ -24,7 +24,6 @@ #include "reflection-internals.h" #include "icall-decl.h" -#ifndef ENABLE_NETCORE #ifndef HOST_WIN32 #ifdef HAVE_GRP_H @@ -668,8 +667,3 @@ ves_icall_System_Security_SecureString_EncryptInternal (MonoArrayHandle data, Mo mono_invoke_protected_memory_method (data, scope, "Protect", &mono_method_securestring_encrypt, error); } -#else - -MONO_EMPTY_SOURCE_FILE (mono_security); - -#endif /* ENABLE_NETCORE */ diff --git a/mono/metadata/native-library.c b/mono/metadata/native-library.c index f1c7c291bb8..3d3b4c43e36 100644 --- a/mono/metadata/native-library.c +++ b/mono/metadata/native-library.c @@ -13,46 +13,6 @@ #include "mono/metadata/native-library.h" #include "mono/metadata/custom-attrs-internals.h" -#ifdef ENABLE_NETCORE -static int pinvoke_search_directories_count; -static char **pinvoke_search_directories; - -// sync with src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DllImportSearchPath.cs -typedef enum -{ - DLLIMPORTSEARCHPATH_LEGACY_BEHAVIOR = 0x0, // when no other flags are present, search the application directory and then call LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH - DLLIMPORTSEARCHPATH_USE_DLL_DIRECTORY_FOR_DEPENDENCIES = 0x100, - DLLIMPORTSEARCHPATH_APPLICATION_DIRECTORY = 0x200, - DLLIMPORTSEARCHPATH_USER_DIRECTORIES = 0x400, - DLLIMPORTSEARCHPATH_SYSTEM32 = 0x800, - DLLIMPORTSEARCHPATH_SAFE_DIRECTORIES = 0x1000, - DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY = 0x2, // search the assembly directory first regardless of platform, not passed on to LoadLibraryEx -} DllImportSearchPath; -#ifdef HOST_WIN32 -static const int DLLIMPORTSEARCHPATH_LOADLIBRARY_FLAG_MASK = DLLIMPORTSEARCHPATH_USE_DLL_DIRECTORY_FOR_DEPENDENCIES | DLLIMPORTSEARCHPATH_APPLICATION_DIRECTORY | - DLLIMPORTSEARCHPATH_USER_DIRECTORIES | DLLIMPORTSEARCHPATH_SYSTEM32 | DLLIMPORTSEARCHPATH_SAFE_DIRECTORIES; -#endif - -// This lock may be taken within an ALC lock, and should never be the other way around. -static MonoCoopMutex native_library_module_lock; -static GHashTable *native_library_module_map; -/* - * This blocklist is used as a set for cache invalidation purposes with netcore pinvokes. - * When pinvokes are resolved with anything other than the last-chance managed event, - * the results of that lookup are added to an ALC-level cache. However, if a library is then - * unloaded with NativeLibrary.Free(), this cache should be invalidated so that a newly called - * pinvoke will not attempt to use it, hence the blocklist. This design means that if another - * library is loaded at the same address, it will function with a perf hit, as the entry will - * repeatedly be added and removed from the cache due to its presence in the blocklist. - * This is a rare scenario and considered a worthwhile tradeoff. - */ -static GHashTable *native_library_module_blocklist; - -#ifndef NO_GLOBALIZATION_SHIM -extern const void *GlobalizationResolveDllImport (const char *name); -#endif -#endif // ENABLE_NETCORE - #ifndef DISABLE_DLLMAP static MonoDllMap *global_dll_map; #endif @@ -76,10 +36,6 @@ static char *bundled_dylibrary_directory; /* Class lazy loading functions */ GENERATE_GET_CLASS_WITH_CACHE (appdomain_unloaded_exception, "System", "AppDomainUnloadedException") GENERATE_TRY_GET_CLASS_WITH_CACHE (appdomain_unloaded_exception, "System", "AppDomainUnloadedException") -#ifdef ENABLE_NETCORE -GENERATE_GET_CLASS_WITH_CACHE (native_library, "System.Runtime.InteropServices", "NativeLibrary"); -static GENERATE_TRY_GET_CLASS_WITH_CACHE (dllimportsearchpath_attribute, "System.Runtime.InteropServices", "DefaultDllImportSearchPathsAttribute"); -#endif #ifndef DISABLE_DLLMAP /* @@ -298,34 +254,6 @@ mono_loader_register_module (const char *name, MonoDl *module) mono_global_loader_data_unlock (); } -#ifdef ENABLE_NETCORE -static MonoDl * -mono_loader_register_module_locking (const char *name, MonoDl *module) -{ - MonoDl *result = NULL; - - MONO_ENTER_GC_SAFE; - mono_global_loader_data_lock (); - MONO_EXIT_GC_SAFE; - - result = (MonoDl *)g_hash_table_lookup (global_module_map, name); - if (result) { - g_free (module->full_name); - g_free (module); - goto exit; - } - - g_hash_table_insert (global_module_map, g_strdup (name), module); - result = module; - -exit: - MONO_ENTER_GC_SAFE; - mono_global_loader_data_unlock (); - MONO_EXIT_GC_SAFE; - - return result; -} -#endif static void remove_cached_module (gpointer key, gpointer value, gpointer user_data) @@ -339,13 +267,6 @@ mono_global_loader_cache_init (void) if (!global_module_map) global_module_map = g_hash_table_new (g_str_hash, g_str_equal); -#ifdef ENABLE_NETCORE - if (!native_library_module_map) - native_library_module_map = g_hash_table_new (g_direct_hash, g_direct_equal); - if (!native_library_module_blocklist) - native_library_module_blocklist = g_hash_table_new (g_direct_hash, g_direct_equal); - mono_coop_mutex_init (&native_library_module_lock); -#endif } void @@ -453,517 +374,6 @@ mono_lookup_pinvoke_call_internal (MonoMethod *method, MonoError *error) return result; } -#ifdef ENABLE_NETCORE -void -mono_set_pinvoke_search_directories (int dir_count, char **dirs) -{ - pinvoke_search_directories_count = dir_count; - g_strfreev (pinvoke_search_directories); - pinvoke_search_directories = dirs; -} - -static void -native_library_lock (void) -{ - mono_coop_mutex_lock (&native_library_module_lock); -} - -static void -native_library_unlock (void) -{ - mono_coop_mutex_unlock (&native_library_module_lock); -} - -static void -alc_pinvoke_lock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_lock (&alc->pinvoke_lock); -} - -static void -alc_pinvoke_unlock (MonoAssemblyLoadContext *alc) -{ - mono_coop_mutex_unlock (&alc->pinvoke_lock); -} - -// LOCKING: expects you to hold native_library_module_lock -static MonoDl * -netcore_handle_lookup (gpointer handle) -{ - return (MonoDl *)g_hash_table_lookup (native_library_module_map, handle); -} - -// LOCKING: expects you to hold native_library_module_lock -static gboolean -netcore_check_blocklist (MonoDl *module) -{ - return g_hash_table_contains (native_library_module_blocklist, module); -} - -static int -convert_dllimport_flags (int flags) -{ -#ifdef HOST_WIN32 - return flags & DLLIMPORTSEARCHPATH_LOADLIBRARY_FLAG_MASK; -#else - // DllImportSearchPath is Windows-only, other than DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY - return 0; -#endif -} - -static MonoDl * -netcore_probe_for_module_variations (const char *mdirname, const char *file_name, int raw_flags) -{ - void *iter = NULL; - char *full_name; - MonoDl *module = NULL; - - // FIXME: this appears to search *.dylib twice for some reason - while ((full_name = mono_dl_build_path (mdirname, file_name, &iter)) && module == NULL) { - char *error_msg; - module = mono_dl_open_full (full_name, MONO_DL_LAZY, raw_flags, &error_msg); - if (!module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "DllImport error loading library '%s': '%s'.", full_name, error_msg); - g_free (error_msg); - } - g_free (full_name); - } - g_free (full_name); - - return module; -} - -static MonoDl * -netcore_probe_for_module (MonoImage *image, const char *file_name, int flags) -{ - MonoDl *module = NULL; - int lflags = convert_dllimport_flags (flags); - - // TODO: this algorithm doesn't quite match CoreCLR, so respecting DLLIMPORTSEARCHPATH_LEGACY_BEHAVIOR makes little sense - // If the difference becomes a problem, overhaul this algorithm to match theirs exactly - - // Try without any path additions - module = netcore_probe_for_module_variations (NULL, file_name, lflags); - - // Check the NATIVE_DLL_SEARCH_DIRECTORIES - for (int i = 0; i < pinvoke_search_directories_count && module == NULL; ++i) - module = netcore_probe_for_module_variations (pinvoke_search_directories[i], file_name, lflags); - - // Check the assembly directory if the search flag is set and the image exists - if (flags & DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY && image != NULL && module == NULL) { - char *mdirname = g_path_get_dirname (image->filename); - if (mdirname) - module = netcore_probe_for_module_variations (mdirname, file_name, lflags); - g_free (mdirname); - } - - // TODO: Pass remaining flags on to LoadLibraryEx on Windows where appropriate, see https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportsearchpath?view=netcore-3.1 - - return module; -} - -static MonoDl * -netcore_resolve_with_dll_import_resolver (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, const char *scope, guint32 flags, MonoError *error) -{ - MonoDl *result = NULL; - gpointer lib = NULL; - MonoDomain *domain = mono_alc_domain (alc); - - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - static gboolean inited; - if (!inited) { - MonoClass *native_lib_class = mono_class_get_native_library_class (); - g_assert (native_lib_class); - resolve = mono_class_get_method_from_name_checked (native_lib_class, "MonoLoadLibraryCallbackStub", -1, 0, local_error); - inited = TRUE; - } - mono_error_cleanup (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - - if (!resolve) - return NULL; - - if (mono_runtime_get_no_exec ()) - return NULL; - - HANDLE_FUNCTION_ENTER (); - - MonoStringHandle scope_handle; - scope_handle = mono_string_new_handle (domain, scope, error); - goto_if_nok (error, leave); - - MonoReflectionAssemblyHandle assembly_handle; - assembly_handle = mono_assembly_get_object_handle (domain, assembly, error); - goto_if_nok (error, leave); - - gboolean has_search_flags; - has_search_flags = flags != 0 ? TRUE : FALSE; - gpointer args [5]; - args [0] = MONO_HANDLE_RAW (scope_handle); - args [1] = MONO_HANDLE_RAW (assembly_handle); - args [2] = &has_search_flags; - args [3] = &flags; - args [4] = &lib; - mono_runtime_invoke_checked (resolve, NULL, args, error); - goto_if_nok (error, leave); - - native_library_lock (); - result = netcore_handle_lookup (lib); - native_library_unlock (); - -leave: - HANDLE_FUNCTION_RETURN_VAL (result); -} - -static MonoDl * -netcore_resolve_with_dll_import_resolver_nofail (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, const char *scope, guint32 flags) -{ - MonoDl *result = NULL; - ERROR_DECL (error); - - result = netcore_resolve_with_dll_import_resolver (alc, assembly, scope, flags, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Error while invoking ALC DllImportResolver(\"%s\") delegate: '%s'", scope, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -static MonoDl * -netcore_resolve_with_load (MonoAssemblyLoadContext *alc, const char *scope, MonoError *error) -{ - MonoDl *result = NULL; - gpointer lib = NULL; - - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUnmanagedDll", -1, 0, local_error); - mono_error_assert_ok (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - g_assert (resolve); - - if (mono_runtime_get_no_exec ()) - return NULL; - - HANDLE_FUNCTION_ENTER (); - - MonoStringHandle scope_handle; - scope_handle = mono_string_new_handle (mono_alc_domain (alc), scope, error); - goto_if_nok (error, leave); - - gpointer gchandle; - gchandle = GUINT_TO_POINTER (alc->gchandle); - gpointer args [3]; - args [0] = MONO_HANDLE_RAW (scope_handle); - args [1] = &gchandle; - args [2] = &lib; - mono_runtime_invoke_checked (resolve, NULL, args, error); - goto_if_nok (error, leave); - - native_library_lock (); - result = netcore_handle_lookup (lib); - native_library_unlock (); - -leave: - HANDLE_FUNCTION_RETURN_VAL (result); -} - -static MonoDl * -netcore_resolve_with_load_nofail (MonoAssemblyLoadContext *alc, const char *scope) -{ - MonoDl *result = NULL; - ERROR_DECL (error); - - result = netcore_resolve_with_load (alc, scope, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Error while invoking ALC LoadUnmanagedDll(\"%s\") method: '%s'", scope, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -static MonoDl * -netcore_resolve_with_resolving_event (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, const char *scope, MonoError *error) -{ - MonoDl *result = NULL; - gpointer lib = NULL; - MonoDomain *domain = mono_alc_domain (alc); - - MONO_STATIC_POINTER_INIT (MonoMethod, resolve) - - ERROR_DECL (local_error); - static gboolean inited; - if (!inited) { - MonoClass *alc_class = mono_class_get_assembly_load_context_class (); - g_assert (alc_class); - resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUnmanagedDllUsingEvent", -1, 0, local_error); - inited = TRUE; - } - mono_error_cleanup (local_error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve) - if (!resolve) - return NULL; - - if (mono_runtime_get_no_exec ()) - return NULL; - - HANDLE_FUNCTION_ENTER (); - - MonoStringHandle scope_handle; - scope_handle = mono_string_new_handle (domain, scope, error); - goto_if_nok (error, leave); - - MonoReflectionAssemblyHandle assembly_handle; - assembly_handle = mono_assembly_get_object_handle (domain, assembly, error); - goto_if_nok (error, leave); - - gpointer gchandle; - gchandle = GUINT_TO_POINTER (alc->gchandle); - gpointer args [4]; - args [0] = MONO_HANDLE_RAW (scope_handle); - args [1] = MONO_HANDLE_RAW (assembly_handle); - args [2] = &gchandle; - args [3] = &lib; - mono_runtime_invoke_checked (resolve, NULL, args, error); - goto_if_nok (error, leave); - - native_library_lock (); - result = netcore_handle_lookup (lib); - native_library_unlock (); - -leave: - HANDLE_FUNCTION_RETURN_VAL (result); -} - -static MonoDl * -netcore_resolve_with_resolving_event_nofail (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, const char *scope) -{ - MonoDl *result = NULL; - ERROR_DECL (error); - - result = netcore_resolve_with_resolving_event (alc, assembly, scope, error); - if (!is_ok (error)) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Error while invoking ALC ResolvingUnmangedDll(\"%s\") event: '%s'", scope, mono_error_get_message (error)); - - mono_error_cleanup (error); - - return result; -} - -// LOCKING: expects you to hold the ALC's pinvoke lock -static MonoDl * -netcore_check_alc_cache (MonoAssemblyLoadContext *alc, const char *scope) -{ - MonoDl *result = NULL; - - result = (MonoDl *)g_hash_table_lookup (alc->pinvoke_scopes, scope); - - if (result) { - gboolean blocklisted; - - native_library_lock (); - blocklisted = netcore_check_blocklist (result); - native_library_unlock (); - - if (blocklisted) { - g_hash_table_remove (alc->pinvoke_scopes, scope); - result = NULL; - } - } - - return result; -} - -static MonoDl * -netcore_lookup_native_library (MonoAssemblyLoadContext *alc, MonoImage *image, const char *scope, guint32 flags) -{ - MonoDl *module = NULL; - MonoDl *cached; - MonoAssembly *assembly = mono_image_get_assembly (image); - char *error_msg = NULL; - - MONO_REQ_GC_UNSAFE_MODE; - - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "DllImport attempting to load: '%s'.", scope); - - // We allow a special name to dlopen from the running process namespace, which is not present in CoreCLR - if (strcmp (scope, "__Internal") == 0) { - if (!internal_module) - internal_module = mono_dl_open_self (&error_msg); - module = internal_module; - - if (!module) { - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "DllImport error loading library '__Internal': '%s'.", error_msg); - g_free (error_msg); - } - - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found via __Internal: '%s'.", scope); - - return module; - } - - /* - * Try these until one of them succeeds: - * - * 1. Check the cache in the active ALC. - * - * 2. Call the DllImportResolver on the active assembly. - * - * 3. Call LoadUnmanagedDll on the active ALC. - * - * 4. Check the global cache. - * - * 5. Run the unmanaged probing logic. - * - * 6. Raise the ResolvingUnmanagedDll event on the active ALC. - * - * 7. Return NULL. - */ - - alc_pinvoke_lock (alc); - module = netcore_check_alc_cache (alc, scope); - alc_pinvoke_unlock (alc); - if (module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found in the active ALC cache: '%s'.", scope); - goto leave; - } - - module = (MonoDl *)netcore_resolve_with_dll_import_resolver_nofail (alc, assembly, scope, flags); - if (module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found via DllImportResolver: '%s'.", scope); - goto add_to_alc_cache; - } - - module = (MonoDl *)netcore_resolve_with_load_nofail (alc, scope); - if (module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found via LoadUnmanagedDll: '%s'.", scope); - goto add_to_alc_cache; - } - - MONO_ENTER_GC_SAFE; - mono_global_loader_data_lock (); - MONO_EXIT_GC_SAFE; - module = (MonoDl *)g_hash_table_lookup (global_module_map, scope); - MONO_ENTER_GC_SAFE; - mono_global_loader_data_unlock (); - MONO_EXIT_GC_SAFE; - if (module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found in the global cache: '%s'.", scope); - goto add_to_alc_cache; - } - - module = netcore_probe_for_module (image, scope, flags); - if (module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found via filesystem probing: '%s'.", scope); - goto add_to_global_cache; - } - - /* As this is last chance, I've opted not to put it in a cache, but that is not necessarily the correct decision. - * It is rather convenient here, however, because it means the global cache will only be populated by libraries - * resolved via netcore_probe_for_module and not NativeLibrary, eliminating potential races/conflicts. - */ - module = netcore_resolve_with_resolving_event_nofail (alc, assembly, scope); - if (module) - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Native library found via the Resolving event: '%s'.", scope); - goto leave; - -add_to_global_cache: - module = mono_loader_register_module_locking (scope, module); - -add_to_alc_cache: - /* Nothing is closed here because the only two places this can come from are: - * 1. A managed callback that made use of NativeLibrary.Load, in which case closing is dependent on NativeLibrary.Free - * 2. The global cache, which is only populated by results of netcore_probe_for_module. When adding to the global cache, - * we free the new MonoDl if another thread beat us, so we don't have to repeat that here. - */ - alc_pinvoke_lock (alc); - cached = netcore_check_alc_cache (alc, scope); - if (cached) - module = cached; - else - g_hash_table_insert (alc->pinvoke_scopes, g_strdup (scope), module); - alc_pinvoke_unlock (alc); - -leave: - return module; -} - -static int -get_dllimportsearchpath_flags (MonoCustomAttrInfo *cinfo) -{ - ERROR_DECL (error); - MonoCustomAttrEntry *attr = NULL; - MonoClass *dllimportsearchpath = mono_class_try_get_dllimportsearchpath_attribute_class (); - int idx; - int flags; - - if (!dllimportsearchpath) - return -1; - if (!cinfo) - return -2; - - for (idx = 0; idx < cinfo->num_attrs; ++idx) { - MonoClass *ctor_class = cinfo->attrs [idx].ctor->klass; - if (ctor_class == dllimportsearchpath) { - attr = &cinfo->attrs [idx]; - break; - } - } - if (!attr) - return -3; - - gpointer *typed_args, *named_args; - CattrNamedArg *arginfo; - int num_named_args; - - mono_reflection_create_custom_attr_data_args_noalloc (m_class_get_image (attr->ctor->klass), attr->ctor, attr->data, attr->data_size, - &typed_args, &named_args, &num_named_args, &arginfo, error); - if (!is_ok (error)) { - mono_error_cleanup (error); - return -4; - } - - flags = *(gint32*)typed_args [0]; - g_free (typed_args [0]); - g_free (typed_args); - g_free (named_args); - g_free (arginfo); - - return flags; -} - -#ifndef NO_GLOBALIZATION_SHIM -#ifdef HOST_WIN32 -#define GLOBALIZATION_DLL_NAME "System.Globalization.Native" -#else -#define GLOBALIZATION_DLL_NAME "libSystem.Globalization.Native" -#endif - -static gpointer -default_resolve_dllimport (const char *dll, const char *func) -{ - if (strcmp (dll, GLOBALIZATION_DLL_NAME) == 0) { - const void *method_impl = GlobalizationResolveDllImport (func); - if (method_impl) - return (gpointer)method_impl; - } - - return NULL; -} -#endif // NO_GLOBALIZATION_SHIM - -#else // ENABLE_NETCORE - static MonoDl * cached_module_load (const char *name, int flags, char **err) { @@ -1292,17 +702,11 @@ legacy_lookup_native_library (MonoImage *image, const char *scope) return module; } -#endif // ENABLE_NETCORE gpointer lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_out) { MonoImage *image = m_class_get_image (method->klass); -#ifdef ENABLE_NETCORE - MonoAssemblyLoadContext *alc = mono_image_get_alc (image); - MonoCustomAttrInfo *cinfo; - int flags; -#endif MonoMethodPInvoke *piinfo = (MonoMethodPInvoke *)method; MonoTableInfo *tables = image->tables; MonoTableInfo *im = &tables [MONO_TABLE_IMPLMAP]; @@ -1374,45 +778,7 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou } #endif -#ifdef ENABLE_NETCORE -#ifndef NO_GLOBALIZATION_SHIM - addr = default_resolve_dllimport (new_scope, new_import); - if (addr) - goto exit; -#endif - - if (pinvoke_override) { - addr = pinvoke_override (new_scope, new_import); - if (addr) - goto exit; - } - -#ifndef HOST_WIN32 -retry_with_libcoreclr: -#endif - { - ERROR_DECL (local_error); - cinfo = mono_custom_attrs_from_method_checked (method, local_error); - mono_error_cleanup (local_error); - } - flags = get_dllimportsearchpath_flags (cinfo); - if (cinfo && !cinfo->cached) - mono_custom_attrs_free (cinfo); - - if (flags < 0) { - ERROR_DECL (local_error); - cinfo = mono_custom_attrs_from_assembly_checked (m_class_get_image (method->klass)->assembly, TRUE, local_error); - mono_error_cleanup (local_error); - flags = get_dllimportsearchpath_flags (cinfo); - if (cinfo && !cinfo->cached) - mono_custom_attrs_free (cinfo); - } - if (flags < 0) - flags = 0; - module = netcore_lookup_native_library (alc, image, new_scope, flags); -#else module = legacy_lookup_native_library (image, new_scope); -#endif // ENABLE_NETCORE if (!module) { mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_DLLIMPORT, @@ -1430,13 +796,6 @@ retry_with_libcoreclr: addr = pinvoke_probe_for_symbol (module, piinfo, new_import, &error_msg); if (!addr) { -#if defined(ENABLE_NETCORE) && !defined(HOST_WIN32) - if (strcmp (new_scope, "__Internal") == 0) { - g_free ((char *)new_scope); - new_scope = g_strdup (MONO_LOADER_LIBRARY_NAME); - goto retry_with_libcoreclr; - } -#endif status_out->err_code = LOOKUP_PINVOKE_ERR_NO_SYM; status_out->err_arg = g_strdup (new_import); goto exit; @@ -1461,7 +820,6 @@ pinvoke_probe_for_symbol (MonoDl *module, MonoMethodPInvoke *piinfo, const char mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "Searching for '%s'.", import); -#if !defined(ENABLE_NETCORE) || defined(HOST_WIN32) // For netcore, name mangling is Windows-exclusive if (piinfo->piflags & PINVOKE_ATTRIBUTE_NO_MANGLE) error_msg = mono_dl_symbol (module, import, &addr); else { @@ -1546,166 +904,11 @@ pinvoke_probe_for_symbol (MonoDl *module, MonoMethodPInvoke *piinfo, const char } } } -#else - error_msg = mono_dl_symbol (module, import, &addr); -#endif *error_msg_out = error_msg; return addr; } -#ifdef ENABLE_NETCORE -void -ves_icall_System_Runtime_InteropServices_NativeLibrary_FreeLib (gpointer lib, MonoError *error) -{ - MonoDl *module; - guint32 ref_count; - - g_assert (lib); - - // Don't free __Internal - if (internal_module && lib == internal_module->handle) - return; - - native_library_lock (); - - module = netcore_handle_lookup (lib); - if (!module) - goto leave; - - ref_count = mono_refcount_dec (module); - if (ref_count > 0) - goto leave; - - g_hash_table_remove (native_library_module_map, module->handle); - g_hash_table_add (native_library_module_blocklist, module); - mono_dl_close (module); - -leave: - native_library_unlock (); -} - -gpointer -ves_icall_System_Runtime_InteropServices_NativeLibrary_GetSymbol (gpointer lib, MonoStringHandle symbol_name_handle, MonoBoolean throw_on_error, MonoError *error) -{ - MonoDl *module; - gpointer symbol = NULL; - char *symbol_name; - - g_assert (lib); - - ERROR_LOCAL_BEGIN (local_error, error, throw_on_error) - - symbol_name = mono_string_handle_to_utf8 (symbol_name_handle, error); - goto_if_nok (error, leave_nolock); - - native_library_lock (); - - module = netcore_handle_lookup (lib); - if (!module) - mono_error_set_generic_error (error, "System", "DllNotFoundException", "%p: %s", lib, symbol_name); - goto_if_nok (error, leave); - - mono_dl_symbol (module, symbol_name, &symbol); - if (!symbol) - mono_error_set_generic_error (error, "System", "EntryPointNotFoundException", "%s: %s", module->full_name, symbol_name); - goto_if_nok (error, leave); - -leave: - native_library_unlock (); - -leave_nolock: - ERROR_LOCAL_END (local_error); - g_free (symbol_name); - - return symbol; -} - -// LOCKING: expects you to hold native_library_module_lock -static MonoDl * -check_native_library_cache (MonoDl *module) -{ - gpointer handle = module->handle; - - MonoDl *cached_module = netcore_handle_lookup (handle); - if (cached_module) { - g_free (module->full_name); - g_free (module); - mono_refcount_inc (cached_module); - return cached_module; - } - g_hash_table_insert (native_library_module_map, handle, (gpointer)module); - - return module; -} - -gpointer -ves_icall_System_Runtime_InteropServices_NativeLibrary_LoadByName (MonoStringHandle lib_name_handle, MonoReflectionAssemblyHandle assembly_handle, MonoBoolean has_search_flag, guint32 search_flag, MonoBoolean throw_on_error, MonoError *error) -{ - MonoDl *module; - gpointer handle = NULL; - MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_handle, assembly); - MonoImage *image = mono_assembly_get_image_internal (assembly); - char *lib_name; - - ERROR_LOCAL_BEGIN (local_error, error, throw_on_error) - - lib_name = mono_string_handle_to_utf8 (lib_name_handle, error); - goto_if_nok (error, leave); - - // FIXME: implement search flag defaults properly - module = netcore_probe_for_module (image, lib_name, has_search_flag ? search_flag : DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY); - if (!module) - mono_error_set_generic_error (error, "System", "DllNotFoundException", "%s", lib_name); - goto_if_nok (error, leave); - - native_library_lock (); - module = check_native_library_cache (module); - native_library_unlock (); - - handle = module->handle; - -leave: - ERROR_LOCAL_END (local_error); - g_free (lib_name); - - return handle; -} - -gpointer -ves_icall_System_Runtime_InteropServices_NativeLibrary_LoadFromPath (MonoStringHandle lib_path_handle, MonoBoolean throw_on_error, MonoError *error) -{ - MonoDl *module; - gpointer handle = NULL; - char *error_msg = NULL; - char *lib_path; - - ERROR_LOCAL_BEGIN (local_error, error, throw_on_error) - - lib_path = mono_string_handle_to_utf8 (lib_path_handle, error); - goto_if_nok (error, leave); - - module = mono_dl_open (lib_path, MONO_DL_LAZY, &error_msg); - if (!module) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_DLLIMPORT, "DllImport error loading library '%s': '%s'.", lib_path, error_msg); - mono_error_set_generic_error (error, "System", "DllNotFoundException", "'%s': '%s'", lib_path, error_msg); - g_free (error_msg); - } - goto_if_nok (error, leave); - - native_library_lock (); - module = check_native_library_cache (module); - native_library_unlock (); - - handle = module->handle; - -leave: - ERROR_LOCAL_END (local_error); - g_free (lib_path); - - return handle; -} -#endif #ifdef HAVE_ATEXIT static void diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h index af9514d2ccb..b2b95479e7b 100644 --- a/mono/metadata/object-internals.h +++ b/mono/metadata/object-internals.h @@ -278,9 +278,7 @@ mono_handle_array_get_bounds_dim (MonoArrayHandle arr, gint32 dim, MonoArrayBoun typedef struct { MonoObject obj; -#ifndef ENABLE_NETCORE MonoObject *identity; -#endif } MonoMarshalByRefObject; TYPED_HANDLE_DECL (MonoMarshalByRefObject); @@ -288,18 +286,14 @@ TYPED_HANDLE_DECL (MonoMarshalByRefObject); /* This is a copy of System.AppDomain */ struct _MonoAppDomain { MonoMarshalByRefObject mbr; -#ifndef ENABLE_NETCORE MonoDomain *data; -#endif }; /* Safely access System.AppDomain from native code */ TYPED_HANDLE_DECL (MonoAppDomain); -#ifndef ENABLE_NETCORE /* Safely access System.AppDomainSetup from native code. (struct is in domain-internals.h) */ TYPED_HANDLE_DECL (MonoAppDomainSetup); -#endif typedef struct _MonoStringBuilder MonoStringBuilder; TYPED_HANDLE_DECL (MonoStringBuilder); @@ -373,12 +367,10 @@ typedef struct { TYPED_HANDLE_DECL (MonoSystemException); -#ifndef ENABLE_NETCORE typedef struct { MonoSystemException base; MonoString *param_name; } MonoArgumentException; -#endif typedef struct { MonoObject object; @@ -594,9 +586,7 @@ struct _MonoInternalThread { gsize debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works gpointer *static_data; struct _MonoThreadInfo *thread_info; -#ifndef ENABLE_NETCORE MonoAppContext *current_appcontext; -#endif MonoThread *root_domain_thread; MonoObject *_serialized_principal; int _serialized_principal_version; @@ -624,13 +614,7 @@ struct _MonoInternalThread { gint32 self_suspended; // TRUE | FALSE gsize thread_state; -#ifdef ENABLE_NETCORE - struct _MonoInternalThread *internal_thread; - MonoObject *start_obj; - MonoException *pending_exception; -#else void* unused [3]; // same size as netcore -#endif /* This is used only to check that we are in sync between the representation * of MonoInternalThread in native and InternalThread in managed * @@ -638,21 +622,18 @@ struct _MonoInternalThread { gpointer last; }; -#ifndef ENABLE_NETCORE struct _MonoThread { MonoObject obj; MonoInternalThread *internal_thread; MonoObject *start_obj; MonoException *pending_exception; }; -#endif typedef struct { guint32 state; MonoObject *additional; } MonoStreamingContext; -#if !ENABLE_NETCORE typedef struct { MonoObject obj; MonoBoolean readOnly; @@ -800,7 +781,6 @@ typedef struct { TYPED_HANDLE_DECL (MonoRegionInfo); -#endif /* !ENABLE_NETCORE */ typedef struct { MonoObject object; @@ -1054,9 +1034,7 @@ TYPED_HANDLE_DECL (MonoReflectionProperty); /*This is System.EventInfo*/ struct _MonoReflectionEvent { MonoObject object; -#ifndef ENABLE_NETCORE MonoObject *cached_add_event; -#endif }; /* Safely access System.Reflection.EventInfo from native code */ @@ -1523,21 +1501,6 @@ typedef struct { TYPED_HANDLE_DECL (MonoReflectionCustomAttr); -#if ENABLE_NETCORE -typedef struct { - MonoObject object; - guint32 utype; - gint32 safe_array_subtype; - MonoReflectionType *marshal_safe_array_user_defined_subtype; - gint32 IidParameterIndex; - guint32 array_subtype; - gint16 size_param_index; - gint32 size_const; - MonoString *marshal_type; - MonoReflectionType *marshal_type_ref; - MonoString *marshal_cookie; -} MonoReflectionMarshalAsAttribute; -#else typedef struct { MonoObject object; MonoString *marshal_cookie; @@ -1551,7 +1514,6 @@ typedef struct { gint32 IidParameterIndex; gint16 size_param_index; } MonoReflectionMarshalAsAttribute; -#endif /* Safely access System.Runtime.InteropServices.MarshalAsAttribute */ TYPED_HANDLE_DECL (MonoReflectionMarshalAsAttribute); @@ -1658,21 +1620,6 @@ typedef struct { MonoProperty *prop; } CattrNamedArg; -#ifdef ENABLE_NETCORE -// Keep in sync with System.Runtime.Loader.AssemblyLoadContext.InternalState -typedef enum { - ALIVE = 0, - UNLOADING = 1 -} MonoManagedAssemblyLoadContextInternalState; - -// Keep in sync with System.Runtime.Loader.AssemblyLoadContext -typedef struct { - MonoObject object; - MonoAssemblyLoadContext *native_assembly_load_context; -} MonoManagedAssemblyLoadContext; - -TYPED_HANDLE_DECL (MonoManagedAssemblyLoadContext); -#endif /* All MonoInternalThread instances should be pinned, so it's safe to use the raw ptr. However * for uniformity, icall wrapping will make handles anyway. So this is the method for getting the payload. @@ -1927,13 +1874,6 @@ mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy void mono_unhandled_exception_checked (MonoObjectHandle exc, MonoError *error); -#ifdef ENABLE_NETCORE -void -mono_first_chance_exception_checked (MonoObjectHandle exc, MonoError *error); - -void -mono_first_chance_exception_internal (MonoObject *exc_raw); -#endif MonoVTable * mono_class_try_get_vtable (MonoDomain *domain, MonoClass *klass); diff --git a/mono/metadata/object-offsets.h b/mono/metadata/object-offsets.h index ab8fb9e86b2..62358a23450 100644 --- a/mono/metadata/object-offsets.h +++ b/mono/metadata/object-offsets.h @@ -167,13 +167,11 @@ DECL_OFFSET(MonoJitTlsData, stack_restore_ctx) DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size) DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here -#if !defined(ENABLE_NETCORE) DECL_OFFSET(MonoContinuation, stack_used_size) DECL_OFFSET(MonoContinuation, saved_stack) DECL_OFFSET(MonoContinuation, return_sp) DECL_OFFSET(MonoContinuation, lmf) DECL_OFFSET(MonoContinuation, return_ip) -#endif DECL_OFFSET(MonoDelegateTrampInfo, method) DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl) diff --git a/mono/metadata/object.c b/mono/metadata/object.c index d14e5434946..4052ce7fa03 100644 --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@ -1255,12 +1255,10 @@ field_is_special_static (MonoClass *fklass, MonoClassField *field) mono_custom_attrs_free (ainfo); return SPECIAL_STATIC_THREAD; } -#ifndef ENABLE_NETCORE else if (strcmp (klass_name, "ContextStaticAttribute") == 0) { mono_custom_attrs_free (ainfo); return SPECIAL_STATIC_CONTEXT; } -#endif } } mono_custom_attrs_free (ainfo); @@ -5005,102 +5003,6 @@ mono_unhandled_exception (MonoObject *exc) MONO_EXTERNAL_ONLY_VOID (mono_unhandled_exception_internal (exc)); } -#ifdef ENABLE_NETCORE -static MonoObjectHandle -create_first_chance_exception_eventargs (MonoObjectHandle exc, MonoError *error) -{ - MONO_REQ_GC_UNSAFE_MODE; - - HANDLE_FUNCTION_ENTER (); - - MonoObjectHandle obj; - MonoClass *klass = mono_class_get_first_chance_exception_event_args_class (); - - MONO_STATIC_POINTER_INIT (MonoMethod, ctor) - - ctor = mono_class_get_method_from_name_checked (klass, ".ctor", 1, METHOD_ATTRIBUTE_PUBLIC, error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, ctor) - - goto_if_nok (error, return_null); - g_assert (ctor); - - gpointer args [1]; - args [0] = MONO_HANDLE_RAW (exc); - - obj = mono_object_new_handle (mono_domain_get (), klass, error); - goto_if_nok (error, return_null); - - mono_runtime_invoke_handle_void (ctor, obj, args, error); - goto_if_nok (error, return_null); - - goto leave; - -return_null: - obj = MONO_HANDLE_NEW (MonoObject, NULL); - -leave: - HANDLE_FUNCTION_RETURN_REF (MonoObject, obj); -} - -void -mono_first_chance_exception_internal (MonoObject *exc_raw) -{ - ERROR_DECL (error); - - HANDLE_FUNCTION_ENTER (); - - MONO_HANDLE_DCL (MonoObject, exc); - - mono_first_chance_exception_checked (exc, error); - - if (!is_ok (error)) - g_warning ("Invoking the FirstChanceException event failed: %s", mono_error_get_message (error)); - - HANDLE_FUNCTION_RETURN (); -} - -void -mono_first_chance_exception_checked (MonoObjectHandle exc, MonoError *error) -{ - MonoClass *klass = mono_handle_class (exc); - MonoDomain *domain = mono_domain_get (); - MonoObject *delegate = NULL; - MonoObjectHandle delegate_handle; - - if (klass == mono_defaults.threadabortexception_class) - return; - - MONO_STATIC_POINTER_INIT (MonoClassField, field) - - static gboolean inited; - if (!inited) { - field = mono_class_get_field_from_name_full (mono_defaults.appcontext_class, "FirstChanceException", NULL); - inited = TRUE; - } - - MONO_STATIC_POINTER_INIT_END (MonoClassField, field) - - if (!field) - return; - - MonoVTable *vt = mono_class_vtable_checked (domain, mono_defaults.appcontext_class, error); - return_if_nok (error); - - // TODO: use handles directly - mono_field_static_get_value_checked (vt, field, &delegate, MONO_HANDLE_NEW (MonoString, NULL), error); - return_if_nok (error); - delegate_handle = MONO_HANDLE_NEW (MonoObject, delegate); - - if (MONO_HANDLE_BOOL (delegate_handle)) { - gpointer args [2]; - args [0] = domain->domain; - args [1] = MONO_HANDLE_RAW (create_first_chance_exception_eventargs (exc, error)); - mono_error_assert_ok (error); - mono_runtime_delegate_try_invoke_handle (delegate_handle, args, error); - } -} -#endif /** * mono_unhandled_exception_checked: @@ -5127,29 +5029,18 @@ mono_unhandled_exception_checked (MonoObjectHandle exc, MonoError *error) * https://msdn.microsoft.com/en-us/library/system.appdomainunloadedexception(v=vs.110).aspx#Anchor_6 */ gboolean no_event = (klass == mono_defaults.threadabortexception_class); -#ifndef ENABLE_NETCORE no_event = no_event || (klass == mono_class_get_appdomain_unloaded_exception_class () && mono_thread_info_current ()->runtime_thread); -#endif if (no_event) return; MONO_STATIC_POINTER_INIT (MonoClassField, field) -#ifndef ENABLE_NETCORE field = mono_class_get_field_from_name_full (mono_defaults.appdomain_class, "UnhandledException", NULL); -#else - static gboolean inited; - if (!inited) { - field = mono_class_get_field_from_name_full (mono_defaults.appcontext_class, "UnhandledException", NULL); - inited = TRUE; - } -#endif MONO_STATIC_POINTER_INIT_END (MonoClassField, field) -#ifndef ENABLE_NETCORE g_assert (field); MonoDomain *root_domain; @@ -5175,32 +5066,6 @@ mono_unhandled_exception_checked (MonoObjectHandle exc, MonoError *error) call_unhandled_exception_delegate (current_domain, current_appdomain_delegate, exc); mono_threads_end_abort_protected_block (); } -#else - if (!field) - goto leave; - - MonoObject *delegate = NULL; - MonoObjectHandle delegate_handle; - MonoVTable *vt = mono_class_vtable_checked (current_domain, mono_defaults.appcontext_class, error); - goto_if_nok (error, leave); - - // TODO: use handles directly - mono_field_static_get_value_checked (vt, field, &delegate, MONO_HANDLE_NEW (MonoString, NULL), error); - goto_if_nok (error, leave); - delegate_handle = MONO_HANDLE_NEW (MonoObject, delegate); - - if (MONO_HANDLE_IS_NULL (delegate_handle)) { - mono_print_unhandled_exception_internal (MONO_HANDLE_RAW (exc)); // TODO: use handles - } else { - gpointer args [2]; - args [0] = current_domain->domain; - args [1] = MONO_HANDLE_RAW (create_unhandled_exception_eventargs (exc, error)); - mono_error_assert_ok (error); - mono_runtime_delegate_try_invoke_handle (delegate_handle, args, error); - } - -leave: -#endif /* set exitcode only if we will abort the process */ if ((main_thread && mono_thread_internal_current () == main_thread->internal_thread) @@ -6703,25 +6568,6 @@ mono_array_new_specific_checked (MonoVTable *vtable, uintptr_t n, MonoError *err return mono_array_new_specific_internal (vtable, n, FALSE, error); } -#ifdef ENABLE_NETCORE -MonoArrayHandle -ves_icall_System_GC_AllocPinnedArray (MonoReflectionTypeHandle array_type, gint32 length, MonoError *error) -{ - MONO_REQ_GC_UNSAFE_MODE; - - MonoClass *klass = mono_class_from_mono_type_internal (MONO_HANDLE_GETVAL (array_type, type)); - MonoVTable *vtable = mono_class_vtable_checked (mono_domain_get (), klass, error); - goto_if_nok (error, fail); - - MonoArray *arr; - arr = mono_array_new_specific_internal (vtable, length, TRUE, error); - goto_if_nok (error, fail); - - return MONO_HANDLE_NEW (MonoArray, arr); -fail: - return MONO_HANDLE_NEW (MonoArray, NULL); -} -#endif MonoArrayHandle @@ -8311,7 +8157,6 @@ mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx) eh_callbacks.mono_raise_exception_with_ctx (ex, ctx); } -#ifndef ENABLE_NETCORE /** * mono_wait_handle_new: @@ -8362,7 +8207,6 @@ mono_wait_handle_get_handle (MonoWaitHandle *handle) return sh->handle; } -#endif /* ENABLE_NETCORE */ /* * Returns the MonoMethod to call to Capture the ExecutionContext. @@ -8417,7 +8261,6 @@ mono_runtime_capture_context (MonoDomain *domain, MonoError *error) #endif } -#ifndef ENABLE_NETCORE /** * mono_async_result_new: @@ -8537,7 +8380,6 @@ ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResultH } return res; } -#endif /* ENABLE_NETCORE */ gboolean mono_message_init (MonoDomain *domain, diff --git a/mono/metadata/object.h b/mono/metadata/object.h index f421c6c1a33..ca835aa7899 100644 --- a/mono/metadata/object.h +++ b/mono/metadata/object.h @@ -22,11 +22,7 @@ typedef struct _MonoReflectionEvent MONO_RT_MANAGED_ATTR MonoReflectionEvent; typedef struct _MonoReflectionType MONO_RT_MANAGED_ATTR MonoReflectionType; typedef struct _MonoDelegate MONO_RT_MANAGED_ATTR MonoDelegate; typedef struct _MonoThreadsSync MonoThreadsSync; -#ifdef ENABLE_NETCORE -typedef struct _MonoInternalThread MONO_RT_MANAGED_ATTR MonoThread; -#else typedef struct _MonoThread MONO_RT_MANAGED_ATTR MonoThread; -#endif typedef struct _MonoDynamicAssembly MonoDynamicAssembly; typedef struct _MonoDynamicImage MonoDynamicImage; typedef struct _MonoReflectionMethodBody MONO_RT_MANAGED_ATTR MonoReflectionMethodBody; diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c index 8ce627ea4d9..faf4abfb82b 100644 --- a/mono/metadata/rand.c +++ b/mono/metadata/rand.c @@ -21,7 +21,6 @@ #include "utils/mono-rand.h" #include "icall-decl.h" -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (MonoError *error) @@ -49,8 +48,3 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpoint mono_rand_close (handle); } -#else - -MONO_EMPTY_SOURCE_FILE (rand); - -#endif /* ENABLE_NETCORE */ diff --git a/mono/metadata/reflection-internals.h b/mono/metadata/reflection-internals.h index 797d1ca383e..3563866139e 100644 --- a/mono/metadata/reflection-internals.h +++ b/mono/metadata/reflection-internals.h @@ -22,10 +22,8 @@ TYPED_HANDLE_DECL (MonoReflectionTypeBuilder) MonoReflectionAssemblyHandle mono_domain_try_type_resolve_name (MonoDomain *domain, MonoAssembly *assembly, MonoStringHandle name, MonoError *error); -#ifndef ENABLE_NETCORE MonoReflectionAssemblyHandle mono_domain_try_type_resolve_typebuilder (MonoDomain *domain, MonoReflectionTypeBuilderHandle typebuilder, MonoError *error); -#endif MonoReflectionTypeBuilderHandle mono_class_get_ref_info (MonoClass *klass); diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 55a21a1094b..cd7a529eabc 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -66,15 +66,9 @@ static GENERATE_GET_CLASS_WITH_CACHE (mono_event, "System.Reflection", "RuntimeE static GENERATE_GET_CLASS_WITH_CACHE (mono_property, "System.Reflection", "RuntimePropertyInfo"); static GENERATE_GET_CLASS_WITH_CACHE (mono_parameter_info, "System.Reflection", "RuntimeParameterInfo"); static GENERATE_GET_CLASS_WITH_CACHE (missing, "System.Reflection", "Missing"); -#ifdef ENABLE_NETCORE -static GENERATE_GET_CLASS_WITH_CACHE (method_body, "System.Reflection", "RuntimeMethodBody"); -static GENERATE_GET_CLASS_WITH_CACHE (local_variable_info, "System.Reflection", "RuntimeLocalVariableInfo"); -static GENERATE_GET_CLASS_WITH_CACHE (exception_handling_clause, "System.Reflection", "RuntimeExceptionHandlingClause"); -#else static GENERATE_GET_CLASS_WITH_CACHE (method_body, "System.Reflection", "MethodBody"); static GENERATE_GET_CLASS_WITH_CACHE (local_variable_info, "System.Reflection", "LocalVariableInfo"); static GENERATE_GET_CLASS_WITH_CACHE (exception_handling_clause, "System.Reflection", "ExceptionHandlingClause"); -#endif static GENERATE_GET_CLASS_WITH_CACHE (type_builder, "System.Reflection.Emit", "TypeBuilder"); static GENERATE_GET_CLASS_WITH_CACHE (dbnull, "System", "DBNull"); @@ -465,13 +459,8 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err g_assert (!type->has_cmods); /* void is very common */ -#ifdef ENABLE_NETCORE - if (!type->byref && type->type == MONO_TYPE_VOID && domain->typeof_void) - return (MonoReflectionType*)domain->typeof_void; -#else if (type->type == MONO_TYPE_VOID && domain->typeof_void) return (MonoReflectionType*)domain->typeof_void; -#endif /* * If the vtable of the given class was already created, we can use @@ -1930,11 +1919,7 @@ mono_reflection_parse_type_checked (char *name, MonoTypeNameParse *info, MonoErr if (ok) { mono_identifier_unescape_info (info); } else { -#if ENABLE_NETCORE - mono_error_set_argument_format (error, "typeName@0", "failed parse: %s", name); -#else mono_error_set_argument_format (error, "typeName", "failed parse: %s", name); -#endif } return (ok != 0); } @@ -2655,11 +2640,7 @@ reflection_bind_generic_method_parameters (MonoMethod *method, MonoArrayHandle t mono_error_assert_ok (error); if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) { -#if ENABLE_NETCORE - mono_error_set_argument (error, NULL, "Invalid generic arguments"); -#else mono_error_set_argument (error, "typeArguments", "Invalid generic arguments"); -#endif return NULL; } @@ -3134,11 +3115,7 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono error_init (error); if (method == NULL) { -#ifdef ENABLE_NETCORE - method = mono_class_get_method_from_name_checked (mono_class_get_type_builder_class (), "IsAssignableToInternal", 1, 0, error); -#else method = mono_class_get_method_from_name_checked (mono_class_get_type_builder_class (), "IsAssignableTo", 1, 0, error); -#endif mono_error_assert_ok (error); g_assert (method); } diff --git a/mono/metadata/runtime.c b/mono/metadata/runtime.c index ecd0eb30d2f..8fc0a388212 100644 --- a/mono/metadata/runtime.c +++ b/mono/metadata/runtime.c @@ -57,18 +57,6 @@ fire_process_exit_event (MonoDomain *domain, gpointer user_data) ERROR_DECL (error); MonoObject *exc; -#if ENABLE_NETCORE - MONO_STATIC_POINTER_INIT (MonoMethod, procexit_method) - - procexit_method = mono_class_get_method_from_name_checked (mono_defaults.appcontext_class, "OnProcessExit", 0, 0, error); - mono_error_assert_ok (error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, procexit_method) - - g_assert (procexit_method); - - mono_runtime_try_invoke (procexit_method, NULL, NULL, &exc, error); -#else MonoClassField *field; gpointer pa [2]; MonoObject *delegate; @@ -84,7 +72,6 @@ fire_process_exit_event (MonoDomain *domain, gpointer user_data) pa [1] = NULL; mono_runtime_delegate_try_invoke (delegate, pa, &exc, error); mono_error_cleanup (error); -#endif } static void diff --git a/mono/metadata/sre.c b/mono/metadata/sre.c index ad482f98330..c3662370973 100644 --- a/mono/metadata/sre.c +++ b/mono/metadata/sre.c @@ -1405,12 +1405,6 @@ mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb, M mono_domain_assemblies_lock (domain); domain->domain_assemblies = g_slist_append (domain->domain_assemblies, assembly); -#ifdef ENABLE_NETCORE - // TODO: potentially relax the locking here? - mono_alc_assemblies_lock (alc); - alc->loaded_assemblies = g_slist_append (alc->loaded_assemblies, assembly); - mono_alc_assemblies_unlock (alc); -#endif mono_domain_assemblies_unlock (domain); register_assembly (mono_object_domain (assemblyb), &assemblyb->assembly, &assembly->assembly); @@ -4332,7 +4326,6 @@ ensure_complete_type (MonoClass *klass, MonoError *error) error_init (error); if (image_is_dynamic (klass->image) && !klass->wastypebuilder && mono_class_has_ref_info (klass)) { -#ifndef ENABLE_NETCORE MonoReflectionTypeBuilderHandle tb = mono_class_get_ref_info (klass); mono_domain_try_type_resolve_typebuilder (mono_domain_get (), tb, error); @@ -4340,10 +4333,6 @@ ensure_complete_type (MonoClass *klass, MonoError *error) // Asserting here could break a lot of code //g_assert (klass->wastypebuilder); -#else - // TODO: make this work on netcore when working on SRE.TypeBuilder - g_assert_not_reached (); -#endif } if (mono_class_is_ginst (klass)) { @@ -4441,15 +4430,10 @@ mono_reflection_resolve_object (MonoImage *image, MonoObject *obj, MonoClass **h /* Already created */ result = klass; } else { -#ifndef ENABLE_NETCORE mono_domain_try_type_resolve_typebuilder (mono_domain_get (), tb, error); goto_if_nok (error, return_null); result = type->data.klass; g_assert (result); -#else - // TODO: make this work on netcore when working on SRE.TypeBuilder - g_assert_not_reached(); -#endif } *handle_class = mono_defaults.typehandle_class; @@ -4685,7 +4669,6 @@ ves_icall_ModuleBuilder_getMethodToken (MonoReflectionModuleBuilderHandle mb, return mono_image_create_method_token (MONO_HANDLE_GETVAL (mb, dynamic_image), MONO_HANDLE_CAST (MonoObject, method), opt_param_types, error); } -#ifndef ENABLE_NETCORE void ves_icall_ModuleBuilder_WriteToFile (MonoReflectionModuleBuilderHandle mb, HANDLE file, MonoError* error) { @@ -4697,7 +4680,6 @@ ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilderHandle mb, Mo { mono_image_build_metadata (MONO_HANDLE_RAW (mb), error); } -#endif void ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, guint32 token, MonoError *error) diff --git a/mono/metadata/support.c b/mono/metadata/support.c index 104ef642a97..e0e86aad6c1 100644 --- a/mono/metadata/support.c +++ b/mono/metadata/support.c @@ -1,9 +1,9 @@ #include "utils/mono-compiler.h" -#if defined(ENABLE_MONOTOUCH) && !defined(ENABLE_NETCORE) +#if defined(ENABLE_MONOTOUCH) #include "../../support/zlib-helper.c" -#elif defined(ENABLE_MONODROID) && !defined(ENABLE_NETCORE) +#elif defined(ENABLE_MONODROID) #include "../../support/nl.c" #include "../../support/zlib-helper.c" #else diff --git a/mono/metadata/sysmath.c b/mono/metadata/sysmath.c index b8457115d36..859da539564 100644 --- a/mono/metadata/sysmath.c +++ b/mono/metadata/sysmath.c @@ -188,30 +188,6 @@ ves_icall_System_Math_Ceiling (gdouble v) return ceil (v); } -#if ENABLE_NETCORE -gint32 -ves_icall_System_Math_ILogB (gdouble x) -{ - if (FP_ILOGB0 != INT_MIN && x == 0.0) - return INT_MIN; - if (FP_ILOGBNAN != INT_MAX && isnan(x)) - return INT_MAX; - - return ilogb(x); -} - -gdouble -ves_icall_System_Math_Log2 (gdouble x) -{ - return log2 (x); -} - -gdouble -ves_icall_System_Math_FusedMultiplyAdd (gdouble x, gdouble y, gdouble z) -{ - return fma (x, y, z); -} -#endif float ves_icall_System_MathF_Acos (float x) @@ -351,27 +327,3 @@ ves_icall_System_MathF_ModF (float x, float *d) return modff (x, d); } -#if ENABLE_NETCORE -gint32 -ves_icall_System_MathF_ILogB (float x) -{ - if (FP_ILOGB0 != INT_MIN && x == 0.0) - return INT_MIN; - if (FP_ILOGBNAN != INT_MAX && isnan(x)) - return INT_MAX; - - return ilogbf(x); -} - -float -ves_icall_System_MathF_Log2 (float x) -{ - return log2f (x); -} - -float -ves_icall_System_MathF_FusedMultiplyAdd (float x, float y, float z) -{ - return fmaf (x, y, z); -} -#endif diff --git a/mono/metadata/threadpool-io.c b/mono/metadata/threadpool-io.c index 45ac0d84b24..dfb0ecc68fa 100644 --- a/mono/metadata/threadpool-io.c +++ b/mono/metadata/threadpool-io.c @@ -12,7 +12,6 @@ #include #include -#ifndef ENABLE_NETCORE #include #include @@ -616,7 +615,6 @@ mono_threadpool_io_cleanup (void) mono_lazy_cleanup (&io_status, cleanup); } -#ifndef ENABLE_NETCORE void ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJobHandle job_handle, MonoError* error) { @@ -661,7 +659,6 @@ ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJobHandle job_ha mono_coop_mutex_unlock (&threadpool_io->updates_lock); } -#endif void ves_icall_System_IOSelector_Remove (gpointer handle) @@ -757,6 +754,5 @@ mono_threadpool_io_remove_domain_jobs (MonoDomain *domain) #endif -#endif /* !ENABLE_NETCORE */ MONO_EMPTY_SOURCE_FILE (threadpool_io); diff --git a/mono/metadata/threadpool-io.h b/mono/metadata/threadpool-io.h index 7a51863c69f..5e97ef266e6 100644 --- a/mono/metadata/threadpool-io.h +++ b/mono/metadata/threadpool-io.h @@ -8,7 +8,6 @@ #include #include -#ifndef ENABLE_NETCORE #include #include @@ -28,6 +27,5 @@ mono_threadpool_io_remove_domain_jobs (MonoDomain *domain); void mono_threadpool_io_cleanup (void); -#endif /* ENABLE_NETCORE */ #endif /* _MONO_METADATA_THREADPOOL_IO_H_ */ diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 27844ab2751..044b0cb7d8f 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -14,7 +14,6 @@ #include #include -#ifndef ENABLE_NETCORE #include #include @@ -1233,4 +1232,3 @@ mono_threadpool_worker_set_suspended (gboolean suspended) mono_refcount_dec (&worker); } -#endif /* ENABLE_NETCORE */ diff --git a/mono/metadata/threadpool-worker-wasm.c b/mono/metadata/threadpool-worker-wasm.c index 3cd3485c56f..d2b8fc68fb1 100644 --- a/mono/metadata/threadpool-worker-wasm.c +++ b/mono/metadata/threadpool-worker-wasm.c @@ -14,7 +14,6 @@ #include #include -#ifndef ENABLE_NETCORE #include #include @@ -78,4 +77,3 @@ mono_threadpool_worker_notify_completed (void) return FALSE; } -#endif diff --git a/mono/metadata/threadpool-worker.h b/mono/metadata/threadpool-worker.h index 0b37d248290..35894230d53 100644 --- a/mono/metadata/threadpool-worker.h +++ b/mono/metadata/threadpool-worker.h @@ -8,7 +8,6 @@ #include #include -#ifndef ENABLE_NETCORE typedef void (*MonoThreadPoolWorkerCallback)(void); @@ -37,6 +36,5 @@ mono_threadpool_worker_set_max (gint32 value); void mono_threadpool_worker_set_suspended (gboolean suspended); -#endif /* ENABLE_NETCORE */ #endif /* _MONO_METADATA_THREADPOOL_WORKER_H */ diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index ecbe81abbda..cc669e9e132 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -24,7 +24,6 @@ #include #include -#ifndef ENABLE_NETCORE #include #define _USE_MATH_DEFINES // needed by MSVC to define math constants @@ -823,6 +822,5 @@ ves_icall_System_Threading_ThreadPool_RequestWorkerThread (MonoError *error) return TRUE; } -#endif /* !ENABLE_NETCORE */ MONO_EMPTY_SOURCE_FILE (threadpool); diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index 8ad7e27599f..de2ecf92270 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -161,10 +161,8 @@ gint64 ves_icall_System_Threading_Interlocked_Exchange_Long(gint64 *location, gi ICALL_EXPORT void ves_icall_System_Threading_Interlocked_Exchange_Object (MonoObject *volatile*location, MonoObject *volatile*value, MonoObject *volatile*res); -#ifndef ENABLE_NETCORE ICALL_EXPORT gpointer ves_icall_System_Threading_Interlocked_Exchange_IntPtr(gpointer *location, gpointer value); -#endif ICALL_EXPORT gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location, gfloat value); @@ -184,10 +182,8 @@ gint64 ves_icall_System_Threading_Interlocked_CompareExchange_Long(gint64 *locat ICALL_EXPORT void ves_icall_System_Threading_Interlocked_CompareExchange_Object (MonoObject *volatile*location, MonoObject *volatile*value, MonoObject *volatile*comparand, MonoObject *volatile*res); -#ifndef ENABLE_NETCORE ICALL_EXPORT gpointer ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr(gpointer *location, gpointer value, gpointer comparand); -#endif ICALL_EXPORT gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location, gfloat value, gfloat comparand); @@ -363,9 +359,7 @@ mono_thread_set_name (MonoInternalThread *thread, MONO_THREAD_NAME_WINDOWS_CONSTANT (name), \ (flags) | MonoSetThreadNameFlag_Constant, NULL) -#ifndef ENABLE_NETCORE void mono_thread_suspend_all_other_threads (void); -#endif gboolean mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout); void mono_thread_push_appdomain_ref (MonoDomain *domain); diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index f861bbf5022..9bfb9ed4d1e 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -545,11 +545,7 @@ unlock_thread_handle (MonoInternalThreadHandle thread) static gboolean is_appdomainunloaded_exception (MonoClass *klass) { -#ifdef ENABLE_NETCORE - return FALSE; -#else return klass == mono_class_get_appdomain_unloaded_exception_class (); -#endif } static gboolean @@ -646,23 +642,17 @@ get_current_thread_ptr_for_domain (MonoDomain *domain, MonoInternalThread *threa static void set_current_thread_for_domain (MonoDomain *domain, MonoInternalThread *thread, MonoThread *current) { -#ifndef ENABLE_NETCORE MonoThread **current_thread_ptr = get_current_thread_ptr_for_domain (domain, thread); g_assert (current->obj.vtable->domain == domain); g_assert (!*current_thread_ptr); *current_thread_ptr = current; -#endif } static MonoThread* create_thread_object (MonoDomain *domain, MonoInternalThread *internal) { -#ifdef ENABLE_NETCORE - MONO_OBJECT_SETREF_INTERNAL (internal, internal_thread, internal); - return internal; -#else MonoThread *thread; MonoVTable *vtable; ERROR_DECL (error); @@ -677,7 +667,6 @@ create_thread_object (MonoDomain *domain, MonoInternalThread *internal) MONO_OBJECT_SETREF_INTERNAL (thread, internal_thread, internal); return thread; -#endif } static void @@ -1005,9 +994,7 @@ mono_thread_detach_internal (MonoInternalThread *thread) thread->abort_state_handle = 0; thread->abort_exc = NULL; -#ifndef ENABLE_NETCORE thread->current_appcontext = NULL; -#endif LOCK_THREAD (thread); @@ -1250,20 +1237,6 @@ start_wrapper_internal (StartInfo *start_info, gsize *stack_ptr) if (start_func) { start_func (start_func_arg); } else { -#ifdef ENABLE_NETCORE - /* Call a callback in the RuntimeThread class */ - g_assert (start_delegate == NULL); - - MONO_STATIC_POINTER_INIT (MonoMethod, cb) - - cb = mono_class_get_method_from_name_checked (internal->obj.vtable->klass, "StartCallback", 0, 0, error); - g_assert (cb); - mono_error_assert_ok (error); - - MONO_STATIC_POINTER_INIT_END (MonoMethod, cb) - - mono_runtime_invoke_checked (cb, internal, NULL, error); -#else void *args [1]; g_assert (start_delegate != NULL); @@ -1271,7 +1244,6 @@ start_wrapper_internal (StartInfo *start_info, gsize *stack_ptr) /* we may want to handle the exception here. See comment below on unhandled exceptions */ args [0] = (gpointer) start_delegate_arg; mono_runtime_delegate_invoke_checked (start_delegate, args, error); -#endif if (!is_ok (error)) { MonoException *ex = mono_error_convert_to_exception (error); @@ -1406,11 +1378,9 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta mono_g_hash_table_insert_internal (threads_starting_up, thread, thread); mono_threads_unlock (); -#ifndef ENABLE_NETCORE internal->threadpool_thread = flags & MONO_THREAD_CREATE_FLAGS_THREADPOOL; if (internal->threadpool_thread) mono_thread_set_state (internal, ThreadState_Background); -#endif internal->debugger_thread = flags & MONO_THREAD_CREATE_FLAGS_DEBUGGER; @@ -1436,11 +1406,7 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta mono_g_hash_table_remove (threads_starting_up, thread); mono_threads_unlock (); -#ifdef ENABLE_NETCORE - throw_thread_start_exception (mono_w32error_get_last(), error); -#else mono_error_set_execution_engine (error, "Couldn't create thread. Error 0x%x", mono_w32error_get_last()); -#endif /* ref is not going to be decremented in start_wrapper_internal */ mono_atomic_dec_i32 (&start_info->ref); ret = FALSE; @@ -1824,13 +1790,11 @@ mono_thread_construct_internal (MonoThreadObjectHandle this_obj_handle) mono_gchandle_free_internal (thread_gchandle); } -#ifndef ENABLE_NETCORE void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThreadObjectHandle this_obj_handle, MonoError *error) { mono_thread_construct_internal (this_obj_handle); } -#endif void ves_icall_System_Threading_Thread_GetCurrentThread (MonoThread *volatile* thread) @@ -1856,7 +1820,6 @@ mono_error_set_exception_thread_not_started_or_dead (MonoError *error) mono_error_set_exception_thread_state (error, "Thread has not been started, or is dead."); } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Threading_Thread_Thread_internal (MonoThreadObjectHandle thread_handle, MonoObjectHandle start_handle, MonoError *error) { @@ -1906,7 +1869,6 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThreadObjectHandle thread UNLOCK_THREAD (internal); return TRUE; } -#endif static void @@ -1996,13 +1958,6 @@ mono_sleep_internal (gint32 ms, MonoBoolean allow_interruption, MonoError *error } } -#ifdef ENABLE_NETCORE -void -ves_icall_System_Threading_Thread_Sleep_internal (gint32 ms, MonoBoolean allow_interruption, MonoError *error) -{ - mono_sleep_internal (ms, allow_interruption, error); -} -#else void ves_icall_System_Threading_Thread_Sleep_internal (gint32 ms, MonoError *error) { @@ -2013,15 +1968,12 @@ void ves_icall_System_Threading_Thread_SpinWait_nop (MonoError *error) { } -#endif -#ifndef ENABLE_NETCORE gint32 ves_icall_System_Threading_Thread_GetDomainID (MonoError *error) { return mono_domain_get()->domain_id; } -#endif /** * mono_thread_get_name_utf8: @@ -2071,7 +2023,6 @@ mono_thread_get_managed_id (MonoThread *thread) return id; } -#ifndef ENABLE_NETCORE MonoStringHandle ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThreadHandle thread_handle, MonoError *error) { @@ -2093,7 +2044,6 @@ ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThreadHandle thr return str; } -#endif // Unusal function: // - MonoError is optional -- failure is usually not interesting, except the documented failure mode for managed callers. @@ -2172,22 +2122,12 @@ ves_icall_System_Threading_Thread_SetName_icall (MonoInternalThreadHandle thread char* name8 = name16 ? g_utf16_to_utf8 (name16, name16_length, NULL, &name8_length, NULL) : NULL; -#ifdef ENABLE_NETCORE - // The managed thread implementation prevents the Name property from being set multiple times on normal threads. On thread - // pool threads, for compatibility the thread's name should be changeable and this function may be called to force-reset the - // thread's name if user code had changed it. So for the flags, MonoSetThreadNameFlag_Reset is passed instead of - // MonoSetThreadNameFlag_Permanent for all threads, relying on the managed side to prevent multiple changes where - // appropriate. - MonoSetThreadNameFlags flags = MonoSetThreadNameFlag_Reset; -#else MonoSetThreadNameFlags flags = MonoSetThreadNameFlag_Permanent; -#endif mono_thread_set_name (mono_internal_thread_handle_ptr (thread_handle), name8, (gint32)name8_length, name16, flags, error); } -#ifndef ENABLE_NETCORE /* * ves_icall_System_Threading_Thread_GetPriority_internal: * @param this_obj: The MonoInternalThread on which to operate. @@ -2208,7 +2148,6 @@ ves_icall_System_Threading_Thread_GetPriority (MonoThreadObjectHandle this_obj, return priority; } -#endif /* * ves_icall_System_Threading_Thread_SetPriority_internal: @@ -2269,7 +2208,6 @@ exit: HANDLE_FUNCTION_RETURN_REF (MonoArray, dest.handle) } -#ifndef ENABLE_NETCORE MonoArrayHandle ves_icall_System_Threading_Thread_ByteArrayToRootDomain (MonoArrayHandle arr, MonoError *error) { @@ -2281,7 +2219,6 @@ ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain (MonoArrayHandle arr, { return byte_array_to_domain (arr, mono_domain_get (), error); } -#endif /** * mono_thread_current: @@ -2289,9 +2226,6 @@ ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain (MonoArrayHandle arr, MonoThread * mono_thread_current (void) { -#ifdef ENABLE_NETCORE - return mono_thread_internal_current (); -#else MonoDomain *domain = mono_domain_get (); MonoInternalThread *internal = mono_thread_internal_current (); MonoThread **current_thread_ptr; @@ -2304,7 +2238,6 @@ mono_thread_current (void) *current_thread_ptr = create_thread_object (domain, internal); } return *current_thread_ptr; -#endif } static MonoThreadObjectHandle @@ -2317,9 +2250,6 @@ mono_thread_current_handle (void) static MonoThread * mono_thread_current_for_thread (MonoInternalThread *internal) { -#ifdef ENABLE_NETCORE - return mono_thread_internal_current (); -#else MonoDomain *domain = mono_domain_get (); MonoThread **current_thread_ptr; @@ -2331,7 +2261,6 @@ mono_thread_current_for_thread (MonoInternalThread *internal) *current_thread_ptr = create_thread_object (domain, internal); } return *current_thread_ptr; -#endif } MonoInternalThread* @@ -2618,12 +2547,10 @@ ves_icall_System_Threading_Interlocked_Exchange_Object (MonoObject *volatile*loc mono_gc_wbarrier_generic_nostore_internal ((gpointer)location); // FIXME volatile } -#ifndef ENABLE_NETCORE gpointer ves_icall_System_Threading_Interlocked_Exchange_IntPtr (gpointer *location, gpointer value) { return mono_atomic_xchg_ptr(location, value); } -#endif gfloat ves_icall_System_Threading_Interlocked_Exchange_Single (gfloat *location, gfloat value) { @@ -2689,12 +2616,10 @@ ves_icall_System_Threading_Interlocked_CompareExchange_Object (MonoObject *volat mono_gc_wbarrier_generic_nostore_internal ((gpointer)location); // FIXME volatile } -#ifndef ENABLE_NETCORE gpointer ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr(gpointer *location, gpointer value, gpointer comparand) { return mono_atomic_cas_ptr(location, value, comparand); } -#endif gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *location, gfloat value, gfloat comparand) { @@ -2927,7 +2852,6 @@ request_thread_abort (MonoInternalThread *thread, MonoObjectHandle *state, gbool return TRUE; } -#ifndef ENABLE_NETCORE void ves_icall_System_Threading_Thread_Abort (MonoInternalThreadHandle thread_handle, MonoObjectHandle state, MonoError *error) { @@ -2945,7 +2869,6 @@ ves_icall_System_Threading_Thread_Abort (MonoInternalThreadHandle thread_handle, async_abort_internal (thread, TRUE); } } -#endif /** * mono_thread_internal_abort: @@ -2963,7 +2886,6 @@ mono_thread_internal_abort (MonoInternalThread *thread, gboolean appdomain_unloa return async_abort_internal (thread, TRUE); } -#ifndef ENABLE_NETCORE void ves_icall_System_Threading_Thread_ResetAbort (MonoThreadObjectHandle this_obj, MonoError *error) { @@ -2993,7 +2915,6 @@ ves_icall_System_Threading_Thread_ResetAbort (MonoThreadObjectHandle this_obj, M only counts if the exception is set */ thread->abort_state_handle = 0; } -#endif void mono_thread_internal_reset_abort (MonoInternalThread *thread) @@ -3014,7 +2935,6 @@ mono_thread_internal_reset_abort (MonoInternalThread *thread) UNLOCK_THREAD (thread); } -#ifndef ENABLE_NETCORE MonoObjectHandle ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThreadObjectHandle this_obj, MonoError *error) { @@ -3054,7 +2974,6 @@ ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThreadObjectHandle // There is state, but we failed to return it. return NULL_HANDLE; } -#endif static gboolean mono_thread_suspend (MonoInternalThread *thread) @@ -3089,7 +3008,6 @@ mono_thread_suspend (MonoInternalThread *thread) return TRUE; } -#ifndef ENABLE_NETCORE void ves_icall_System_Threading_Thread_Suspend (MonoThreadObjectHandle this_obj, MonoError *error) { @@ -3097,7 +3015,6 @@ ves_icall_System_Threading_Thread_Suspend (MonoThreadObjectHandle this_obj, Mono mono_error_set_exception_thread_not_started_or_dead (error); } -#endif /* LOCKING: LOCK_THREAD(thread) must be held */ static gboolean @@ -3142,7 +3059,6 @@ mono_thread_resume (MonoInternalThread *thread) return TRUE; } -#ifndef ENABLE_NETCORE void ves_icall_System_Threading_Thread_Resume (MonoThreadObjectHandle thread_handle, MonoError *error) { @@ -3162,7 +3078,6 @@ ves_icall_System_Threading_Thread_Resume (MonoThreadObjectHandle thread_handle, if (exception) mono_error_set_exception_thread_not_started_or_dead (error); } -#endif gboolean mono_threads_is_critical_method (MonoMethod *method) @@ -3499,13 +3414,11 @@ mono_threads_register_app_context (MonoAppContextHandle ctx, MonoError *error) MONO_PROFILER_RAISE (context_loaded, (MONO_HANDLE_RAW (ctx))); } -#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Remoting_Contexts_Context_RegisterContext (MonoAppContextHandle ctx, MonoError *error) { mono_threads_register_app_context (ctx, error); } -#endif void mono_threads_release_app_context (MonoAppContext* ctx, MonoError *error) @@ -3521,13 +3434,11 @@ mono_threads_release_app_context (MonoAppContext* ctx, MonoError *error) MONO_PROFILER_RAISE (context_unloaded, (ctx)); } -#ifndef ENABLE_NETCORE void ves_icall_System_Runtime_Remoting_Contexts_Context_ReleaseContext (MonoAppContextHandle ctx, MonoError *error) { mono_threads_release_app_context (MONO_HANDLE_RAW (ctx), error); /* FIXME use handles in mono_threads_release_app_context */ } -#endif void mono_thread_init (MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb) @@ -3948,7 +3859,6 @@ mono_thread_manage_internal (void) mono_thread_execute_interruption_void (); } -#ifndef ENABLE_NETCORE /* * Under netcore, we don't abort any threads, just exit. * This is not a problem since we don't do runtime cleanup either. @@ -3975,7 +3885,6 @@ mono_thread_manage_internal (void) wait_for_tids (wait, MONO_INFINITE_WAIT, FALSE); } } while (wait->num > 0); -#endif /* * give the subthreads a chance to really quit (this is mainly needed @@ -3985,7 +3894,6 @@ mono_thread_manage_internal (void) mono_thread_info_yield (); } -#ifndef ENABLE_NETCORE static void collect_threads_for_suspend (gpointer key, gpointer value, gpointer user_data) { @@ -4117,7 +4025,6 @@ void mono_thread_suspend_all_other_threads (void) } } } -#endif typedef struct { MonoInternalThread *thread; @@ -4343,7 +4250,6 @@ mono_threads_perform_thread_dump (void) thread_dump_requested = FALSE; } -#ifndef ENABLE_NETCORE /* Obtain the thread dump of all threads */ void ves_icall_System_Threading_Thread_GetStackTraces (MonoArrayHandleOut out_threads_handle, MonoArrayHandleOut out_stack_frames_handle, MonoError *error) @@ -4458,7 +4364,6 @@ leave: mono_gchandle_free_internal (handle); g_free (ud.frames); } -#endif /** * mono_threads_request_thread_dump: @@ -5052,11 +4957,7 @@ mono_get_special_static_data_for_thread (MonoInternalThread *thread, guint32 off if (static_type == SPECIAL_STATIC_OFFSET_TYPE_THREAD) { return get_thread_static_data (thread, offset); } else { -#ifndef ENABLE_NETCORE return get_context_static_data (thread->current_appcontext, offset); -#else - g_assert_not_reached (); -#endif } } @@ -7383,93 +7284,3 @@ mono_threads_summarize (MonoContext *ctx, gchar **out, MonoStackHash *hashes, gb #endif -#ifdef ENABLE_NETCORE -void -ves_icall_System_Threading_Thread_StartInternal (MonoThreadObjectHandle thread_handle, MonoError *error) -{ - MonoThread *internal = MONO_HANDLE_RAW (thread_handle); - gboolean res; - -#ifdef DISABLE_THREADS - mono_error_set_platform_not_supported (error, "Cannot start threads on this runtime."); - return; -#endif - - THREAD_DEBUG (g_message("%s: Trying to start a new thread: this (%p)", __func__, internal)); - - LOCK_THREAD (internal); - - if ((internal->state & ThreadState_Unstarted) == 0) { - UNLOCK_THREAD (internal); - mono_error_set_exception_thread_state (error, "Thread has already been started."); - return; - } - - if ((internal->state & ThreadState_Aborted) != 0) { - UNLOCK_THREAD (internal); - return; - } - - res = create_thread (internal, internal, NULL, NULL, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error); - if (!res) { - UNLOCK_THREAD (internal); - return; - } - - internal->state &= ~ThreadState_Unstarted; - - THREAD_DEBUG (g_message ("%s: Started thread ID %" G_GSIZE_FORMAT " (handle %p)", __func__, (gsize)internal->tid, internal->handle)); - - UNLOCK_THREAD (internal); -} - -void -ves_icall_System_Threading_Thread_InitInternal (MonoThreadObjectHandle thread_handle, MonoError *error) -{ - MonoThread *internal = MONO_HANDLE_RAW (thread_handle); - - // Need to initialize thread objects created from managed code - init_internal_thread_object (internal); - internal->state = ThreadState_Unstarted; - MONO_OBJECT_SETREF_INTERNAL (internal, internal_thread, internal); -} - -guint64 -ves_icall_System_Threading_Thread_GetCurrentOSThreadId (MonoError *error) -{ - return mono_native_thread_os_id_get (); -} - -gint32 -ves_icall_System_Threading_Thread_GetCurrentProcessorNumber (MonoError *error) -{ - return mono_native_thread_processor_id_get (); -} - -gpointer -ves_icall_System_Threading_LowLevelLifoSemaphore_InitInternal (void) -{ - return (gpointer)mono_lifo_semaphore_init (); -} - -void -ves_icall_System_Threading_LowLevelLifoSemaphore_DeleteInternal (gpointer sem_ptr) -{ - LifoSemaphore *sem = (LifoSemaphore *)sem_ptr; - mono_lifo_semaphore_delete (sem); -} - -gint32 -ves_icall_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal (gpointer sem_ptr, gint32 timeout_ms) -{ - LifoSemaphore *sem = (LifoSemaphore *)sem_ptr; - return mono_lifo_semaphore_timed_wait (sem, timeout_ms); -} - -void -ves_icall_System_Threading_LowLevelLifoSemaphore_ReleaseInternal (gpointer sem_ptr, gint32 count) -{ - LifoSemaphore *sem = (LifoSemaphore *)sem_ptr; - mono_lifo_semaphore_release (sem, count); -} -#endif diff --git a/mono/metadata/w32event-unix.c b/mono/metadata/w32event-unix.c index abc9bf98b26..4d38307ac22 100644 --- a/mono/metadata/w32event-unix.c +++ b/mono/metadata/w32event-unix.c @@ -378,7 +378,6 @@ ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle) mono_w32handle_close (handle); } -#ifndef ENABLE_NETCORE gpointer ves_icall_System_Threading_Events_OpenEvent_icall (const gunichar2 *name, gint32 name_length, gint32 rights, gint32 *win32error, MonoError *error) @@ -390,7 +389,6 @@ ves_icall_System_Threading_Events_OpenEvent_icall (const gunichar2 *name, gint32 g_free (utf8_name); return handle; } -#endif gpointer mono_w32event_open (const gchar *utf8_name, gint32 rights G_GNUC_UNUSED, gint32 *win32error) diff --git a/mono/metadata/w32file-unix.c b/mono/metadata/w32file-unix.c index 98a0d8ad767..3224ec416f5 100644 --- a/mono/metadata/w32file-unix.c +++ b/mono/metadata/w32file-unix.c @@ -4734,7 +4734,6 @@ GetDriveTypeFromPath (const gchar *utf8_root_path_name) } #endif -#ifndef ENABLE_NETCORE guint32 mono_w32file_get_drive_type (const gunichar2 *root_path_name, gint32 root_path_name_length, MonoError *error) { @@ -4766,7 +4765,6 @@ mono_w32file_get_drive_type (const gunichar2 *root_path_name, gint32 root_path_n return (drive_type); } -#endif #if defined (HOST_DARWIN) || defined (__linux__) || defined(HOST_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__) || defined(_AIX) static gchar* diff --git a/mono/metadata/w32file.c b/mono/metadata/w32file.c index bee7f717400..76bef3be8f8 100644 --- a/mono/metadata/w32file.c +++ b/mono/metadata/w32file.c @@ -187,7 +187,6 @@ static guint32 convert_attrs(MonoFileAttributes attrs) /* System.IO.MonoIO internal calls */ -#if !ENABLE_NETCORE MonoBoolean ves_icall_System_IO_MonoIO_CreateDirectory (const gunichar2 *path, gint32 *error) @@ -868,7 +867,6 @@ void ves_icall_System_IO_MonoIO_DumpHandles (void) } #endif /* !HOST_WIN32 */ -#endif /* !ENABLE_NETCORE */ //Support for io-layer free mmap'd files. diff --git a/mono/metadata/w32file.h b/mono/metadata/w32file.h index e40eac1a0ff..3a6b93cac3e 100644 --- a/mono/metadata/w32file.h +++ b/mono/metadata/w32file.h @@ -113,7 +113,6 @@ typedef struct _MonoFSAsyncResult { */ /* System.IO.MonoIO */ -#if !ENABLE_NETCORE ICALL_EXPORT MonoBoolean @@ -248,7 +247,6 @@ ICALL_EXPORT void ves_icall_System_IO_MonoIO_DumpHandles (void); -#endif /* !ENABLE_NETCORE */ #if defined (TARGET_IOS) || defined (TARGET_ANDROID) diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c index 31d2d2319a8..892e9c07447 100644 --- a/mono/metadata/w32process-unix.c +++ b/mono/metadata/w32process-unix.c @@ -91,7 +91,7 @@ #include "object-internals.h" #include "icall-decl.h" -#if !defined(ENABLE_NETCORE) && !defined(DISABLE_PROCESSES) +#if !defined(DISABLE_PROCESSES) #ifndef MAXPATHLEN #define MAXPATHLEN 242 @@ -3500,50 +3500,4 @@ mono_w32process_ver_query_value (gconstpointer datablock, const gunichar2 *subbl return(ret); } -#else /* ENABLE_NETCORE && DISABLE_PROCESSES */ - -void -mono_w32process_init (void) -{ -} - -void -mono_w32process_cleanup (void) -{ -} - -void -mono_w32process_set_cli_launcher (gchar *path) -{ -} - -void -mono_w32process_signal_finished (void) -{ -} - -guint32 -mono_w32process_ver_language_name (guint32 lang, gunichar2 *lang_out, guint32 lang_len) -{ - return 0; -} - -gboolean -mono_w32process_get_fileversion_info (const gunichar2 *filename, gpointer *data) -{ - return FALSE; -} - -gboolean -mono_w32process_module_get_information (gpointer handle, gpointer module, gpointer modinfo, guint32 size) -{ - return FALSE; -} - -gboolean -mono_w32process_ver_query_value (gconstpointer datablock, const gunichar2 *subblock, gpointer *buffer, guint32 *len) -{ - return FALSE; -} - -#endif /* ENABLE_NETCORE && DISABLE_PROCESSES */ +#endif /* !defined(DISABLE_PROCESSES) */ diff --git a/mono/metadata/w32process.c b/mono/metadata/w32process.c index 08f9386f1ff..7c459a7b332 100644 --- a/mono/metadata/w32process.c +++ b/mono/metadata/w32process.c @@ -312,7 +312,6 @@ mono_w32process_get_fileversion (MonoObjectHandle filever, MonoStringHandle str, } #endif -#ifndef ENABLE_NETCORE void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObjectHandle this_obj, const gunichar2 *filename, int filename_length, MonoError *error) @@ -324,7 +323,6 @@ ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject process_set_field_utf16 (this_obj, str, "filename", filename, filename_length, error); } -#endif static GPtrArray* get_domain_assemblies (MonoDomain *domain) @@ -451,7 +449,6 @@ exit: HANDLE_FUNCTION_RETURN (); } -#ifndef ENABLE_NETCORE /* Returns an array of System.Diagnostics.ProcessModule */ MonoArrayHandle ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObjectHandle this_obj, HANDLE process, MonoError *error) @@ -548,7 +545,6 @@ ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process, MonoE g_free (name); return res; } -#endif /* ENABLE_NETCORE */ gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, MonoProcessError *error) diff --git a/mono/metadata/w32socket-unix.c b/mono/metadata/w32socket-unix.c index 3c0e13a214c..58645ed4ef8 100644 --- a/mono/metadata/w32socket-unix.c +++ b/mono/metadata/w32socket-unix.c @@ -1557,7 +1557,6 @@ mono_w32socket_convert_error (gint error) } } -#ifndef ENABLE_NETCORE MonoBoolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse_icall (MonoProtocolType proto) { @@ -1572,7 +1571,6 @@ ves_icall_System_Net_Sockets_Socket_SupportPortReuse_icall (MonoProtocolType pro return FALSE; #endif } -#endif gboolean mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle) diff --git a/mono/metadata/w32socket.c b/mono/metadata/w32socket.c index e7102f43f3d..1ad49360e59 100644 --- a/mono/metadata/w32socket.c +++ b/mono/metadata/w32socket.c @@ -18,7 +18,7 @@ #include -#if !defined(DISABLE_SOCKETS) && !defined(ENABLE_NETCORE) +#if !defined(DISABLE_SOCKETS) #if defined(__APPLE__) || defined(__FreeBSD__) #define __APPLE_USE_RFC_3542 @@ -2644,4 +2644,4 @@ mono_network_cleanup (void) { } -#endif // !defined(DISABLE_SOCKETS) && !defined(ENABLE_NETCORE) +#endif // !defined(DISABLE_SOCKETS) diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 132c3561b02..20765e4228d 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -447,11 +447,6 @@ llvm_runtime_sources = \ endif endif -if ENABLE_NETCORE -netcore_sources = \ - main-core.c -endif - common_sources = \ mini.c \ mini-runtime.c \ @@ -496,11 +491,9 @@ common_sources = \ branch-opts.c \ mini-generic-sharing.c \ simd-methods.h \ - simd-methods-netcore.h \ tasklets.c \ tasklets.h \ simd-intrinsics.c \ - simd-intrinsics-netcore.c \ mini-native-types.c \ mini-unwind.h \ unwind.c \ @@ -750,7 +743,7 @@ endif # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain # compile time dependencies on boehm/sgen. # -libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources) $(netcore_sources) +libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources) libmini_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@ libmonoboehm_2_0_la_SOURCES = @@ -1091,10 +1084,6 @@ EXTRA_DIST = TestDriver.cs \ interp/whitebox-snippets.il \ Makefile.am.in -if ENABLE_NETCORE -version.h: Makefile - echo "#define FULL_VERSION \"netcore\"" > version.h -else version.h: Makefile if test -e $(top_srcdir)/.git; then \ (cd $(top_srcdir); \ @@ -1114,7 +1103,6 @@ version.h: Makefile echo "#define FULL_VERSION \"$$MONO_BRANCH/$$MONO_BUILD_REVISION\""; \ fi \ fi > version.h -endif # Utility target for patching libtool to speed up linking patch-libtool: diff --git a/mono/mini/alias-analysis.c b/mono/mini/alias-analysis.c index ea596ffb006..cf51350186f 100644 --- a/mono/mini/alias-analysis.c +++ b/mono/mini/alias-analysis.c @@ -311,11 +311,6 @@ handle_instruction: } g_hash_table_destroy (addr_loads); -#ifdef ENABLE_NETCORE - /* There could be ldaddr instructions which already got eliminated */ - if (COMPILE_LLVM (cfg)) - return TRUE; -#endif return needs_dce; } diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index 6247628384d..1a9b616fc50 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -5090,49 +5090,6 @@ MONO_RESTORE_WARNING g_hash_table_insert (acfg->export_names, wrapper, export_name); } -#ifdef ENABLE_NETCORE - for (j = 0; j < cattr->num_attrs; ++j) - if (cattr->attrs [j].ctor && mono_is_corlib_image (m_class_get_image (cattr->attrs [j].ctor->klass)) && !strcmp (m_class_get_name (cattr->attrs [j].ctor->klass), "UnmanagedCallersOnlyAttribute")) - break; - if (j < cattr->num_attrs) { - MonoCustomAttrEntry *e = &cattr->attrs [j]; - const char *named; - int slen; - char *export_name = NULL; - MonoMethod *wrapper; - - if (!(method->flags & METHOD_ATTRIBUTE_STATIC)) { - g_warning ("AOT restriction: Method '%s' must be static since it is decorated with [UnmanagedCallers].", - mono_method_full_name (method, TRUE)); - exit (1); - } - - gpointer *typed_args = NULL; - gpointer *named_args = NULL; - CattrNamedArg *named_arg_info = NULL; - int num_named_args = 0; - mono_reflection_create_custom_attr_data_args_noalloc (acfg->image, e->ctor, e->data, e->data_size, &typed_args, &named_args, &num_named_args, &named_arg_info, error); - mono_error_assert_ok (error); - for (j = 0; j < num_named_args; ++j) { - if (named_arg_info [j].field && !strcmp (named_arg_info [j].field->name, "EntryPoint")) { - named = named_args [j]; - slen = mono_metadata_decode_value (named, &named); - export_name = (char *)g_malloc (slen + 1); - memcpy (export_name, named, slen); - export_name [slen] = 0; - } - } - g_free (named_args); - g_free (named_arg_info); - - wrapper = mono_marshal_get_managed_wrapper (method, NULL, 0, error); - mono_error_assert_ok (error); - - add_method (acfg, wrapper); - if (export_name) - g_hash_table_insert (acfg->export_names, wrapper, export_name); - } -#endif g_free (cattr); } @@ -5424,7 +5381,6 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, else name_prefix = g_strdup_printf ("%s.%s", klass_name_space, klass_name); -#ifndef ENABLE_NETCORE /* Add the T[]/InternalEnumerator class */ if (!strcmp (klass_name, "IEnumerable`1") || !strcmp (klass_name, "IEnumerator`1")) { ERROR_DECL (error); @@ -5440,7 +5396,6 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, mono_error_assert_ok (error); /* FIXME don't swallow the error */ add_generic_class (acfg, nclass, FALSE, "ICollection"); } -#endif iter = NULL; while ((method = mono_class_get_methods (array_class, &iter))) { @@ -5802,7 +5757,6 @@ add_generic_instances (MonoAotCompile *acfg) enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1"); add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE); -#ifndef ENABLE_NETCORE ninsts = 0; insts [ninsts ++] = int16_type; enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "ShortEnumEqualityComparer`1"); @@ -5818,7 +5772,6 @@ add_generic_instances (MonoAotCompile *acfg) insts [ninsts ++] = int64_type; insts [ninsts ++] = uint64_type; add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE); -#endif } /* Add instances of the array generic interfaces for primitive types */ diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index ac6fc504871..ae697d64fa0 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -2870,10 +2870,8 @@ suspend_vm (void) tp_suspend = TRUE; mono_loader_unlock (); -#ifndef ENABLE_NETCORE if (tp_suspend) mono_threadpool_suspend (); -#endif } /* @@ -2913,10 +2911,8 @@ resume_vm (void) tp_resume = TRUE; mono_loader_unlock (); -#ifndef ENABLE_NETCORE if (tp_resume) mono_threadpool_resume (); -#endif } /* @@ -7107,10 +7103,8 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf) mono_environment_exitcode_set (exit_code); /* Suspend all managed threads since the runtime is going away */ -#ifndef ENABLE_NETCORE PRINT_DEBUG_MSG (1, "Suspending all threads...\n"); mono_thread_suspend_all_other_threads (); -#endif PRINT_DEBUG_MSG (1, "Shutting down the runtime...\n"); mono_runtime_quit_internal (); transport_close2 (); diff --git a/mono/mini/driver.c b/mono/mini/driver.c index 472df6f48d3..6a48f075dcf 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -202,9 +202,6 @@ static gboolean parse_debug_options (const char* p) { MonoDebugOptions *opt = mini_get_debug_options (); -#ifdef ENABLE_NETCORE - opt->enabled = TRUE; -#endif do { if (!*p) { @@ -221,11 +218,6 @@ parse_debug_options (const char* p) } else if (!strncmp (p, "gdb", 3)) { opt->gdb = TRUE; p += 3; -#ifdef ENABLE_NETCORE - } else if (!strncmp (p, "ignore", 6)) { - opt->enabled = FALSE; - p += 6; -#endif } else { fprintf (stderr, "Invalid debug option `%s', use --help-debug for details\n", p); return FALSE; @@ -1620,12 +1612,7 @@ mini_usage (void) "\n" "Development:\n" " --aot[=] Compiles the assembly to native code\n" -#ifdef ENABLE_NETCORE - " --debug=ignore Disable debugging support (on by default)\n" - " --debug=[] Disable debugging support or enable debugging extras, use --help-debug for details\n" -#else " --debug[=] Enable debugging support, use --help-debug for details\n" -#endif " --debugger-agent=options Enable the debugger agent\n" " --profile[=profiler] Runs in profiling mode with the specified profiler module\n" " --trace[=EXPR] Enable tracing, use --help-trace for details\n" @@ -1692,17 +1679,10 @@ mini_debug_usage (void) { fprintf (stdout, "Debugging options:\n" -#ifdef ENABLE_NETCORE - " --debug[=OPTIONS] Disable debugging support or enable debugging extras, optional OPTIONS is a comma\n" -#else " --debug[=OPTIONS] Enable debugging support, optional OPTIONS is a comma\n" -#endif " separated list of options\n" "\n" "OPTIONS is composed of:\n" -#ifdef ENABLE_NETCORE - " ignore Disable debugging support (on by default).\n" -#endif " casts Enable more detailed InvalidCastException messages.\n" " mdb-optimizations Disable some JIT optimizations which are normally\n" " disabled when running inside the debugger.\n" @@ -2010,14 +1990,10 @@ switch_arch (char* argv[], const char* target_arch) static void apply_root_domain_configuration_file_bindings (MonoDomain *domain, char *root_domain_configuration_file) { -#ifndef ENABLE_NETCORE g_assert (domain->setup == NULL || domain->setup->configuration_file == NULL); g_assert (!domain->assembly_bindings_parsed); mono_domain_parse_assembly_bindings (domain, 0, 0, root_domain_configuration_file); -#else - g_assert_not_reached (); -#endif } static void @@ -2164,9 +2140,6 @@ mono_main (int argc, char* argv[]) opt = mono_parse_default_optimizations (NULL); -#ifdef ENABLE_NETCORE - enable_debugging = TRUE; -#endif mono_options_parse_options ((const char**)argv + 1, argc - 1, &argc, error); argc ++; @@ -2415,13 +2388,6 @@ mono_main (int argc, char* argv[]) enable_debugging = TRUE; if (!parse_debug_options (argv [i] + 8)) return 1; -#ifdef ENABLE_NETCORE - MonoDebugOptions *opt = mini_get_debug_options (); - - if (!opt->enabled) { - enable_debugging = FALSE; - } -#endif } else if (strncmp (argv [i], "--debugger-agent=", 17) == 0) { MonoDebugOptions *opt = mini_get_debug_options (); diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c index 82f25f81d03..9c23789491f 100644 --- a/mono/mini/exceptions-amd64.c +++ b/mono/mini/exceptions-amd64.c @@ -1906,7 +1906,7 @@ void mono_arch_code_chunk_destroy (void *chunk) } #endif /* MONO_ARCH_HAVE_UNWIND_TABLE */ -#if MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT) && !defined(ENABLE_NETCORE) +#if MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT) MonoContinuationRestore mono_tasklets_arch_restore (void) { @@ -1957,7 +1957,7 @@ mono_tasklets_arch_restore (void) saved = start; return (MonoContinuationRestore)saved; } -#endif /* MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT) && !defined(ENABLE_NETCORE) */ +#endif /* MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT) */ /* * mono_arch_setup_resume_sighandler_ctx: @@ -1976,14 +1976,14 @@ mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func) MONO_CONTEXT_SET_IP (ctx, func); } -#if (!MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT)) && !defined(ENABLE_NETCORE) +#if (!MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT)) MonoContinuationRestore mono_tasklets_arch_restore (void) { g_assert_not_reached (); return NULL; } -#endif /* (!MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT)) && !defined(ENABLE_NETCORE) */ +#endif /* (!MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT)) */ void mono_arch_undo_ip_adjustment (MonoContext *ctx) diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index d2b3201c343..d8f6f769a1c 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -1175,7 +1175,7 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s #endif } -#if MONO_SUPPORT_TASKLETS && !defined(ENABLE_NETCORE) +#if MONO_SUPPORT_TASKLETS MonoContinuationRestore mono_tasklets_arch_restore (void) { diff --git a/mono/mini/interp/interp.c b/mono/mini/interp/interp.c index d80d5201afc..46b0da7a4ef 100644 --- a/mono/mini/interp/interp.c +++ b/mono/mini/interp/interp.c @@ -1570,11 +1570,6 @@ ves_pinvoke_method ( } #endif -#ifdef ENABLE_NETCORE - if (save_last_error) { - mono_marshal_clear_last_error (); - } -#endif #ifdef MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP CallContext ccontext; @@ -1705,7 +1700,6 @@ interp_delegate_ctor (MonoObjectHandle this_obj, MonoObjectHandle target, gpoint * runtime specifies that the implementation of the method is automatically * provided by the runtime and is primarily used for the methods of delegates. */ -#ifndef ENABLE_NETCORE static MONO_NEVER_INLINE MonoException* ves_imethod (InterpFrame *frame, MonoMethod *method, MonoMethodSignature *sig, stackval *sp) { @@ -1726,7 +1720,6 @@ ves_imethod (InterpFrame *frame, MonoMethod *method, MonoMethodSignature *sig, s m_class_get_name_space (method->klass), m_class_get_name (method->klass), method->name); } -#endif #if DEBUG_INTERP static void @@ -2033,10 +2026,6 @@ interp_entry (InterpEntryData *data) static void do_icall (MonoMethodSignature *sig, int op, stackval *sp, gpointer ptr, gboolean save_last_error) { -#ifdef ENABLE_NETCORE - if (save_last_error) - mono_marshal_clear_last_error (); -#endif switch (op) { case MINT_ICALL_V_V: { @@ -2903,15 +2892,6 @@ interp_create_method_pointer (MonoMethod *method, gboolean compile, MonoError *e return addr; } -#ifdef ENABLE_NETCORE - /* - * The runtime expects a function pointer unique to method and - * the native caller expects a function pointer with the - * right signature, so fail right away. - */ - mono_error_set_platform_not_supported (error, "No native to managed transitions on this platform."); - return NULL; -#endif } #endif return (gpointer)interp_no_native_to_managed; @@ -3749,7 +3729,6 @@ call: MINT_IN_BREAK; } MINT_IN_CASE(MINT_CALLRUN) { -#ifndef ENABLE_NETCORE MonoMethod *target_method = (MonoMethod*) frame->imethod->data_items [ip [2]]; MonoMethodSignature *sig = (MonoMethodSignature*) frame->imethod->data_items [ip [3]]; @@ -3758,9 +3737,6 @@ call: THROW_EX (ex, ip); ip += 4; -#else - g_assert_not_reached (); -#endif MINT_IN_BREAK; } MINT_IN_CASE(MINT_RET) diff --git a/mono/mini/interp/transform.c b/mono/mini/interp/transform.c index aa98dcaa85e..64e2d96d0d2 100644 --- a/mono/mini/interp/transform.c +++ b/mono/mini/interp/transform.c @@ -1987,10 +1987,8 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas interp_emit_ldelema (td, target_method->klass, check_class); td->ip += 5; return TRUE; -#ifndef ENABLE_NETCORE } else if (!strcmp (tm, "UnsafeMov") || !strcmp (tm, "UnsafeLoad")) { *op = MINT_CALLRUN; -#endif } else if (!strcmp (tm, "Get")) { interp_emit_ldelema (td, target_method->klass, NULL); interp_emit_ldobj (td, m_class_get_element_class (target_method->klass)); @@ -2191,112 +2189,7 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas } else if (((in_corlib && !strcmp (klass_name_space, "Internal.Runtime.CompilerServices")) || !strcmp (klass_name_space, "System.Runtime.CompilerServices")) && !strcmp (klass_name, "Unsafe")) { -#ifdef ENABLE_NETCORE - if (!strcmp (tm, "AddByteOffset")) - *op = MINT_INTRINS_UNSAFE_ADD_BYTE_OFFSET; - else if (!strcmp (tm, "ByteOffset")) - *op = MINT_INTRINS_UNSAFE_BYTE_OFFSET; - else if (!strcmp (tm, "As") || !strcmp (tm, "AsRef")) - *op = MINT_MOV_P; - else if (!strcmp (tm, "AsPointer")) { - /* NOP */ - SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_MP); - td->ip += 5; - return TRUE; - } else if (!strcmp (tm, "IsAddressLessThan")) { - MonoGenericContext *ctx = mono_method_get_context (target_method); - g_assert (ctx); - g_assert (ctx->method_inst); - g_assert (ctx->method_inst->type_argc == 1); - - MonoClass *k = mono_defaults.boolean_class; - interp_add_ins (td, MINT_CLT_UN_P); - td->sp -= 2; - interp_ins_set_sregs2 (td->last_ins, td->sp [0].local, td->sp [1].local); - push_type (td, stack_type [mint_type (m_class_get_byval_arg (k))], k); - interp_ins_set_dreg (td->last_ins, td->sp [-1].local); - td->ip += 5; - return TRUE; - } else if (!strcmp (tm, "SizeOf")) { - MonoGenericContext *ctx = mono_method_get_context (target_method); - g_assert (ctx); - g_assert (ctx->method_inst); - g_assert (ctx->method_inst->type_argc == 1); - MonoType *t = ctx->method_inst->type_argv [0]; - int align; - int esize = mono_type_size (t, &align); - interp_add_ins (td, MINT_LDC_I4); - WRITE32_INS (td->last_ins, 0, &esize); - push_simple_type (td, STACK_TYPE_I4); - interp_ins_set_dreg (td->last_ins, td->sp [-1].local); - td->ip += 5; - return TRUE; - } else if (!strcmp (tm, "AreSame")) { - *op = MINT_CEQ_P; - } else if (!strcmp (tm, "SkipInit")) { - *op = MINT_NOP; - } else if (!strcmp (tm, "InitBlockUnaligned")) { - *op = MINT_INITBLK; - } -#endif } else if (in_corlib && !strcmp (klass_name_space, "System.Runtime.CompilerServices") && !strcmp (klass_name, "RuntimeHelpers")) { -#ifdef ENABLE_NETCORE - if (!strcmp (tm, "get_OffsetToStringData")) { - g_assert (csignature->param_count == 0); - int offset = MONO_STRUCT_OFFSET (MonoString, chars); - interp_add_ins (td, MINT_LDC_I4); - WRITE32_INS (td->last_ins, 0, &offset); - push_simple_type (td, STACK_TYPE_I4); - interp_ins_set_dreg (td->last_ins, td->sp [-1].local); - td->ip += 5; - return TRUE; - } else if (!strcmp (tm, "GetRawData")) { - interp_add_ins (td, MINT_LDFLDA_UNSAFE); - td->last_ins->data [0] = (gint16) MONO_ABI_SIZEOF (MonoObject); - - td->sp--; - interp_ins_set_sreg (td->last_ins, td->sp [0].local); - push_simple_type (td, STACK_TYPE_MP); - interp_ins_set_dreg (td->last_ins, td->sp [-1].local); - - td->ip += 5; - return TRUE; - } else if (!strcmp (tm, "IsBitwiseEquatable")) { - g_assert (csignature->param_count == 0); - MonoGenericContext *ctx = mono_method_get_context (target_method); - g_assert (ctx); - g_assert (ctx->method_inst); - g_assert (ctx->method_inst->type_argc == 1); - MonoType *t = mini_get_underlying_type (ctx->method_inst->type_argv [0]); - - if (MONO_TYPE_IS_PRIMITIVE (t) && t->type != MONO_TYPE_R4 && t->type != MONO_TYPE_R8) - *op = MINT_LDC_I4_1; - else - *op = MINT_LDC_I4_0; - } else if (!strcmp (tm, "ObjectHasComponentSize")) { - *op = MINT_INTRINS_RUNTIMEHELPERS_OBJECT_HAS_COMPONENT_SIZE; - } else if (!strcmp (tm, "IsReferenceOrContainsReferences")) { - g_assert (csignature->param_count == 0); - MonoGenericContext *ctx = mono_method_get_context (target_method); - g_assert (ctx); - g_assert (ctx->method_inst); - g_assert (ctx->method_inst->type_argc == 1); - MonoType *t = mini_get_underlying_type (ctx->method_inst->type_argv [0]); - - gboolean has_refs; - - MonoClass *klass = mono_class_from_mono_type_internal (t); - mono_class_init_internal (klass); - if (MONO_TYPE_IS_REFERENCE (t)) - has_refs = TRUE; - else if (MONO_TYPE_IS_PRIMITIVE (t)) - has_refs = FALSE; - else - has_refs = m_class_has_references (klass); - - *op = has_refs ? MINT_LDC_I4_1 : MINT_LDC_I4_0; - } -#endif } else if (in_corlib && !strcmp (klass_name_space, "System") && !strcmp (klass_name, "RuntimeMethodHandle") && !strcmp (tm, "GetFunctionPointer") && csignature->param_count == 1) { // We must intrinsify this method on interp so we don't return a pointer to native code entering interpreter *op = MINT_LDFTN_DYNAMIC; @@ -2429,20 +2322,6 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas } } } -#ifdef ENABLE_NETCORE - else if (in_corlib && - !strcmp ("System.Runtime.CompilerServices", klass_name_space) && - !strcmp ("RuntimeFeature", klass_name)) { - if (!strcmp (tm, "get_IsDynamicCodeSupported")) - *op = MINT_LDC_I4_1; - else if (!strcmp (tm, "get_IsDynamicCodeCompiled")) - *op = MINT_LDC_I4_0; - } else if (in_corlib && - !strncmp ("System.Runtime.Intrinsics", klass_name_space, 25) && - !strcmp (tm, "get_IsSupported")) { - *op = MINT_LDC_I4_0; - } -#endif return FALSE; } @@ -3074,13 +2953,11 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target #endif } -#ifndef ENABLE_NETCORE if (op == MINT_CALLRUN) { interp_ins_set_dreg (td->last_ins, dreg); td->last_ins->data [0] = get_data_item_index (td, target_method); td->last_ins->data [1] = get_data_item_index (td, mono_method_signature_internal (target_method)); } -#endif } else if (!calli && !is_delegate_invoke && !is_virtual && mono_interp_jit_call_supported (target_method, csignature)) { interp_add_ins (td, MINT_JIT_CALL); interp_ins_set_dreg (td->last_ins, dreg); diff --git a/mono/mini/intrinsics.c b/mono/mini/intrinsics.c index c8b9d9249d2..f9151792977 100644 --- a/mono/mini/intrinsics.c +++ b/mono/mini/intrinsics.c @@ -569,21 +569,6 @@ emit_unsafe_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignatu ins->type = STACK_PTR; return ins; } -#ifdef ENABLE_NETCORE - else if (!strcmp (cmethod->name, "InitBlockUnaligned")) { - g_assert (fsig->param_count == 3); - - mini_emit_memory_init_bytes (cfg, args [0], args [1], args [2], MONO_INST_UNALIGNED); - MONO_INST_NEW (cfg, ins, OP_NOP); - MONO_ADD_INS (cfg->cbb, ins); - return ins; - } - else if (!strcmp (cmethod->name, "SkipInit")) { - MONO_INST_NEW (cfg, ins, OP_NOP); - MONO_ADD_INS (cfg->cbb, ins); - return ins; - } -#endif return NULL; } @@ -1926,57 +1911,6 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign } } -#ifdef ENABLE_NETCORE - // Return false for IsSupported for all types in System.Runtime.Intrinsics.* - // if it's not handled in mono_emit_simd_intrinsics - if (in_corlib && - !strncmp ("System.Runtime.Intrinsics", cmethod_klass_name_space, 25) && - !strcmp (cmethod->name, "get_IsSupported")) { - EMIT_NEW_ICONST (cfg, ins, 0); - ins->type = STACK_I4; - return ins; - } - - // Return false for RuntimeFeature.IsDynamicCodeSupported and RuntimeFeature.IsDynamicCodeCompiled on FullAOT, otherwise true - if (in_corlib && - !strcmp ("System.Runtime.CompilerServices", cmethod_klass_name_space) && - !strcmp ("RuntimeFeature", cmethod_klass_name)) { - if (!strcmp (cmethod->name, "get_IsDynamicCodeSupported") || !strcmp (cmethod->name, "get_IsDynamicCodeCompiled")) { - EMIT_NEW_ICONST (cfg, ins, cfg->full_aot ? 0 : 1); - ins->type = STACK_I4; - return ins; - } - } - - if (in_corlib && - !strcmp ("System", cmethod_klass_name_space) && - !strcmp ("ThrowHelper", cmethod_klass_name) && - !strcmp ("ThrowForUnsupportedVectorBaseType", cmethod->name)) { - /* The mono JIT can't optimize the body of this method away */ - MonoGenericContext *ctx = mono_method_get_context (cmethod); - g_assert (ctx); - g_assert (ctx->method_inst); - - MonoType *t = ctx->method_inst->type_argv [0]; - switch (t->type) { - case MONO_TYPE_I1: - case MONO_TYPE_U1: - case MONO_TYPE_I2: - case MONO_TYPE_U2: - case MONO_TYPE_I4: - case MONO_TYPE_U4: - case MONO_TYPE_I8: - case MONO_TYPE_U8: - case MONO_TYPE_R4: - case MONO_TYPE_R8: - MONO_INST_NEW (cfg, ins, OP_NOP); - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - break; - } - } -#endif ins = mono_emit_native_types_intrinsics (cfg, cmethod, fsig, args); if (ins) @@ -2112,7 +2046,6 @@ emit_array_unsafe_mov (MonoCompile *cfg, MonoMethodSignature *fsig, MonoInst **a return NULL; } -#ifndef ENABLE_NETCORE MonoInst* mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) { @@ -2127,7 +2060,6 @@ mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoM return NULL; } -#endif MonoInst* mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field) @@ -2145,12 +2077,6 @@ mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field) EMIT_NEW_ICONST (cfg, ins, is_le); return ins; } -#ifdef ENABLE_NETCORE - else if ((klass == mono_defaults.int_class || klass == mono_defaults.uint_class) && strcmp (field->name, "Zero") == 0) { - EMIT_NEW_PCONST (cfg, ins, 0); - return ins; - } -#endif return NULL; } #else diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index 29d13e32963..3104418350c 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -1420,19 +1420,6 @@ mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *kl gpointer this_arg; gpointer new_args [16]; -#ifdef ENABLE_NETCORE - /* Object.GetType () is an intrinsic under netcore */ - if (!mono_class_is_ginst (cmethod->klass) && !cmethod->is_inflated && !strcmp (cmethod->name, "GetType")) { - MonoVTable *vt; - - vt = mono_class_vtable_checked (mono_domain_get (), klass, error); - if (!is_ok (error)) { - mono_error_set_pending_exception (error); - return NULL; - } - return vt->type; - } -#endif m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg, error); if (!is_ok (error)) { diff --git a/mono/mini/main-core.c b/mono/mini/main-core.c deleted file mode 100644 index 29f575fcf5d..00000000000 --- a/mono/mini/main-core.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include - -#if ENABLE_NETCORE - -#include "mini.h" -#include "mini-runtime.h" -#include -#include -#include -#include -#include -#include - -#ifndef STDAPICALLTYPE -#define STDAPICALLTYPE -#endif - -#if defined(_MSC_VER) && defined(HOST_WIN32) && defined(HOST_X86) -// Ensure that the exported symbols are not decorated and that only one set is exported -#pragma comment(linker, "/export:coreclr_initialize=_coreclr_initialize@28") -#pragma comment(linker, "/export:coreclr_execute_assembly=_coreclr_execute_assembly@24") -#pragma comment(linker, "/export:coreclr_shutdown_2=_coreclr_shutdown_2@12") -#pragma comment(linker, "/export:coreclr_create_delegate=_coreclr_create_delegate@24") -#undef MONO_API -#define MONO_API MONO_EXTERN_C -#endif - -MONO_API int STDAPICALLTYPE coreclr_initialize (const char* exePath, const char* appDomainFriendlyName, - int propertyCount, const char** propertyKeys, const char** propertyValues, - void** hostHandle, unsigned int* domainId); - -MONO_API int STDAPICALLTYPE coreclr_execute_assembly (void* hostHandle, unsigned int domainId, - int argc, const char** argv, - const char* managedAssemblyPath, unsigned int* exitCode); - -MONO_API int STDAPICALLTYPE coreclr_shutdown_2 (void* hostHandle, unsigned int domainId, int* latchedExitCode); - -MONO_API int STDAPICALLTYPE coreclr_create_delegate (void* hostHandle, unsigned int domainId, - const char* entryPointAssemblyName, const char* entryPointTypeName, const char* entryPointMethodName, - void** delegate); - -// -// Initialize the CoreCLR. Creates and starts CoreCLR host and creates an app domain -// -// Parameters: -// exePath - Absolute path of the executable that invoked the ExecuteAssembly -// appDomainFriendlyName - Friendly name of the app domain that will be created to execute the assembly -// propertyCount - Number of properties (elements of the following two arguments) -// propertyKeys - Keys of properties of the app domain -// propertyValues - Values of properties of the app domain -// hostHandle - Output parameter, handle of the created host -// domainId - Output parameter, id of the created app domain -// -// Returns: -// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed -// -int STDAPICALLTYPE coreclr_initialize (const char* exePath, const char* appDomainFriendlyName, - int propertyCount, const char** propertyKeys, const char** propertyValues, - void** hostHandle, unsigned int* domainId) -{ - return monovm_initialize (propertyCount, propertyKeys, propertyValues); -} - -// -// Execute a managed assembly with given arguments -// -// Parameters: -// hostHandle - Handle of the host -// domainId - Id of the domain -// argc - Number of arguments passed to the executed assembly -// argv - Array of arguments passed to the executed assembly -// managedAssemblyPath - Path of the managed assembly to execute (or NULL if using a custom entrypoint). -// exitCode - Exit code returned by the executed assembly -// -// Returns: -// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed -// -int STDAPICALLTYPE coreclr_execute_assembly (void* hostHandle, unsigned int domainId, - int argc, const char** argv, - const char* managedAssemblyPath, unsigned int* exitCode) -{ - return monovm_execute_assembly (argc, argv, managedAssemblyPath, exitCode); -} - -// -// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host. -// -// Parameters: -// hostHandle - Handle of the host -// domainId - Id of the domain -// latchedExitCode - Latched exit code after domain unloaded -// -// Returns: -// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed -// -int STDAPICALLTYPE coreclr_shutdown_2 (void* hostHandle, unsigned int domainId, int* latchedExitCode) -{ - return monovm_shutdown (latchedExitCode); -} - -// -// Create a native callable delegate for a managed method. -// -// Parameters: -// hostHandle - Handle of the host -// domainId - Id of the domain -// entryPointAssemblyName - Name of the assembly which holds the custom entry point -// entryPointTypeName - Name of the type which holds the custom entry point -// entryPointMethodName - Name of the method which is the custom entry point -// delegate - Output parameter, the function stores a pointer to the delegate at the specified address -// -// Returns: -// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed -// -int STDAPICALLTYPE coreclr_create_delegate (void* hostHandle, unsigned int domainId, - const char* entryPointAssemblyName, const char* entryPointTypeName, const char* entryPointMethodName, - void** delegate) -{ - g_error ("Not implemented"); - return 0; -} -#else - -MONO_EMPTY_SOURCE_FILE (main_core); -#endif // ENABLE_NETCORE diff --git a/mono/mini/memory-access.c b/mono/mini/memory-access.c index b666d4c4e81..f65105085df 100644 --- a/mono/mini/memory-access.c +++ b/mono/mini/memory-access.c @@ -17,11 +17,7 @@ #include "ir-emit.h" #include "jit-icalls.h" -#ifdef ENABLE_NETCORE -#define MAX_INLINE_COPIES 16 -#else #define MAX_INLINE_COPIES 10 -#endif #define MAX_INLINE_COPY_SIZE 10000 void diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index aec34bf2000..0944915708b 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -97,11 +97,7 @@ * while the jit only sees one method, so we have to inline things ourselves. */ /* Used by LLVM AOT */ -#ifdef ENABLE_NETCORE -#define LLVM_AOT_INLINE_LENGTH_LIMIT 30 -#else #define LLVM_AOT_INLINE_LENGTH_LIMIT INLINE_LENGTH_LIMIT -#endif /* Used to LLVM JIT */ #define LLVM_JIT_INLINE_LENGTH_LIMIT 100 @@ -3495,21 +3491,6 @@ method_needs_stack_walk (MonoCompile *cfg, MonoMethod *cmethod) return TRUE; } -#if defined(ENABLE_NETCORE) - /* - * In corelib code, methods which need to do a stack walk declare a StackCrawlMark local and pass it as an - * arguments until it reaches an icall. Its hard to detect which methods do that especially with - * StackCrawlMark.LookForMyCallersCaller, so for now, just hardcode the classes which contain the public - * methods whose caller is needed. - */ - if (mono_is_corlib_image (m_class_get_image (cmethod->klass))) { - const char *cname = m_class_get_name (cmethod->klass); - if (!strcmp (cname, "Assembly") || - !strcmp (cname, "AssemblyLoadContext") || - (!strcmp (cname, "Activator"))) - return TRUE; - } -#endif return FALSE; } @@ -7498,7 +7479,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b if ((m_class_get_parent (cmethod->klass) == mono_defaults.multicastdelegate_class) && !strcmp (cmethod->name, "Invoke")) delegate_invoke = TRUE; -#ifndef ENABLE_NETCORE if ((cfg->opt & MONO_OPT_INTRINS) && (ins = mini_emit_inst_for_sharable_method (cfg, cmethod, fsig, sp))) { if (!MONO_TYPE_IS_VOID (fsig->ret)) { mini_type_to_eval_stack_type ((cfg), fsig->ret, ins); @@ -7509,7 +7489,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b mono_tailcall_print ("missed tailcall intrins_sharable %s -> %s\n", method->name, cmethod->name); goto call_end; } -#endif /* * Implement a workaround for the inherent races involved in locking: @@ -7748,11 +7727,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b } } -#ifdef ENABLE_NETCORE - if (save_last_error) { - mono_emit_jit_icall (cfg, mono_marshal_clear_last_error, NULL); - } -#endif /* Tail prefix / tailcall optimization */ @@ -9262,129 +9236,6 @@ calli_end: } } -#ifdef ENABLE_NETCORE - // Optimize - // - // box - // ldnull - // ceq (or cgt.un) - // - // to just - // - // ldc.i4.0 (or 1) - guchar* ldnull_ip; - if ((ldnull_ip = il_read_op (next_ip, end, CEE_LDNULL, MONO_CEE_LDNULL)) && ip_in_bb (cfg, cfg->cbb, ldnull_ip)) { - gboolean is_eq = FALSE, is_neq = FALSE; - if ((ip = il_read_op (ldnull_ip, end, CEE_PREFIX1, MONO_CEE_CEQ))) - is_eq = TRUE; - else if ((ip = il_read_op (ldnull_ip, end, CEE_PREFIX1, MONO_CEE_CGT_UN))) - is_neq = TRUE; - - if ((is_eq || is_neq) && ip_in_bb (cfg, cfg->cbb, ip) && - !mono_class_is_nullable (klass) && !mini_is_gsharedvt_klass (klass)) { - next_ip = ip; - il_op = (MonoOpcodeEnum) (is_eq ? CEE_LDC_I4_0 : CEE_LDC_I4_1); - EMIT_NEW_ICONST (cfg, ins, is_eq ? 0 : 1); - ins->type = STACK_I4; - *sp++ = ins; - break; - } - } - - guint32 isinst_tk = 0; - if ((ip = il_read_op_and_token (next_ip, end, CEE_ISINST, MONO_CEE_ISINST, &isinst_tk)) && - ip_in_bb (cfg, cfg->cbb, ip)) { - MonoClass *isinst_class = mini_get_class (method, isinst_tk, generic_context); - if (!mono_class_is_nullable (klass) && !mono_class_is_nullable (isinst_class) && - !mini_is_gsharedvt_variable_klass (klass) && !mini_is_gsharedvt_variable_klass (isinst_class) && - !mono_class_is_open_constructed_type (m_class_get_byval_arg (klass)) && - !mono_class_is_open_constructed_type (m_class_get_byval_arg (isinst_class))) { - - // Optimize - // - // box - // isinst [Type] - // brfalse/brtrue - // - // to - // - // ldc.i4.0 (or 1) - // brfalse/brtrue - // - guchar* br_ip = NULL; - if ((br_ip = il_read_brtrue (ip, end, &target)) || (br_ip = il_read_brtrue_s (ip, end, &target)) || - (br_ip = il_read_brfalse (ip, end, &target)) || (br_ip = il_read_brfalse_s (ip, end, &target))) { - - gboolean isinst = mono_class_is_assignable_from_internal (isinst_class, klass); - next_ip = ip; - il_op = (MonoOpcodeEnum) (isinst ? CEE_LDC_I4_1 : CEE_LDC_I4_0); - EMIT_NEW_ICONST (cfg, ins, isinst ? 1 : 0); - ins->type = STACK_I4; - *sp++ = ins; - break; - } - - // Optimize - // - // box - // isinst [Type] - // ldnull - // ceq/cgt.un - // - // to - // - // ldc.i4.0 (or 1) - // - guchar* ldnull_ip = NULL; - if ((ldnull_ip = il_read_op (ip, end, CEE_LDNULL, MONO_CEE_LDNULL)) && ip_in_bb (cfg, cfg->cbb, ldnull_ip)) { - gboolean is_eq = FALSE, is_neq = FALSE; - if ((ip = il_read_op (ldnull_ip, end, CEE_PREFIX1, MONO_CEE_CEQ))) - is_eq = TRUE; - else if ((ip = il_read_op (ldnull_ip, end, CEE_PREFIX1, MONO_CEE_CGT_UN))) - is_neq = TRUE; - - if ((is_eq || is_neq) && ip_in_bb (cfg, cfg->cbb, ip) && - !mono_class_is_nullable (klass) && !mini_is_gsharedvt_klass (klass)) { - gboolean isinst = mono_class_is_assignable_from_internal (isinst_class, klass); - next_ip = ip; - if (is_eq) - isinst = !isinst; - il_op = (MonoOpcodeEnum) (isinst ? CEE_LDC_I4_1 : CEE_LDC_I4_0); - EMIT_NEW_ICONST (cfg, ins, isinst ? 1 : 0); - ins->type = STACK_I4; - *sp++ = ins; - break; - } - } - - // Optimize - // - // box - // isinst [Type] - // unbox.any - // - // to - // - // nop - // - guchar* unbox_ip = NULL; - guint32 unbox_token = 0; - if ((unbox_ip = il_read_unbox_any (ip, end, &unbox_token)) && ip_in_bb (cfg, cfg->cbb, unbox_ip)) { - MonoClass *unbox_klass = mini_get_class (method, unbox_token, generic_context); - CHECK_TYPELOAD (unbox_klass); - if (!mono_class_is_nullable (unbox_klass) && - !mini_is_gsharedvt_klass (unbox_klass) && - klass == isinst_class && - klass == unbox_klass) - { - *sp++ = val; - next_ip = unbox_ip; - break; - } - } - } - } -#endif gboolean is_true; diff --git a/mono/mini/mini-arm64.h b/mono/mini/mini-arm64.h index 244857326b2..69a67986337 100644 --- a/mono/mini/mini-arm64.h +++ b/mono/mini/mini-arm64.h @@ -21,9 +21,6 @@ #define MONO_MAX_FREGS 32 #define MONO_MAX_XREGS 32 -#if !defined(DISABLE_SIMD) && defined(ENABLE_NETCORE) -#define MONO_ARCH_SIMD_INTRINSICS 1 -#endif #define MONO_CONTEXT_SET_LLVM_EXC_REG(ctx, exc) do { (ctx)->regs [0] = (gsize)exc; } while (0) diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index e0f4f1d094e..144a61ad654 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -2722,9 +2722,6 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu MONO_PROFILER_RAISE (exception_throw, (obj)); jit_tls->orig_ex_ctx_set = FALSE; -#ifdef ENABLE_NETCORE - mono_first_chance_exception_internal (obj); -#endif StackFrameInfo catch_frame; MonoFirstPassResult res; @@ -2754,12 +2751,10 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu * FIXME: The check below is hackish, but its hard to distinguish * these runtime invoke calls from others in the runtime. */ -#ifndef ENABLE_NETCORE if (ji && jinfo_get_method (ji)->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE) { if (prev_ji && jinfo_get_method (prev_ji) == mono_defaults.threadpool_perform_wait_callback_method) unhandled = TRUE; } -#endif if (unhandled) mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, NULL, NULL); diff --git a/mono/mini/mini-llvm-cpp.cpp b/mono/mini/mini-llvm-cpp.cpp index 7240b067bdf..fab42463c93 100644 --- a/mono/mini/mini-llvm-cpp.cpp +++ b/mono/mini/mini-llvm-cpp.cpp @@ -323,22 +323,6 @@ mono_llvm_set_func_nonnull_arg (LLVMValueRef func, int argNo) gboolean mono_llvm_can_be_gep (LLVMValueRef base, LLVMValueRef* gep_base, LLVMValueRef* gep_offset) { -#ifdef ENABLE_NETCORE - // Look for a pattern like this: - // %1 = ptrtoint i8* %gep_base to i64 - // %2 = add i64 %1, %gep_offset - if (Instruction *base_inst = dyn_cast (unwrap (base))) { - if (base_inst->getOpcode () == Instruction::Add) { - if (Instruction *base_ptr_ins = dyn_cast (base_inst->getOperand (0))) { - if (base_ptr_ins->getOpcode () == Instruction::PtrToInt) { - *gep_base = wrap (base_ptr_ins->getOperand (0)); - *gep_offset = wrap (base_inst->getOperand (1)); - return TRUE; - } - } - } - } -#endif return FALSE; } diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index 29658abd89d..c29cf857a60 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -3730,11 +3730,6 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder) case LLVMArgVtypeInReg: case LLVMArgVtypeByVal: case LLVMArgAsIArgs: -#ifdef ENABLE_NETCORE - // FIXME: Enabling this fails on windows - case LLVMArgVtypeAddr: - case LLVMArgVtypeByRef: -#endif { if (MONO_CLASS_IS_SIMD (ctx->cfg, mono_class_from_mono_type_internal (ainfo->type))) /* Treat these as normal values */ @@ -6986,11 +6981,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) LLVMValueRef mask [32], v; int i; -#ifdef ENABLE_NETCORE - t = simd_class_to_llvm_type (ctx, ins->klass); -#else t = simd_op_to_llvm_type (ins->opcode); -#endif for (i = 0; i < 32; ++i) mask [i] = LLVMConstInt (LLVMInt32Type (), 0, FALSE); @@ -8794,369 +8785,10 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) } #endif -#ifdef ENABLE_NETCORE - case OP_XCAST: { - LLVMTypeRef t = simd_class_to_llvm_type (ctx, ins->klass); - - values [ins->dreg] = LLVMBuildBitCast (builder, lhs, t, ""); - break; - } - case OP_XCOMPARE_FP: { - LLVMRealPredicate pred = fpcond_to_llvm_cond [ins->inst_c0]; - LLVMValueRef cmp = LLVMBuildFCmp (builder, pred, lhs, rhs, ""); - int nelems = LLVMGetVectorSize (LLVMTypeOf (cmp)); - g_assert (LLVMTypeOf (lhs) == LLVMTypeOf (rhs)); - if (ins->inst_c1 == MONO_TYPE_R8) - values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt64Type (), nelems), ""), LLVMTypeOf (lhs), ""); - else - values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt32Type (), nelems), ""), LLVMTypeOf (lhs), ""); - break; - } - case OP_XCOMPARE: { - LLVMIntPredicate pred = cond_to_llvm_cond [ins->inst_c0]; - LLVMValueRef cmp = LLVMBuildICmp (builder, pred, lhs, rhs, ""); - g_assert (LLVMTypeOf (lhs) == LLVMTypeOf (rhs)); - values [ins->dreg] = LLVMBuildSExt (builder, cmp, LLVMTypeOf (lhs), ""); - break; - } - case OP_XEQUAL: { - LLVMTypeRef t; - LLVMValueRef cmp, mask [32], shuffle; - int nelems; - -#if defined(TARGET_WASM) && LLVM_API_VERSION >= 800 - /* The wasm code generator doesn't understand the shuffle/and code sequence below */ - LLVMValueRef val; - if (LLVMIsNull (lhs) || LLVMIsNull (rhs)) { - val = LLVMIsNull (lhs) ? rhs : lhs; - nelems = LLVMGetVectorSize (LLVMTypeOf (lhs)); - - IntrinsicId intrins = (IntrinsicId)0; - switch (nelems) { - case 16: - intrins = INTRINS_WASM_ANYTRUE_V16; - break; - case 8: - intrins = INTRINS_WASM_ANYTRUE_V8; - break; - case 4: - intrins = INTRINS_WASM_ANYTRUE_V4; - break; - case 2: - intrins = INTRINS_WASM_ANYTRUE_V2; - break; - default: - g_assert_not_reached (); - } - /* res = !wasm.anytrue (val) */ - values [ins->dreg] = call_intrins (ctx, intrins, &val, ""); - values [ins->dreg] = LLVMBuildZExt (builder, LLVMBuildICmp (builder, LLVMIntEQ, values [ins->dreg], LLVMConstInt (LLVMInt32Type (), 0, FALSE), ""), LLVMInt32Type (), dname); - break; - } -#endif - LLVMTypeRef srcelemt = LLVMGetElementType (LLVMTypeOf (lhs)); - - //%c = icmp sgt <16 x i8> %a0, %a1 - if (srcelemt == LLVMDoubleType () || srcelemt == LLVMFloatType ()) - cmp = LLVMBuildFCmp (builder, LLVMRealOEQ, lhs, rhs, ""); - else - cmp = LLVMBuildICmp (builder, LLVMIntEQ, lhs, rhs, ""); - nelems = LLVMGetVectorSize (LLVMTypeOf (cmp)); - - LLVMTypeRef elemt; - if (srcelemt == LLVMDoubleType ()) - elemt = LLVMInt64Type (); - else if (srcelemt == LLVMFloatType ()) - elemt = LLVMInt32Type (); - else - elemt = srcelemt; - - t = LLVMVectorType (elemt, nelems); - cmp = LLVMBuildSExt (builder, cmp, t, ""); - // cmp is a vector, each element is either 0xff... or 0 - int half = nelems / 2; - while (half >= 1) { - // AND the top and bottom halfes into the bottom half - for (int i = 0; i < half; ++i) - mask [i] = LLVMConstInt (LLVMInt32Type (), half + i, FALSE); - for (int i = half; i < nelems; ++i) - mask [i] = LLVMConstInt (LLVMInt32Type (), 0, FALSE); - shuffle = LLVMBuildShuffleVector (builder, cmp, LLVMGetUndef (t), LLVMConstVector (mask, LLVMGetVectorSize (t)), ""); - cmp = LLVMBuildAnd (builder, cmp, shuffle, ""); - half = half / 2; - } - // Extract [0] - LLVMValueRef first_elem = LLVMBuildExtractElement (builder, cmp, LLVMConstInt (LLVMInt32Type (), 0, FALSE), ""); - // convert to 0/1 - LLVMValueRef cmp_zero = LLVMBuildICmp (builder, LLVMIntNE, first_elem, LLVMConstInt (elemt, 0, FALSE), ""); - values [ins->dreg] = LLVMBuildZExt (builder, cmp_zero, LLVMInt8Type (), ""); - break; - } - case OP_XBINOP: { - switch (ins->inst_c0) { - case OP_IADD: - values [ins->dreg] = LLVMBuildAdd (builder, lhs, rhs, ""); - break; - case OP_ISUB: - values [ins->dreg] = LLVMBuildSub (builder, lhs, rhs, ""); - break; - case OP_IAND: - values [ins->dreg] = LLVMBuildAnd (builder, lhs, rhs, ""); - break; - case OP_IOR: - values [ins->dreg] = LLVMBuildOr (builder, lhs, rhs, ""); - break; - case OP_IXOR: - values [ins->dreg] = LLVMBuildXor (builder, lhs, rhs, ""); - break; - case OP_FADD: - values [ins->dreg] = LLVMBuildFAdd (builder, lhs, rhs, ""); - break; - case OP_FSUB: - values [ins->dreg] = LLVMBuildFSub (builder, lhs, rhs, ""); - break; - case OP_FMUL: - values [ins->dreg] = LLVMBuildFMul (builder, lhs, rhs, ""); - break; - case OP_FDIV: - values [ins->dreg] = LLVMBuildFDiv (builder, lhs, rhs, ""); - break; - case OP_FMAX: - case OP_FMIN: { -#if defined(TARGET_X86) || defined(TARGET_AMD64) - LLVMValueRef args [] = { lhs, rhs }; - - gboolean is_r4 = ins->inst_c1 == MONO_TYPE_R4; - if (ins->inst_c0 == OP_FMAX) - values [ins->dreg] = call_intrins (ctx, is_r4 ? INTRINS_SSE_MAXPS : INTRINS_SSE_MAXPD, args, dname); - else - values [ins->dreg] = call_intrins (ctx, is_r4 ? INTRINS_SSE_MINPS : INTRINS_SSE_MINPD, args, dname); -#else - NOT_IMPLEMENTED; -#endif - break; - } - case OP_IMAX: { - gboolean is_unsigned = ins->inst_c1 == MONO_TYPE_U1 || ins->inst_c1 == MONO_TYPE_U2 || ins->inst_c1 == MONO_TYPE_U4 || ins->inst_c1 == MONO_TYPE_U8; - LLVMValueRef cmp = LLVMBuildICmp (builder, is_unsigned ? LLVMIntUGT : LLVMIntSGT, lhs, rhs, ""); - values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, ""); - break; - } - case OP_IMIN: { - gboolean is_unsigned = ins->inst_c1 == MONO_TYPE_U1 || ins->inst_c1 == MONO_TYPE_U2 || ins->inst_c1 == MONO_TYPE_U4 || ins->inst_c1 == MONO_TYPE_U8; - LLVMValueRef cmp = LLVMBuildICmp (builder, is_unsigned ? LLVMIntULT : LLVMIntSLT, lhs, rhs, ""); - values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, ""); - } - break; - - default: - g_assert_not_reached (); - } - break; - } - case OP_XEXTRACT_I32: - case OP_XEXTRACT_I64: - case OP_XEXTRACT_R8: - case OP_XEXTRACT_R4: { - LLVMTypeRef rhst = LLVMTypeOf (rhs); - LLVMValueRef mask = NULL; - switch (ins->opcode) { - case OP_XEXTRACT_I32: case OP_XEXTRACT_R4: - mask = LLVMConstInt (rhst, 0x3, FALSE); break; - case OP_XEXTRACT_I64: case OP_XEXTRACT_R8: - mask = LLVMConstInt (rhst, 0x1, FALSE); break; - default: - g_assert_not_reached (); - } - LLVMValueRef selector = LLVMBuildAnd (builder, rhs, mask, ""); - values [ins->dreg] = LLVMBuildExtractElement (builder, lhs, selector, ""); - break; - } - case OP_POPCNT32: - values [ins->dreg] = call_intrins (ctx, INTRINS_CTPOP_I32, &lhs, ""); - break; - case OP_POPCNT64: - values [ins->dreg] = call_intrins (ctx, INTRINS_CTPOP_I64, &lhs, ""); - break; - case OP_CTTZ32: - case OP_CTTZ64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = LLVMConstInt (LLVMInt1Type (), 0, FALSE); - values [ins->dreg] = call_intrins (ctx, ins->opcode == OP_CTTZ32 ? INTRINS_CTTZ_I32 : INTRINS_CTTZ_I64, args, ""); - break; - } - case OP_BEXTR32: - case OP_BEXTR64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = convert (ctx, rhs, ins->opcode == OP_BEXTR32 ? LLVMInt32Type () : LLVMInt64Type ()); // cast ushort to u32/u64 - values [ins->dreg] = call_intrins (ctx, ins->opcode == OP_BEXTR32 ? INTRINS_BEXTR_I32 : INTRINS_BEXTR_I64, args, ""); - break; - } - case OP_BZHI32: - case OP_BZHI64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = rhs; - values [ins->dreg] = call_intrins (ctx, ins->opcode == OP_BZHI32 ? INTRINS_BZHI_I32 : INTRINS_BZHI_I64, args, ""); - break; - } - case OP_MULX_H32: - case OP_MULX_H64: - case OP_MULX_HL32: - case OP_MULX_HL64: { - gboolean is_64 = ins->opcode == OP_MULX_H64 || ins->opcode == OP_MULX_HL64; - gboolean only_high = ins->opcode == OP_MULX_H32 || ins->opcode == OP_MULX_H64; - LLVMValueRef lx = LLVMBuildZExt (ctx->builder, lhs, LLVMInt128Type (), ""); - LLVMValueRef rx = LLVMBuildZExt (ctx->builder, rhs, LLVMInt128Type (), ""); - LLVMValueRef mulx = LLVMBuildMul (ctx->builder, lx, rx, ""); - if (!only_high) { - LLVMValueRef lowx = LLVMBuildTrunc (ctx->builder, mulx, is_64 ? LLVMInt64Type () : LLVMInt32Type (), ""); - LLVMBuildStore (ctx->builder, lowx, values [ins->sreg3]); - } - LLVMValueRef shift = LLVMConstInt (LLVMInt128Type (), is_64 ? 64 : 32, FALSE); - LLVMValueRef highx = LLVMBuildLShr (ctx->builder, mulx, shift, ""); - values [ins->dreg] = LLVMBuildTrunc (ctx->builder, highx, is_64 ? LLVMInt64Type () : LLVMInt32Type (), ""); - break; - } - case OP_PEXT32: - case OP_PEXT64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = rhs; - values [ins->dreg] = call_intrins (ctx, ins->opcode == OP_PEXT32 ? INTRINS_PEXT_I32 : INTRINS_PEXT_I64, args, ""); - break; - } - case OP_PDEP32: - case OP_PDEP64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = rhs; - values [ins->dreg] = call_intrins (ctx, ins->opcode == OP_PDEP32 ? INTRINS_PDEP_I32 : INTRINS_PDEP_I64, args, ""); - break; - } -#endif /* ENABLE_NETCORE */ #endif /* defined(TARGET_X86) || defined(TARGET_AMD64) */ // Shared between ARM64 and X86 -#if defined(ENABLE_NETCORE) && (defined(TARGET_ARM64) || defined(TARGET_X86) || defined(TARGET_AMD64)) - case OP_LZCNT32: - case OP_LZCNT64: { - LLVMValueRef args [2]; - args [0] = lhs; - args [1] = LLVMConstInt (LLVMInt1Type (), 1, FALSE); - values [ins->dreg] = LLVMBuildCall (builder, get_intrins (ctx, ins->opcode == OP_LZCNT32 ? INTRINS_CTLZ_I32 : INTRINS_CTLZ_I64), args, 2, ""); - break; - } -#endif - -#if defined(ENABLE_NETCORE) && defined(TARGET_ARM64) - case OP_XOP_I4_I4: - case OP_XOP_I8_I8: { - IntrinsicId id = (IntrinsicId)0; - switch (ins->inst_c0) { - case SIMD_OP_ARM64_RBIT32: id = INTRINS_BITREVERSE_I32; break; - case SIMD_OP_ARM64_RBIT64: id = INTRINS_BITREVERSE_I64; break; - default: g_assert_not_reached (); break; - } - values [ins->dreg] = call_intrins (ctx, id, &lhs, ""); - break; - } - case OP_XOP_X_X_X: - case OP_XOP_I4_I4_I4: - case OP_XOP_I4_I4_I8: { - IntrinsicId id = (IntrinsicId)0; - gboolean zext_last = FALSE; - switch (ins->inst_c0) { - case SIMD_OP_ARM64_CRC32B: id = INTRINS_AARCH64_CRC32B; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32H: id = INTRINS_AARCH64_CRC32H; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32W: id = INTRINS_AARCH64_CRC32W; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32X: id = INTRINS_AARCH64_CRC32X; break; - case SIMD_OP_ARM64_CRC32CB: id = INTRINS_AARCH64_CRC32CB; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32CH: id = INTRINS_AARCH64_CRC32CH; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32CW: id = INTRINS_AARCH64_CRC32CW; zext_last = TRUE; break; - case SIMD_OP_ARM64_CRC32CX: id = INTRINS_AARCH64_CRC32CX; break; - case SIMD_OP_ARM64_SHA1SU1: id = INTRINS_AARCH64_SHA1SU1; break; - case SIMD_OP_ARM64_SHA256SU0: id = INTRINS_AARCH64_SHA256SU0; break; - default: g_assert_not_reached (); break; - } - LLVMValueRef arg1 = rhs; - if (zext_last) - arg1 = LLVMBuildZExt (ctx->builder, arg1, LLVMInt32Type (), ""); - LLVMValueRef args [] = { lhs, arg1 }; - values [ins->dreg] = call_intrins (ctx, id, args, ""); - break; - } - case OP_XOP_X_X_X_X: { - IntrinsicId id = (IntrinsicId)0; - switch (ins->inst_c0) { - case SIMD_OP_ARM64_SHA1SU0: id = INTRINS_AARCH64_SHA1SU0; break; - case SIMD_OP_ARM64_SHA256H: id = INTRINS_AARCH64_SHA256H; break; - case SIMD_OP_ARM64_SHA256H2: id = INTRINS_AARCH64_SHA256H2; break; - case SIMD_OP_ARM64_SHA256SU1: id = INTRINS_AARCH64_SHA256SU1; break; - default: g_assert_not_reached (); break; - } - LLVMValueRef args [] = { lhs, rhs, arg3 }; - values [ins->dreg] = call_intrins (ctx, id, args, ""); - break; - } - case OP_XOP_X_X: { - IntrinsicId id = (IntrinsicId)0; - switch (ins->inst_c0) { - case SIMD_OP_LLVM_FABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_FLOAT; break; - case SIMD_OP_LLVM_DABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_DOUBLE; break; - case SIMD_OP_LLVM_I8ABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_INT8; break; - case SIMD_OP_LLVM_I16ABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_INT16; break; - case SIMD_OP_LLVM_I32ABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_INT32; break; - case SIMD_OP_LLVM_I64ABS: id = INTRINS_AARCH64_ADV_SIMD_ABS_INT64; break; - default: g_assert_not_reached (); break; - } - LLVMValueRef arg0 = lhs; - values [ins->dreg] = call_intrins (ctx, id, &arg0, ""); - break; - } - case OP_LSCNT32: - case OP_LSCNT64: { - // %shr = ashr i32 %x, 31 - // %xor = xor i32 %shr, %x - // %mul = shl i32 %xor, 1 - // %add = or i32 %mul, 1 - // %0 = tail call i32 @llvm.ctlz.i32(i32 %add, i1 false) - LLVMValueRef shr = LLVMBuildAShr (builder, lhs, ins->opcode == OP_LSCNT32 ? - LLVMConstInt (LLVMInt32Type (), 31, FALSE) : - LLVMConstInt (LLVMInt64Type (), 63, FALSE), ""); - LLVMValueRef one = ins->opcode == OP_LSCNT32 ? - LLVMConstInt (LLVMInt32Type (), 1, FALSE) : - LLVMConstInt (LLVMInt64Type (), 1, FALSE); - LLVMValueRef xor = LLVMBuildXor (builder, shr, lhs, ""); - LLVMValueRef mul = LLVMBuildShl (builder, xor, one, ""); - LLVMValueRef add = LLVMBuildOr (builder, mul, one, ""); - - LLVMValueRef args [2]; - args [0] = add; - args [1] = LLVMConstInt (LLVMInt1Type (), 0, FALSE); - values [ins->dreg] = LLVMBuildCall (builder, get_intrins (ctx, ins->opcode == OP_LSCNT32 ? INTRINS_CTLZ_I32 : INTRINS_CTLZ_I64), args, 2, ""); - break; - } - case OP_ARM64_SMULH: - case OP_ARM64_UMULH: { - LLVMValueRef op1, op2; - if (ins->opcode == OP_ARM64_SMULH) { - op1 = LLVMBuildSExt (builder, lhs, LLVMInt128Type (), ""); - op2 = LLVMBuildSExt (builder, rhs, LLVMInt128Type (), ""); - } else { - op1 = LLVMBuildZExt (builder, lhs, LLVMInt128Type (), ""); - op2 = LLVMBuildZExt (builder, rhs, LLVMInt128Type (), ""); - } - LLVMValueRef mul = LLVMBuildMul (builder, op1, op2, ""); - LLVMValueRef hi64 = LLVMBuildLShr (builder, mul, - LLVMConstInt (LLVMInt128Type (), 64, FALSE), ""); - values [ins->dreg] = LLVMBuildTrunc (builder, hi64, LLVMInt64Type (), ""); - break; - } -#endif case OP_DUMMY_USE: break; diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index e9c4914a0e2..b8df86ea538 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -85,9 +85,7 @@ #include #include #include "trace.h" -#ifndef ENABLE_NETCORE #include "version.h" -#endif #include "aot-compiler.h" #include "aot-runtime.h" #include "llvmonly-runtime.h" @@ -393,7 +391,6 @@ gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee) if (caller->domain_neutral && !callee->domain_neutral) return FALSE; -#ifndef ENABLE_NETCORE MonoMethod *cmethod; cmethod = jinfo_get_method (caller); @@ -402,7 +399,6 @@ gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee) /* The InvokeInDomain methods change the current appdomain */ return FALSE; } -#endif return TRUE; } @@ -4639,9 +4635,7 @@ mini_init (const char *filename, const char *runtime_version) mono_simd_intrinsics_init (); #endif -#ifndef ENABLE_NETCORE mono_tasklets_init (); -#endif register_trampolines (domain); @@ -5088,9 +5082,7 @@ mini_cleanup (MonoDomain *domain) mono_runtime_cleanup (domain); #endif -#ifndef ENABLE_NETCORE mono_threadpool_cleanup (); -#endif MONO_PROFILER_RAISE (runtime_shutdown_end, ()); diff --git a/mono/mini/mini-runtime.h b/mono/mini/mini-runtime.h index 52adc272c8f..15b7a033639 100644 --- a/mono/mini/mini-runtime.h +++ b/mono/mini/mini-runtime.h @@ -273,9 +273,6 @@ typedef struct MonoDebugOptions { */ gboolean top_runtime_invoke_unhandled; -#ifdef ENABLE_NETCORE - gboolean enabled; -#endif } MonoDebugOptions; /* diff --git a/mono/mini/mini-wasm.c b/mono/mini/mini-wasm.c index f8d3e1855be..76407a82d1c 100644 --- a/mono/mini/mini-wasm.c +++ b/mono/mini/mini-wasm.c @@ -545,11 +545,7 @@ mono_set_timeout_exec (int id) { ERROR_DECL (error); -#ifdef ENABLE_NETCORE - MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "TimerQueue"); -#else MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "WasmRuntime"); -#endif g_assert (klass); MonoMethod *method = mono_class_get_method_from_name_checked (klass, "TimeoutCallback", -1, 0, error); @@ -625,13 +621,8 @@ void mono_arch_register_icall (void) { #ifdef HOST_WASM -#ifdef ENABLE_NETCORE - mono_add_internal_call_internal ("System.Threading.TimerQueue::SetTimeout", mono_wasm_set_timeout); - mono_add_internal_call_internal ("System.Threading.ThreadPool::QueueCallback", mono_wasm_queue_tp_cb); -#else mono_add_internal_call_internal ("System.Threading.WasmRuntime::SetTimeout", mono_wasm_set_timeout); #endif -#endif } void diff --git a/mono/mini/mini-wasm.h b/mono/mini/mini-wasm.h index 57c73a4bc9a..1026fad0c2a 100644 --- a/mono/mini/mini-wasm.h +++ b/mono/mini/mini-wasm.h @@ -89,9 +89,6 @@ typedef struct { #define MONO_ARCH_GSHAREDVT_SUPPORTED 1 #define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1 -#ifdef ENABLE_NETCORE -#define MONO_ARCH_SIMD_INTRINSICS 1 -#endif #define MONO_ARCH_INTERPRETER_SUPPORTED 1 #define MONO_ARCH_HAS_REGISTER_ICALL 1 diff --git a/mono/mini/mini-x86.h b/mono/mini/mini-x86.h index 6d44cb5f2bf..991756ad8e1 100644 --- a/mono/mini/mini-x86.h +++ b/mono/mini/mini-x86.h @@ -65,11 +65,9 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep); #define MONO_ARCH_SUPPORT_TASKLETS 1 #ifndef DISABLE_SIMD -#ifndef ENABLE_NETCORE #define MONO_ARCH_SIMD_INTRINSICS 1 #define MONO_ARCH_NEED_SIMD_BANK 1 #endif -#endif /* we should lower this size and make sure we don't call heavy stack users in the segv handler */ #if defined(__APPLE__) diff --git a/mono/mini/mini.c b/mono/mini/mini.c index d12f3b07ed7..495babcd607 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -753,15 +753,6 @@ mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode) { int dreg; -#ifdef ENABLE_NETCORE - if (type->type == MONO_TYPE_VALUETYPE && !type->byref) { - MonoClass *klass = mono_class_from_mono_type_internal (type); - if (m_class_is_enumtype (klass) && m_class_get_image (klass) == mono_get_corlib () && !strcmp (m_class_get_name (klass), "StackCrawlMark")) { - if (!(cfg->method->flags & METHOD_ATTRIBUTE_REQSECOBJ)) - g_error ("Method '%s' which contains a StackCrawlMark local variable must be decorated with [System.Security.DynamicSecurityMethod].", mono_method_get_full_name (cfg->method)); - } - } -#endif type = mini_get_underlying_type (type); diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 0dba272e692..4cb01fc09f2 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -2285,9 +2285,7 @@ void mini_emit_memory_copy (MonoCompile *cfg, MonoInst *dest, MonoI MonoInst* mini_emit_array_store (MonoCompile *cfg, MonoClass *klass, MonoInst **sp, gboolean safety_checks); MonoInst* mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); MonoInst* mini_emit_inst_for_ctor (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); -#ifndef ENABLE_NETCORE MonoInst* mini_emit_inst_for_sharable_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); -#endif MonoInst* mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field); MonoInst* mini_handle_enum_has_flag (MonoCompile *cfg, MonoClass *klass, MonoInst *enum_this, int enum_val_reg, MonoInst *enum_flag); diff --git a/mono/mini/monovm.c b/mono/mini/monovm.c index bbde28cce1b..91f0f78f8ae 100644 --- a/mono/mini/monovm.c +++ b/mono/mini/monovm.c @@ -2,277 +2,6 @@ #include #include "monovm.h" -#if ENABLE_NETCORE - -#include -#include -#include -#include -#include -#include -#include -#include - -typedef struct { - int assembly_count; - char **basenames; /* Foo.dll */ - int *basename_lens; - char **assembly_filepaths; /* /blah/blah/blah/Foo.dll */ -} MonoCoreTrustedPlatformAssemblies; - -typedef struct { - int dir_count; - char **dirs; -} MonoCoreLookupPaths; - -static MonoCoreTrustedPlatformAssemblies *trusted_platform_assemblies; -static MonoCoreLookupPaths *native_lib_paths; -static MonoCoreLookupPaths *app_paths; -static MonoCoreLookupPaths *app_ni_paths; -static MonoCoreLookupPaths *platform_resource_roots; - -static void -mono_core_trusted_platform_assemblies_free (MonoCoreTrustedPlatformAssemblies *a) -{ - if (!a) - return; - g_strfreev (a->basenames); - g_strfreev (a->assembly_filepaths); - g_free (a); -} - -static void -mono_core_lookup_paths_free (MonoCoreLookupPaths *dl) -{ - if (!dl) - return; - g_strfreev (dl->dirs); - g_free (dl); -} - -static gboolean -parse_trusted_platform_assemblies (const char *assemblies_paths) -{ - // From - // https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting#step-3---prepare-runtime-properties - // this is ';' separated on Windows and ':' separated elsewhere. - char **parts = g_strsplit (assemblies_paths, G_SEARCHPATH_SEPARATOR_S, 0); - int asm_count = 0; - for (char **p = parts; *p != NULL && **p != '\0'; p++) { -#if 0 - const char *part = *p; - // can't use logger, it's not initialized yet. - printf ("\t\tassembly %d = <%s>\n", asm_count, part); -#endif - asm_count++; - } - MonoCoreTrustedPlatformAssemblies *a = g_new0 (MonoCoreTrustedPlatformAssemblies, 1); - a->assembly_count = asm_count; - a->assembly_filepaths = parts; - a->basenames = g_new0 (char*, asm_count + 1); - a->basename_lens = g_new0 (int, asm_count + 1); - for (int i = 0; i < asm_count; ++i) { - a->basenames [i] = g_path_get_basename (a->assembly_filepaths [i]); - a->basename_lens [i] = strlen (a->basenames [i]); - } - a->basenames [asm_count] = NULL; - a->basename_lens [asm_count] = 0; - - trusted_platform_assemblies = a; - return TRUE; -} - -static MonoCoreLookupPaths * -parse_lookup_paths (const char *search_path) -{ - char **parts = g_strsplit (search_path, G_SEARCHPATH_SEPARATOR_S, 0); - int dir_count = 0; - for (char **p = parts; *p != NULL && **p != '\0'; p++) { -#if 0 - const char *part = *p; - // can't use logger, it's not initialized yet. - printf ("\t\tnative search dir %d = <%s>\n", dir_count, part); -#endif - dir_count++; - } - MonoCoreLookupPaths *dl = g_new0 (MonoCoreLookupPaths, 1); - dl->dirs = parts; - dl->dir_count = dir_count; - return dl; -} - -static MonoAssembly* -mono_core_preload_hook (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname, char **assemblies_path, gboolean refonly, gpointer user_data, MonoError *error) -{ - MonoAssembly *result = NULL; - MonoCoreTrustedPlatformAssemblies *a = (MonoCoreTrustedPlatformAssemblies *)user_data; - /* TODO: check that CoreCLR wants the strong name semantics here */ - MonoAssemblyCandidatePredicate predicate = &mono_assembly_candidate_predicate_sn_same_name; - void* predicate_ud = aname; - char *basename = NULL; - - if (a == NULL) // no TPA paths set - goto leave; - - g_assert (aname); - g_assert (aname->name); - g_assert (!refonly); - /* alc might be a user ALC - we get here from alc.LoadFromAssemblyName(), but we should load TPA assemblies into the default alc */ - MonoAssemblyLoadContext *default_alc; - default_alc = mono_domain_default_alc (mono_alc_domain (alc)); - - basename = g_strconcat (aname->name, ".dll", (const char*)NULL); /* TODO: make sure CoreCLR never needs to load .exe files */ - - size_t basename_len; - basename_len = strlen (basename); - - for (int i = 0; i < a->assembly_count; ++i) { - if (basename_len == a->basename_lens [i] && !g_strncasecmp (basename, a->basenames [i], a->basename_lens [i])) { - MonoAssemblyOpenRequest req; - mono_assembly_request_prepare_open (&req, MONO_ASMCTX_DEFAULT, default_alc); - req.request.predicate = predicate; - req.request.predicate_ud = predicate_ud; - - const char *fullpath = a->assembly_filepaths [i]; - - gboolean found = g_file_test (fullpath, G_FILE_TEST_IS_REGULAR); - - if (found) { - MonoImageOpenStatus status; - result = mono_assembly_request_open (fullpath, &req, &status); - /* TODO: do something with the status at the end? */ - if (result) - break; - } - } - } - -leave: - g_free (basename); - - if (!result) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "netcore preload hook: did not find '%s'.", aname->name); - } else { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "netcore preload hook: loading '%s' from '%s'.", aname->name, result->image->name); - } - return result; -} - -static void -install_assembly_loader_hooks (void) -{ - mono_install_assembly_preload_hook_v2 (mono_core_preload_hook, (void*)trusted_platform_assemblies, FALSE, FALSE); -} - -static gboolean -parse_properties (int propertyCount, const char **propertyKeys, const char **propertyValues) -{ - // A partial list of relevant properties is at: - // https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting#step-3---prepare-runtime-properties - - for (int i = 0; i < propertyCount; ++i) { - size_t prop_len = strlen (propertyKeys [i]); - if (prop_len == 27 && !strncmp (propertyKeys [i], "TRUSTED_PLATFORM_ASSEMBLIES", 27)) { - parse_trusted_platform_assemblies (propertyValues[i]); - } else if (prop_len == 9 && !strncmp (propertyKeys [i], "APP_PATHS", 9)) { - app_paths = parse_lookup_paths (propertyValues [i]); - } else if (prop_len == 12 && !strncmp (propertyKeys [i], "APP_NI_PATHS", 12)) { - app_ni_paths = parse_lookup_paths (propertyValues [i]); - } else if (prop_len == 23 && !strncmp (propertyKeys [i], "PLATFORM_RESOURCE_ROOTS", 23)) { - platform_resource_roots = parse_lookup_paths (propertyValues [i]); - } else if (prop_len == 29 && !strncmp (propertyKeys [i], "NATIVE_DLL_SEARCH_DIRECTORIES", 29)) { - native_lib_paths = parse_lookup_paths (propertyValues [i]); - } else if (prop_len == 16 && !strncmp (propertyKeys [i], "PINVOKE_OVERRIDE", 16)) { - PInvokeOverrideFn override_fn = (PInvokeOverrideFn)(uintptr_t)strtoull (propertyValues [i], NULL, 0); - mono_loader_install_pinvoke_override (override_fn); - } else if (prop_len == 30 && !strncmp (propertyKeys [i], "System.Globalization.Invariant", 30)) { - // TODO: Ideally we should propagate this through AppContext options - g_setenv ("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", propertyValues [i], TRUE); - } else if (prop_len == 27 && !strncmp (propertyKeys [i], "System.Globalization.UseNls", 27)) { - // TODO: Ideally we should propagate this through AppContext options - g_setenv ("DOTNET_SYSTEM_GLOBALIZATION_USENLS", propertyValues [i], TRUE); - } else if (prop_len == 32 && !strncmp (propertyKeys [i], "System.Globalization.AppLocalIcu", 32)) { - // TODO: Ideally we should propagate this through AppContext options - g_setenv ("DOTNET_SYSTEM_GLOBALIZATION_APPLOCALICU", propertyValues [i], TRUE); - } else { -#if 0 - // can't use mono logger, it's not initialized yet. - printf ("\t Unprocessed property %03d '%s': <%s>\n", i, propertyKeys[i], propertyValues[i]); -#endif - } - } - return TRUE; -} - -int -monovm_initialize (int propertyCount, const char **propertyKeys, const char **propertyValues) -{ - mono_runtime_register_appctx_properties (propertyCount, propertyKeys, propertyValues); - - if (!parse_properties (propertyCount, propertyKeys, propertyValues)) - return 0x80004005; /* E_FAIL */ - - install_assembly_loader_hooks (); - if (native_lib_paths != NULL) - mono_set_pinvoke_search_directories (native_lib_paths->dir_count, g_strdupv (native_lib_paths->dirs)); - // Our load hooks don't distinguish between normal, AOT'd, and satellite lookups the way CoreCLR's does. - // For now, just set assemblies_path with APP_PATHS and leave the rest. - if (app_paths != NULL) - mono_set_assemblies_path_direct (g_strdupv (app_paths->dirs)); - - /* - * Don't use Mono's legacy assembly name matching behavior - respect - * the requested version and culture. - */ - mono_loader_set_strict_assembly_name_check (TRUE); - - return 0; -} - -int -monovm_execute_assembly (int argc, const char **argv, const char *managedAssemblyPath, unsigned int *exitCode) -{ - if (exitCode == NULL) - { - return -1; - } - - // - // Make room for program name and executable assembly - // - int mono_argc = argc + 2; - - char **mono_argv = (char **) malloc (sizeof (char *) * (mono_argc + 1 /* null terminated */)); - const char **ptr = (const char **) mono_argv; - - *ptr++ = NULL; - - // executable assembly - *ptr++ = (char*) managedAssemblyPath; - - // the rest - for (int i = 0; i < argc; ++i) - *ptr++ = argv [i]; - - *ptr = NULL; - - mono_parse_env_options (&mono_argc, &mono_argv); - - // TODO: Should be return code of Main only (mono_jit_exec result) - *exitCode = mono_main (mono_argc, mono_argv); - - return 0; -} - -int -monovm_shutdown (int *latchedExitCode) -{ - *latchedExitCode = mono_environment_exitcode_get (); - - return 0; -} - -#else int monovm_initialize (int propertyCount, const char **propertyKeys, const char **propertyValues) @@ -292,4 +21,3 @@ monovm_shutdown (int *latchedExitCode) return -1; } -#endif // ENABLE_NETCORE diff --git a/mono/mini/simd-intrinsics-netcore.c b/mono/mini/simd-intrinsics-netcore.c deleted file mode 100644 index 33d307d5738..00000000000 --- a/mono/mini/simd-intrinsics-netcore.c +++ /dev/null @@ -1,2329 +0,0 @@ -/** - * SIMD Intrinsics support for netcore. - * Only LLVM is supported as a backend. - */ - -#include -#include -#include -#include "mini.h" -#include "mini-runtime.h" -#include "ir-emit.h" -#ifdef ENABLE_LLVM -#include "mini-llvm.h" -#endif -#include "mono/utils/bsearch.h" -#include -#include -#include - -#if defined (MONO_ARCH_SIMD_INTRINSICS) && defined(ENABLE_NETCORE) - -#if defined(DISABLE_JIT) - -void -mono_simd_intrinsics_init (void) -{ -} - -#else - -#define MSGSTRFIELD(line) MSGSTRFIELD1(line) -#define MSGSTRFIELD1(line) str##line -static const struct msgstr_t { -#define METHOD(name) char MSGSTRFIELD(__LINE__) [sizeof (#name)]; -#define METHOD2(str,name) char MSGSTRFIELD(__LINE__) [sizeof (str)]; -#include "simd-methods-netcore.h" -#undef METHOD -#undef METHOD2 -} method_names = { -#define METHOD(name) #name, -#define METHOD2(str,name) str, -#include "simd-methods-netcore.h" -#undef METHOD -#undef METHOD2 -}; - -enum { -#define METHOD(name) SN_ ## name = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), -#define METHOD2(str,name) SN_ ## name = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), -#include "simd-methods-netcore.h" -}; -#define method_name(idx) ((const char*)&method_names + (idx)) - -static int register_size; - -typedef struct { - // One of the SN_ constants - guint16 id; - // ins->opcode - int op; - // ins->inst_c0 - int instc0; -} SimdIntrinsic; - -void -mono_simd_intrinsics_init (void) -{ - register_size = 16; -#if FALSE - if ((mini_get_cpu_features () & MONO_CPU_X86_AVX) != 0) - register_size = 32; -#endif - /* Tell the class init code the size of the System.Numerics.Register type */ - mono_simd_register_size = register_size; -} - -MonoInst* -mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr) -{ - return NULL; -} - -static int -simd_intrinsic_compare_by_name (const void *key, const void *value) -{ - return strcmp ((const char*)key, method_name (*(guint16*)value)); -} - -static int -simd_intrinsic_info_compare_by_name (const void *key, const void *value) -{ - SimdIntrinsic *info = (SimdIntrinsic*)value; - return strcmp ((const char*)key, method_name (info->id)); -} - -static int -lookup_intrins (guint16 *intrinsics, int size, MonoMethod *cmethod) -{ - const guint16 *result = (const guint16 *)mono_binary_search (cmethod->name, intrinsics, size / sizeof (guint16), sizeof (guint16), &simd_intrinsic_compare_by_name); - - if (result == NULL) - return -1; - else - return (int)*result; -} - -static SimdIntrinsic* -lookup_intrins_info (SimdIntrinsic *intrinsics, int size, MonoMethod *cmethod) -{ -#if 0 - for (int i = 0; i < (size / sizeof (SimdIntrinsic)) - 1; ++i) { - const char *n1 = method_name (intrinsics [i].id); - const char *n2 = method_name (intrinsics [i + 1].id); - int len1 = strlen (n1); - int len2 = strlen (n2); - for (int j = 0; j < len1 && j < len2; ++j) { - if (n1 [j] > n2 [j]) { - printf ("%s %s\n", n1, n2); - g_assert_not_reached (); - } else if (n1 [j] < n2 [j]) { - break; - } - } - } -#endif - - return (SimdIntrinsic *)mono_binary_search (cmethod->name, intrinsics, size / sizeof (SimdIntrinsic), sizeof (SimdIntrinsic), &simd_intrinsic_info_compare_by_name); -} - -/* - * Return a simd vreg for the simd value represented by SRC. - * SRC is the 'this' argument to methods. - * Set INDIRECT to TRUE if the value was loaded from memory. - */ -static int -load_simd_vreg_class (MonoCompile *cfg, MonoClass *klass, MonoInst *src, gboolean *indirect) -{ - const char *spec = INS_INFO (src->opcode); - - if (indirect) - *indirect = FALSE; - if (src->opcode == OP_XMOVE) { - return src->sreg1; - } else if (src->opcode == OP_LDADDR) { - int res = ((MonoInst*)src->inst_p0)->dreg; - return res; - } else if (spec [MONO_INST_DEST] == 'x') { - return src->dreg; - } else if (src->type == STACK_PTR || src->type == STACK_MP) { - MonoInst *ins; - if (indirect) - *indirect = TRUE; - - MONO_INST_NEW (cfg, ins, OP_LOADX_MEMBASE); - ins->klass = klass; - ins->sreg1 = src->dreg; - ins->type = STACK_VTYPE; - ins->dreg = alloc_ireg (cfg); - MONO_ADD_INS (cfg->cbb, ins); - return ins->dreg; - } - g_warning ("load_simd_vreg:: could not infer source simd (%d) vreg for op", src->type); - mono_print_ins (src); - g_assert_not_reached (); -} - -static int -load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *indirect) -{ - return load_simd_vreg_class (cfg, cmethod->klass, src, indirect); -} - -/* Create and emit a SIMD instruction, dreg is auto-allocated */ -static MonoInst* -emit_simd_ins (MonoCompile *cfg, MonoClass *klass, int opcode, int sreg1, int sreg2) -{ - const char *spec = INS_INFO (opcode); - MonoInst *ins; - - MONO_INST_NEW (cfg, ins, opcode); - if (spec [MONO_INST_DEST] == 'x') { - ins->dreg = alloc_xreg (cfg); - ins->type = STACK_VTYPE; - } else if (spec [MONO_INST_DEST] == 'i') { - ins->dreg = alloc_ireg (cfg); - ins->type = STACK_I4; - } else if (spec [MONO_INST_DEST] == 'l') { - ins->dreg = alloc_lreg (cfg); - ins->type = STACK_I8; - } else if (spec [MONO_INST_DEST] == 'f') { - ins->dreg = alloc_freg (cfg); - ins->type = STACK_R8; - } - ins->sreg1 = sreg1; - ins->sreg2 = sreg2; - ins->klass = klass; - MONO_ADD_INS (cfg->cbb, ins); - return ins; -} - -static MonoInst* -emit_simd_ins_for_sig (MonoCompile *cfg, MonoClass *klass, int opcode, int instc0, int instc1, MonoMethodSignature *fsig, MonoInst **args) -{ - g_assert (fsig->param_count <= 3); - MonoInst* ins = emit_simd_ins (cfg, klass, opcode, - fsig->param_count > 0 ? args [0]->dreg : -1, - fsig->param_count > 1 ? args [1]->dreg : -1); - if (instc0 != -1) - ins->inst_c0 = instc0; - if (instc1 != -1) - ins->inst_c1 = instc1; - if (fsig->param_count == 3) - ins->sreg3 = args [2]->dreg; - return ins; -} - -static gboolean -is_hw_intrinsics_class (MonoClass *klass, const char *name, gboolean *is_64bit) -{ - const char *class_name = m_class_get_name (klass); - if ((!strcmp (class_name, "X64") || !strcmp (class_name, "Arm64")) && m_class_get_nested_in (klass)) { - *is_64bit = TRUE; - return !strcmp (m_class_get_name (m_class_get_nested_in (klass)), name); - } else { - *is_64bit = FALSE; - return !strcmp (class_name, name); - } -} - -static MonoTypeEnum -get_underlying_type (MonoType* type) -{ - MonoClass* klass = mono_class_from_mono_type_internal (type); - if (type->type == MONO_TYPE_PTR) // e.g. int* => MONO_TYPE_I4 - return m_class_get_byval_arg (m_class_get_element_class (klass))->type; - else if (type->type == MONO_TYPE_GENERICINST) // e.g. Vector128 => MONO_TYPE_I4 - return mono_class_get_context (klass)->class_inst->type_argv [0]->type; - else - return type->type; -} - -static MonoInst* -emit_xcompare (MonoCompile *cfg, MonoClass *klass, MonoTypeEnum etype, MonoInst *arg1, MonoInst *arg2) -{ - MonoInst *ins; - gboolean is_fp = etype == MONO_TYPE_R4 || etype == MONO_TYPE_R8; - - ins = emit_simd_ins (cfg, klass, is_fp ? OP_XCOMPARE_FP : OP_XCOMPARE, arg1->dreg, arg2->dreg); - ins->inst_c0 = CMP_EQ; - ins->inst_c1 = etype; - return ins; -} - -static MonoType* -get_vector_t_elem_type (MonoType *vector_type) -{ - MonoClass *klass; - MonoType *etype; - - g_assert (vector_type->type == MONO_TYPE_GENERICINST); - klass = mono_class_from_mono_type_internal (vector_type); - g_assert ( - !strcmp (m_class_get_name (klass), "Vector`1") || - !strcmp (m_class_get_name (klass), "Vector128`1") || - !strcmp (m_class_get_name (klass), "Vector256`1")); - etype = mono_class_get_context (klass)->class_inst->type_argv [0]; - return etype; -} - -static MonoInst * -emit_arch_vector128_create_multi (MonoCompile *cfg, MonoMethodSignature *fsig, MonoClass *klass, MonoType *etype, MonoInst **args) -{ -#if defined(TARGET_AMD64) - MonoInst *ins, *load; - - // FIXME: Optimize this - MONO_INST_NEW (cfg, ins, OP_LOCALLOC_IMM); - ins->dreg = alloc_preg (cfg); - ins->inst_imm = 16; - MONO_ADD_INS (cfg->cbb, ins); - - int esize = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL); - int store_opcode = mono_type_to_store_membase (cfg, etype); - for (int i = 0; i < fsig->param_count; ++i) - MONO_EMIT_NEW_STORE_MEMBASE (cfg, store_opcode, ins->dreg, i * esize, args [i]->dreg); - - load = emit_simd_ins (cfg, klass, OP_SSE_LOADU, ins->dreg, -1); - load->inst_c0 = 16; - load->inst_c1 = get_underlying_type (etype); - return load; -#else - return NULL; -#endif -} - -#if defined(TARGET_AMD64) || defined(TARGET_ARM64) - -static int -type_to_expand_op (MonoType *type) -{ - switch (type->type) { - case MONO_TYPE_I1: - case MONO_TYPE_U1: - return OP_EXPAND_I1; - case MONO_TYPE_I2: - case MONO_TYPE_U2: - return OP_EXPAND_I2; - case MONO_TYPE_I4: - case MONO_TYPE_U4: - return OP_EXPAND_I4; - case MONO_TYPE_I8: - case MONO_TYPE_U8: - return OP_EXPAND_I8; - case MONO_TYPE_R4: - return OP_EXPAND_R4; - case MONO_TYPE_R8: - return OP_EXPAND_R8; - default: - g_assert_not_reached (); - } -} - -static guint16 vector_128_methods [] = { - SN_AsByte, - SN_AsDouble, - SN_AsInt16, - SN_AsInt32, - SN_AsInt64, - SN_AsSByte, - SN_AsSingle, - SN_AsUInt16, - SN_AsUInt32, - SN_AsUInt64, - SN_Create, - SN_CreateScalarUnsafe, -}; - -static MonoInst* -emit_vector128 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - if (!COMPILE_LLVM (cfg)) - return NULL; - - MonoClass *klass = cmethod->klass; - int id = lookup_intrins (vector_128_methods, sizeof (vector_128_methods), cmethod); - if (id == -1) - return NULL; - - if (!strcmp (m_class_get_name (cfg->method->klass), "Vector256")) - return NULL; // TODO: Fix Vector256.WithUpper/WithLower - - MonoTypeEnum arg0_type = fsig->param_count > 0 ? get_underlying_type (fsig->params [0]) : MONO_TYPE_VOID; - - switch (id) { - case SN_AsByte: - case SN_AsDouble: - case SN_AsInt16: - case SN_AsInt32: - case SN_AsInt64: - case SN_AsSByte: - case SN_AsSingle: - case SN_AsUInt16: - case SN_AsUInt32: - case SN_AsUInt64: - return emit_simd_ins (cfg, klass, OP_XCAST, args [0]->dreg, -1); - case SN_Create: { - MonoType *etype = get_vector_t_elem_type (fsig->ret); - if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype)) - return emit_simd_ins (cfg, klass, type_to_expand_op (etype), args [0]->dreg, -1); - else - return emit_arch_vector128_create_multi (cfg, fsig, klass, etype, args); - } - case SN_CreateScalarUnsafe: - return emit_simd_ins_for_sig (cfg, klass, OP_CREATE_SCALAR_UNSAFE, -1, arg0_type, fsig, args); - default: - break; - } - - return NULL; -} - -#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64) - -#ifdef TARGET_AMD64 - -static guint16 vector_methods [] = { - SN_ConvertToDouble, - SN_ConvertToInt32, - SN_ConvertToInt64, - SN_ConvertToSingle, - SN_ConvertToUInt32, - SN_ConvertToUInt64, - SN_Narrow, - SN_Widen, - SN_get_IsHardwareAccelerated, -}; - -static MonoInst* -emit_sys_numerics_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *ins; - gboolean supported = FALSE; - int id; - MonoType *etype; - - id = lookup_intrins (vector_methods, sizeof (vector_methods), cmethod); - if (id == -1) - return NULL; - - //printf ("%s\n", mono_method_full_name (cmethod, 1)); - -#ifdef MONO_ARCH_SIMD_INTRINSICS - supported = TRUE; -#endif - - if (cfg->verbose_level > 1) { - char *name = mono_method_full_name (cmethod, TRUE); - printf (" SIMD intrinsic %s\n", name); - g_free (name); - } - - switch (id) { - case SN_get_IsHardwareAccelerated: - EMIT_NEW_ICONST (cfg, ins, supported ? 1 : 0); - ins->type = STACK_I4; - return ins; - case SN_ConvertToInt32: - etype = get_vector_t_elem_type (fsig->params [0]); - g_assert (etype->type == MONO_TYPE_R4); - return emit_simd_ins (cfg, mono_class_from_mono_type_internal (fsig->ret), OP_CVTPS2DQ, args [0]->dreg, -1); - case SN_ConvertToSingle: - etype = get_vector_t_elem_type (fsig->params [0]); - g_assert (etype->type == MONO_TYPE_I4 || etype->type == MONO_TYPE_U4); - // FIXME: - if (etype->type == MONO_TYPE_U4) - return NULL; - return emit_simd_ins (cfg, mono_class_from_mono_type_internal (fsig->ret), OP_CVTDQ2PS, args [0]->dreg, -1); - case SN_ConvertToDouble: - case SN_ConvertToInt64: - case SN_ConvertToUInt32: - case SN_ConvertToUInt64: - case SN_Narrow: - case SN_Widen: - // FIXME: - break; - default: - break; - } - - return NULL; -} - -static guint16 vector_t_methods [] = { - SN_ctor, - SN_CopyTo, - SN_Equals, - SN_GreaterThan, - SN_GreaterThanOrEqual, - SN_LessThan, - SN_LessThanOrEqual, - SN_Max, - SN_Min, - SN_get_AllBitsSet, - SN_get_Count, - SN_get_Item, - SN_get_One, - SN_get_Zero, - SN_op_Addition, - SN_op_BitwiseAnd, - SN_op_BitwiseOr, - SN_op_Division, - SN_op_Equality, - SN_op_ExclusiveOr, - SN_op_Explicit, - SN_op_Inequality, - SN_op_Multiply, - SN_op_Subtraction -}; - -static MonoInst* -emit_sys_numerics_vector_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *ins; - MonoType *type, *etype; - MonoClass *klass; - int size, len, id; - gboolean is_unsigned; - - static const float r4_one = 1.0f; - static const double r8_one = 1.0; - - id = lookup_intrins (vector_t_methods, sizeof (vector_t_methods), cmethod); - if (id == -1) - return NULL; - - klass = cmethod->klass; - type = m_class_get_byval_arg (klass); - etype = mono_class_get_context (klass)->class_inst->type_argv [0]; - size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL); - g_assert (size); - len = register_size / size; - - if (!MONO_TYPE_IS_PRIMITIVE (etype) || etype->type == MONO_TYPE_CHAR || etype->type == MONO_TYPE_BOOLEAN) - return NULL; - - if (cfg->verbose_level > 1) { - char *name = mono_method_full_name (cmethod, TRUE); - printf (" SIMD intrinsic %s\n", name); - g_free (name); - } - - switch (id) { - case SN_get_Count: - if (!(fsig->param_count == 0 && fsig->ret->type == MONO_TYPE_I4)) - break; - EMIT_NEW_ICONST (cfg, ins, len); - return ins; - case SN_get_Zero: - g_assert (fsig->param_count == 0 && mono_metadata_type_equal (fsig->ret, type)); - return emit_simd_ins (cfg, klass, OP_XZERO, -1, -1); - case SN_get_One: { - g_assert (fsig->param_count == 0 && mono_metadata_type_equal (fsig->ret, type)); - MonoInst *one = NULL; - int expand_opcode = type_to_expand_op (etype); - MONO_INST_NEW (cfg, one, -1); - switch (expand_opcode) { - case OP_EXPAND_R4: - one->opcode = OP_R4CONST; - one->type = STACK_R4; - one->inst_p0 = (void *) &r4_one; - break; - case OP_EXPAND_R8: - one->opcode = OP_R8CONST; - one->type = STACK_R8; - one->inst_p0 = (void *) &r8_one; - break; - default: - one->opcode = OP_ICONST; - one->type = STACK_I4; - one->inst_c0 = 1; - break; - } - one->dreg = alloc_dreg (cfg, (MonoStackType)one->type); - MONO_ADD_INS (cfg->cbb, one); - return emit_simd_ins (cfg, klass, expand_opcode, one->dreg, -1); - } - case SN_get_AllBitsSet: { - /* Compare a zero vector with itself */ - ins = emit_simd_ins (cfg, klass, OP_XZERO, -1, -1); - return emit_xcompare (cfg, klass, etype->type, ins, ins); - } - case SN_get_Item: { - if (!COMPILE_LLVM (cfg)) - return NULL; - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, args [1]->dreg, len); - MONO_EMIT_NEW_COND_EXC (cfg, GE_UN, "IndexOutOfRangeException"); - int opcode = -1; - int dreg; - gboolean is64 = FALSE; - switch (etype->type) { - case MONO_TYPE_I8: - case MONO_TYPE_U8: - opcode = OP_XEXTRACT_I64; - is64 = TRUE; - dreg = alloc_lreg (cfg); - break; - case MONO_TYPE_R8: - opcode = OP_XEXTRACT_R8; - dreg = alloc_freg (cfg); - break; - case MONO_TYPE_R4: - g_assert (cfg->r4fp); - opcode = OP_XEXTRACT_R4; - dreg = alloc_freg (cfg); - break; - default: - opcode = OP_XEXTRACT_I32; - dreg = alloc_ireg (cfg); - break; - } - MONO_INST_NEW (cfg, ins, opcode); - ins->dreg = dreg; - ins->sreg1 = load_simd_vreg (cfg, cmethod, args [0], NULL); - ins->sreg2 = args [1]->dreg; - ins->inst_c0 = etype->type; - mini_type_to_eval_stack_type (cfg, etype, ins); - MONO_ADD_INS (cfg->cbb, ins); - return ins; - } - case SN_ctor: - if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype)) { - int dreg = load_simd_vreg (cfg, cmethod, args [0], NULL); - - int opcode = type_to_expand_op (etype); - ins = emit_simd_ins (cfg, klass, opcode, args [1]->dreg, -1); - ins->dreg = dreg; - return ins; - } - if ((fsig->param_count == 1 || fsig->param_count == 2) && (fsig->params [0]->type == MONO_TYPE_SZARRAY)) { - MonoInst *array_ins = args [1]; - MonoInst *index_ins; - MonoInst *ldelema_ins; - MonoInst *var; - int end_index_reg; - - if (args [0]->opcode != OP_LDADDR) - return NULL; - - /* .ctor (T[]) or .ctor (T[], index) */ - - if (fsig->param_count == 2) { - index_ins = args [2]; - } else { - EMIT_NEW_ICONST (cfg, index_ins, 0); - } - - /* Emit index check for the end (index + len - 1 < array length) */ - end_index_reg = alloc_ireg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, OP_IADD_IMM, end_index_reg, index_ins->dreg, len - 1); - MONO_EMIT_BOUNDS_CHECK (cfg, array_ins->dreg, MonoArray, max_length, end_index_reg); - - /* Load the array slice into the simd reg */ - ldelema_ins = mini_emit_ldelema_1_ins (cfg, mono_class_from_mono_type_internal (etype), array_ins, index_ins, TRUE, FALSE); - g_assert (args [0]->opcode == OP_LDADDR); - var = (MonoInst*)args [0]->inst_p0; - EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOADX_MEMBASE, var->dreg, ldelema_ins->dreg, 0); - ins->klass = cmethod->klass; - return args [0]; - } - break; - case SN_CopyTo: - if ((fsig->param_count == 1 || fsig->param_count == 2) && (fsig->params [0]->type == MONO_TYPE_SZARRAY)) { - MonoInst *array_ins = args [1]; - MonoInst *index_ins; - MonoInst *ldelema_ins; - int val_vreg, end_index_reg; - - val_vreg = load_simd_vreg (cfg, cmethod, args [0], NULL); - - /* CopyTo (T[]) or CopyTo (T[], index) */ - - if (fsig->param_count == 2) { - index_ins = args [2]; - } else { - EMIT_NEW_ICONST (cfg, index_ins, 0); - } - - /* CopyTo () does complicated argument checks */ - mini_emit_bounds_check_offset (cfg, array_ins->dreg, MONO_STRUCT_OFFSET (MonoArray, max_length), index_ins->dreg, "ArgumentOutOfRangeException"); - end_index_reg = alloc_ireg (cfg); - int len_reg = alloc_ireg (cfg); - MONO_EMIT_NEW_LOAD_MEMBASE_OP_FLAGS (cfg, OP_LOADI4_MEMBASE, len_reg, array_ins->dreg, MONO_STRUCT_OFFSET (MonoArray, max_length), MONO_INST_INVARIANT_LOAD); - EMIT_NEW_BIALU (cfg, ins, OP_ISUB, end_index_reg, len_reg, index_ins->dreg); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, end_index_reg, len); - MONO_EMIT_NEW_COND_EXC (cfg, LT, "ArgumentException"); - - /* Load the array slice into the simd reg */ - ldelema_ins = mini_emit_ldelema_1_ins (cfg, mono_class_from_mono_type_internal (etype), array_ins, index_ins, FALSE, FALSE); - EMIT_NEW_STORE_MEMBASE (cfg, ins, OP_STOREX_MEMBASE, ldelema_ins->dreg, 0, val_vreg); - ins->klass = cmethod->klass; - return ins; - } - break; - case SN_Equals: - if (fsig->param_count == 1 && fsig->ret->type == MONO_TYPE_BOOLEAN && mono_metadata_type_equal (fsig->params [0], type)) { - int sreg1 = load_simd_vreg (cfg, cmethod, args [0], NULL); - - return emit_simd_ins (cfg, klass, OP_XEQUAL, sreg1, args [1]->dreg); - } else if (fsig->param_count == 2 && mono_metadata_type_equal (fsig->ret, type) && mono_metadata_type_equal (fsig->params [0], type) && mono_metadata_type_equal (fsig->params [1], type)) { - /* Per element equality */ - return emit_xcompare (cfg, klass, etype->type, args [0], args [1]); - } - break; - case SN_op_Equality: - case SN_op_Inequality: - g_assert (fsig->param_count == 2 && fsig->ret->type == MONO_TYPE_BOOLEAN && - mono_metadata_type_equal (fsig->params [0], type) && - mono_metadata_type_equal (fsig->params [1], type)); - ins = emit_simd_ins (cfg, klass, OP_XEQUAL, args [0]->dreg, args [1]->dreg); - if (id == SN_op_Inequality) { - int sreg = ins->dreg; - int dreg = alloc_ireg (cfg); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, sreg, 0); - EMIT_NEW_UNALU (cfg, ins, OP_CEQ, dreg, -1); - } - return ins; - case SN_GreaterThan: - case SN_GreaterThanOrEqual: - case SN_LessThan: - case SN_LessThanOrEqual: - g_assert (fsig->param_count == 2 && mono_metadata_type_equal (fsig->ret, type) && mono_metadata_type_equal (fsig->params [0], type) && mono_metadata_type_equal (fsig->params [1], type)); - is_unsigned = etype->type == MONO_TYPE_U1 || etype->type == MONO_TYPE_U2 || etype->type == MONO_TYPE_U4 || etype->type == MONO_TYPE_U8; - ins = emit_xcompare (cfg, klass, etype->type, args [0], args [1]); - switch (id) { - case SN_GreaterThan: - ins->inst_c0 = is_unsigned ? CMP_GT_UN : CMP_GT; - break; - case SN_GreaterThanOrEqual: - ins->inst_c0 = is_unsigned ? CMP_GE_UN : CMP_GE; - break; - case SN_LessThan: - ins->inst_c0 = is_unsigned ? CMP_LT_UN : CMP_LT; - break; - case SN_LessThanOrEqual: - ins->inst_c0 = is_unsigned ? CMP_LE_UN : CMP_LE; - break; - default: - g_assert_not_reached (); - } - return ins; - case SN_op_Explicit: - return emit_simd_ins (cfg, klass, OP_XCAST, args [0]->dreg, -1); - case SN_op_Addition: - case SN_op_Subtraction: - case SN_op_Division: - case SN_op_Multiply: - case SN_op_BitwiseAnd: - case SN_op_BitwiseOr: - case SN_op_ExclusiveOr: - case SN_Max: - case SN_Min: - if (!(fsig->param_count == 2 && mono_metadata_type_equal (fsig->ret, type) && mono_metadata_type_equal (fsig->params [0], type) && mono_metadata_type_equal (fsig->params [1], type))) - return NULL; - ins = emit_simd_ins (cfg, klass, OP_XBINOP, args [0]->dreg, args [1]->dreg); - ins->inst_c1 = etype->type; - - if (etype->type == MONO_TYPE_R4 || etype->type == MONO_TYPE_R8) { - switch (id) { - case SN_op_Addition: - ins->inst_c0 = OP_FADD; - break; - case SN_op_Subtraction: - ins->inst_c0 = OP_FSUB; - break; - case SN_op_Multiply: - ins->inst_c0 = OP_FMUL; - break; - case SN_op_Division: - ins->inst_c0 = OP_FDIV; - break; - case SN_Max: - ins->inst_c0 = OP_FMAX; - break; - case SN_Min: - ins->inst_c0 = OP_FMIN; - break; - default: - NULLIFY_INS (ins); - return NULL; - } - } else { - switch (id) { - case SN_op_Addition: - ins->inst_c0 = OP_IADD; - break; - case SN_op_Subtraction: - ins->inst_c0 = OP_ISUB; - break; - /* - case SN_op_Division: - ins->inst_c0 = OP_IDIV; - break; - case SN_op_Multiply: - ins->inst_c0 = OP_IMUL; - break; - */ - case SN_op_BitwiseAnd: - ins->inst_c0 = OP_IAND; - break; - case SN_op_BitwiseOr: - ins->inst_c0 = OP_IOR; - break; - case SN_op_ExclusiveOr: - ins->inst_c0 = OP_IXOR; - break; - case SN_Max: - ins->inst_c0 = OP_IMAX; - break; - case SN_Min: - ins->inst_c0 = OP_IMIN; - break; - default: - NULLIFY_INS (ins); - return NULL; - } - } - return ins; - default: - break; - } - - return NULL; -} -#endif // TARGET_AMD64 - -static MonoInst* -emit_invalid_operation (MonoCompile *cfg, const char* message) -{ - mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); - mono_error_set_generic_error (cfg->error, "System", "InvalidOperationException", "%s", message); - return NULL; -} - -#ifdef TARGET_ARM64 - - -static SimdIntrinsic armbase_methods [] = { - {SN_LeadingSignCount}, - {SN_LeadingZeroCount}, - {SN_MultiplyHigh}, - {SN_ReverseElementBits}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic crc32_methods [] = { - {SN_ComputeCrc32}, - {SN_ComputeCrc32C}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sha1_methods [] = { - {SN_FixedRotate, OP_XOP_X_X, SIMD_OP_ARM64_SHA1H}, - {SN_HashUpdateChoose, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA1C}, - {SN_HashUpdateMajority, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA1M}, - {SN_HashUpdateParity, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA1P}, - {SN_ScheduleUpdate0, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA1SU0}, - {SN_ScheduleUpdate1, OP_XOP_X_X_X, SIMD_OP_ARM64_SHA1SU1}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sha256_methods [] = { - {SN_HashUpdate1, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA256H}, - {SN_HashUpdate2, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA256H2}, - {SN_ScheduleUpdate0, OP_XOP_X_X_X, SIMD_OP_ARM64_SHA256SU0}, - {SN_ScheduleUpdate1, OP_XOP_X_X_X_X, SIMD_OP_ARM64_SHA256SU1}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic advsimd_methods [] = { - {SN_Abs} -}; - -static MonoInst* -emit_arm64_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - // Arm64 intrinsics are LLVM-only - if (!COMPILE_LLVM (cfg)) - return NULL; - - MonoInst *ins; - gboolean supported, is_64bit; - MonoClass *klass = cmethod->klass; - MonoTypeEnum arg0_type = fsig->param_count > 0 ? get_underlying_type (fsig->params [0]) : MONO_TYPE_VOID; - gboolean arg0_i32 = (arg0_type == MONO_TYPE_I4) || (arg0_type == MONO_TYPE_U4); - SimdIntrinsic *info; - MonoCPUFeatures feature = -1; - SimdIntrinsic *intrinsics = NULL; - int intrinsics_size; - int id = -1; - gboolean jit_supported = FALSE; - - if (is_hw_intrinsics_class (klass, "ArmBase", &is_64bit)) { - info = lookup_intrins_info (armbase_methods, sizeof (armbase_methods), cmethod); - if (!info) - return NULL; - - supported = (mini_get_cpu_features (cfg) & MONO_CPU_ARM64_BASE) != 0; - - switch (info->id) { - case SN_get_IsSupported: - EMIT_NEW_ICONST (cfg, ins, supported ? 1 : 0); - ins->type = STACK_I4; - return ins; - case SN_LeadingZeroCount: - return emit_simd_ins_for_sig (cfg, klass, arg0_i32 ? OP_LZCNT32 : OP_LZCNT64, 0, arg0_type, fsig, args); - case SN_LeadingSignCount: - return emit_simd_ins_for_sig (cfg, klass, arg0_i32 ? OP_LSCNT32 : OP_LSCNT64, 0, arg0_type, fsig, args); - case SN_MultiplyHigh: - return emit_simd_ins_for_sig (cfg, klass, - (arg0_type == MONO_TYPE_I8 ? OP_ARM64_SMULH : OP_ARM64_UMULH), 0, arg0_type, fsig, args); - case SN_ReverseElementBits: - return emit_simd_ins_for_sig (cfg, klass, - (is_64bit ? OP_XOP_I8_I8 : OP_XOP_I4_I4), - (is_64bit ? SIMD_OP_ARM64_RBIT64 : SIMD_OP_ARM64_RBIT32), - arg0_type, fsig, args); - default: - g_assert_not_reached (); // if a new API is added we need to either implement it or change IsSupported to false - } - } - - if (is_hw_intrinsics_class (klass, "Crc32", &is_64bit)) { - info = lookup_intrins_info (crc32_methods, sizeof (crc32_methods), cmethod); - if (!info) - return NULL; - - supported = (mini_get_cpu_features (cfg) & MONO_CPU_ARM64_CRC) != 0; - - switch (info->id) { - case SN_get_IsSupported: - EMIT_NEW_ICONST (cfg, ins, supported ? 1 : 0); - ins->type = STACK_I4; - return ins; - case SN_ComputeCrc32: - case SN_ComputeCrc32C: { - SimdOp op = (SimdOp)0; - gboolean is_c = info->id == SN_ComputeCrc32C; - switch (get_underlying_type (fsig->params [1])) { - case MONO_TYPE_U1: op = is_c ? SIMD_OP_ARM64_CRC32CB : SIMD_OP_ARM64_CRC32B; break; - case MONO_TYPE_U2: op = is_c ? SIMD_OP_ARM64_CRC32CH : SIMD_OP_ARM64_CRC32H; break; - case MONO_TYPE_U4: op = is_c ? SIMD_OP_ARM64_CRC32CW : SIMD_OP_ARM64_CRC32W; break; - case MONO_TYPE_U8: op = is_c ? SIMD_OP_ARM64_CRC32CX : SIMD_OP_ARM64_CRC32X; break; - default: g_assert_not_reached (); break; - } - return emit_simd_ins_for_sig (cfg, klass, is_64bit ? OP_XOP_I4_I4_I8 : OP_XOP_I4_I4_I4, op, arg0_type, fsig, args); - } - default: - g_assert_not_reached (); // if a new API is added we need to either implement it or change IsSupported to false - } - } - - if (is_hw_intrinsics_class (klass, "Sha256", &is_64bit)) { - feature = MONO_CPU_ARM64_CRYPTO; - intrinsics = sha256_methods; - intrinsics_size = sizeof (sha256_methods); - } - - if (is_hw_intrinsics_class (klass, "Sha1", &is_64bit)) { - feature = MONO_CPU_ARM64_CRYPTO; - intrinsics = sha1_methods; - intrinsics_size = sizeof (sha1_methods); - } - - /* - * Common logic for all instruction sets - */ - if (intrinsics) { - if (!COMPILE_LLVM (cfg) && !jit_supported) - return NULL; - info = lookup_intrins_info (intrinsics, intrinsics_size, cmethod); - if (!info) - return NULL; - id = info->id; - - if (feature) - supported = (mini_get_cpu_features (cfg) & feature) != 0; - else - supported = TRUE; - if (id == SN_get_IsSupported) { - EMIT_NEW_ICONST (cfg, ins, supported ? 1 : 0); - return ins; - } - - if (!supported && cfg->compile_aot) { - // Can't emit non-supported llvm intrinsics - if (cfg->method != cmethod) { - // Keep the original call so we end up in the intrinsic method - return NULL; - } else { - // Emit an exception from the intrinsic method - mono_emit_jit_icall (cfg, mono_throw_not_supported, NULL); - return NULL; - } - } - - if (info->op != 0) - return emit_simd_ins_for_sig (cfg, klass, info->op, info->instc0, arg0_type, fsig, args); - } - - if (is_hw_intrinsics_class (klass, "AdvSimd", &is_64bit)) { - info = lookup_intrins_info (advsimd_methods, sizeof (advsimd_methods), cmethod); - - if (!info) - return NULL; - - supported = (mini_get_cpu_features (cfg) & MONO_CPU_ARM64_ADVSIMD) != 0; - - switch (info -> id) { - case SN_Abs: { - SimdOp op = (SimdOp)0; - switch (get_underlying_type (fsig->params [0])) { - case MONO_TYPE_R8: - op = SIMD_OP_LLVM_DABS; - break; - case MONO_TYPE_R4: - op = SIMD_OP_LLVM_FABS; - break; - case MONO_TYPE_I1: - op = SIMD_OP_LLVM_I8ABS; - break; - case MONO_TYPE_I2: - op = SIMD_OP_LLVM_I16ABS; - break; - case MONO_TYPE_I4: - op = SIMD_OP_LLVM_I32ABS; - break; - case MONO_TYPE_I8: - op = SIMD_OP_LLVM_I64ABS; - break; - } - - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X, op, arg0_type, fsig, args); - } - } - - } - - return NULL; -} -#endif // TARGET_ARM64 - -#ifdef TARGET_AMD64 - -static SimdIntrinsic sse_methods [] = { - {SN_Add, OP_XBINOP, OP_FADD}, - {SN_AddScalar, OP_SSE_ADDSS}, - {SN_And, OP_SSE_AND}, - {SN_AndNot, OP_SSE_ANDN}, - {SN_CompareEqual, OP_XCOMPARE_FP, CMP_EQ}, - {SN_CompareGreaterThan, OP_XCOMPARE_FP,CMP_GT}, - {SN_CompareGreaterThanOrEqual, OP_XCOMPARE_FP, CMP_GE}, - {SN_CompareLessThan, OP_XCOMPARE_FP, CMP_LT}, - {SN_CompareLessThanOrEqual, OP_XCOMPARE_FP, CMP_LE}, - {SN_CompareNotEqual, OP_XCOMPARE_FP, CMP_NE}, - {SN_CompareNotGreaterThan, OP_XCOMPARE_FP, CMP_LE}, - {SN_CompareNotGreaterThanOrEqual, OP_XCOMPARE_FP, CMP_LT}, - {SN_CompareNotLessThan, OP_XCOMPARE_FP, CMP_GE}, - {SN_CompareNotLessThanOrEqual, OP_XCOMPARE_FP, CMP_GT}, - {SN_CompareOrdered, OP_XCOMPARE_FP, CMP_ORD}, - {SN_CompareScalarEqual, OP_SSE_CMPSS, CMP_EQ}, - {SN_CompareScalarGreaterThan, OP_SSE_CMPSS, CMP_GT}, - {SN_CompareScalarGreaterThanOrEqual, OP_SSE_CMPSS, CMP_GE}, - {SN_CompareScalarLessThan, OP_SSE_CMPSS, CMP_LT}, - {SN_CompareScalarLessThanOrEqual, OP_SSE_CMPSS, CMP_LE}, - {SN_CompareScalarNotEqual, OP_SSE_CMPSS, CMP_NE}, - {SN_CompareScalarNotGreaterThan, OP_SSE_CMPSS, CMP_LE}, - {SN_CompareScalarNotGreaterThanOrEqual, OP_SSE_CMPSS, CMP_LT}, - {SN_CompareScalarNotLessThan, OP_SSE_CMPSS, CMP_GE}, - {SN_CompareScalarNotLessThanOrEqual, OP_SSE_CMPSS, CMP_GT}, - {SN_CompareScalarOrdered, OP_SSE_CMPSS, CMP_ORD}, - {SN_CompareScalarOrderedEqual, OP_SSE_COMISS, CMP_EQ}, - {SN_CompareScalarOrderedGreaterThan, OP_SSE_COMISS, CMP_GT}, - {SN_CompareScalarOrderedGreaterThanOrEqual, OP_SSE_COMISS, CMP_GE}, - {SN_CompareScalarOrderedLessThan, OP_SSE_COMISS, CMP_LT}, - {SN_CompareScalarOrderedLessThanOrEqual, OP_SSE_COMISS, CMP_LE}, - {SN_CompareScalarOrderedNotEqual, OP_SSE_COMISS, CMP_NE}, - {SN_CompareScalarUnordered, OP_SSE_CMPSS, CMP_UNORD}, - {SN_CompareScalarUnorderedEqual, OP_SSE_UCOMISS, CMP_EQ}, - {SN_CompareScalarUnorderedGreaterThan, OP_SSE_UCOMISS, CMP_GT}, - {SN_CompareScalarUnorderedGreaterThanOrEqual, OP_SSE_UCOMISS, CMP_GE}, - {SN_CompareScalarUnorderedLessThan, OP_SSE_UCOMISS, CMP_LT}, - {SN_CompareScalarUnorderedLessThanOrEqual, OP_SSE_UCOMISS, CMP_LE}, - {SN_CompareScalarUnorderedNotEqual, OP_SSE_UCOMISS, CMP_NE}, - {SN_CompareUnordered, OP_XCOMPARE_FP, CMP_UNORD}, - {SN_ConvertScalarToVector128Single}, - {SN_ConvertToInt32, OP_XOP_I4_X, SIMD_OP_SSE_CVTSS2SI}, - {SN_ConvertToInt32WithTruncation, OP_XOP_I4_X, SIMD_OP_SSE_CVTTSS2SI}, - {SN_ConvertToInt64, OP_XOP_I8_X, SIMD_OP_SSE_CVTSS2SI64}, - {SN_ConvertToInt64WithTruncation, OP_XOP_I8_X, SIMD_OP_SSE_CVTTSS2SI64}, - {SN_Divide, OP_XBINOP, OP_FDIV}, - {SN_DivideScalar, OP_SSE_DIVSS}, - {SN_LoadAlignedVector128, OP_SSE_LOADU, 16 /* alignment */}, - {SN_LoadHigh, OP_SSE_MOVHPS_LOAD}, - {SN_LoadLow, OP_SSE_MOVLPS_LOAD}, - {SN_LoadScalarVector128, OP_SSE_MOVSS}, - {SN_LoadVector128, OP_SSE_LOADU, 1 /* alignment */}, - {SN_Max, OP_XOP_X_X_X, SIMD_OP_SSE_MAXPS}, - {SN_MaxScalar, OP_XOP_X_X_X, SIMD_OP_SSE_MAXSS}, - {SN_Min, OP_XOP_X_X_X, SIMD_OP_SSE_MINPS}, - {SN_MinScalar, OP_XOP_X_X_X, SIMD_OP_SSE_MINSS}, - {SN_MoveHighToLow, OP_SSE_MOVEHL}, - {SN_MoveLowToHigh, OP_SSE_MOVELH}, - {SN_MoveMask, OP_SSE_MOVMSK}, - {SN_MoveScalar, OP_SSE_MOVS2}, - {SN_Multiply, OP_XBINOP, OP_FMUL}, - {SN_MultiplyScalar, OP_SSE_MULSS}, - {SN_Or, OP_SSE_OR}, - {SN_Prefetch0, OP_SSE_PREFETCHT0}, - {SN_Prefetch1, OP_SSE_PREFETCHT1}, - {SN_Prefetch2, OP_SSE_PREFETCHT2}, - {SN_PrefetchNonTemporal, OP_SSE_PREFETCHNTA}, - {SN_Reciprocal, OP_XOP_X_X, SIMD_OP_SSE_RCPPS}, - {SN_ReciprocalScalar}, - {SN_ReciprocalSqrt, OP_XOP_X_X, SIMD_OP_SSE_RSQRTPS}, - {SN_ReciprocalSqrtScalar}, - {SN_Shuffle}, - {SN_Sqrt, OP_XOP_X_X, SIMD_OP_SSE_SQRTPS}, - {SN_SqrtScalar}, - {SN_Store, OP_SSE_STORE, 1 /* alignment */}, - {SN_StoreAligned, OP_SSE_STORE, 16 /* alignment */}, - {SN_StoreAlignedNonTemporal, OP_SSE_MOVNTPS, 16 /* alignment */}, - {SN_StoreFence, OP_XOP, SIMD_OP_SSE_SFENCE}, - {SN_StoreHigh, OP_SSE_MOVHPS_STORE}, - {SN_StoreLow, OP_SSE_MOVLPS_STORE}, - {SN_StoreScalar, OP_SSE_MOVSS_STORE}, - {SN_Subtract, OP_XBINOP, OP_FSUB}, - {SN_SubtractScalar, OP_SSE_SUBSS}, - {SN_UnpackHigh, OP_SSE_UNPACKHI}, - {SN_UnpackLow, OP_SSE_UNPACKLO}, - {SN_Xor, OP_SSE_XOR}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sse2_methods [] = { - {SN_Add}, - {SN_AddSaturate, OP_SSE2_ADDS}, - {SN_AddScalar, OP_SSE2_ADDSD}, - {SN_And, OP_SSE_AND}, - {SN_AndNot, OP_SSE_ANDN}, - {SN_Average}, - {SN_CompareEqual}, - {SN_CompareGreaterThan}, - {SN_CompareGreaterThanOrEqual, OP_XCOMPARE_FP, CMP_GE}, - {SN_CompareLessThan}, - {SN_CompareLessThanOrEqual, OP_XCOMPARE_FP, CMP_LE}, - {SN_CompareNotEqual, OP_XCOMPARE_FP, CMP_NE}, - {SN_CompareNotGreaterThan, OP_XCOMPARE_FP, CMP_LE}, - {SN_CompareNotGreaterThanOrEqual, OP_XCOMPARE_FP, CMP_LT}, - {SN_CompareNotLessThan, OP_XCOMPARE_FP, CMP_GE}, - {SN_CompareNotLessThanOrEqual, OP_XCOMPARE_FP, CMP_GT}, - {SN_CompareOrdered, OP_XCOMPARE_FP, CMP_ORD}, - {SN_CompareScalarEqual, OP_SSE2_CMPSD, CMP_EQ}, - {SN_CompareScalarGreaterThan, OP_SSE2_CMPSD, CMP_GT}, - {SN_CompareScalarGreaterThanOrEqual, OP_SSE2_CMPSD, CMP_GE}, - {SN_CompareScalarLessThan, OP_SSE2_CMPSD, CMP_LT}, - {SN_CompareScalarLessThanOrEqual, OP_SSE2_CMPSD, CMP_LE}, - {SN_CompareScalarNotEqual, OP_SSE2_CMPSD, CMP_NE}, - {SN_CompareScalarNotGreaterThan, OP_SSE2_CMPSD, CMP_LE}, - {SN_CompareScalarNotGreaterThanOrEqual, OP_SSE2_CMPSD, CMP_LT}, - {SN_CompareScalarNotLessThan, OP_SSE2_CMPSD, CMP_GE}, - {SN_CompareScalarNotLessThanOrEqual, OP_SSE2_CMPSD, CMP_GT}, - {SN_CompareScalarOrdered, OP_SSE2_CMPSD, CMP_ORD}, - {SN_CompareScalarOrderedEqual, OP_SSE2_COMISD, CMP_EQ}, - {SN_CompareScalarOrderedGreaterThan, OP_SSE2_COMISD, CMP_GT}, - {SN_CompareScalarOrderedGreaterThanOrEqual, OP_SSE2_COMISD, CMP_GE}, - {SN_CompareScalarOrderedLessThan, OP_SSE2_COMISD, CMP_LT}, - {SN_CompareScalarOrderedLessThanOrEqual, OP_SSE2_COMISD, CMP_LE}, - {SN_CompareScalarOrderedNotEqual, OP_SSE2_COMISD, CMP_NE}, - {SN_CompareScalarUnordered, OP_SSE2_CMPSD, CMP_UNORD}, - {SN_CompareScalarUnorderedEqual, OP_SSE2_UCOMISD, CMP_EQ}, - {SN_CompareScalarUnorderedGreaterThan, OP_SSE2_UCOMISD, CMP_GT}, - {SN_CompareScalarUnorderedGreaterThanOrEqual, OP_SSE2_UCOMISD, CMP_GE}, - {SN_CompareScalarUnorderedLessThan, OP_SSE2_UCOMISD, CMP_LT}, - {SN_CompareScalarUnorderedLessThanOrEqual, OP_SSE2_UCOMISD, CMP_LE}, - {SN_CompareScalarUnorderedNotEqual, OP_SSE2_UCOMISD, CMP_NE}, - {SN_CompareUnordered, OP_XCOMPARE_FP, CMP_UNORD}, - {SN_ConvertScalarToVector128Double}, - {SN_ConvertScalarToVector128Int32}, - {SN_ConvertScalarToVector128Int64}, - {SN_ConvertScalarToVector128Single, OP_XOP_X_X_X, SIMD_OP_SSE_CVTSD2SS}, - {SN_ConvertScalarToVector128UInt32}, - {SN_ConvertScalarToVector128UInt64}, - {SN_ConvertToInt32}, - {SN_ConvertToInt32WithTruncation, OP_XOP_I4_X, SIMD_OP_SSE_CVTTSD2SI}, - {SN_ConvertToInt64}, - {SN_ConvertToInt64WithTruncation, OP_XOP_I8_X, SIMD_OP_SSE_CVTTSD2SI64}, - {SN_ConvertToUInt32}, - {SN_ConvertToUInt64}, - {SN_ConvertToVector128Double}, - {SN_ConvertToVector128Int32}, - {SN_ConvertToVector128Int32WithTruncation}, - {SN_ConvertToVector128Single}, - {SN_Divide, OP_XBINOP, OP_FDIV}, - {SN_DivideScalar, OP_SSE2_DIVSD}, - {SN_Extract}, - {SN_Insert}, - {SN_LoadAlignedVector128}, - {SN_LoadFence, OP_XOP, SIMD_OP_SSE_LFENCE}, - {SN_LoadHigh, OP_SSE2_MOVHPD_LOAD}, - {SN_LoadLow, OP_SSE2_MOVLPD_LOAD}, - {SN_LoadScalarVector128}, - {SN_LoadVector128}, - {SN_MaskMove, OP_SSE2_MASKMOVDQU}, - {SN_Max}, - {SN_MaxScalar, OP_XOP_X_X_X, SIMD_OP_SSE_MAXSD}, - {SN_MemoryFence, OP_XOP, SIMD_OP_SSE_MFENCE}, - {SN_Min}, // FIXME: - {SN_MinScalar, OP_XOP_X_X_X, SIMD_OP_SSE_MINSD}, - {SN_MoveMask, OP_SSE_MOVMSK}, - {SN_MoveScalar}, - {SN_Multiply}, - {SN_MultiplyAddAdjacent, OP_XOP_X_X_X, SIMD_OP_SSE_PMADDWD}, - {SN_MultiplyHigh}, - {SN_MultiplyLow, OP_PMULW}, - {SN_MultiplyScalar, OP_SSE2_MULSD}, - {SN_Or, OP_SSE_OR}, - {SN_PackSignedSaturate}, - {SN_PackUnsignedSaturate}, - {SN_ShiftLeftLogical}, - {SN_ShiftLeftLogical128BitLane}, - {SN_ShiftRightArithmetic}, - {SN_ShiftRightLogical}, - {SN_ShiftRightLogical128BitLane}, - {SN_Shuffle}, - {SN_ShuffleHigh}, - {SN_ShuffleLow}, - {SN_Sqrt, OP_XOP_X_X, SIMD_OP_SSE_SQRTPD}, - {SN_SqrtScalar}, - {SN_Store, OP_SSE_STORE, 1 /* alignment */}, - {SN_StoreAligned, OP_SSE_STORE, 16 /* alignment */}, - {SN_StoreAlignedNonTemporal, OP_SSE_MOVNTPS, 16 /* alignment */}, - {SN_StoreHigh, OP_SSE2_MOVHPD_STORE}, - {SN_StoreLow, OP_SSE2_MOVLPD_STORE}, - {SN_StoreNonTemporal, OP_SSE_MOVNTPS, 1 /* alignment */}, - {SN_StoreScalar, OP_SSE_STORES}, - {SN_Subtract}, - {SN_SubtractSaturate, OP_SSE2_SUBS}, - {SN_SubtractScalar, OP_SSE2_SUBSD}, - {SN_SumAbsoluteDifferences, OP_XOP_X_X_X, SIMD_OP_SSE_PSADBW}, - {SN_UnpackHigh, OP_SSE_UNPACKHI}, - {SN_UnpackLow, OP_SSE_UNPACKLO}, - {SN_Xor, OP_SSE_XOR}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sse3_methods [] = { - {SN_AddSubtract}, - {SN_HorizontalAdd}, - {SN_HorizontalSubtract}, - {SN_LoadAndDuplicateToVector128, OP_SSE3_MOVDDUP_MEM}, - {SN_LoadDquVector128, OP_XOP_X_I, SIMD_OP_SSE_LDDQU}, - {SN_MoveAndDuplicate, OP_SSE3_MOVDDUP}, - {SN_MoveHighAndDuplicate, OP_SSE3_MOVSHDUP}, - {SN_MoveLowAndDuplicate, OP_SSE3_MOVSLDUP}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic ssse3_methods [] = { - {SN_Abs, OP_SSSE3_ABS}, - {SN_AlignRight}, - {SN_HorizontalAdd}, - {SN_HorizontalAddSaturate, OP_XOP_X_X_X, SIMD_OP_SSE_PHADDSW}, - {SN_HorizontalSubtract}, - {SN_HorizontalSubtractSaturate, OP_XOP_X_X_X, SIMD_OP_SSE_PHSUBSW}, - {SN_MultiplyAddAdjacent, OP_XOP_X_X_X, SIMD_OP_SSE_PMADDUBSW}, - {SN_MultiplyHighRoundScale, OP_XOP_X_X_X, SIMD_OP_SSE_PMULHRSW}, - {SN_Shuffle, OP_SSSE3_SHUFFLE}, - {SN_Sign}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sse41_methods [] = { - {SN_Blend}, - {SN_BlendVariable}, - {SN_Ceiling, OP_SSE41_ROUNDP, 10 /*round mode*/}, - {SN_CeilingScalar, 0, 10 /*round mode*/}, - {SN_CompareEqual, OP_XCOMPARE, CMP_EQ}, - {SN_ConvertToVector128Int16, OP_SSE_CVTII, MONO_TYPE_I2}, - {SN_ConvertToVector128Int32, OP_SSE_CVTII, MONO_TYPE_I4}, - {SN_ConvertToVector128Int64, OP_SSE_CVTII, MONO_TYPE_I8}, - {SN_DotProduct}, - {SN_Extract}, - {SN_Floor, OP_SSE41_ROUNDP, 9 /*round mode*/}, - {SN_FloorScalar, 0, 9 /*round mode*/}, - {SN_Insert}, - {SN_LoadAlignedVector128NonTemporal, OP_SSE41_LOADANT}, - {SN_Max, OP_XBINOP, OP_IMAX}, - {SN_Min, OP_XBINOP, OP_IMIN}, - {SN_MinHorizontal, OP_XOP_X_X, SIMD_OP_SSE_PHMINPOSUW}, - {SN_MultipleSumAbsoluteDifferences}, - {SN_Multiply, OP_SSE41_MUL}, - {SN_MultiplyLow, OP_SSE41_MULLO}, - {SN_PackUnsignedSaturate, OP_XOP_X_X_X, SIMD_OP_SSE_PACKUSDW}, - {SN_RoundCurrentDirection, OP_SSE41_ROUNDP, 4 /*round mode*/}, - {SN_RoundCurrentDirectionScalar, 0, 4 /*round mode*/}, - {SN_RoundToNearestInteger, OP_SSE41_ROUNDP, 8 /*round mode*/}, - {SN_RoundToNearestIntegerScalar, 0, 8 /*round mode*/}, - {SN_RoundToNegativeInfinity, OP_SSE41_ROUNDP, 9 /*round mode*/}, - {SN_RoundToNegativeInfinityScalar, 0, 9 /*round mode*/}, - {SN_RoundToPositiveInfinity, OP_SSE41_ROUNDP, 10 /*round mode*/}, - {SN_RoundToPositiveInfinityScalar, 0, 10 /*round mode*/}, - {SN_RoundToZero, OP_SSE41_ROUNDP, 11 /*round mode*/}, - {SN_RoundToZeroScalar, 0, 11 /*round mode*/}, - {SN_TestC, OP_XOP_I4_X_X, SIMD_OP_SSE_TESTC}, - {SN_TestNotZAndNotC, OP_XOP_I4_X_X, SIMD_OP_SSE_TESTNZ}, - {SN_TestZ, OP_XOP_I4_X_X, SIMD_OP_SSE_TESTZ}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic sse42_methods [] = { - {SN_CompareGreaterThan, OP_XCOMPARE, CMP_GT}, - {SN_Crc32}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic pclmulqdq_methods [] = { - {SN_CarrylessMultiply}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic aes_methods [] = { - {SN_Decrypt, OP_XOP_X_X_X, SIMD_OP_AES_DEC}, - {SN_DecryptLast, OP_XOP_X_X_X, SIMD_OP_AES_DECLAST}, - {SN_Encrypt, OP_XOP_X_X_X, SIMD_OP_AES_ENC}, - {SN_EncryptLast, OP_XOP_X_X_X, SIMD_OP_AES_ENCLAST}, - {SN_InverseMixColumns, OP_XOP_X_X, SIMD_OP_AES_IMC}, - {SN_KeygenAssist}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic popcnt_methods [] = { - {SN_PopCount}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic lzcnt_methods [] = { - {SN_LeadingZeroCount}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic bmi1_methods [] = { - {SN_AndNot}, - {SN_BitFieldExtract}, - {SN_ExtractLowestSetBit}, - {SN_GetMaskUpToLowestSetBit}, - {SN_ResetLowestSetBit}, - {SN_TrailingZeroCount}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic bmi2_methods [] = { - {SN_MultiplyNoFlags}, - {SN_ParallelBitDeposit}, - {SN_ParallelBitExtract}, - {SN_ZeroHighBits}, - {SN_get_IsSupported} -}; - -static SimdIntrinsic x86base_methods [] = { - {SN_BitScanForward}, - {SN_BitScanReverse}, - {SN_get_IsSupported} -}; - -static MonoInst* -emit_x86_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *ins; - gboolean supported, is_64bit; - MonoClass *klass = cmethod->klass; - MonoTypeEnum arg0_type = fsig->param_count > 0 ? get_underlying_type (fsig->params [0]) : MONO_TYPE_VOID; - SimdIntrinsic *info = NULL; - MonoCPUFeatures feature = -1; - SimdIntrinsic *intrinsics = NULL; - int intrinsics_size; - int id = -1; - gboolean jit_supported = FALSE; - - if (is_hw_intrinsics_class (klass, "Sse", &is_64bit)) { - feature = MONO_CPU_X86_SSE; - intrinsics = sse_methods; - intrinsics_size = sizeof (sse_methods); - } else if (is_hw_intrinsics_class (klass, "Sse2", &is_64bit)) { - feature = MONO_CPU_X86_SSE2; - intrinsics = sse2_methods; - intrinsics_size = sizeof (sse2_methods); - } else if (is_hw_intrinsics_class (klass, "Sse3", &is_64bit)) { - feature = MONO_CPU_X86_SSE3; - intrinsics = sse3_methods; - intrinsics_size = sizeof (sse3_methods); - } else if (is_hw_intrinsics_class (klass, "Ssse3", &is_64bit)) { - feature = MONO_CPU_X86_SSSE3; - intrinsics = ssse3_methods; - intrinsics_size = sizeof (ssse3_methods); - } else if (is_hw_intrinsics_class (klass, "Sse41", &is_64bit)) { - feature = MONO_CPU_X86_SSE41; - intrinsics = sse41_methods; - intrinsics_size = sizeof (sse41_methods); - } else if (is_hw_intrinsics_class (klass, "Sse42", &is_64bit)) { - feature = MONO_CPU_X86_SSE42; - intrinsics = sse42_methods; - intrinsics_size = sizeof (sse42_methods); - } else if (is_hw_intrinsics_class (klass, "Pclmulqdq", &is_64bit)) { - feature = MONO_CPU_X86_PCLMUL; - intrinsics = pclmulqdq_methods; - intrinsics_size = sizeof (pclmulqdq_methods); - } else if (is_hw_intrinsics_class (klass, "Aes", &is_64bit)) { - feature = MONO_CPU_X86_AES; - intrinsics = aes_methods; - intrinsics_size = sizeof (aes_methods); - } else if (is_hw_intrinsics_class (klass, "Popcnt", &is_64bit)) { - feature = MONO_CPU_X86_POPCNT; - intrinsics = popcnt_methods; - intrinsics_size = sizeof (popcnt_methods); - jit_supported = TRUE; - } else if (is_hw_intrinsics_class (klass, "Lzcnt", &is_64bit)) { - feature = MONO_CPU_X86_LZCNT; - intrinsics = lzcnt_methods; - intrinsics_size = sizeof (lzcnt_methods); - jit_supported = TRUE; - } else if (is_hw_intrinsics_class (klass, "Bmi1", &is_64bit)) { - feature = MONO_CPU_X86_BMI1; - intrinsics = bmi1_methods; - intrinsics_size = sizeof (bmi1_methods); - } else if (is_hw_intrinsics_class (klass, "Bmi2", &is_64bit)) { - feature = MONO_CPU_X86_BMI2; - intrinsics = bmi2_methods; - intrinsics_size = sizeof (bmi2_methods); - } else if (is_hw_intrinsics_class (klass, "X86Base", &is_64bit)) { - feature = 0; - intrinsics = x86base_methods; - intrinsics_size = sizeof (x86base_methods); - } - - /* - * Common logic for all instruction sets - */ - if (intrinsics) { - if (!COMPILE_LLVM (cfg) && !jit_supported) - return NULL; - info = lookup_intrins_info (intrinsics, intrinsics_size, cmethod); - if (!info) - return NULL; - id = info->id; - - if (feature) - supported = (mini_get_cpu_features (cfg) & feature) != 0; - else - supported = TRUE; - if (id == SN_get_IsSupported) { - EMIT_NEW_ICONST (cfg, ins, supported ? 1 : 0); - return ins; - } - - if (!supported && cfg->compile_aot) { - /* Can't emit non-supported llvm intrinsics */ - if (cfg->method != cmethod) { - /* Keep the original call so we end up in the intrinsic method */ - return NULL; - } else { - /* Emit an exception from the intrinsic method */ - mono_emit_jit_icall (cfg, mono_throw_not_supported, NULL); - return NULL; - } - } - - if (info->op != 0) - return emit_simd_ins_for_sig (cfg, klass, info->op, info->instc0, arg0_type, fsig, args); - } - - /* - * Instruction set specific cases - */ - if (feature == MONO_CPU_X86_SSE) { - switch (id) { - case SN_Shuffle: - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE_SHUFFLE, args [2]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant mask (generate a switch) - return emit_invalid_operation (cfg, "mask in Sse.Shuffle must be constant"); - case SN_ConvertScalarToVector128Single: { - int op = 0; - switch (fsig->params [1]->type) { - case MONO_TYPE_I4: op = OP_SSE_CVTSI2SS; break; - case MONO_TYPE_I8: op = OP_SSE_CVTSI2SS64; break; - default: g_assert_not_reached (); break; - } - return emit_simd_ins_for_sig (cfg, klass, op, 0, 0, fsig, args); - } - case SN_ReciprocalScalar: - case SN_ReciprocalSqrtScalar: - case SN_SqrtScalar: { - int op = 0; - switch (id) { - case SN_ReciprocalScalar: op = OP_SSE_RCPSS; break; - case SN_ReciprocalSqrtScalar: op = OP_SSE_RSQRTSS; break; - case SN_SqrtScalar: op = OP_SSE_SQRTSS; break; - }; - if (fsig->param_count == 1) - return emit_simd_ins (cfg, klass, op, args [0]->dreg, args[0]->dreg); - else if (fsig->param_count == 2) - return emit_simd_ins (cfg, klass, op, args [0]->dreg, args[1]->dreg); - else - g_assert_not_reached (); - break; - } - case SN_LoadScalarVector128: - return NULL; - default: - return NULL; - } - } - - if (feature == MONO_CPU_X86_SSE2) { - switch (id) { - case SN_Subtract: - return emit_simd_ins_for_sig (cfg, klass, OP_XBINOP, arg0_type == MONO_TYPE_R8 ? OP_FSUB : OP_ISUB, arg0_type, fsig, args); - case SN_Add: - return emit_simd_ins_for_sig (cfg, klass, OP_XBINOP, arg0_type == MONO_TYPE_R8 ? OP_FADD : OP_IADD, arg0_type, fsig, args); - case SN_Average: - if (arg0_type == MONO_TYPE_U1) - return emit_simd_ins_for_sig (cfg, klass, OP_PAVGB_UN, -1, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_U2) - return emit_simd_ins_for_sig (cfg, klass, OP_PAVGW_UN, -1, arg0_type, fsig, args); - else - return NULL; - case SN_CompareNotEqual: - return emit_simd_ins_for_sig (cfg, klass, arg0_type == MONO_TYPE_R8 ? OP_XCOMPARE_FP : OP_XCOMPARE, CMP_NE, arg0_type, fsig, args); - case SN_CompareEqual: - return emit_simd_ins_for_sig (cfg, klass, arg0_type == MONO_TYPE_R8 ? OP_XCOMPARE_FP : OP_XCOMPARE, CMP_EQ, arg0_type, fsig, args); - case SN_CompareGreaterThan: - return emit_simd_ins_for_sig (cfg, klass, arg0_type == MONO_TYPE_R8 ? OP_XCOMPARE_FP : OP_XCOMPARE, CMP_GT, arg0_type, fsig, args); - case SN_CompareLessThan: - return emit_simd_ins_for_sig (cfg, klass, arg0_type == MONO_TYPE_R8 ? OP_XCOMPARE_FP : OP_XCOMPARE, CMP_LT, arg0_type, fsig, args); - case SN_ConvertToInt32: - if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_I4_X, SIMD_OP_SSE_CVTSD2SI, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_I4) - return emit_simd_ins_for_sig (cfg, klass, OP_EXTRACT_I4, 0, arg0_type, fsig, args); - else - return NULL; - case SN_ConvertToInt64: - if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_I8_X, SIMD_OP_SSE_CVTSD2SI64, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_I8) - return emit_simd_ins_for_sig (cfg, klass, OP_EXTRACT_I8, 0 /*element index*/, arg0_type, fsig, args); - else - g_assert_not_reached (); - break; - case SN_ConvertScalarToVector128Double: { - int op = OP_SSE2_CVTSS2SD; - switch (fsig->params [1]->type) { - case MONO_TYPE_I4: op = OP_SSE2_CVTSI2SD; break; - case MONO_TYPE_I8: op = OP_SSE2_CVTSI2SD64; break; - } - return emit_simd_ins_for_sig (cfg, klass, op, 0, 0, fsig, args); - } - case SN_ConvertScalarToVector128Int32: - case SN_ConvertScalarToVector128Int64: - case SN_ConvertScalarToVector128UInt32: - case SN_ConvertScalarToVector128UInt64: - return emit_simd_ins_for_sig (cfg, klass, OP_CREATE_SCALAR, -1, arg0_type, fsig, args); - case SN_ConvertToUInt32: - return emit_simd_ins_for_sig (cfg, klass, OP_EXTRACT_I4, 0 /*element index*/, arg0_type, fsig, args); - case SN_ConvertToUInt64: - return emit_simd_ins_for_sig (cfg, klass, OP_EXTRACT_I8, 0 /*element index*/, arg0_type, fsig, args); - case SN_ConvertToVector128Double: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTPS2PD, 0, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_I4) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTDQ2PD, 0, arg0_type, fsig, args); - else - return NULL; - case SN_ConvertToVector128Int32: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTPS2DQ, 0, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTPD2DQ, 0, arg0_type, fsig, args); - else - return NULL; - case SN_ConvertToVector128Int32WithTruncation: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTTPS2DQ, 0, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTTPD2DQ, 0, arg0_type, fsig, args); - else - return NULL; - case SN_ConvertToVector128Single: - if (arg0_type == MONO_TYPE_I4) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTDQ2PS, 0, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_CVTPD2PS, 0, arg0_type, fsig, args); - else - return NULL; - case SN_LoadAlignedVector128: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE_LOADU, 16 /*alignment*/, arg0_type, fsig, args); - case SN_LoadVector128: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE_LOADU, 1 /*alignment*/, arg0_type, fsig, args); - case SN_MoveScalar: - return emit_simd_ins_for_sig (cfg, klass, fsig->param_count == 2 ? OP_SSE_MOVS2 : OP_SSE_MOVS, -1, arg0_type, fsig, args); - case SN_Max: - switch (arg0_type) { - case MONO_TYPE_U1: - return emit_simd_ins_for_sig (cfg, klass, OP_PMAXB_UN, 0, arg0_type, fsig, args); - case MONO_TYPE_I2: - return emit_simd_ins_for_sig (cfg, klass, OP_PMAXW, 0, arg0_type, fsig, args); - case MONO_TYPE_R8: return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_MAXPD, arg0_type, fsig, args); - default: - g_assert_not_reached (); - break; - } - break; - case SN_Min: - switch (arg0_type) { - case MONO_TYPE_U1: - return emit_simd_ins_for_sig (cfg, klass, OP_PMINB_UN, 0, arg0_type, fsig, args); - case MONO_TYPE_I2: - return emit_simd_ins_for_sig (cfg, klass, OP_PMINW, 0, arg0_type, fsig, args); - case MONO_TYPE_R8: return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_MINPD, arg0_type, fsig, args); - default: - g_assert_not_reached (); - break; - } - break; - case SN_Multiply: - if (arg0_type == MONO_TYPE_U4) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PMULUDQ, 0, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_MULPD, 0, arg0_type, fsig, args); - else - g_assert_not_reached (); - case SN_MultiplyHigh: - if (arg0_type == MONO_TYPE_I2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PMULHW, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_U2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PMULHUW, arg0_type, fsig, args); - else - g_assert_not_reached (); - case SN_PackSignedSaturate: - if (arg0_type == MONO_TYPE_I2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PACKSSWB, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_I4) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PACKSSDW, arg0_type, fsig, args); - else - g_assert_not_reached (); - case SN_PackUnsignedSaturate: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PACKUS, -1, arg0_type, fsig, args); - case SN_Extract: - g_assert (arg0_type == MONO_TYPE_U2); - return emit_simd_ins_for_sig (cfg, klass, OP_XEXTRACT_I32, arg0_type, 0, fsig, args); - case SN_Insert: - g_assert (arg0_type == MONO_TYPE_I2 || arg0_type == MONO_TYPE_U2); - return emit_simd_ins_for_sig (cfg, klass, OP_XINSERT_I2, 0, arg0_type, fsig, args); - case SN_ShiftRightLogical: { - gboolean is_imm = fsig->params [1]->type == MONO_TYPE_U1; - SimdOp op = (SimdOp)0; - switch (arg0_type) { - case MONO_TYPE_I2: - case MONO_TYPE_U2: - op = is_imm ? SIMD_OP_SSE_PSRLW_IMM : SIMD_OP_SSE_PSRLW; - break; - case MONO_TYPE_I4: - case MONO_TYPE_U4: - op = is_imm ? SIMD_OP_SSE_PSRLD_IMM : SIMD_OP_SSE_PSRLD; - break; - case MONO_TYPE_I8: - case MONO_TYPE_U8: - op = is_imm ? SIMD_OP_SSE_PSRLQ_IMM : SIMD_OP_SSE_PSRLQ; - break; - default: g_assert_not_reached (); break; - } - return emit_simd_ins_for_sig (cfg, klass, is_imm ? OP_XOP_X_X_I4 : OP_XOP_X_X_X, op, arg0_type, fsig, args); - } - case SN_ShiftRightArithmetic: { - gboolean is_imm = fsig->params [1]->type == MONO_TYPE_U1; - SimdOp op = (SimdOp)0; - switch (arg0_type) { - case MONO_TYPE_I2: - case MONO_TYPE_U2: - op = is_imm ? SIMD_OP_SSE_PSRAW_IMM : SIMD_OP_SSE_PSRAW; - break; - case MONO_TYPE_I4: - case MONO_TYPE_U4: - op = is_imm ? SIMD_OP_SSE_PSRAD_IMM : SIMD_OP_SSE_PSRAD; - break; - default: g_assert_not_reached (); break; - } - return emit_simd_ins_for_sig (cfg, klass, is_imm ? OP_XOP_X_X_I4 : OP_XOP_X_X_X, op, arg0_type, fsig, args); - } - case SN_ShiftLeftLogical: { - gboolean is_imm = fsig->params [1]->type == MONO_TYPE_U1; - SimdOp op = (SimdOp)0; - switch (arg0_type) { - case MONO_TYPE_I2: - case MONO_TYPE_U2: - op = is_imm ? SIMD_OP_SSE_PSLLW_IMM : SIMD_OP_SSE_PSLLW; - break; - case MONO_TYPE_I4: - case MONO_TYPE_U4: - op = is_imm ? SIMD_OP_SSE_PSLLD_IMM : SIMD_OP_SSE_PSLLD; - break; - case MONO_TYPE_I8: - case MONO_TYPE_U8: - op = is_imm ? SIMD_OP_SSE_PSLLQ_IMM : SIMD_OP_SSE_PSLLQ; - break; - default: g_assert_not_reached (); break; - } - return emit_simd_ins_for_sig (cfg, klass, is_imm ? OP_XOP_X_X_I4 : OP_XOP_X_X_X, op, arg0_type, fsig, args); - } - case SN_ShiftLeftLogical128BitLane: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PSLLDQ, 0, arg0_type, fsig, args); - case SN_ShiftRightLogical128BitLane: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PSRLDQ, 0, arg0_type, fsig, args); - case SN_Shuffle: { - if (fsig->param_count == 2) { - g_assert (arg0_type == MONO_TYPE_I4 || arg0_type == MONO_TYPE_U4); - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PSHUFD, 0, arg0_type, fsig, args); - } else if (fsig->param_count == 3) { - g_assert (arg0_type == MONO_TYPE_R8); - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_SHUFPD, 0, arg0_type, fsig, args); - } else { - g_assert_not_reached (); - break; - } - } - case SN_ShuffleHigh: - g_assert (fsig->param_count == 2); - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PSHUFHW, 0, arg0_type, fsig, args); - case SN_ShuffleLow: - g_assert (fsig->param_count == 2); - return emit_simd_ins_for_sig (cfg, klass, OP_SSE2_PSHUFLW, 0, arg0_type, fsig, args); - case SN_SqrtScalar: { - if (fsig->param_count == 1) - return emit_simd_ins (cfg, klass, OP_SSE2_SQRTSD, args [0]->dreg, args[0]->dreg); - else if (fsig->param_count == 2) - return emit_simd_ins (cfg, klass, OP_SSE2_SQRTSD, args [0]->dreg, args[1]->dreg); - else { - g_assert_not_reached (); - break; - } - } - case SN_LoadScalarVector128: { - int op = 0; - switch (arg0_type) { - case MONO_TYPE_I4: - case MONO_TYPE_U4: op = OP_SSE2_MOVD; break; - case MONO_TYPE_I8: - case MONO_TYPE_U8: op = OP_SSE2_MOVQ; break; - case MONO_TYPE_R8: op = OP_SSE2_MOVUPD; break; - default: g_assert_not_reached(); break; - } - return emit_simd_ins_for_sig (cfg, klass, op, 0, 0, fsig, args); - } - default: - return NULL; - } - } - - if (feature == MONO_CPU_X86_SSE3) { - switch (id) { - case SN_AddSubtract: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_ADDSUBPS, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_ADDSUBPD, arg0_type, fsig, args); - else - g_assert_not_reached (); - break; - case SN_HorizontalAdd: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_HADDPS, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_HADDPD, arg0_type, fsig, args); - else - g_assert_not_reached (); - break; - case SN_HorizontalSubtract: - if (arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_HSUBPS, arg0_type, fsig, args); - else if (arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_HSUBPD, arg0_type, fsig, args); - else - g_assert_not_reached (); - break; - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_SSSE3) { - switch (id) { - case SN_AlignRight: - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_SSSE3_ALIGNR, args [2]->inst_c0, arg0_type, fsig, args); - return emit_invalid_operation (cfg, "mask in Ssse3.AlignRight must be constant"); - case SN_HorizontalAdd: - if (arg0_type == MONO_TYPE_I2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PHADDW, arg0_type, fsig, args); - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PHADDD, arg0_type, fsig, args); - case SN_HorizontalSubtract: - if (arg0_type == MONO_TYPE_I2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PHSUBW, arg0_type, fsig, args); - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PHSUBD, arg0_type, fsig, args); - case SN_Sign: - if (arg0_type == MONO_TYPE_I1) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PSIGNB, arg0_type, fsig, args); - if (arg0_type == MONO_TYPE_I2) - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PSIGNW, arg0_type, fsig, args); - return emit_simd_ins_for_sig (cfg, klass, OP_XOP_X_X_X, SIMD_OP_SSE_PSIGND, arg0_type, fsig, args); - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_SSE41) { - switch (id) { - case SN_DotProduct: - if (args [2]->opcode == OP_ICONST && arg0_type == MONO_TYPE_R4) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_DPPS_IMM, args [2]->inst_c0, arg0_type, fsig, args); - else if (args [2]->opcode == OP_ICONST && arg0_type == MONO_TYPE_R8) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_DPPD_IMM, args [2]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant control byte (generate a switch) - return emit_invalid_operation (cfg, "control byte in Sse41.DotProduct must be constant"); - case SN_MultipleSumAbsoluteDifferences: - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_MPSADBW_IMM, args [2]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant control byte (generate a switch) - return emit_invalid_operation (cfg, "control byte in Sse41.MultipleSumAbsoluteDifferences must be constant"); - case SN_Blend: - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_BLEND_IMM, args [2]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant control byte (generate a switch) - return emit_invalid_operation (cfg, "control byte in Sse41.Blend must be constant"); - case SN_BlendVariable: - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_BLENDV, -1, arg0_type, fsig, args); - case SN_Extract: { - int op = 0; - switch (arg0_type) { - case MONO_TYPE_U1: - case MONO_TYPE_U4: - case MONO_TYPE_I4: op = OP_XEXTRACT_I32; break; - case MONO_TYPE_I8: - case MONO_TYPE_U8: op = OP_XEXTRACT_I64; break; - case MONO_TYPE_R4: op = OP_XEXTRACT_R4; break; - default: g_assert_not_reached(); break; - } - return emit_simd_ins_for_sig (cfg, klass, op, arg0_type, 0, fsig, args); - } - case SN_Insert: - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_INSERT, -1, arg0_type, fsig, args); - // FIXME: handle non-constant index (generate a switch) - return emit_invalid_operation (cfg, "index in Sse41.Insert must be constant"); - case SN_CeilingScalar: - case SN_FloorScalar: - case SN_RoundCurrentDirectionScalar: - case SN_RoundToNearestIntegerScalar: - case SN_RoundToNegativeInfinityScalar: - case SN_RoundToPositiveInfinityScalar: - case SN_RoundToZeroScalar: - if (fsig->param_count == 2) { - return emit_simd_ins_for_sig (cfg, klass, OP_SSE41_ROUNDS, info->instc0, arg0_type, fsig, args); - } else { - MonoInst* ins = emit_simd_ins (cfg, klass, OP_SSE41_ROUNDS, args [0]->dreg, args [0]->dreg); - ins->inst_c0 = info->instc0; - ins->inst_c1 = arg0_type; - return ins; - } - break; - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_SSE42) { - switch (id) { - case SN_Crc32: { - MonoTypeEnum arg1_type = get_underlying_type (fsig->params [1]); - return emit_simd_ins_for_sig (cfg, klass, - arg1_type == MONO_TYPE_U8 ? OP_SSE42_CRC64 : OP_SSE42_CRC32, - arg1_type, arg0_type, fsig, args); - } - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_PCLMUL) { - switch (id) { - case SN_CarrylessMultiply: { - if (args [2]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_PCLMULQDQ_IMM, args [2]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant control byte (generate a switch) - return emit_invalid_operation (cfg, "index in Pclmulqdq.CarrylessMultiply must be constant"); - } - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_AES) { - switch (id) { - case SN_KeygenAssist: { - if (args [1]->opcode == OP_ICONST) - return emit_simd_ins_for_sig (cfg, klass, OP_AES_KEYGEN_IMM, args [1]->inst_c0, arg0_type, fsig, args); - // FIXME: handle non-constant control byte (generate a switch) - return emit_invalid_operation (cfg, "control byte in Aes.KeygenAssist must be constant"); - } - default: - g_assert_not_reached (); - break; - } - } - - if (feature == MONO_CPU_X86_POPCNT) { - switch (id) { - case SN_PopCount: - if (!supported) - return NULL; - MONO_INST_NEW (cfg, ins, is_64bit ? OP_POPCNT64 : OP_POPCNT32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - return NULL; - } - } - if (feature == MONO_CPU_X86_LZCNT) { - switch (id) { - case SN_LeadingZeroCount: - if (!supported) - return NULL; - MONO_INST_NEW (cfg, ins, is_64bit ? OP_LZCNT64 : OP_LZCNT32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - return NULL; - } - } - if (feature == MONO_CPU_X86_BMI1) { - switch (id) { - case SN_AndNot: { - // (a ^ -1) & b - // LLVM replaces it with `andn` - int tmp_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - int result_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, is_64bit ? OP_LXOR_IMM : OP_IXOR_IMM, tmp_reg, args [0]->dreg, -1); - EMIT_NEW_BIALU (cfg, ins, is_64bit ? OP_LAND : OP_IAND, result_reg, tmp_reg, args [1]->dreg); - return ins; - } - case SN_BitFieldExtract: { - if (fsig->param_count == 2) { - MONO_INST_NEW (cfg, ins, is_64bit ? OP_BEXTR64 : OP_BEXTR32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - } - } - case SN_GetMaskUpToLowestSetBit: { - // x ^ (x - 1) - // LLVM replaces it with `blsmsk` - int tmp_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - int result_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, is_64bit ? OP_LSUB_IMM : OP_ISUB_IMM, tmp_reg, args [0]->dreg, 1); - EMIT_NEW_BIALU (cfg, ins, is_64bit ? OP_LXOR : OP_IXOR, result_reg, args [0]->dreg, tmp_reg); - return ins; - } - case SN_ResetLowestSetBit: { - // x & (x - 1) - // LLVM replaces it with `blsr` - int tmp_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - int result_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, is_64bit ? OP_LSUB_IMM : OP_ISUB_IMM, tmp_reg, args [0]->dreg, 1); - EMIT_NEW_BIALU (cfg, ins, is_64bit ? OP_LAND : OP_IAND, result_reg, args [0]->dreg, tmp_reg); - return ins; - } - case SN_ExtractLowestSetBit: { - // x & (0 - x) - // LLVM replaces it with `blsi` - int tmp_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - int result_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - int zero_reg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - MONO_EMIT_NEW_ICONST (cfg, zero_reg, 0); - EMIT_NEW_BIALU (cfg, ins, is_64bit ? OP_LSUB : OP_ISUB, tmp_reg, zero_reg, args [0]->dreg); - EMIT_NEW_BIALU (cfg, ins, is_64bit ? OP_LAND : OP_IAND, result_reg, args [0]->dreg, tmp_reg); - return ins; - } - case SN_TrailingZeroCount: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_CTTZ64 : OP_CTTZ32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - g_assert_not_reached (); - } - } - if (feature == MONO_CPU_X86_BMI2) { - switch (id) { - case SN_MultiplyNoFlags: - if (fsig->param_count == 2) { - MONO_INST_NEW (cfg, ins, is_64bit ? OP_MULX_H64 : OP_MULX_H32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - } else if (fsig->param_count == 3) { - MONO_INST_NEW (cfg, ins, is_64bit ? OP_MULX_HL64 : OP_MULX_HL32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->sreg3 = args [2]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - } else { - g_assert_not_reached (); - } - return ins; - case SN_ZeroHighBits: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_BZHI64 : OP_BZHI32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - case SN_ParallelBitExtract: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_PEXT64 : OP_PEXT32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - case SN_ParallelBitDeposit: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_PDEP64 : OP_PDEP32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->sreg2 = args [1]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - g_assert_not_reached (); - } - } - - if (intrinsics == x86base_methods) { - switch (id) { - case SN_BitScanForward: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_X86_BSF64 : OP_X86_BSF32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - case SN_BitScanReverse: - MONO_INST_NEW (cfg, ins, is_64bit ? OP_X86_BSR64 : OP_X86_BSR32); - ins->dreg = is_64bit ? alloc_lreg (cfg) : alloc_ireg (cfg); - ins->sreg1 = args [0]->dreg; - ins->type = is_64bit ? STACK_I8 : STACK_I4; - MONO_ADD_INS (cfg->cbb, ins); - return ins; - default: - g_assert_not_reached (); - } - } - - return NULL; -} - -static guint16 vector_128_t_methods [] = { - SN_get_Count, - SN_get_Zero, -}; - -static MonoInst* -emit_vector128_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *ins; - MonoType *type, *etype; - MonoClass *klass; - int size, len, id; - - id = lookup_intrins (vector_128_t_methods, sizeof (vector_128_t_methods), cmethod); - if (id == -1) - return NULL; - - klass = cmethod->klass; - type = m_class_get_byval_arg (klass); - etype = mono_class_get_context (klass)->class_inst->type_argv [0]; - size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL); - g_assert (size); - len = 16 / size; - - if (!MONO_TYPE_IS_PRIMITIVE (etype) || etype->type == MONO_TYPE_CHAR || etype->type == MONO_TYPE_BOOLEAN) - return NULL; - - if (cfg->verbose_level > 1) { - char *name = mono_method_full_name (cmethod, TRUE); - printf (" SIMD intrinsic %s\n", name); - g_free (name); - } - - switch (id) { - case SN_get_Count: - if (!(fsig->param_count == 0 && fsig->ret->type == MONO_TYPE_I4)) - break; - EMIT_NEW_ICONST (cfg, ins, len); - return ins; - case SN_get_Zero: { - return emit_simd_ins (cfg, klass, OP_XZERO, -1, -1); - } - default: - break; - } - - return NULL; -} - -static guint16 vector_256_t_methods [] = { - SN_get_Count, -}; - -static MonoInst* -emit_vector256_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *ins; - MonoType *type, *etype; - MonoClass *klass; - int size, len, id; - - id = lookup_intrins (vector_256_t_methods, sizeof (vector_256_t_methods), cmethod); - if (id == -1) - return NULL; - - klass = cmethod->klass; - type = m_class_get_byval_arg (klass); - etype = mono_class_get_context (klass)->class_inst->type_argv [0]; - size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL); - g_assert (size); - len = 32 / size; - - if (!MONO_TYPE_IS_PRIMITIVE (etype) || etype->type == MONO_TYPE_CHAR || etype->type == MONO_TYPE_BOOLEAN) - return NULL; - - if (cfg->verbose_level > 1) { - char *name = mono_method_full_name (cmethod, TRUE); - printf (" SIMD intrinsic %s\n", name); - g_free (name); - } - - switch (id) { - case SN_get_Count: - if (!(fsig->param_count == 0 && fsig->ret->type == MONO_TYPE_I4)) - break; - EMIT_NEW_ICONST (cfg, ins, len); - return ins; - default: - break; - } - - return NULL; -} - -static -MonoInst* -emit_amd64_intrinsics (const char *class_ns, const char *class_name, MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - if (!strcmp (class_ns, "System.Runtime.Intrinsics.X86")) { - return emit_x86_intrinsics (cfg, cmethod, fsig, args); - } - - if (!strcmp (class_ns, "System.Runtime.Intrinsics")) { - if (!strcmp (class_name, "Vector128`1")) - return emit_vector128_t (cfg, cmethod, fsig, args); - if (!strcmp (class_name, "Vector256`1")) - return emit_vector256_t (cfg, cmethod, fsig, args); - } - - if (!strcmp (class_ns, "System.Numerics")) { - if (!strcmp (class_name, "Vector")) - return emit_sys_numerics_vector (cfg, cmethod, fsig, args); - if (!strcmp (class_name, "Vector`1")) - return emit_sys_numerics_vector_t (cfg, cmethod, fsig, args); - } - - return NULL; -} -#endif // !TARGET_ARM64 - -#ifdef TARGET_ARM64 -static -MonoInst* -emit_simd_intrinsics (const char *class_ns, const char *class_name, MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - // FIXME: implement Vector64, Vector128 and Vector for Arm64 - if (!strcmp (class_ns, "System.Runtime.Intrinsics.Arm")) { - return emit_arm64_intrinsics (cfg, cmethod, fsig, args); - } - - return NULL; -} -#elif TARGET_AMD64 -// TODO: test and enable for x86 too -static -MonoInst* -emit_simd_intrinsics (const char *class_ns, const char *class_name, MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - MonoInst *simd_inst = emit_amd64_intrinsics (class_ns, class_name, cfg, cmethod, fsig, args); - if (simd_inst != NULL) { - cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS; - cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS_DECOMPOSE_VTYPE; - } - return simd_inst; -} -#else -static -MonoInst* -emit_simd_intrinsics (const char *class_ns, const char *class_name, MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - return NULL; -} -#endif - -MonoInst* -mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -{ - const char *class_name; - const char *class_ns; - MonoImage *image = m_class_get_image (cmethod->klass); - - if (image != mono_get_corlib ()) - return NULL; - - class_ns = m_class_get_name_space (cmethod->klass); - class_name = m_class_get_name (cmethod->klass); - - // If cmethod->klass is nested, the namespace is on the enclosing class. - if (m_class_get_nested_in (cmethod->klass)) - class_ns = m_class_get_name_space (m_class_get_nested_in (cmethod->klass)); - -#if defined(TARGET_AMD64) || defined(TARGET_ARM64) - if (!strcmp (class_ns, "System.Runtime.Intrinsics")) { - if (!strcmp (class_name, "Vector128")) - return emit_vector128 (cfg, cmethod, fsig, args); - } -#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64) - - return emit_simd_intrinsics (class_ns, class_name, cfg, cmethod, fsig, args); -} - -/* -* Windows x64 value type ABI uses reg/stack references (ArgValuetypeAddrInIReg/ArgValuetypeAddrOnStack) -* for function arguments. When using SIMD intrinsics arguments optimized into OP_ARG needs to be decomposed -* into correspondig SIMD LOADX/STOREX instructions. -*/ -#if defined(TARGET_WIN32) && defined(TARGET_AMD64) -static gboolean -decompose_vtype_opt_uses_simd_intrinsics (MonoCompile *cfg, MonoInst *ins) -{ - if (cfg->uses_simd_intrinsics & MONO_CFG_USES_SIMD_INTRINSICS_DECOMPOSE_VTYPE) - return TRUE; - - switch (ins->opcode) { - case OP_XMOVE: - case OP_XZERO: - case OP_LOADX_MEMBASE: - case OP_LOADX_ALIGNED_MEMBASE: - case OP_STOREX_MEMBASE: - case OP_STOREX_ALIGNED_MEMBASE_REG: - return TRUE; - default: - return FALSE; - } -} - -static void -decompose_vtype_opt_load_arg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, gint32 *sreg_int32) -{ - guint32 *sreg = (guint32*)sreg_int32; - MonoInst *src_var = get_vreg_to_inst (cfg, *sreg); - if (src_var && src_var->opcode == OP_ARG && src_var->klass && MONO_CLASS_IS_SIMD (cfg, src_var->klass)) { - MonoInst *varload_ins, *load_ins; - NEW_VARLOADA (cfg, varload_ins, src_var, src_var->inst_vtype); - mono_bblock_insert_before_ins (bb, ins, varload_ins); - MONO_INST_NEW (cfg, load_ins, OP_LOADX_MEMBASE); - load_ins->klass = src_var->klass; - load_ins->type = STACK_VTYPE; - load_ins->sreg1 = varload_ins->dreg; - load_ins->dreg = alloc_xreg (cfg); - mono_bblock_insert_after_ins (bb, varload_ins, load_ins); - *sreg = load_ins->dreg; - } -} - -void -mono_simd_decompose_intrinsic (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins) -{ - if (cfg->opt & MONO_OPT_SIMD && decompose_vtype_opt_uses_simd_intrinsics (cfg, ins)) { - decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg1)); - decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg2)); - decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg3)); - MonoInst *dest_var = get_vreg_to_inst (cfg, ins->dreg); - if (dest_var && dest_var->opcode == OP_ARG && dest_var->klass && MONO_CLASS_IS_SIMD (cfg, dest_var->klass)) { - MonoInst *varload_ins, *store_ins; - ins->dreg = alloc_xreg (cfg); - NEW_VARLOADA (cfg, varload_ins, dest_var, dest_var->inst_vtype); - mono_bblock_insert_after_ins (bb, ins, varload_ins); - MONO_INST_NEW (cfg, store_ins, OP_STOREX_MEMBASE); - store_ins->klass = dest_var->klass; - store_ins->type = STACK_VTYPE; - store_ins->sreg1 = ins->dreg; - store_ins->dreg = varload_ins->dreg; - mono_bblock_insert_after_ins (bb, varload_ins, store_ins); - } - } -} -#else -void -mono_simd_decompose_intrinsic (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins) -{ -} -#endif /*defined(TARGET_WIN32) && defined(TARGET_AMD64)*/ - -void -mono_simd_simplify_indirection (MonoCompile *cfg) -{ -} - -#endif /* DISABLE_JIT */ -#endif /* MONO_ARCH_SIMD_INTRINSICS */ - -#if defined(ENABLE_NETCORE) && defined(TARGET_AMD64) -void -ves_icall_System_Runtime_Intrinsics_X86_X86Base___cpuidex (int abcd[4], int function_id, int subfunction_id) -{ -#ifndef MONO_CROSS_COMPILE - mono_hwcap_x86_call_cpuidex (function_id, subfunction_id, - &abcd [0], &abcd [1], &abcd [2], &abcd [3]); -#endif -} -#endif - -MONO_EMPTY_SOURCE_FILE (simd_intrinsics_netcore); diff --git a/mono/mini/simd-intrinsics.c b/mono/mini/simd-intrinsics.c index cadf38ae1c9..613a529dea7 100644 --- a/mono/mini/simd-intrinsics.c +++ b/mono/mini/simd-intrinsics.c @@ -64,7 +64,7 @@ The advantage of this change is that it could have a _membase version and promot without a OP_LDADDR. */ -#if defined (MONO_ARCH_SIMD_INTRINSICS) && !defined(ENABLE_NETCORE) +#if defined (MONO_ARCH_SIMD_INTRINSICS) #if defined (DISABLE_JIT) diff --git a/mono/mini/simd-methods-netcore.h b/mono/mini/simd-methods-netcore.h deleted file mode 100644 index a19958c9e3e..00000000000 --- a/mono/mini/simd-methods-netcore.h +++ /dev/null @@ -1,247 +0,0 @@ -METHOD2(".ctor", ctor) -METHOD(CopyTo) -METHOD(Equals) -METHOD(GreaterThan) -METHOD(GreaterThanOrEqual) -METHOD(LessThan) -METHOD(LessThanOrEqual) -METHOD(Min) -METHOD(Max) -METHOD(MinScalar) -METHOD(MaxScalar) -METHOD(PopCount) -METHOD(LeadingZeroCount) -METHOD(get_Count) -METHOD(get_IsHardwareAccelerated) -METHOD(get_IsSupported) -METHOD(get_AllBitsSet) -METHOD(get_Item) -METHOD(get_One) -METHOD(get_Zero) -METHOD(op_Addition) -METHOD(op_BitwiseAnd) -METHOD(op_BitwiseOr) -METHOD(op_Division) -METHOD(op_Equality) -METHOD(op_ExclusiveOr) -METHOD(op_Explicit) -METHOD(op_Inequality) -METHOD(op_Multiply) -METHOD(op_Subtraction) -// Vector -METHOD(ConvertToInt32) -METHOD(ConvertToInt32WithTruncation) -METHOD(ConvertToUInt32) -METHOD(ConvertToInt64) -METHOD(ConvertToInt64WithTruncation) -METHOD(ConvertToUInt64) -METHOD(ConvertToSingle) -METHOD(ConvertToDouble) -METHOD(Narrow) -METHOD(Widen) -// Vector128 -METHOD(AsByte) -METHOD(AsDouble) -METHOD(AsInt16) -METHOD(AsInt32) -METHOD(AsInt64) -METHOD(AsSByte) -METHOD(AsSingle) -METHOD(AsUInt16) -METHOD(AsUInt32) -METHOD(AsUInt64) -METHOD(Create) -METHOD(CreateScalarUnsafe) -// Bmi1 -METHOD(AndNot) -METHOD(BitFieldExtract) -METHOD(ExtractLowestSetBit) -METHOD(GetMaskUpToLowestSetBit) -METHOD(ResetLowestSetBit) -METHOD(TrailingZeroCount) -// Bmi2 -METHOD(ZeroHighBits) -METHOD(MultiplyNoFlags) -METHOD(ParallelBitDeposit) -METHOD(ParallelBitExtract) -// Sse -METHOD(Add) -METHOD(CompareGreaterThanOrEqual) -METHOD(CompareLessThanOrEqual) -METHOD(CompareNotEqual) -METHOD(CompareNotGreaterThan) -METHOD(CompareNotGreaterThanOrEqual) -METHOD(CompareNotLessThan) -METHOD(CompareNotLessThanOrEqual) -METHOD(CompareScalarGreaterThan) -METHOD(CompareScalarGreaterThanOrEqual) -METHOD(CompareScalarLessThan) -METHOD(CompareScalarLessThanOrEqual) -METHOD(CompareScalarNotEqual) -METHOD(CompareScalarNotGreaterThan) -METHOD(CompareScalarNotGreaterThanOrEqual) -METHOD(CompareScalarNotLessThan) -METHOD(CompareScalarNotLessThanOrEqual) -METHOD(CompareScalarOrderedEqual) -METHOD(CompareScalarOrderedGreaterThan) -METHOD(CompareScalarOrderedGreaterThanOrEqual) -METHOD(CompareScalarOrderedLessThan) -METHOD(CompareScalarOrderedLessThanOrEqual) -METHOD(CompareScalarOrderedNotEqual) -METHOD(CompareScalarUnorderedEqual) -METHOD(CompareScalarUnorderedGreaterThan) -METHOD(CompareScalarUnorderedGreaterThanOrEqual) -METHOD(CompareScalarUnorderedLessThan) -METHOD(CompareScalarUnorderedLessThanOrEqual) -METHOD(CompareScalarUnorderedNotEqual) -METHOD(CompareOrdered) -METHOD(CompareUnordered) -METHOD(CompareScalarOrdered) -METHOD(CompareScalarUnordered) -METHOD(ConvertScalarToVector128Single) -METHOD(Divide) -METHOD(DivideScalar) -METHOD(Store) -METHOD(StoreFence) -METHOD(StoreHigh) -METHOD(StoreLow) -METHOD(Subtract) -METHOD(SubtractScalar) -METHOD(CompareEqual) -METHOD(Extract) -METHOD(LoadHigh) -METHOD(LoadLow) -METHOD(LoadVector128) -METHOD(LoadScalarVector128) -METHOD(MoveHighToLow) -METHOD(MoveLowToHigh) -METHOD(MoveMask) -METHOD(MoveScalar) -METHOD(Multiply) -METHOD(MultiplyAddAdjacent) -METHOD(MultiplyScalar) -METHOD(Shuffle) -METHOD(UnpackHigh) -METHOD(UnpackLow) -METHOD(Prefetch0) -METHOD(Prefetch1) -METHOD(Prefetch2) -METHOD(PrefetchNonTemporal) -METHOD(Reciprocal) -METHOD(ReciprocalScalar) -METHOD(ReciprocalSqrt) -METHOD(ReciprocalSqrtScalar) -METHOD(Sqrt) -METHOD(SqrtScalar) -// Sse2 -METHOD(AddSaturate) -METHOD(AddScalar) -METHOD(And) -METHOD(Average) -METHOD(Or) -METHOD(LoadAlignedVector128) -METHOD(Xor) -METHOD(CompareGreaterThan) -METHOD(CompareScalarEqual) -METHOD(ConvertScalarToVector128Double) -METHOD(ConvertScalarToVector128Int32) -METHOD(ConvertScalarToVector128Int64) -METHOD(ConvertScalarToVector128UInt32) -METHOD(ConvertScalarToVector128UInt64) -METHOD(ConvertToVector128Double) -METHOD(ConvertToVector128Int32) -METHOD(ConvertToVector128Int32WithTruncation) -METHOD(ConvertToVector128Single) -METHOD(MaskMove) -METHOD(MultiplyHigh) -METHOD(MultiplyLow) -METHOD(PackSignedSaturate) -METHOD(PackUnsignedSaturate) -METHOD(ShuffleHigh) -METHOD(ShuffleLow) -METHOD(SubtractSaturate) -METHOD(SumAbsoluteDifferences) -METHOD(StoreScalar) -METHOD(StoreAligned) -METHOD(StoreAlignedNonTemporal) -METHOD(StoreNonTemporal) -METHOD(ShiftLeftLogical) -METHOD(ShiftLeftLogical128BitLane) -METHOD(ShiftRightArithmetic) -METHOD(ShiftRightLogical) -METHOD(ShiftRightLogical128BitLane) -METHOD(CompareLessThan) -METHOD(LoadFence) -METHOD(MemoryFence) -// Sse3 -METHOD(HorizontalAdd) -METHOD(HorizontalSubtract) -METHOD(AddSubtract) -METHOD(LoadAndDuplicateToVector128) -METHOD(LoadDquVector128) -METHOD(MoveAndDuplicate) -METHOD(MoveHighAndDuplicate) -METHOD(MoveLowAndDuplicate) -// Ssse3 -METHOD(Abs) // Also used by ARM64 -METHOD(AlignRight) -METHOD(HorizontalAddSaturate) -METHOD(HorizontalSubtractSaturate) -METHOD(MultiplyHighRoundScale) -METHOD(Sign) -// Sse41 -METHOD(Blend) -METHOD(BlendVariable) -METHOD(Ceiling) -METHOD(CeilingScalar) -METHOD(ConvertToVector128Int16) -METHOD(ConvertToVector128Int64) -METHOD(Floor) -METHOD(FloorScalar) -METHOD(Insert) -METHOD(LoadAlignedVector128NonTemporal) -METHOD(RoundCurrentDirectionScalar) -METHOD(RoundToNearestInteger) -METHOD(RoundToNearestIntegerScalar) -METHOD(RoundToNegativeInfinity) -METHOD(RoundToNegativeInfinityScalar) -METHOD(RoundToPositiveInfinity) -METHOD(RoundToPositiveInfinityScalar) -METHOD(RoundToZero) -METHOD(RoundToZeroScalar) -METHOD(RoundCurrentDirection) -METHOD(MinHorizontal) -METHOD(TestC) -METHOD(TestNotZAndNotC) -METHOD(TestZ) -METHOD(DotProduct) -METHOD(MultipleSumAbsoluteDifferences) -// Sse42 -METHOD(Crc32) -// Aes -METHOD(Decrypt) -METHOD(DecryptLast) -METHOD(Encrypt) -METHOD(EncryptLast) -METHOD(InverseMixColumns) -METHOD(KeygenAssist) -// Pclmulqdq -METHOD(CarrylessMultiply) -// ArmBase -METHOD(LeadingSignCount) -METHOD(ReverseElementBits) -// Crc32 -METHOD(ComputeCrc32) -METHOD(ComputeCrc32C) -// X86Base -METHOD(BitScanForward) -METHOD(BitScanReverse) -// Crypto -METHOD(FixedRotate) -METHOD(HashUpdateChoose) -METHOD(HashUpdateMajority) -METHOD(HashUpdateParity) -METHOD(HashUpdate1) -METHOD(HashUpdate2) -METHOD(ScheduleUpdate0) -METHOD(ScheduleUpdate1) diff --git a/mono/mini/tasklets.c b/mono/mini/tasklets.c index 402a3a981c2..34642cd1ebd 100644 --- a/mono/mini/tasklets.c +++ b/mono/mini/tasklets.c @@ -12,7 +12,6 @@ #include "mono/metadata/loader-internals.h" #include "mono/utils/mono-tls-inline.h" -#if !defined(ENABLE_NETCORE) #if defined(MONO_SUPPORT_TASKLETS) #include "mono/metadata/loader-internals.h" @@ -216,5 +215,4 @@ mono_tasklets_init(void) } #endif /* MONO_SUPPORT_TASKLETS */ -#endif /* ENABLE_NETCORE */ diff --git a/mono/mini/tasklets.h b/mono/mini/tasklets.h index dd8750f3f2f..66823fff7b3 100644 --- a/mono/mini/tasklets.h +++ b/mono/mini/tasklets.h @@ -7,7 +7,6 @@ #include "mini.h" -#if !defined(ENABLE_NETCORE) typedef struct { MonoLMF *lmf; gpointer top_sp; @@ -32,7 +31,6 @@ void mono_tasklets_cleanup (void); MonoContinuationRestore mono_tasklets_arch_restore (void); -#endif /* ENABLE_NETCORE */ #endif /* __MONO_TASKLETS_H__ */ diff --git a/mono/sgen/sgen-debug.c b/mono/sgen/sgen-debug.c index b62c4cede31..e2546e49a11 100644 --- a/mono/sgen/sgen-debug.c +++ b/mono/sgen/sgen-debug.c @@ -947,7 +947,6 @@ sgen_scan_for_registered_roots_in_domain (MonoDomain *domain, int root_type) static gboolean is_xdomain_ref_allowed (GCObject **ptr, GCObject *obj, MonoDomain *domain) { -#ifndef ENABLE_NETCORE MonoObject *o = (MonoObject*)(obj); size_t offset = (char*)(ptr) - (char*)o; @@ -960,7 +959,6 @@ is_xdomain_ref_allowed (GCObject **ptr, GCObject *obj, MonoDomain *domain) if (m_class_get_supertypes (mono_defaults.real_proxy_class) && mono_class_has_parent_fast (o->vtable->klass, mono_defaults.real_proxy_class) && offset == G_STRUCT_OFFSET (MonoRealProxy, unwrapped_server)) return TRUE; -#endif #endif return FALSE; } diff --git a/mono/tools/offsets-tool/offsets-tool.py b/mono/tools/offsets-tool/offsets-tool.py index 8af7cc1f34f..358d98cb297 100644 --- a/mono/tools/offsets-tool/offsets-tool.py +++ b/mono/tools/offsets-tool/offsets-tool.py @@ -63,7 +63,6 @@ class OffsetsTool: parser.add_argument ('--abi=', dest='abi', help='ABI triple to generate', required=True) parser.add_argument ('--sysroot=', dest='sysroot', help='path to sysroot headers of target') parser.add_argument ('--prefix=', dest='prefixes', action='append', help='prefix path to include directory of target') - parser.add_argument ('--netcore', dest='netcore', help='target runs with netcore', action='store_true') args = parser.parse_args () if not args.libclang or not os.path.isfile (args.libclang): @@ -201,9 +200,6 @@ class OffsetsTool: print ("ABI '" + args.abi + "' is not supported.", file=sys.stderr) sys.exit (1) - if args.netcore: - self.target_args += ["-DENABLE_NETCORE"] - self.args = args # diff --git a/mono/utils/mono-complex.h b/mono/utils/mono-complex.h index 6b3fe7544ae..6839f3f8c99 100644 --- a/mono/utils/mono-complex.h +++ b/mono/utils/mono-complex.h @@ -14,7 +14,6 @@ #define _USE_MATH_DEFINES // needed by MSVC to define math constants #include -#ifndef ENABLE_NETCORE typedef struct double_complex { double real; @@ -62,4 +61,3 @@ double_complex mono_double_complex_sub(double_complex left, double_complex right #include "../../support/libm/complex.c" -#endif diff --git a/mono/utils/mono-dl-posix.c b/mono/utils/mono-dl-posix.c index 7b19cd5174a..d140e9bc6a1 100644 --- a/mono/utils/mono-dl-posix.c +++ b/mono/utils/mono-dl-posix.c @@ -134,15 +134,7 @@ mono_dl_convert_flags (int mono_flags, int native_flags) { int lflags = native_flags; -#ifdef ENABLE_NETCORE - // Specifying both will default to LOCAL - if (mono_flags & MONO_DL_GLOBAL && !(mono_flags & MONO_DL_LOCAL)) - lflags |= RTLD_GLOBAL; - else - lflags |= RTLD_LOCAL; -#else lflags = mono_flags & MONO_DL_LOCAL ? RTLD_LOCAL : RTLD_GLOBAL; -#endif if (mono_flags & MONO_DL_LAZY) lflags |= RTLD_LAZY; diff --git a/mono/utils/mono-dl-wasm.c b/mono/utils/mono-dl-wasm.c index 333d54db799..3a904f04bca 100644 --- a/mono/utils/mono-dl-wasm.c +++ b/mono/utils/mono-dl-wasm.c @@ -62,15 +62,7 @@ mono_dl_convert_flags (int mono_flags, int native_flags) { int lflags = native_flags; -#ifdef ENABLE_NETCORE - // Specifying both will default to LOCAL - if (mono_flags & MONO_DL_GLOBAL && !(mono_flags & MONO_DL_LOCAL)) - lflags |= RTLD_GLOBAL; - else - lflags |= RTLD_LOCAL; -#else lflags = mono_flags & MONO_DL_LOCAL ? RTLD_LOCAL : RTLD_GLOBAL; -#endif if (mono_flags & MONO_DL_LAZY) lflags |= RTLD_LAZY; diff --git a/mono/utils/mono-dl.c b/mono/utils/mono-dl.c index ab4712778e2..92b0f07a0a3 100644 --- a/mono/utils/mono-dl.c +++ b/mono/utils/mono-dl.c @@ -21,9 +21,6 @@ #include #include #include -#if defined(ENABLE_NETCORE) && defined(TARGET_ANDROID) -#include -#endif // Contains LIBC_SO definition #ifdef HAVE_GNU_LIB_NAMES_H @@ -151,25 +148,6 @@ get_dl_name_from_libtool (const char *libtool_file) return line; } -#ifdef ENABLE_NETCORE -static const char * -fix_libc_name (const char *name) -{ - if (name != NULL && strcmp (name, "libc") == 0) { - // Taken from CoreCLR: https://github.com/dotnet/coreclr/blob/6b0dab793260d36e35d66c82678c63046828d01b/src/pal/src/loader/module.cpp#L568-L576 -#if defined (HOST_DARWIN) - return "/usr/lib/libc.dylib"; -#elif defined (__FreeBSD__) - return "libc.so.7"; -#elif defined (LIBC_SO) - return LIBC_SO; -#else - return "libc.so"; -#endif - } - return name; -} -#endif /** * mono_dl_open_self: @@ -182,24 +160,7 @@ fix_libc_name (const char *name) MonoDl* mono_dl_open_self (char **error_msg) { -#if defined(ENABLE_NETCORE) && defined(TARGET_ANDROID) - MonoDl *module; - if (error_msg) - *error_msg = NULL; - module = (MonoDl *) g_malloc (sizeof (MonoDl)); - if (!module) { - if (error_msg) - *error_msg = g_strdup ("Out of memory"); - return NULL; - } - mono_refcount_init (module, NULL); - module->handle = RTLD_DEFAULT; - module->dl_fallback = NULL; - module->full_name = NULL; - return module; -#else return mono_dl_open (NULL, MONO_DL_LAZY, error_msg); -#endif } /** @@ -244,9 +205,6 @@ mono_dl_open_full (const char *name, int mono_flags, int native_flags, char **er } module->main_module = name == NULL? TRUE: FALSE; -#ifdef ENABLE_NETCORE - name = fix_libc_name (name); -#endif // No GC safe transition because this is called early in main.c lib = mono_dl_open_file (name, lflags); @@ -438,17 +396,9 @@ mono_dl_build_path (const char *directory, const char *name, void **iter) need_suffix = FALSE; suffix = ""; } else if (idx == 1) { -#ifdef ENABLE_NETCORE - /* netcore system libs have a suffix but no prefix */ - need_prefix = FALSE; - need_suffix = TRUE; - suffix = mono_dl_get_so_suffixes () [0]; - suffixlen = strlen (suffix); -#else suffix = mono_dl_get_so_suffixes () [idx - 1]; if (suffix [0] == '\0') return NULL; -#endif } else { /* Prefix.Name.suffix */ suffix = mono_dl_get_so_suffixes () [idx - 2]; diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index c3ddb64d565..78a171ab329 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -32,7 +32,7 @@ #include -#if !defined(ENABLE_NETCORE) && defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) +#if defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) // tkill was deprecated and removed in the recent versions of Android NDK #define USE_TKILL_ON_ANDROID 1 extern int tkill (pid_t tid, int signal); diff --git a/mono/utils/mono-threads-windows.c b/mono/utils/mono-threads-windows.c index faeecbba4c3..deb9321b54a 100644 --- a/mono/utils/mono-threads-windows.c +++ b/mono/utils/mono-threads-windows.c @@ -383,12 +383,7 @@ mono_threads_suspend_get_abort_signal (void) #if defined (HOST_WIN32) -#ifndef ENABLE_NETCORE #define MONO_WIN32_DEFAULT_NATIVE_STACK_SIZE (1024 * 1024) -#else -// Use default stack size on netcore. -#define MONO_WIN32_DEFAULT_NATIVE_STACK_SIZE 0 -#endif gboolean mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *tid) diff --git a/msvc/build-init.vcxproj b/msvc/build-init.vcxproj index 8d15e191ac4..1d46d6f1814 100644 --- a/msvc/build-init.vcxproj +++ b/msvc/build-init.vcxproj @@ -141,7 +141,6 @@ <_EnableDefines Condition="'$(MONO_ENABLE_LLVM)' == 'true'">$(_EnableDefines);ENABLE_LLVM;ENABLE_LLVM_RUNTIME - <_EnableDefines Condition="'$(MONO_ENABLE_NETCORE)' == 'true'">$(_EnableDefines);ENABLE_NETCORE <_HaveDefines Condition="'$(MONO_ENABLE_BTLS)' == 'true'">$(_HaveDefines);HAVE_BTLS <_EnableDefines>$(_EnableDefines.Trim(';')) <_HaveDefines>$(_HaveDefines.Trim(';')) diff --git a/msvc/libmini-common.targets b/msvc/libmini-common.targets index f151afb4b53..88d70c89eae 100644 --- a/msvc/libmini-common.targets +++ b/msvc/libmini-common.targets @@ -43,12 +43,10 @@ - - diff --git a/msvc/libmini-common.targets.filters b/msvc/libmini-common.targets.filters index 0bb299e7dca..d96cb44d123 100644 --- a/msvc/libmini-common.targets.filters +++ b/msvc/libmini-common.targets.filters @@ -127,9 +127,6 @@ Header Files$(MonoMiniFilterSubFolder)\common - - Header Files$(MonoMiniFilterSubFolder)\common - Source Files$(MonoMiniFilterSubFolder)\common @@ -142,9 +139,6 @@ Source Files$(MonoMiniFilterSubFolder)\common - - Source Files$(MonoMiniFilterSubFolder)\common - Header Files$(MonoMiniFilterSubFolder)\common diff --git a/msvc/libmini-netcore.targets b/msvc/libmini-netcore.targets deleted file mode 100644 index 62244796431..00000000000 --- a/msvc/libmini-netcore.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/msvc/libmini-netcore.targets.filters b/msvc/libmini-netcore.targets.filters deleted file mode 100644 index a2ce4044444..00000000000 --- a/msvc/libmini-netcore.targets.filters +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Source Files$(MonoMiniFilterSubFolder)\netcore - - - - - {80bfd698-91f3-4a08-8a20-766345b64ce0} - - - diff --git a/msvc/libmini.targets b/msvc/libmini.targets index c951c5ef9c2..5202159d86e 100644 --- a/msvc/libmini.targets +++ b/msvc/libmini.targets @@ -6,5 +6,4 @@ - diff --git a/msvc/libmini.targets.filters b/msvc/libmini.targets.filters index 2d1c7f9d84d..972f58bf861 100644 --- a/msvc/libmini.targets.filters +++ b/msvc/libmini.targets.filters @@ -6,7 +6,6 @@ - {b64924de-7e02-416b-9779-4cc7fe0270e6} diff --git a/msvc/libmono-dynamic.vcxproj b/msvc/libmono-dynamic.vcxproj index cd120b7cfb1..f153323e3a1 100644 --- a/msvc/libmono-dynamic.vcxproj +++ b/msvc/libmono-dynamic.vcxproj @@ -200,10 +200,10 @@ - + {e41ddf41-0916-454b-a7c2-6e410e45cafd} - + {c3d4c623-55f8-4653-980d-61aa629b4e1d} diff --git a/msvc/libmonoruntime-common.targets b/msvc/libmonoruntime-common.targets index e02f1f20cf7..057d5db40b0 100644 --- a/msvc/libmonoruntime-common.targets +++ b/msvc/libmonoruntime-common.targets @@ -62,7 +62,6 @@ - diff --git a/msvc/libmonoruntime-common.targets.filters b/msvc/libmonoruntime-common.targets.filters index 7f1b95fb925..bf8d3c150a2 100644 --- a/msvc/libmonoruntime-common.targets.filters +++ b/msvc/libmonoruntime-common.targets.filters @@ -175,9 +175,6 @@ Source Files$(MonoRuntimeFilterSubFolder)\common - - Source Files$(MonoRuntimeFilterSubFolder)\common - Source Files$(MonoRuntimeFilterSubFolder)\common diff --git a/msvc/libmonoruntime.targets b/msvc/libmonoruntime.targets index 7b797ee766d..ba371e200fe 100644 --- a/msvc/libmonoruntime.targets +++ b/msvc/libmonoruntime.targets @@ -1,7 +1,6 @@ - diff --git a/msvc/mono.props b/msvc/mono.props index e72e58cb1eb..4aa149a7ab5 100644 --- a/msvc/mono.props +++ b/msvc/mono.props @@ -27,9 +27,6 @@ false false - - false - true .. @@ -45,9 +42,6 @@ $(MONO_LIBGC_INCLUDE_DIR) $(MONO_EGLIB_SOURCE_DIR) 610 - $(top_srcdir)/../libraries/Native/Unix/System.Globalization.Native - $(top_srcdir)/../libraries/Native/Unix/Common - $(SHIM_GLOBALIZATION_COMMON);$(SHIM_GLOBALIZATION) $(MONO_DIR)/external/llvm-project/llvm/include @@ -61,7 +55,6 @@ HAVE_SGEN_GC;HAVE_MOVING_COLLECTOR;HAVE_WRITE_BARRIERS;HAVE_CONC_GC_AS_DEFAULT $(SGEN_DEFINES) - TARGET_WINDOWS;PALEXPORT=extern "C" libgcmonosgen.lib -sgen $(MONO_BUILD_DIR_PREFIX)sgen/ @@ -121,9 +114,6 @@ $(MONO_ENABLE_BTLS) - - $(MONO_ENABLE_NETCORE) - HAVE_CONFIG_H @@ -140,8 +130,6 @@ bcrypt.lib;Mswsock.lib;ws2_32.lib;ole32.lib;oleaut32.lib;psapi.lib;version.lib;advapi32.lib;winmm.lib;kernel32.lib;%(AdditionalDependencies) $(MONO_BUILD_DIR_PREFIX)$(Platform)/lib/$(Configuration) - - /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions) $(MONO_BUILD_DIR_PREFIX)$(Platform)/lib/$(Configuration) diff --git a/msvc/mono.winconfig.targets b/msvc/mono.winconfig.targets index d8e39ca7ad2..ae6c94523cf 100644 --- a/msvc/mono.winconfig.targets +++ b/msvc/mono.winconfig.targets @@ -123,8 +123,7 @@ "ENABLE_LLVM", "ENABLE_LLVM_RUNTIME", "ENABLE_HYBRID_SUSPEND", - "ENABLE_COOP_SUSPEND", - "ENABLE_NETCORE" }; + "ENABLE_COOP_SUSPEND" }; var enableFeatures = GetConfigFeatures(path, ".*#define.*ENABLE_.*1"); if (enableDefines != null) diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 9e29cb58e33..d29429917f9 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -90,10 +90,6 @@ if INSTALL_WASM build_profiles += wasm wasm_tools endif -if ENABLE_NETCORE -build_profiles += netcore -endif - test_profiles = $(filter-out binary_reference_assemblies monodroid_tools wasm_tools,$(build_profiles)) MAKE_FLAGS=$(if $(V),,--no-print-directory -s) diff --git a/scripts/ci/run-jenkins.sh b/scripts/ci/run-jenkins.sh index ec5900edf59..948193e8a81 100755 --- a/scripts/ci/run-jenkins.sh +++ b/scripts/ci/run-jenkins.sh @@ -24,10 +24,6 @@ source ${MONO_REPO_ROOT}/scripts/ci/util.sh # # FIXME: Add more # skip=false # skip_step="" -# if ! grep -q -v -e a/netcore -e a/scripts/ci/pipeline-netcore-runtime.yml pr-files.txt; then -# skip_step="NETCORE" -# skip=true -# fi # if ! grep -q -v a/mono/mini/mini-ppc pr-files.txt; then # skip_step="PPC" # skip=true @@ -53,9 +49,6 @@ source ${MONO_REPO_ROOT}/scripts/ci/util.sh # rm pr-files.txt # fi -helix_set_env_vars -helix_send_build_start_event "build/source/$MONO_HELIX_TYPE/" - make_timeout=300m gnumake=$(which gmake || which gnumake || which make) @@ -378,7 +371,6 @@ if [[ ${CI_TAGS} == *'webassembly'* ]] || [[ ${CI_TAGS} == *'wasm'* ]]; fi echo "ENABLE_WASM_THREADS=1" >> sdks/Make.config - #echo "ENABLE_WASM_NETCORE=1" >> sdks/Make.config export aot_test_suites="System.Core" export mixed_test_suites="System.Core" @@ -402,8 +394,8 @@ if [[ ${CI_TAGS} == *'webassembly'* ]] || [[ ${CI_TAGS} == *'wasm'* ]]; ${TESTCMD} --label=system-core --timeout=60m $gnumake -C sdks/wasm run-all-System.Core for suite in ${xunit_test_suites}; do ${TESTCMD} --label=xunit-${suite} --timeout=30m $gnumake -C sdks/wasm run-${suite}-xunit; done # disable for now until https://github.com/mono/mono/pull/13622 goes in - ${TESTCMD} --label=browser --timeout=20m $gnumake -C sdks/wasm run-browser-tests - ${TESTCMD} --label=browser-threads --timeout=20m $gnumake -C sdks/wasm run-browser-threads-tests + #${TESTCMD} --label=browser --timeout=20m $gnumake -C sdks/wasm run-browser-tests + #${TESTCMD} --label=browser-threads --timeout=20m $gnumake -C sdks/wasm run-browser-threads-tests #${TESTCMD} --label=browser-dynamic --timeout=20m $gnumake -C sdks/wasm run-browser-dynamic-tests if [[ ${CI_TAGS} == *'osx-amd64'* ]]; then ${TESTCMD} --label=browser-safari --timeout=20m $gnumake -C sdks/wasm run-browser-safari-tests @@ -412,8 +404,6 @@ if [[ ${CI_TAGS} == *'webassembly'* ]] || [[ ${CI_TAGS} == *'wasm'* ]]; ${TESTCMD} --label=build-aot-all --timeout=20m $gnumake -j ${CI_CPU_COUNT} -C sdks/wasm build-aot-all for suite in ${aot_test_suites}; do ${TESTCMD} --label=run-aot-${suite} --timeout=10m $gnumake -C sdks/wasm run-aot-${suite}; done for suite in ${mixed_test_suites}; do ${TESTCMD} --label=run-aot-mixed-${suite} --timeout=10m $gnumake -C sdks/wasm run-aot-mixed-${suite}; done - # Requires a net 3.0 sdk - #${TESTCMD} --label=netcore --timeout=20m $gnumake -j ${CI_CPU_COUNT} -C sdks/wasm run-hello-netcore #${TESTCMD} --label=check-aot --timeout=20m $gnumake -C sdks/wasm check-aot fi exit 0 @@ -462,11 +452,9 @@ if [[ ${CI_TAGS} != *'mac-sdk'* ]]; # Mac SDK builds Mono itself then build_error=0 ${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelism} ${make_continue} -w V=1 || build_error=1 - helix_send_build_done_event "build/source/$MONO_HELIX_TYPE/" $build_error if [[ ${build_error} != 0 ]]; then echo "ERROR: The Mono build failed." - ${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh exit ${build_error} fi fi @@ -485,7 +473,6 @@ elif [[ ${CI_TAGS} == *'stress-tests'* ]]; then ${MONO_REPO_ROOT}/sc elif [[ ${CI_TAGS} == *'interpreter'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-interpreter.sh; elif [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-mcs.sh; elif [[ ${CI_TAGS} == *'mac-sdk'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-mac-sdk.sh; -elif [[ ${CI_TAGS} == *'helix-tests'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-helix.sh; elif [[ ${CI_TAGS} == *'compile-msbuild-source'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-msbuild.sh; elif [[ ${CI_TAGS} == *'make-install'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-make-install.sh; elif [[ ${CI_TAGS} == *'compiler-server-tests'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-compiler-server.sh; diff --git a/scripts/ci/run-test-acceptance-tests.sh b/scripts/ci/run-test-acceptance-tests.sh index 2b303586ce8..61d0b97165b 100755 --- a/scripts/ci/run-test-acceptance-tests.sh +++ b/scripts/ci/run-test-acceptance-tests.sh @@ -30,5 +30,3 @@ ${TESTCMD} --label=coreclr-runtest-coremanglib --timeout=10m make -C acceptance- # run the GC stress tests (on PRs we only run a short version) ${TESTCMD} --label=coreclr-gcstress --timeout=1200m make -C acceptance-tests coreclr-gcstress - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-default.sh b/scripts/ci/run-test-default.sh index c11f89a8b6c..ce6874d66a6 100755 --- a/scripts/ci/run-test-default.sh +++ b/scripts/ci/run-test-default.sh @@ -155,5 +155,3 @@ fi ${TESTCMD} --label=bundle-test-results --timeout=2m find . -name "TestResult*.xml" -exec tar -rvf TestResults.tar {} \; rm -fr /tmp/jenkins-temp-aspnet* - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-helix.sh b/scripts/ci/run-test-helix.sh deleted file mode 100755 index e885b9cf214..00000000000 --- a/scripts/ci/run-test-helix.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -e - -source ${MONO_REPO_ROOT}/scripts/ci/util.sh - -helix_send_build_start_event "build/tests/$MONO_HELIX_TYPE/" -${TESTCMD} --label=compile-runtime-tests --timeout=20m --fatal make -w -C mono -j ${CI_CPU_COUNT} test -# workaround some races in the tests build -for dir in mcs/tools/nunit-lite mcs/class/Microsoft.Build*; do - ${TESTCMD} --label=compile-$(basename $dir) --timeout=5m make -w -C $dir test xunit-test - ${TESTCMD} --label=compile-$(basename $dir)-xbuild_12 --timeout=5m make -w -C $dir test xunit-test PROFILE=xbuild_12 - ${TESTCMD} --label=compile-$(basename $dir)-xbuild_14 --timeout=5m make -w -C $dir test xunit-test PROFILE=xbuild_14 -done -${TESTCMD} --label=compile-bcl-tests --timeout=40m --fatal make -w -C runtime -j ${CI_CPU_COUNT} test xunit-test -${TESTCMD} --label=create-test-payload --timeout=5m --fatal make -w test-bundle TEST_BUNDLE_PATH="$MONO_REPO_ROOT/mono-test-bundle" -helix_send_build_done_event "build/tests/$MONO_HELIX_TYPE/" 0 - -# get libgdiplus from CI output -if [[ ${CI_TAGS} == *'linux-amd64'* ]]; then - wget "https://xamjenkinsartifact.blob.core.windows.net/test-libgdiplus-mainline/280/debian-9-amd64/src/.libs/libgdiplus.so" -O "$MONO_REPO_ROOT/mono-test-bundle/mono-libgdiplus.so" -else - echo "Unknown OS, couldn't determine appropriate libgdiplus." - exit 1 -fi - -export MONO_HELIX_TEST_PAYLOAD_DIRECTORY="$MONO_REPO_ROOT/mono-test-bundle" -export MONO_HELIX_CORRELATION_ID_FILE="$MONO_REPO_ROOT/test-correlation-id.txt" -${TESTCMD} --label=upload-helix-tests --timeout=5m --fatal make -w -C mcs/tools/mono-helix-client upload-to-helix - -# test suites which aren't ported to helix yet -${TESTCMD} --label=mini-aotcheck --timeout=5m make -j ${CI_CPU_COUNT} -w -C mono/mini -k aotcheck -${TESTCMD} --label=runtime --timeout=20m make -w -C mono/tests test-wrench IGNORE_TEST_JIT=1 V=1 -${TESTCMD} --label=runtime-unit-tests --timeout=5m make -w -C mono/unit-tests -k check -${TESTCMD} --label=runtime-eglib-tests --timeout=5m make -w -C mono/eglib/test -k check -${TESTCMD} --label=monolinker --timeout=10m make -w -C mcs/tools/linker check -${TESTCMD} --label=System.Web.Extensions-standalone --timeout=5m make -w -C mcs/class/System.Web.Extensions run-standalone-test - -# wait for helix tests to complete -export MONO_HELIX_CORRELATION_ID=$(cat "$MONO_HELIX_CORRELATION_ID_FILE") -${TESTCMD} --label=wait-helix-tests --timeout=40m make -w -C mcs/tools/mono-helix-client wait-for-job-completion - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-interpreter.sh b/scripts/ci/run-test-interpreter.sh index 2e5badc1760..e6756ca476e 100755 --- a/scripts/ci/run-test-interpreter.sh +++ b/scripts/ci/run-test-interpreter.sh @@ -114,5 +114,3 @@ if [[ "$run_full_test_suite" -eq "1" ]]; then ${TESTCMD} --label=Microsoft.Build.Utilities-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_14 V=1 ${TESTCMD} --label=System.IO.Compression --timeout=5m make -w -C mcs/class/System.IO.Compression run-test V=1 fi - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-mac-sdk.sh b/scripts/ci/run-test-mac-sdk.sh index 3b73e6b333e..ad05685dfb9 100755 --- a/scripts/ci/run-test-mac-sdk.sh +++ b/scripts/ci/run-test-mac-sdk.sh @@ -23,5 +23,3 @@ else # Bundled libgdiplus ${TESTCMD} --label="System.Drawing" --timeout=60m make -C mcs/class/System.Drawing run-test fi - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-mcs.sh b/scripts/ci/run-test-mcs.sh index 824ce78040e..c3f2e499a12 100755 --- a/scripts/ci/run-test-mcs.sh +++ b/scripts/ci/run-test-mcs.sh @@ -3,5 +3,3 @@ ${TESTCMD} --label=mcs-tests --timeout=30m make -w -C mcs/tests run-test ${TESTCMD} --label=mcs-errors --timeout=10m make -w -C mcs/errors run-test ${TESTCMD} --label=compile-bcl-tests --timeout=40m make -w -C runtime test - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-profiler-stress-tests.sh b/scripts/ci/run-test-profiler-stress-tests.sh index 231745151d2..4e4fa80b8e5 100755 --- a/scripts/ci/run-test-profiler-stress-tests.sh +++ b/scripts/ci/run-test-profiler-stress-tests.sh @@ -4,5 +4,3 @@ ${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check ${TESTCMD} --label=Mono.Profiler.Log-xunit --timeout=30m make -w -C mcs/class/Mono.Profiler.Log run-xunit-test export MONO_BABYSITTER_EXTRA_XML=${MONO_REPO_ROOT}/acceptance-tests/profiler-stress/TestResult-profiler-stress.xml ${TESTCMD} --label=check-profiler-stress --timeout=24h make -C acceptance-tests check-profiler-stress - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-stress-tests.sh b/scripts/ci/run-test-stress-tests.sh index 58afe9d3010..6227f9b6108 100755 --- a/scripts/ci/run-test-stress-tests.sh +++ b/scripts/ci/run-test-stress-tests.sh @@ -1,5 +1,3 @@ #!/bin/bash -e ${TESTCMD} --label=check-stress --timeout=12h make -w -C mono/tests -k check-stress V=1 - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-testing_aot_bitcode.sh b/scripts/ci/run-test-testing_aot_bitcode.sh index c513c353414..21928c9c71a 100755 --- a/scripts/ci/run-test-testing_aot_bitcode.sh +++ b/scripts/ci/run-test-testing_aot_bitcode.sh @@ -35,5 +35,3 @@ ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run ${TESTCMD} --label=monolinker --timeout=10m make -w -C mcs/tools/linker check rm -fr /tmp/jenkins-temp-aspnet* - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-testing_aot_bitcode_interp.sh b/scripts/ci/run-test-testing_aot_bitcode_interp.sh index 80bb9e132a4..d01c962b0c7 100755 --- a/scripts/ci/run-test-testing_aot_bitcode_interp.sh +++ b/scripts/ci/run-test-testing_aot_bitcode_interp.sh @@ -26,5 +26,3 @@ ${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml. ${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test # ${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test - -scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-testing_aot_full.sh b/scripts/ci/run-test-testing_aot_full.sh index f7b45465191..55a5844f210 100755 --- a/scripts/ci/run-test-testing_aot_full.sh +++ b/scripts/ci/run-test-testing_aot_full.sh @@ -47,5 +47,3 @@ ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run ${TESTCMD} --label=monolinker --timeout=10m make -w -C mcs/tools/linker check rm -fr /tmp/jenkins-temp-aspnet* - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-testing_aot_full_interp.sh b/scripts/ci/run-test-testing_aot_full_interp.sh index 2f91b0df8df..8506b3dda24 100755 --- a/scripts/ci/run-test-testing_aot_full_interp.sh +++ b/scripts/ci/run-test-testing_aot_full_interp.sh @@ -32,5 +32,3 @@ ${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run ${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test ${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-testing_aot_hybrid.sh b/scripts/ci/run-test-testing_aot_hybrid.sh index 5575b36a778..42388ae10ce 100755 --- a/scripts/ci/run-test-testing_aot_hybrid.sh +++ b/scripts/ci/run-test-testing_aot_hybrid.sh @@ -29,5 +29,3 @@ ${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net. ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test rm -fr /tmp/jenkins-temp-aspnet* - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-test-winaot.sh b/scripts/ci/run-test-winaot.sh index b4e9879442d..27431e545e3 100755 --- a/scripts/ci/run-test-winaot.sh +++ b/scripts/ci/run-test-winaot.sh @@ -33,5 +33,3 @@ ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run ${TESTCMD} --label=monolinker --timeout=10m make -w -C mcs/tools/linker check rm -fr /tmp/jenkins-temp-aspnet* - -${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh diff --git a/scripts/ci/run-upload-sentry.sh b/scripts/ci/run-upload-sentry.sh deleted file mode 100755 index 763ea385c7b..00000000000 --- a/scripts/ci/run-upload-sentry.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -e -export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh - -if [[ ${CI_TAGS} == *'win-'* ]]; -then - echo "Skipping telemetry phase due to arch" -elif [ ! -f mcs/class/lib/build/upload-to-sentry.exe ]; then - echo "Skipping telemetry phase due to missing uploader" - ${TESTCMD} --label=sentry-telemetry-upload --skip -else - export MONO_SENTRY_OS="${CI_TAGS}" - export MONO_SENTRY_URL="https://baaf612e845d407eb5f415c338bb6df9@sentry.io/1314141" - export MONO_SENTRY_ROOT="$MONO_REPO_ROOT" - ${TESTCMD} --label=sentry-telemetry-upload --timeout=10m make -C mcs/tools/upload-to-sentry upload-crashes -fi diff --git a/scripts/ci/util.sh b/scripts/ci/util.sh index 8b2978c24f5..26519ed705c 100755 --- a/scripts/ci/util.sh +++ b/scripts/ci/util.sh @@ -9,71 +9,3 @@ function report_github_status { wget -qO- --header "Content-Type: application/json" --header "Authorization: token ${GITHUB_STATUS_AUTH_TOKEN}" --post-data "{\"state\": \"$1\", \"context\":\"$2\", \"description\": \"$3\", \"target_url\": \"$4\"}" "https://api.github.com/repos/mono/mono/statuses/${ghprbActualCommit}" } - -function helix_set_env_vars { - if [[ ${CI_TAGS} != *'helix'* ]]; then return 0; fi; - - if [[ ${CI_TAGS} == *'-i386'* ]]; then export MONO_HELIX_ARCHITECTURE="x86"; - elif [[ ${CI_TAGS} == *'-amd64'* ]]; then export MONO_HELIX_ARCHITECTURE="x64"; - elif [[ ${CI_TAGS} == *'-arm64'* ]]; then export MONO_HELIX_ARCHITECTURE="arm64"; - elif [[ ${CI_TAGS} == *'-armel'* ]]; then export MONO_HELIX_ARCHITECTURE="armel"; - elif [[ ${CI_TAGS} == *'-armhf'* ]]; then export MONO_HELIX_ARCHITECTURE="armhf"; - else echo "Couldn't determine architecture for Helix."; return 1; fi - - if [[ ${CI_TAGS} == *'linux-'* ]]; then export MONO_HELIX_OPERATINGSYSTEM="Debian 9"; export MONO_HELIX_TARGET_QUEUE="Debian.9.Amd64"; - elif [[ ${CI_TAGS} == *'osx-'* ]]; then export MONO_HELIX_OPERATINGSYSTEM="macOS 10.12"; export MONO_HELIX_TARGET_QUEUE="OSX.1012.Amd64"; - elif [[ ${CI_TAGS} == *'win-'* ]]; then export MONO_HELIX_OPERATINGSYSTEM="Windows 10"; export MONO_HELIX_TARGET_QUEUE="Windows.10.Amd64"; - else echo "Couldn't determine operating system and target queue for Helix."; return 1; fi - - if [[ ${CI_TAGS} == *'pull-request'* ]]; then - export MONO_HELIX_CREATOR="$ghprbPullAuthorLogin" - export MONO_HELIX_TARGET_QUEUE="${MONO_HELIX_TARGET_QUEUE}.Open" - export MONO_HELIX_SOURCE="pr/jenkins/mono/mono/$ghprbTargetBranch/" - export MONO_HELIX_BUILD_MONIKER="$(git rev-parse HEAD)" - else - version_number=$(grep AC_INIT configure.ac | sed -e 's/AC_INIT(mono, \[//' -e 's/\],//') - major_ver=$(echo "$version_number" | cut -d . -f 1) - minor_ver=$(echo "$version_number" | cut -d . -f 2) - build_ver=$(echo "$version_number" | cut -d . -f 3) - blame_rev=$(git blame configure.ac HEAD | grep AC_INIT | sed 's/ .*//') - patch_ver=$(git log "$blame_rev"..HEAD --oneline | wc -l | sed 's/ //g') - export MONO_HELIX_CREATOR="monojenkins" - export MONO_HELIX_SOURCE="official/mono/mono/$MONO_BRANCH/" - export MONO_HELIX_BUILD_MONIKER=$(printf %d.%d.%d.%d "$major_ver" "$minor_ver" "$build_ver" "$patch_ver") - fi -} - -function helix_send_build_start_event { - if [[ ${CI_TAGS} != *'helix-telemetry'* ]]; then return 0; fi; - if [ -z "$1" ]; then echo "No type."; return 1; fi; - - url="https://helix.dot.net/api/2018-03-14/telemetry/job" - - # we need an API key for non-PR builds - if [[ "${MONO_HELIX_SOURCE}" != "pr/"* ]]; then - if [ -z "$MONO_HELIX_API_KEY" ]; then echo "No Helix API key."; return 1; fi; - url="${url}?access_token=${MONO_HELIX_API_KEY}" - fi - - mkdir -p "helix-telemetry/${1}" - wget -O- --method="POST" --header='Content-Type: application/json' --header='Accept: application/json' --body-data="{ - \"QueueId\": \"Build\", - \"Source\": \"${MONO_HELIX_SOURCE}\", - \"Type\": \"${1}\", - \"Build\": \"${MONO_HELIX_BUILD_MONIKER}\", - \"Properties\": { \"architecture\": \"${MONO_HELIX_ARCHITECTURE}\", \"operatingSystem\": \"${MONO_HELIX_OPERATINGSYSTEM}\"} - }" "${url}" > "helix-telemetry/${1}/job-token.txt" - helix_job_token=$(cat "helix-telemetry/${1}/job-token.txt" | sed 's/"//g') - - wget -O- --method="POST" --header='Accept: application/json' --header="X-Helix-Job-Token: ${helix_job_token}" "https://helix.dot.net/api/2018-03-14/telemetry/job/build?buildUri=${BUILD_URL//+/%2B}" > "helix-telemetry/${1}/build-id.txt" -} - -function helix_send_build_done_event { - if [[ ${CI_TAGS} != *'helix-telemetry'* ]]; then return 0; fi; - if [ -z "$1" ]; then echo "No type."; return 1; fi; - if [ -z "$2" ]; then echo "No error count."; return 1; fi; - - helix_job_token=$(cat "helix-telemetry/${1}/job-token.txt" | sed 's/"//g') - helix_build_id=$(cat "helix-telemetry/$1/build-id.txt" | sed 's/"//g') - wget -O- --method="POST" --header='Accept: application/json' --header="X-Helix-Job-Token: ${helix_job_token}" "https://helix.dot.net/api/2018-03-14/telemetry/job/build/${helix_build_id}/finish?errorCount=${2}&warningCount=0" -} diff --git a/sdks/Make.config.sample b/sdks/Make.config.sample index d15d862a130..c57fbbd74b6 100644 --- a/sdks/Make.config.sample +++ b/sdks/Make.config.sample @@ -30,15 +30,6 @@ ENABLE_ANDROID = 1 #Enables passing --enable-cxx to configure. #ENABLE_CXX = 1 -# Enable netcore support in the WASM build -#ENABLE_WASM_NETCORE = 1 - -# Disable non-wasm support in the WASM build -#DISABLE_WASM_NO_NETCORE = 1 - -# Path to the dotnet/runtime repo for the WASM netcore build -#DOTNET_REPO_DIR = - # Enable WASM threads build #ENABLE_WASM_THREADS=1 diff --git a/sdks/README.netcore.md b/sdks/README.netcore.md deleted file mode 100644 index 0a2958a362e..00000000000 --- a/sdks/README.netcore.md +++ /dev/null @@ -1,25 +0,0 @@ -``` -git clone --branch add-ios https://github.com/akoeplinger/runtime -cd runtime -./build.sh --restore -./build.sh --build --buildtests --os iOSSimulator -./build.sh --build --buildtests --os iOSDevice -cd .. - -cd mono - -echo ENABLE_IOS=1 > sdks/Make.config -echo ENABLE_NETCORE=1 >> sdks/Make.config -echo DISABLE_CLASSIC=1 >> sdks/Make.config -echo DOTNET_RUNTIME_REPO_DIR=$(cd ../runtime && pwd) >> sdks/Make.config - -make -C sdks/builds build-ios -j8 -make -C sdks/builds package-ios -j8 - -make -C sdks/ios build-ios-sim-System.Runtime.Tests -make -C sdks/ios run-ios-sim-System.Runtime.Tests - -# for iOS 13 device runs we need latest ios-deploy tool from master: -brew uninstall ios-deploy -brew install --HEAD ios-deploy -``` diff --git a/sdks/builds/.gitignore b/sdks/builds/.gitignore index 7b3d0cb2ca9..5e18b6d46b2 100644 --- a/sdks/builds/.gitignore +++ b/sdks/builds/.gitignore @@ -39,21 +39,6 @@ ios-sim64-*/ ios-simtv-*/ ios-simwatch-*/ ios-simwatch64-*/ -ios-netcore_target32-*/ -ios-netcore_target32s-*/ -ios-netcore_target64-*/ -ios-netcore_targettv-*/ -ios-netcore_targetwatch-*/ -ios-netcore_targetwatch64_32-*/ -ios-netcore_cross32-*/ -ios-netcore_cross64-*/ -ios-netcore_crosswatch-*/ -ios-netcore_crosswatch64_32-*/ -ios-netcore_sim32-*/ -ios-netcore_sim64-*/ -ios-netcore_simtv-*/ -ios-netcore_simwatch-*/ -ios-netcore_simwatch64-*/ mac-mac64-*/ mac-macarm64-*/ mac-crossarm64-*/ diff --git a/sdks/builds/ios.mk b/sdks/builds/ios.mk index 28752f2c3ae..f09b176e335 100644 --- a/sdks/builds/ios.mk +++ b/sdks/builds/ios.mk @@ -12,7 +12,6 @@ ios_FRAMEWORKS_DIR = $(TOP)/sdks/out/ios-frameworks ios_LIBS_DIR = $(TOP)/sdks/out/ios-libs -ios_NETCORE_LIBS_DIR = $(TOP)/sdks/out/ios-netcore_libs ios_SOURCES_DIR = $(TOP)/sdks/out/ios-sources ios_TPN_DIR = $(TOP)/sdks/out/ios-tpn ios_MONO_VERSION = $(TOP)/sdks/out/ios-mono-version.txt @@ -22,11 +21,6 @@ ios_ARCHIVE += ios-frameworks ios-libs ios-sources ios-tpn ios-mono-version.txt ADDITIONAL_PACKAGE_DEPS += $(ios_FRAMEWORKS_DIR) $(ios_LIBS_DIR) $(ios_SOURCES_DIR) $(ios_TPN_DIR) $(ios_MONO_VERSION) endif -ifdef ENABLE_NETCORE -ios_ARCHIVE += ios-netcore_libs -ADDITIONAL_PACKAGE_DEPS += $(ios_NETCORE_LIBS_DIR) -endif - ios_PLATFORM_BIN=$(XCODE_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin ## @@ -211,44 +205,6 @@ ios-targettv_AC_VARS = \ ios-targetwatch_AC_VARS = $(ios-targettv_AC_VARS) ios-targetwatch64_32_AC_VARS = $(ios-targettv_AC_VARS) -# --- NETCORE ---- -ios-netcore_target32_CONFIGURE_FLAGS = --with-core=only -ios-netcore_target32s_CONFIGURE_FLAGS = --with-core=only -ios-netcore_target64_CONFIGURE_FLAGS = --with-core=only -ios-netcore_targettv_CONFIGURE_FLAGS = $(ios-targettv_CONFIGURE_FLAGS) --with-core=only -ios-netcore_targetwatch_CONFIGURE_FLAGS = $(ios-targetwatch_CONFIGURE_FLAGS) --with-core=only -ios-netcore_targetwatch64_32_CONFIGURE_FLAGS = $(ios-targetwatch64_32_CONFIGURE_FLAGS) --with-core=only - -ios-netcore_target32_SYSROOT = $(ios-target32_SYSROOT) -ios-netcore_target32s_SYSROOT = $(ios-target32s_SYSROOT) -ios-netcore_target64_SYSROOT = $(ios-target64_SYSROOT) -ios-netcore_targettv_SYSROOT = $(ios-targettv_SYSROOT) -ios-netcore_targetwatch_SYSROOT = $(ios-targetwatch_SYSROOT) -ios-netcore_targetwatch64_32_SYSROOT = $(ios-targetwatch64_32_SYSROOT) - -ios-netcore_target32_CPPFLAGS = $(ios-target32_CPPFLAGS) -ios-netcore_target32s_CPPFLAGS = $(ios-target32s_CPPFLAGS) -ios-netcore_target64_CPPFLAGS = $(ios-target64_CPPFLAGS) -ios-netcore_targettv_CPPFLAGS = $(ios-targettv_CPPFLAGS) -ios-netcore_targetwatch_CPPFLAGS = $(ios-targetwatch_CPPFLAGS) -ios-netcore_targetwatch64_32_CPPFLAGS = $(ios-targetwatch64_32_CPPFLAGS) - -ios-netcore_targettv_CFLAGS = $(ios-targettv_CFLAGS) -ios-netcore_targettv_CXXFLAGS = $(ios-targettv_CXXFLAGS) -ios-netcore_targetwatch_CFLAGS = $(ios-targetwatch_CFLAGS) -ios-netcore_targetwatch_CXXFLAGS = $(ios-targetwatch_CXXFLAGS) -ios-netcore_targetwatch64_32_CFLAGS = $(ios-targetwatch64_32_CFLAGS) -ios-netcore_targetwatch64_32_CXXFLAGS = $(ios-targetwatch64_32_CXXFLAGS) - -ios-netcore_targettv_LDFLAGS = $(ios-targettv_LDFLAGS) -ios-netcore_targetwatch_LDFLAGS = $(ios-targetwatch_LDFLAGS) -ios-netcore_targetwatch64_32_LDFLAGS = $(ios-targetwatch64_32_LDFLAGS) - -ios-netcore_targettv_AC_VARS = $(ios-targettv_AC_VARS) -ios-netcore_targetwatch_AC_VARS =$(ios-targetwatch_AC_VARS) -ios-netcore_targetwatch64_32_AC_VARS = $(ios-targetwatch64_32_AC_VARS) - - ifndef DISABLE_CLASSIC # ios-target32_BITCODE_MARKER=-fembed-bitcode-marker $(eval $(call iOSDeviceTemplate,target32,arm-apple-darwin10,armv7)) @@ -260,17 +216,6 @@ $(eval $(call iOSDeviceTemplate,targetwatch,armv7k-apple-darwin10,armv7k)) $(eval $(call iOSDeviceTemplate,targetwatch64_32,aarch64-apple-darwin10_ilp32,arm64_32)) endif -ifdef ENABLE_NETCORE -# ios-netcore_target32_BITCODE_MARKER=-fembed-bitcode-marker -$(eval $(call iOSDeviceTemplate,netcore_target32,arm-apple-darwin10,armv7)) -$(eval $(call iOSDeviceTemplate,netcore_target32s,arm-apple-darwin10,armv7s)) -# ios-netcore_target64_BITCODE_MARKER=-fembed-bitcode-marker -$(eval $(call iOSDeviceTemplate,netcore_target64,aarch64-apple-darwin10,arm64)) -$(eval $(call iOSDeviceTemplate,netcore_targettv,aarch64-apple-darwin10,arm64)) -$(eval $(call iOSDeviceTemplate,netcore_targetwatch,armv7k-apple-darwin10,armv7k)) -$(eval $(call iOSDeviceTemplate,netcore_targetwatch64_32,aarch64-apple-darwin10_ilp32,arm64_32)) -endif - ## # Simulator builds # @@ -398,29 +343,6 @@ ios-simwatch64_AC_VARS = \ ac_cv_func_execvp=no \ ac_cv_func_signal=no -# --- NETCORE ---- -ios-netcore_sim32_SYSROOT = $(ios-sim32_SYSROOT) -ios-netcore_sim64_SYSROOT = $(ios-sim64_SYSROOT) -ios-netcore_simtv_SYSROOT = $(ios-simtv_SYSROOT) -ios-netcore_simwatch_SYSROOT = $(ios-simwatch_SYSROOT) -ios-netcore_simwatch64_SYSROOT = $(ios-simwatch64_SYSROOT) - -ios-netcore_sim32_CONFIGURE_FLAGS = --with-core=only -ios-netcore_sim64_CONFIGURE_FLAGS = --with-core=only -ios-netcore_simtv_CONFIGURE_FLAGS = --with-core=only -ios-netcore_simwatch_CONFIGURE_FLAGS = $(ios-simwatch_CONFIGURE_FLAGS) --with-core=only -ios-netcore_simwatch64_CONFIGURE_FLAGS = $(ios-simwatch64_CONFIGURE_FLAGS) --with-core=only - -ios-netcore_sim32_CPPFLAGS = $(ios-sim32_CPPFLAGS) -ios-netcore_sim64_CPPFLAGS = $(ios-sim64_CPPFLAGS) -ios-netcore_simtv_CPPFLAGS = $(ios-simtv_CPPFLAGS) -ios-netcore_simwatch_CPPFLAGS = $(ios-simwatch_CPPFLAGS) -ios-netcore_simwatch64_CPPFLAGS = $(ios-simwatch64_CPPFLAGS) - -ios-netcore_simtv_AC_VARS = $(ios-simtv_AC_VARS) -ios-netcore_simwatch_AC_VARS = $(ios-simwatch_AC_VARS) -ios-netcore_simwatch64_AC_VARS = $(ios-simwatch64_AC_VARS) - ifndef DISABLE_CLASSIC $(eval $(call iOSSimulatorTemplate,sim32,i386-apple-darwin10,i386)) @@ -430,14 +352,6 @@ $(eval $(call iOSSimulatorTemplate,simwatch,i386-apple-darwin10,i386)) $(eval $(call iOSSimulatorTemplate,simwatch64,x86_64-apple-darwin10,x86_64)) endif -ifdef ENABLE_NETCORE -$(eval $(call iOSSimulatorTemplate,netcore_sim32,i386-apple-darwin10,i386)) -$(eval $(call iOSSimulatorTemplate,netcore_sim64,x86_64-apple-darwin10,x86_64)) -$(eval $(call iOSSimulatorTemplate,netcore_simtv,x86_64-apple-darwin10,x86_64)) -$(eval $(call iOSSimulatorTemplate,netcore_simwatch,i386-apple-darwin10,i386)) -$(eval $(call iOSSimulatorTemplate,netcore_simwatch64,x86_64-apple-darwin10,x86_64)) -endif - ## # Cross compiler builds # @@ -507,18 +421,6 @@ ios-crosswatch64_32_SYSROOT=-isysroot $(XCODE_DIR)/Platforms/MacOSX.platform/Dev ios-crosswatch_CONFIGURE_FLAGS=--enable-cooperative-suspend -# --- NETCORE ---- -ios-netcore_cross32_SYSROOT = $(ios-cross32_SYSROOT) -ios-netcore_crosswatch_SYSROOT = $(ios-crosswatch_SYSROOT) -ios-netcore_cross64_SYSROOT = $(ios-cross64_SYSROOT) -ios-netcore_crosswatch64_32_SYSROOT = $(ios-crosswatch64_32_SYSROOT) - -ios-netcore_cross32_CONFIGURE_FLAGS = --with-core=only -ios-netcore_crosswatch_CONFIGURE_FLAGS = $(ios-crosswatch_CONFIGURE_FLAGS) --with-core=only -ios-netcore_cross64_CONFIGURE_FLAGS = --with-core=only -ios-netcore_crosswatch64_32_CONFIGURE_FLAGS = --with-core=only - - ifndef DISABLE_CLASSIC $(eval $(call iOSCrossTemplate,cross32,x86_64,arm-darwin,target32,llvm-llvm64,arm-apple-darwin10,$(ios_sysroot_path))) $(eval $(call iOSCrossTemplate,cross64,x86_64,aarch64-darwin,target64,llvm-llvm64,aarch64-apple-darwin10,$(ios_sysroot_path))) @@ -526,14 +428,6 @@ $(eval $(call iOSCrossTemplate,crosswatch,x86_64,armv7k-unknown-darwin,targetwat $(eval $(call iOSCrossTemplate,crosswatch64_32,x86_64,aarch64-apple-darwin10_ilp32,targetwatch64_32,llvm-llvm64,aarch64-apple-darwin10_ilp32,$(watchos64_32_sysroot_path))) endif -ifdef ENABLE_NETCORE -$(eval $(call iOSCrossTemplate,netcore_cross32,x86_64,arm-darwin,netcore_target32,llvm-llvm64,arm-apple-darwin10,$(ios_sysroot_path))) -$(eval $(call iOSCrossTemplate,netcore_cross64,x86_64,aarch64-darwin,netcore_target64,llvm-llvm64,aarch64-apple-darwin10,$(ios_sysroot_path))) -$(eval $(call iOSCrossTemplate,netcore_crosswatch,x86_64,armv7k-unknown-darwin,netcore_targetwatch,llvm-llvm64,armv7k-apple-darwin,$(watchos_sysroot_path))) -$(eval $(call iOSCrossTemplate,netcore_crosswatch64_32,x86_64,aarch64-apple-darwin10_ilp32,netcore_targetwatch64_32,llvm-llvm64,aarch64-apple-darwin10_ilp32,$(watchos64_32_sysroot_path))) -endif - - $(ios_FRAMEWORKS_DIR): package-ios-target32 package-ios-target32s package-ios-target64 package-ios-targettv package-ios-targetwatch package-ios-targetwatch64_32 package-ios-sim32 package-ios-sim64 package-ios-simtv package-ios-simwatch package-ios-simwatch64 $(TOP)/sdks/builds/ios-Mono.framework-Info.plist $(TOP)/sdks/builds/ios-Mono.framework-tvos.Info.plist $(TOP)/sdks/builds/ios-Mono.framework-watchos.Info.plist $(TOP)/sdks/out/ios-target32-$(CONFIGURATION)/lib/libmonosgen-2.0-minversion80.dylib $(TOP)/sdks/out/ios-target32s-$(CONFIGURATION)/lib/libmonosgen-2.0-minversion80.dylib $(TOP)/sdks/out/ios-target64-$(CONFIGURATION)/lib/libmonosgen-2.0-minversion80.dylib rm -rf $(ios_FRAMEWORKS_DIR) @@ -718,7 +612,7 @@ $(ios_LIBS_DIR): package-ios-target32 package-ios-target32s package-ios-target64 $(ios_SOURCES_DIR)/mcs/build/common/Consts.cs: # we use this as a sentinel file to avoid rsyncing everything on each build (slows down iterating) mkdir -p $(ios_SOURCES_DIR) - cd $(TOP) && rsync -r --exclude='external/api-doc-tools/*' --exclude='external/api-snapshot/*' --exclude='external/aspnetwebstack/*' --exclude='external/binary-reference-assemblies/*' --exclude='netcore/*' --include='*.cs' --include='*/' --exclude="*" --prune-empty-dirs . $(ios_SOURCES_DIR) + cd $(TOP) && rsync -r --exclude='external/api-doc-tools/*' --exclude='external/api-snapshot/*' --exclude='external/aspnetwebstack/*' --exclude='external/binary-reference-assemblies/*' --include='*.cs' --include='*/' --exclude="*" --prune-empty-dirs . $(ios_SOURCES_DIR) $(ios_SOURCES_DIR): $(ios_SOURCES_DIR)/mcs/build/common/Consts.cs @@ -738,15 +632,3 @@ $(ios_MONO_VERSION): $(TOP)/configure.ac ifndef DISABLE_CLASSIC $(eval $(call BclTemplate,ios,monotouch monotouch_runtime monotouch_tv monotouch_tv_runtime monotouch_watch monotouch_watch_runtime monotouch_tools,monotouch monotouch_tv monotouch_watch)) endif - -ifdef ENABLE_NETCORE -$(ios_NETCORE_LIBS_DIR): package-ios-netcore_target32 package-ios-netcore_target32s package-ios-netcore_target64 package-ios-netcore_targettv package-ios-netcore_targetwatch package-ios-netcore_targetwatch64_32 package-ios-netcore_sim32 package-ios-netcore_sim64 package-ios-netcore_simtv package-ios-netcore_simwatch - cp $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSSimulator-Debug-appleuniversal/System.*.dylib $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSSimulator-Debug-appleuniversal/System.*.a $(TOP)/sdks/out/ios-netcore_sim64-$(CONFIGURATION)/lib - cp $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSDevice-Debug-appleuniversal/System.*.dylib $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSDevice-Debug-appleuniversal/System.*.a $(TOP)/sdks/out/ios-netcore_target64-$(CONFIGURATION)/lib - mkdir -p $(TOP)/sdks/out/ios-netcore_libs/ios/ - cp $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSSimulator-Debug-appleuniversal/*.dll $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/runtime/netcoreapp-iOSSimulator-Debug-appleuniversal/*.pdb $(TOP)/sdks/out/ios-netcore_libs/ios/ - cp $(TOP)/sdks/builds/ios-netcore_sim64-$(CONFIGURATION)/netcore/config.make $(TOP)/netcore - $(MAKE) -C $(TOP)/netcore bcl - cp $(TOP)/netcore/System.Private.CoreLib/bin/x64/System.Private.CoreLib.dll $(TOP)/sdks/out/ios-netcore_libs/ios/ - cp $(TOP)/netcore/System.Private.CoreLib/bin/x64/System.Private.CoreLib.pdb $(TOP)/sdks/out/ios-netcore_libs/ios/ -endif diff --git a/sdks/ios/Makefile b/sdks/ios/Makefile index 669574624cc..913abc24d1b 100644 --- a/sdks/ios/Makefile +++ b/sdks/ios/Makefile @@ -5,10 +5,6 @@ include $(TOP)/sdks/paths.mk ALL_TARGETS = harness.exe appbuilder.exe -ifdef ENABLE_NETCORE -ALL_TARGETS += netcore-test-runner.exe -endif - ifndef DISABLE_CLASSIC ALL_TARGETS += test-runner.exe endif @@ -16,7 +12,6 @@ endif all: $(ALL_TARGETS) BCL_DIR = ../out/ios-bcl/monotouch -NETCORE_BCL_DIR = ../out/ios-netcore_libs/ios NINJA_PATH:=$(or $(shell which ninja),$(error "ninja not found, install it using 'brew install ninja'.")) IOS_DEPLOY_PATH:=$(or $(shell which ios-deploy),$(error "ios-deploy not found, install it using 'brew install ios-deploy'.")) @@ -58,11 +53,6 @@ harness.exe: harness/harness.cs $(OPTIONS_CS) appbuilder.exe: appbuilder/appbuilder.cs $(OPTIONS_CS) csc /out:$@ $^ -NETCORE_XUNIT_DIR := $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/System.Buffers.Tests/netcoreapp-Debug - -netcore-test-runner.exe: test-runner/runner.cs $(NETCORE_XUNIT_DIR)/xunit.core.dll - csc /out:$@ /debug /noconfig /nostdlib /d:ENABLE_NETCORE /d:XUNIT_RUNNER /r:$(NETCORE_BCL_DIR)/System.Private.CoreLib.dll /r:$(NETCORE_BCL_DIR)/System.Runtime.dll /r:$(NETCORE_BCL_DIR)/System.Runtime.Extensions.dll /r:$(NETCORE_BCL_DIR)/System.Xml.XDocument.dll /r:$(NETCORE_BCL_DIR)/System.Private.Xml.dll /r:$(NETCORE_BCL_DIR)/System.Private.Xml.Linq.dll /r:$(NETCORE_BCL_DIR)/System.Linq.dll /r:$(NETCORE_BCL_DIR)/System.IO.dll /r:$(NETCORE_BCL_DIR)/System.IO.FileSystem.dll /r:$(NETCORE_BCL_DIR)/System.Collections.dll /r:$(NETCORE_BCL_DIR)/System.Threading.dll /r:$(NETCORE_BCL_DIR)/System.Net.Sockets.dll /r:$(NETCORE_XUNIT_DIR)/xunit.core.dll /r:$(NETCORE_XUNIT_DIR)/xunit.abstractions.dll /r:$(NETCORE_XUNIT_DIR)/xunit.runner.utility.netcoreapp10.dll test-runner/runner.cs - test-runner.exe: test-runner/runner.cs obj/Xamarin.iOS.dll csc /out:$@ /debug -r:$(BCL_DIR)/nunitlite.dll -r:$(BCL_DIR)/Mono.Security.dll test-runner/runner.cs @@ -70,13 +60,9 @@ obj/Xamarin.iOS.dll: test-runner/xi.cs test-runner/xi.snk mkdir -p obj csc /out:$@ /noconfig /nostdlib /keyfile:test-runner/xi.snk /optimize /deterministic /publicsign /target:library /r:$(BCL_DIR)/mscorlib.dll /r:$(BCL_DIR)/System.Net.Http.dll test-runner/xi.cs -app/app-simulator app/app-device.a app/app-netcore-simulator app/app-netcore-device.a: app/*.h app/*.m app/Makefile +app/app-simulator app/app-device.a: app/*.h app/*.m app/Makefile $(MAKE) -C app -ifdef ENABLE_NETCORE -SIM_DEPS += netcore-test-runner.exe app/app-netcore-simulator -endif - ifndef DISABLE_CLASSIC SIM_DEPS += test-runner.exe app/app-simulator endif @@ -111,10 +97,6 @@ ifdef ENABLE_AOT_CACHE APPBUILDER_ARGS += --aot-cachedir $(abspath aot-cache) endif -ifdef ENABLE_NETCORE -DEV_DEPS += netcore-test-runner.exe app/app-netcore-device.a -endif - ifndef DISABLE_CLASSIC DEV_DEPS += test-runner.exe app/app-device.a endif @@ -204,46 +186,6 @@ start-sim: stop-sim: xcrun simctl shutdown $(SIM_NAME) -ifdef ENABLE_NETCORE - -NETCORE_TEST_ASSEMBLIES = $(filter-out $(NETCORE_BCL_DIR)/System.Runtime.WindowsRuntime.dll $(NETCORE_BCL_DIR)/System.Runtime.WindowsRuntime.UI.Xaml.dll, $(wildcard $(NETCORE_BCL_DIR)/*.dll)) netcore-test-runner.exe - -# Parameters: -# $(1): test assembly name (no .dll suffix) -define NetCoreTestTemplate - -$(1)_ASSEMBLIES = \ - $(NETCORE_TEST_ASSEMBLIES) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/$(1).dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/CoreFx.Private.TestUtilities.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Newtonsoft.Json.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.abstractions.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.assert.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.core.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.execution.dotnet.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.runner.utility.netcoreapp10.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.DotNet.PlatformAbstractions.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.DotNet.XUnitExtensions.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CommunicationUtilities.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CoreUtilities.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CrossPlatEngine.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.PlatformAbstractions.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.Utilities.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.CodeCoverage.Shim.dll) \ - $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.TestPlatform.Common.dll) - -# TODO: remove need for DOTNET_SYSTEM_GLOBALIZATION_INVARIANT by compiling System.Globalization.Native.dylib -# TODO: replace nonosxtests trait with noniostests -$(1)_ARGS = --setenv=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 netcore-test-runner.exe CONNSTR $(1).dll -notrait category=nonosxtests @CoreFX.issues.rsp @CoreFX.issues_mac.rsp -$(1)_APPBUILDER_ARGS += --netcore --content="$(abspath $(TOP)/netcore/CoreFX.issues.rsp)" --content="$(abspath $(TOP)/netcore/CoreFX.issues_mac.rsp)" - -endef - -$(foreach testdir,$(notdir $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/*.Tests)),$(eval $(call NetCoreTestTemplate,$(testdir)))) - -endif - ifndef DISABLE_CLASSIC CLASSIC_TEST_ASSEMBLIES = $(BCL_DIR)/mscorlib.dll \ diff --git a/sdks/ios/app/Makefile b/sdks/ios/app/Makefile index b3014cb2f64..8aab87be03d 100644 --- a/sdks/ios/app/Makefile +++ b/sdks/ios/app/Makefile @@ -7,10 +7,6 @@ ifndef DISABLE_CLASSIC ALL_TARGETS += app-simulator app-device.a endif -ifdef ENABLE_NETCORE -ALL_TARGETS += app-netcore-simulator app-netcore-device.a -endif - all: $(ALL_TARGETS) CONFIGURATION?=release @@ -31,7 +27,6 @@ CC = $(XCODE_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang SIM_SYSROOT = $(XCODE_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk SIM_ARCH = x86_64 SIM_CLASSIC_SDK_DIR = ../../out/ios-sim64-$(CONFIGURATION) -SIM_NETCORE_SDK_DIR = ../../out/ios-netcore_sim64-$(CONFIGURATION) SIM_CFLAGS = \ -std=gnu11 \ -fobjc-arc \ @@ -61,25 +56,8 @@ app-simulator: sim-main.o sim-runtime.o $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_LDFLAGS) $(SIM_CLASSIC_LDFLAGS) -o $@ $^ endif -ifdef ENABLE_NETCORE -SIM_NETCORE_LDFLAGS = \ - $(foreach u,$(UNREFERENCED_SYMBOLS_COMMON),-u $u) \ - $(SIM_NETCORE_SDK_DIR)/lib/libmonosgen-2.0.a \ - -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.Native.a \ - -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.IO.Compression.Native.a \ - -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.Security.Cryptography.Native.Apple.a - -sim-netcore-%.o: %.m - $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_CFLAGS) -I$(SIM_NETCORE_SDK_DIR)/include/mono-2.0 -c -o $@ $^ - -app-netcore-simulator: sim-netcore-main.o sim-netcore-runtime.o - $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_LDFLAGS) $(SIM_NETCORE_LDFLAGS) -o $@ $^ -endif - - DEV_ARCH = arm64 DEV_CLASSIC_SDK_DIR = ../../out/ios-target64-$(CONFIGURATION) -DEV_NETCORE_SDK_DIR = ../../out/ios-netcore_target64-$(CONFIGURATION) DEV_SYSROOT = $(XCODE_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ DEV_CFLAGS = \ -isysroot $(DEV_SYSROOT) \ @@ -98,13 +76,5 @@ app-device.a: dev-main.o dev-runtime.o libtool -static -o $@ $^ endif -ifdef ENABLE_NETCORE -dev-netcore-%.o: %.m - $(ENV) $(CC) -arch $(DEV_ARCH) $(DEV_CFLAGS) -I$(DEV_NETCORE_SDK_DIR)/include/mono-2.0 -DENABLE_NETCORE -c -o $@ $^ - -app-netcore-device.a: dev-netcore-main.o dev-netcore-runtime.o - libtool -static -o $@ $^ -endif - clean: - $(RM) -rf app-simulator app-netcore-simulator *.o *.a + $(RM) -rf app-simulator *.o *.a diff --git a/sdks/ios/appbuilder/appbuilder.cs b/sdks/ios/appbuilder/appbuilder.cs index 61d9e6b43da..02f98858dc0 100644 --- a/sdks/ios/appbuilder/appbuilder.cs +++ b/sdks/ios/appbuilder/appbuilder.cs @@ -96,7 +96,6 @@ public class AppBuilder string exe = null; string signing_identity = null; string team_identifier = null; - bool isnetcore = false; bool isdev = false; bool isdebug = false; bool isllvm = false; @@ -118,7 +117,6 @@ public class AppBuilder { "signing-identity=", s => signing_identity = s }, { "team-identifier=", s => team_identifier = s }, { "llvm", s => isllvm = true }, - { "netcore", s => isnetcore = true }, { "debug", s => isdebug = true }, { "interp-only", s => isinterponly = true }, { "interp-mixed", s => isinterpmixed = true }, @@ -149,8 +147,8 @@ public class AppBuilder break; } - string runtime = isnetcore ? "ios-netcore_target64-release" : "ios-target64-release"; - string cross_runtime = isnetcore ? "ios-netcore_cross64-release" : "ios-cross64-release"; + string runtime = "ios-target64-release"; + string cross_runtime = "ios-cross64-release"; bool isinterpany = isinterponly || isinterpmixed; @@ -341,14 +339,11 @@ public class AppBuilder libs += $" $mono_sdkdir/{runtime}/lib/libmono-icall-table.a"; libs += $" $mono_sdkdir/{runtime}/lib/libmono-ilgen.a"; } - ninja.WriteLine ($"build $appdir/{bundle_executable}: gen-exe {ofiles} $builddir/modules.o " + libs + (isnetcore ? " $apptemplate_dir/app-netcore-device.a" : " $apptemplate_dir/app-device.a")); - if (isnetcore) - ninja.WriteLine ($" forcelibs = -force_load $mono_sdkdir/{runtime}/lib/System.Native.a -force_load $mono_sdkdir/{runtime}/lib/System.IO.Compression.Native.a -force_load $mono_sdkdir/{runtime}/lib/System.Security.Cryptography.Native.Apple.a"); - else - ninja.WriteLine ($" forcelibs = -force_load $mono_sdkdir/{runtime}/lib/libmono-native-unified.a"); + ninja.WriteLine ($"build $appdir/{bundle_executable}: gen-exe {ofiles} $builddir/modules.o " + libs + " $apptemplate_dir/app-device.a"); + ninja.WriteLine ($" forcelibs = -force_load $mono_sdkdir/{runtime}/lib/libmono-native-unified.a"); ninja.WriteLine ("build $builddir/modules.o: compile-objc $builddir/modules.m"); } else { - ninja.WriteLine ($"build $appdir/{bundle_executable}: cp " + (isnetcore ? "$apptemplate_dir/app-netcore-simulator" : "$apptemplate_dir/app-simulator")); + ninja.WriteLine ($"build $appdir/{bundle_executable}: cp " + "$apptemplate_dir/app-simulator"); } ninja.WriteLine ("build $builddir/Info.plist.binary: plutil $builddir/Info.plist"); ninja.WriteLine ("build $appdir/Info.plist: cpifdiff $builddir/Info.plist.binary"); diff --git a/sdks/ios/test-runner/runner.cs b/sdks/ios/test-runner/runner.cs index 796439292fa..e3c75bb1ff9 100644 --- a/sdks/ios/test-runner/runner.cs +++ b/sdks/ios/test-runner/runner.cs @@ -193,12 +193,10 @@ public class TestRunner closeAfterTestRun = false; } -#if !ENABLE_NETCORE // Make sure the TLS subsystem including the DependencyInjector is initialized. // This would normally happen on system startup in // `xamarin-macios/src/ObjcRuntime/Runtime.cs`. MonoTlsProviderFactory.Initialize (); -#endif // some tests assert having a SynchronizationContext for MONOTOUCH, provide a default one SynchronizationContext.SetSynchronizationContext (new SynchronizationContext ()); diff --git a/sdks/wasm/.gitignore b/sdks/wasm/.gitignore index d5a19e3abce..f5bad46dfcf 100644 --- a/sdks/wasm/.gitignore +++ b/sdks/wasm/.gitignore @@ -8,5 +8,5 @@ emsdk_env.sh builds/threads-debug builds/threads-release .configured -src/pinvoke-tables-default-netcore.h !DebuggerTestSuite +nuget.config diff --git a/sdks/wasm/Makefile b/sdks/wasm/Makefile index 56ecaf7c824..d06f8457691 100644 --- a/sdks/wasm/Makefile +++ b/sdks/wasm/Makefile @@ -36,12 +36,7 @@ PACKAGER=mono --debug packager.exe --no-native-strip MSBUILD_QUIET_ARGS=--nologo -v q -consoleloggerparameters:NoSummary -ifeq ($(HOST_PLATFORM),win32) -DOTNET_CMD := $(shell powershell -ExecutionPolicy Bypass -Command "./init-tools.ps1")/dotnet.exe -DOTNET_CMD := "$(subst \,/,$(DOTNET))" -else -DOTNET_CMD := $(shell ./init-tools.sh | tail -1) -endif +DOTNET_CMD := dotnet DOTNET_PACK=$(DOTNET_CMD) pack DOTNET_BUILD=$(DOTNET_CMD) build @@ -208,7 +203,6 @@ build-interp-$(1): builds/$(1)/dotnet.js endef -ifndef DISABLE_WASM_NO_NETCORE $(eval $(call InterpBuildTemplate,debug,wasm-runtime-release,$(EMCC_DEBUG_FLAGS),$(MONO_LIBS),$(MONO_DEPS))) $(eval $(call InterpBuildTemplate,release,wasm-runtime-release,$(EMCC_RELEASE_FLAGS),$(MONO_LIBS),$(MONO_DEPS))) ifdef ENABLE_WASM_THREADS @@ -219,134 +213,6 @@ ifdef ENABLE_WASM_DYNAMIC_RUNTIME $(eval $(call InterpBuildTemplate,dynamic-debug,wasm-runtime-dynamic-release,$(EMCC_DEBUG_FLAGS) $(EMCC_DYNAMIC_FLAGS),$(MONO_DYNAMIC_LIBS),$(MONO_DEPS))) $(eval $(call InterpBuildTemplate,dynamic-release,wasm-runtime-dynamic-release,$(EMCC_RELEASE_FLAGS) $(EMCC_DYNAMIC_FLAGS),$(MONO_DYNAMIC_LIBS),$(MONO_DEPS))) endif -endif - -# -# NETCORE TARGETS -# - -# -# These require a separate dotnet/runtime repo -# - -ifdef ENABLE_WASM_NETCORE - -ifeq ($(ENABLE_WASM_NETCORE_LOCAL_BUILD),) -$(error "Only local builds using a separate dotnet/runtime repo are supported.") -endif - -ifeq ($(DOTNET_REPO_PATH),) -$(error "Set the DOTNET_REPO_PATH variable for the netcore build to a checkout of the dotnet/runtime repo.") -endif - -DOTNET=$(DOTNET_REPO_PATH)/dotnet.sh -RUNTIMEPACK_DIR=$(DOTNET_REPO_PATH)/artifacts/bin/lib-runtime-packs/net5.0-Browser-Release-wasm - -.PHONY: build-netcore -build-netcore: | provision-emsdk - EMSDK_PATH=$(EMSCRIPTEN_SDK_DIR) && make -C $(DOTNET_REPO_PATH)/src/mono/wasm build - -samples/hello/bin/Debug/net5.0/hello.dll: samples/hello/Program.cs - $(DOTNET) build samples/hello -f net5.0 $(MSBUILD_QUIET_ARGS) - -build-interp-netcore-hello: packager.exe samples/hello/bin/Debug/net5.0/hello.dll - $(PACKAGER) --debugrt --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/interp-netcore-hello --nobinding --builddir=obj/interp-netcore-hello --framework=net5.0 --runtimepack-dir=$(RUNTIMEPACK_DIR) --template=runtime-tests.js --linker samples/hello/bin/Debug/net5.0/hello.dll - ninja -v -C obj/interp-netcore-hello - -bin/interp-netcore-hello/dotnet.js: build-interp-netcore-hello - -run-interp-netcore-hello: bin/interp-netcore-hello/dotnet.js - (cd bin/interp-netcore-hello && $(SM) runtime.js --run hello.dll) - -build-aot-hello-netcore: packager.exe samples/hello/bin/Debug/net5.0/hello.dll - $(PACKAGER) --native-strip --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/aot-hello-netcore --nobinding --builddir=obj/aot-hello-netcore --framework=net5.0 --runtimepack-dir=$(RUNTIMEPACK_DIR) --template=runtime-tests.js --aot --linker --pinvoke-libs=libSystem.Native samples/hello/bin/Debug/net5.0/hello.dll - ninja -v -C obj/aot-hello-netcore - -bin/aot-hello-netcore/dotnet.js: build-aot-hello-netcore - -run-aot-hello-netcore: bin/aot-hello-netcore/dotnet.js - (cd bin/aot-hello-netcore && $(RUN_V8) --experimental-wasm-simd runtime.js -- --run hello.dll) - -# -# XUNIT test support -# -# This depends on the tests being built using build.sh --subset Libs.Tests -c release - -## -# Parameters: -# $(1) - make target suffix -# $(2) - directory name -# $(3) - test directory -# $(4) - test assembly -# $(5) - command line arguments -define NetcoreTestTemplate - -ifeq ($(3),Common.Tests) -$(1)_PATH=$(DOTNET_REPO_PATH)/artifacts/bin/$(3)/netcoreapp5.0-OSX-Release -else -$(1)_PATH=$(DOTNET_REPO_PATH)/artifacts/bin/$(3)/netcoreapp5.0-Release -endif - -bin/$(2)/dotnet.js: packager.exe runtime-tests.js corefx-exclusions.rsp - cd xunit-runner && ../../../.dotnet/dotnet build $(MSBUILD_QUIET_ARGS) - $(PACKAGER) --debugrt --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --search-path=$(COREFX_TESTS_DIR)/$(3) --template=runtime-tests.js --appdir=bin/$(2) --builddir=obj/$(2) --asset=corefx-exclusions.rsp --framework=netcoreapp5.0 --netcore-sdkdir=$(NETCOREAPP_DIR) --search-path=$$($(1)_PATH) --search-path=$$($(1)_PATH) xunit-runner/bin/Debug/netcoreapp5.0/xunit-runner.dll $(5) $$($(1)_PATH)/$(4) - ninja -v -C obj/$(2) - -build-$(1): bin/$(2)/dotnet.js - -run-$(1): bin/$(2)/dotnet.js - (cd bin/$(2) && $$(SM) runtime.js --enable-gc --run xunit-runner.dll $(4) `cat corefx-exclusions.rsp | grep -v '#'`) - -endef - -include corefx-test-suites.mk - -# Passing testsuites after exclusions -NETCORE_COREFX_PASSING_TEST_SUITES = \ - Common.Tests \ - Invariant.Tests \ - Microsoft.CSharp.Tests \ - Microsoft.VisualBasic.Core.Tests \ - Microsoft.Win32.Primitives.Tests \ - System.AppContext.Tests \ - System.Buffers.Tests \ - System.Collections.Concurrent.Tests \ - System.Collections.Immutable.Tests \ - System.Collections.NonGeneric.Tests \ - System.Collections.Specialized.Tests \ - System.Collections.Tests \ - System.IO.UnmanagedMemoryStream.Tests \ - System.Json.Tests \ - System.Memory.Tests \ - System.Numerics.Vectors.Tests \ - System.Runtime.CompilerServices.Unsafe.Tests \ - System.Runtime.CompilerServices.VisualC.Tests \ - System.Runtime.Extensions.Tests \ - System.Runtime.Handles.Tests \ - System.Runtime.Tests - -System.IO.Compression.ZipFile.Tests_PACKAGER_ARGS=--pinvoke-libs=System.IO.Compression.Native --native-lib=$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/System.IO.Compression.Native.bc --embed-file $(COREFX_TESTS_DIR)/System.IO.Compression.ZipFile.Tests/ZipTestData@ZipTestData -System.IO.Compression.Brotli.Tests_PACKAGER_ARGS=--pinvoke-libs=System.IO.Compression.Native --native-lib=$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/System.IO.Compression.Native.bc --embed-file $(COREFX_TESTS_DIR)/System.IO.Compression.Brotli.Tests/UncompressedTestFiles@UncompressedTestFiles --embed-file $(COREFX_TESTS_DIR)/System.IO.Compression.Brotli.Tests/BrotliTestData@BrotliTestData - -# Test targets are named run-netcore- -$(foreach suite,$(NETCORE_COREFX_TEST_SUITES),$(eval $(call NetcoreTestTemplate,netcore-$(suite),netcore-$(suite),$(suite),$(suite).dll,$($(suite)_PACKAGER_ARGS)))) - -$(foreach suite,$(NETCORE_COREFX_PASSING_TEST_SUITES),$(eval run-corefx-tests-netcore: run-$(suite))) - -# Path to a fully built https://github.com/dotnet/performance -PERF_REPO_ROOT= - -# Need to embed corelib because BenchmarkDotNet reads version info from it -build-bench: packager.exe $(NETCOREAPP_DIR) bench-runner/WasmRunner.cs - @if test -z "$(PERF_REPO_ROOT)"; then echo "PERF_REPO_ROOT is not set"; exit 1; fi - cd bench-runner && dotnet build /nologo /p:Configuration=Release - $(PACKAGER) --debugrt --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/bench --nobinding --builddir=obj/bench --framework=netcoreapp3.0 --netcore-sdkdir=$(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0 --template=runtime-tests.js --search-path=bench-runner/bin/Release/netcoreapp3.0 --embed-file System.Private.CoreLib.dll@System.Private.CoreLib.dll --embed-file System.Text.RegularExpressions.dll --search-path=$(PERF_REPO_ROOT)/artifacts/bin/MicroBenchmarks/Release/netcoreapp5.0 --search-path=$(PERF_REPO_ROOT)/artifacts/bin/MicroBenchmarks/Release/netcoreapp5.0/runtimes/unix/lib/netstandard2.0 bench-runner/bin/Release/netcoreapp3.0/bench.dll MicroBenchmarks.dll - ninja -v -C obj/bench - -run-bench: build-bench - (cd bin/bench && $(SM) runtime.js --enable-gc --setenv=MONO_LOG_MASK= --run bench.dll MicroBenchmarks.dll Perf_HashCode) - -endif runtime-threads: $(MAKE) -C ../builds package-wasm-runtime-threads @@ -747,11 +613,9 @@ clean: clean-browser-tests $(RM) $(WASM_FRAMEWORK)/WebAssembly.*.dll $(RM) $(WASM_FRAMEWORK)/WebAssembly.*.pdb $(RM) $(WASM_FRAMEWORK)/WebAssembly.*.xml - $(RM) -r $(NETCOREAPP_DIR) $(RM) -r builds $(RM) emsdk_env.sh $(RM) .configured - $(RM) src/pinvoke-tables-default-netcore.h package: build build-sdk build-dbg-proxy rm -rf tmp @@ -823,11 +687,13 @@ clean-sdk: $(RM) -r sdk/**/**/bin $(RM) -r sdk/**/**/obj $(RM) -r sdk/packages + $(RM) -r sdk/nuget.config $(RM) -r $(WASM_FRAMEWORK)/.stamp-framework build-sdk: $(WASM_FRAMEWORK)/.stamp-framework $(DOTNET_BUILD) sdk/MonoWasmSdkCLI.sln $(DOTNET_PACK) sdk/Templates/Mono.WebAssembly.Templates.csproj + @echo '' > nuget.config clean-browser-tests: clean-sdk $(RM) -r $(BROWSER_TEST)/.stamp-browser-test-suite diff --git a/sdks/wasm/corefx-exclusions.rsp b/sdks/wasm/corefx-exclusions.rsp deleted file mode 100644 index 6bd07a66358..00000000000 --- a/sdks/wasm/corefx-exclusions.rsp +++ /dev/null @@ -1,239 +0,0 @@ -# Takes too long --nomethod System.Net.Test.Common.VirtualNetworkTest.VirtualNetwork_SingleThreadIntegrityTest_Ok --nomethod System.Net.Test.Common.VirtualNetworkStreamTest.VirtualNetworkStream_SingleThreadIntegrityTest_Ok --nomethod System.Linq.Expressions.Tests.ArrayBoundsTests.NewArrayBounds - -# Threads --nomethod System.Net.Test.Common.VirtualNetworkTest.VirtualNetwork_MultiThreadIntegrityTest_Ok --nomethod System.Net.Test.Common.VirtualNetworkStreamTest.VirtualNetworkStream_MultiThreadIntegrityTest_Ok --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.UsePoolInParallel --nonamespace System.Collections.Concurrent.Tests --noclass System.Collections.Immutable.Tests.ImmutableInterlockedTests --nomethod System.Collections.Immutable.Tests.ImmutableArrayTest.AddThreadSafety --nomethod System.Collections.Tests.ArrayList_SyncRootTests.GetSyncRoot --noclass System.Collections.Tests.ArrayList_SynchronizedTests --nomethod System.Collections.Tests.Queue_SyncRootTests.SyncRoot --nomethod System.Collections.Tests.Stack_SyncRootTests.GetSyncRootBasic --nomethod System.Collections.Tests.Hashtable_SyncRootTests.SyncRoot --nomethod System.Collections.Tests.Queue_SynchronizedTests.SynchronizedEnqueue --nomethod System.Tests.EnvironmentTests.CurrentManagedThreadId_DifferentForActiveThreads - -# Needs crypto --noclass Tests.System.MarvinTests --noclass Tests.System.Security.IdentityHelperTests - -# File IO --nomethod Microsoft.VisualBasic.FileIO.Tests.FileSystemTests.GetDriveInfo_Drive - -# RemoteExecutor --nomethod Microsoft.VisualBasic.Tests.FileSystemTests.CloseAllFiles --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentingManyBuffersFiresExpectedDiagnosticEvents --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentBufferFiresRentedDiagnosticEvent --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.ReturnBufferFiresDiagnosticEvent --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentingNonExistentBufferFiresAllocatedDiagnosticEvent --nomethod System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent --nomethod System.Runtime.Tests.ProfileOptimizationTest.ProfileOptimization_CheckFileExists --nomethod System.IO.Tests.PathTests_Unix.GetTempPath_SetEnvVar_Unix --nomethod System.Tests.EnvironmentTests.CurrentDirectory_SetToValidOtherDirectory --nomethod System.Tests.AppDomainTests.UnhandledException_Add_Remove --nomethod System.Tests.AppDomainTests.UnhandledException_NotCalled_When_Handled --nomethod System.Tests.AppDomainTests.Id --nomethod System.Tests.AppDomainTests.FirstChanceException_Add_Remove --nomethod System.Tests.AppDomainTests.ProcessExit_Add_Remove --nomethod System.Tests.AppDomainTests.ProcessExit_Called --nomethod System.Tests.AppDomainTests.ExecuteAssemblyByName --nomethod System.Tests.UnloadingAndProcessExitTests.UnloadingEventMustHappenBeforeProcessExitEvent --nomethod System.Buffers.ArrayPool.Tests.CollectionTests.BuffersAreCollectedWhenStale - -# Serialization + mscorlib not found --nomethod *.EqualityComparer_SerializationRoundtrip --nomethod *.IGenericSharedAPI_SerializeDeserialize --nomethod System.Collections.Tests.Dictionary_Tests.ComparerSerialization --nomethod *.Ctor_SerializationInfo_StreamingContext - -################ -# Per assembly -################ - -# Microsoft.VisualBasic.Core.Tests --noclass Microsoft.VisualBasic.Tests.ConversionsTests --noclass Microsoft.VisualBasic.Tests.ConversionTests --nomethod Microsoft.VisualBasic.Tests.FinancialTests.PV --nomethod Microsoft.VisualBasic.Tests.FinancialTests.Rate --nomethod Microsoft.VisualBasic.CompilerServices.Tests.CharTypeTests.FromObject_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.CharTypeTests.FromString_ThrowsInvalidCastException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.CharTypeTests.FromString_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.DateTypeTests.FromObject_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.DateTypeTests.FromString_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.IntegerTypeTests.FromString_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.LongTypeTests.FromString_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.DateTypeTests.FromObject_ThrowsInvalidCastException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.ObjectTypeTests.ObjTst --nomethod Microsoft.VisualBasic.CompilerServices.Tests.ProjectDataTests.EndApp --nomethod Microsoft.VisualBasic.CompilerServices.Tests.SingleTypeTests.FromObject_ThrowsOverflowException --nomethod Microsoft.VisualBasic.CompilerServices.Tests.StringTypeTests.StrCmp -# System.Collections.Immutable.Tests --nomethod System.Collections.Immutable.Tests.ImmutableArrayTest.IStructuralEquatableGetHashCode -# System.Collections.NonGeneric.Tests --nomethod System.Collections.Tests.CaseInsensitiveComparerTests.Ctor_CultureInfo_Compare_TurkishI --nomethod System.Collections.Tests.ComparerTests.Default_Compare --nomethod System.Collections.Tests.ComparerTests.DefaultInvariant_Compare --nomethod System.Collections.Tests.SortedListTests.Item_Get_DifferentCulture --nomethod System.Collections.Tests.CaseInsensitiveHashCodeProviderTests.Ctor_CultureInfo_GetHashCodeCompare_TurkishI --nomethod System.Collections.Tests.CaseInsensitiveHashCodeProviderTests.Default_Compare_TurkishI -# System.Collections.Specialized.Tests -# System.Collections.Tests --nomethod System.Collections.Tests.StructuralComparisonsTests.StructuralComparer_Compare -# System.ComponentModel.TypeConverter.Tests --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XAttributeValuePropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementAttributePropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementDescendantsPropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementElementPropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementElementsPropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementValuePropertyDescriptor --nomethod System.Xml.Linq.Tests.XTypeDescriptionProviderTests.XElementXmlPropertyDescriptor --nomethod System.Timers.Tests.TimerTests.TestTimerStartAutoReset --nomethod System.ComponentModel.Tests.MaskedTextProviderTests.Ctor_Mask_Culture --nomethod System.ComponentModel.Tests.MaskedTextProviderTests.Ctor_Mask_Culture__RestrictToAscii --nomethod System.ComponentModel.Tests.MaskedTextProviderTests.Ctor_Mask_Culture_PasswordChar_AllowPromptAsInput --nomethod System.ComponentModel.Tests.MaskedTextProviderTests.Ctor_Mask_Culture_AllowPromptAsInput_PromptChar_PasswordChar_RestrictToAscii --nomethod System.ComponentModel.Tests.MaskedTextProviderTests.ComplexDigitMaskTest --nomethod System.ComponentModel.Tests.DateTimeConverterTests.ConvertTo_DestinationType_Success --nomethod System.ComponentModel.Tests.DateTimeOffsetConverterTests.ConvertTo_DestinationType_Success --nomethod System.ComponentModel.Tests.CultureInfoConverterTests.ConvertFrom_DestinationType_Success --nomethod System.ComponentModel.Tests.ToolboxItemFilterAttributeTests.Equals_Object_ReturnsExpected --nomethod System.ComponentModel.Tests.MemberDescriptorTests.Equals_Invoke_ReturnsExpected -# System.Memory.Tests --nomethod System.Tests.StringTests.Compare --nomethod System.Tests.StringTests.EndsWith --nomethod System.Tests.StringTests.EndsWithMatchNonOrdinal_StringComparison --nomethod System.Tests.StringTests.IndexOf_TurkishI_TurkishCulture --nomethod System.Tests.StringTests.IndexOf_HungarianDoubleCompression_HungarianCulture --nomethod System.Tests.StringTests.IndexOf_EquivalentDiacritics_EnglishUSCulture --nomethod System.Tests.StringTests.IndexOf_EquivalentDiacritics_InvariantCulture --nomethod System.Tests.StringTests.StartsWith --nomethod System.Tests.StringTests.Test_ToLower_Culture --nomethod System.Tests.StringTests.ToUpper_TurkishI_TurkishCulture --nomethod System.Tests.StringTests.ToUpper_TurkishI_EnglishUSCulture --nomethod System.Tests.StringTests.CompareTest --nomethod System.Tests.StringTests.CasingTest --nomethod System.Tests.StringTests.StartEndWithTest --nomethod System.Tests.StringTests.StartsWithMatchNonOrdinal_StringComparison --nomethod System.Tests.StringTests.NormalizationTest --nomethod System.SpanTests.SpanTests.Span_Constructor --nomethod System.SpanTests.SpanTests.Span_InstanceMethod --nomethod System.SpanTests.SpanTests.ReadOnlySpan_Constructor --nomethod System.SpanTests.SpanTests.ReadOnlySpan_InstanceMethod --nomethod System.SpanTests.SpanTests.Memory_PropertyReturningSpan --nomethod System.SpanTests.SpanTests.ReadOnlyMemory_PropertyReturningReadOnlySpan --nomethod System.Tests.StringTests.Test_ToUpper_Culture -# System.Numerics.Vectors.Tests --nomethod System.Numerics.Tests.GenericVectorTests.ConstructorWithUnsupportedTypes_Guid --nomethod System.Numerics.Tests.GenericVectorTests.ConstructorWithUnsupportedTypes_DateTime --nomethod System.Numerics.Tests.GenericVectorTests.ConstructorWithUnsupportedTypes_Char -# System.Runtime.Extensions.Tests --nomethod System.Tests.EnvironmentUserName.UserNameIsCorrect --nomethod System.Tests.EnvironmentUserName.UserName_Valid --nomethod System.Tests.Environment_MachineName.TestMachineNameProperty --nomethod System.Tests.ProgressTests.* --nomethod System.Reflection.Tests.AssemblyNameProxyTests.GetAssemblyName_AssemblyNameProxy --nomethod System.IO.Tests.PathTests.GetFullPath_CoreTests --noclass System.IO.Tests.PathTests_Windows --noclass System.Tests.StringComparerTests --nomethod System.Tests.EnvironmentTests.WorkingSet_Valid --noclass System.Tests.AppDomainTests --noclass System.Tests.Environment_Exit --noclass System.Tests.GetCommandLineArgs --noclass System.Tests.EnvironmentStackTrace -# System.Runtime.Tests -## Takes too long --nomethod System.Text.Unicode.Tests.Utf8Tests.ToBytes_WithSmallValidBuffers -## Threads --nomethod System.Runtime.CompilerServices.Tests.ConditionalWeakTableTests.Concurrent_Add_Read_Remove_DifferentObjects --nomethod System.Runtime.CompilerServices.Tests.ConditionalWeakTableTests.Concurrent_AddMany_DropReferences --nomethod System.Runtime.CompilerServices.Tests.ConditionalWeakTableTests.Concurrent_GetValue_Read_Remove_SameObject --nomethod System.Tests.DateTimeTests.TestTryParseAtBoundaries -## Other --noclass System.Reflection.Tests.IsCollectibleTests --noclass System.Tests.TimeZoneInfoTests --nomethod System.Text.Tests.AsciiUtilityTests.WidenAsciiToUtf16_SomeNonAsciiInput --nomethod System.Text.Tests.AsciiUtilityTests.NarrowUtf16ToAscii_SomeNonAsciiInput --nomethod System.Reflection.Tests.ModuleTests.GetField --nomethod System.Reflection.Tests.ModuleTests.ResolveMethod --nomethod System.Reflection.Tests.ModuleTests.ResolveField --nomethod System.Reflection.Tests.PointerTests.PointerPropertyGetValue --nomethod System.ComponentModel.Tests.DefaultValueAttributeTests.Ctor_TypeDescriptorNotFound_ExceptionFallback --nomethod System.Runtime.ExceptionServices.Tests.ExceptionDispatchInfoTests.SetCurrentStackTrace_IncludedInExceptionStackTrace --nomethod System.Runtime.CompilerServices.Tests.ConditionalWeakTableTests.Concurrent_GetValue_Read_Remove_DifferentObjects --nomethod System.Runtime.CompilerServices.Tests.RuntimeFeatureTests.DynamicCode_Jit --nomethod System.Runtime.Tests.NullableMetadataTests.ShimsHaveOnlyTypeForwards --nomethod System.Runtime.Tests.NullableMetadataTests.ShimsDontHaveNullablePublicOnlyAttribute --nomethod System.Tests.StringTests.Contains --nomethod System.Tests.StringTests.Contains_StringComparison_TurkishI --nomethod System.Tests.StringTests.Replace_StringComparison_ReturnsExpected --nomethod System.Tests.StringTests.Replace_StringComparison_TurkishI --nomethod System.Tests.StringTests.IndexOf_TurkishI_TurkishCulture_Char --nomethod System.Tests.StringTests.IndexOf_EquivalentDiacritics_EnglishUSCulture_Char --nomethod System.Tests.StringTests.IndexOf_EquivalentDiacritics_InvariantCulture_Char --nomethod System.Tests.ActivatorTests.TestingCreateInstanceFromObjectHandle --nomethod System.Tests.ActivatorTests.TestingCreateInstanceObjectHandle --nomethod System.Tests.ActivatorTests.CreateInstanceAssemblyResolve --nomethod System.Tests.CharTests.ToLower --nomethod System.Tests.CharTests.ToLowerInvariant --nomethod System.Tests.CharTests.ToUpper --nomethod System.Tests.CharTests.ToUpperInvariant --nomethod System.Tests.CharTests.CasingTest --nomethod System.Tests.CharTests.CasingTest --nomethod System.Tests.DelegateTests.DynamicInvoke_OptionalParameter_WithMissingValue --nomethod System.Tests.DelegateTests.DynamicInvoke_OptionalParameterUnassingableFromMissing_WithMissingValue --nomethod System.Tests.DelegateTests.DynamicInvoke_ParameterSpecification_ArrayOfMissing --nomethod System.Tests.ExceptionTests.ThrowStatementDoesNotResetExceptionStackLineSameMethod --nomethod System.Tests.ExceptionTests.ThrowStatementDoesNotResetExceptionStackLineOtherMethod --nomethod System.Tests.GCTests.AddMemoryPressure_InvalidBytesAllocated_ThrowsArgumentOutOfRangeException --nomethod System.Tests.GCTests.LatencyRoundtrips --nomethod System.Tests.GCExtendedTests.GetGCMemoryInfo --nomethod System.Tests.StringGetHashCodeTests.GetHashCodeWithStringComparer_UseSameStringInTwoProcesses_ReturnsDifferentHashCodes --nomethod System.Tests.TupleTests.CompareTo --nomethod System.Tests.UnitySerializationHolderTests.UnitySerializationHolderWithAssemblySingleton --nomethod System.Tests.UriCreateStringTests.Create_String_Invalid --nomethod System.Tests.TypeTestsExtended.GetTypeByName --nomethod System.Tests.TypeTestsExtended.GetTypeByName_NoSuchType_ThrowsTypeLoadException --nomethod System.Tests.TypeTestsExtended.GetTypeByNameCaseSensitiveTypeloadFailure --nomethod System.Tests.ArgIteratorTests.ArgIterator_GetRemainingCount_GetNextArg --nomethod System.Tests.StringTests.Replace_StringComparisonCulture_ReturnsExpected --nomethod System.Tests.ActivatorTests.TestingCreateInstanceFromObjectHandleFullSignature --nomethod System.Tests.ActivatorTests.TestingCreateInstanceObjectHandleFullSignature --nomethod System.Tests.DateTimeTests.InvalidDateTimeStyles --nomethod System.Tests.DateTimeTests.TryFormat_MatchesExpected --nomethod System.Tests.DateTimeTests.GetDateTimeFormats_FormatSpecifier_InvalidFormat --nomethod System.Tests.DateTimeTests.ToString_Invoke_ReturnsExpected --nomethod System.Tests.DateTimeTests.TryFormat_MatchesToString --nomethod System.Tests.DateTimeTests.GetDateTimeFormats --nomethod System.Tests.DateTimeTests.Parse_ValidInput_Succeeds --nomethod System.Tests.DateTimeTests.ParseExact_ValidInput_Succeeds --nomethod System.Tests.DateTimeTests.Parse_Span_ValidInput_Succeeds --nomethod System.Tests.DateTimeTests.ParseExact_Span_ValidInput_Succeeds --nomethod System.Tests.DateTimeOffsetTests.ToString_MatchesExpected --nomethod System.Tests.DateTimeOffsetTests.TryFormat_MatchesExpected --nomethod System.Tests.DateTimeOffsetTests.ToString_WithCulture_MatchesExpected --nomethod System.Tests.TimeSpanTests.Parse --nomethod System.Tests.TimeSpanTests.Parse_Invalid --nomethod System.Tests.TimeSpanTests.ToString_Valid --nomethod System.Tests.TimeSpanTests.Parse_Span --nomethod System.Tests.TimeSpanTests.Parse_Span_Invalid --nomethod System.Tests.TimeSpanTests.TryFormat_Valid -# System.IO.Compression --nomethod System.IO.Compression.DeflateStreamUnitTests.FlushAsync_DuringWriteAsync --nomethod System.IO.Compression.DeflateStreamUnitTests.WriteAsync_DuringWriteAsync --nomethod System.IO.Compression.GzipStreamUnitTests.FlushAsync_DuringWriteAsync --nomethod System.IO.Compression.GzipStreamUnitTests.WriteAsync_DuringWriteAsync --nomethod System.IO.Compression.Tests.zip_InvalidParametersAndStrangeFiles.ZipArchiveEntry_CorruptedStream_EnsureNoExtraBytesReadOrOverWritten --nomethod System.IO.Compression.Tests.zip_InvalidParametersAndStrangeFiles.ZipWithLargeSparseFile --nomethod System.IO.Compression.Tests.zip_InvalidParametersAndStrangeFiles.ReadArchive_WithEOCDComment_TrailingPrecedingGarbage -# System.IO.Compression.ZipFile.Tests --nomethod System.IO.Compression.Tests.ZipFile_Create.InvalidDates -# System.IO.Compression.Brotli.Tests --nomethod System.IO.Compression.BrotliStreamUnitTests.WrapStreamReturningBadReadValues --nomethod System.IO.Compression.BrotliStreamUnitTests.FlushAsync_DuringReadAsync --nomethod System.IO.Compression.BrotliStreamUnitTests.FlushAsync_DuringFlushAsync --nomethod System.IO.Compression.BrotliStreamUnitTests.ReadAsync_DuringReadAsync diff --git a/sdks/wasm/corefx-test-suites.mk b/sdks/wasm/corefx-test-suites.mk deleted file mode 100644 index 5d697a6dffd..00000000000 --- a/sdks/wasm/corefx-test-suites.mk +++ /dev/null @@ -1,208 +0,0 @@ -NETCORE_COREFX_TEST_SUITES = \ -Common.Tests \ -Invariant.Tests \ -Microsoft.CSharp.Tests \ -Microsoft.VisualBasic.Core.Tests \ -Microsoft.Win32.Primitives.Tests \ -Microsoft.XmlSerializer.Generator.Tests \ -System.AppContext.Tests \ -System.Buffers.Tests \ -System.CodeDom.Tests \ -System.Collections.Concurrent.Tests \ -System.Collections.Immutable.Tests \ -System.Collections.NonGeneric.Tests \ -System.Collections.Specialized.Tests \ -System.Collections.Tests \ -System.ComponentModel.Annotations.Tests \ -System.ComponentModel.Composition.Registration.Tests \ -System.ComponentModel.Composition.Tests \ -System.ComponentModel.EventBasedAsync.Tests \ -System.ComponentModel.Primitives.Tests \ -System.ComponentModel.Tests \ -System.ComponentModel.TypeConverter.Tests \ -System.Composition.AttributeModel.Tests \ -System.Composition.Convention.Tests \ -System.Composition.Hosting.Tests \ -System.Composition.Runtime.Tests \ -System.Composition.Tests \ -System.Composition.TypedParts.Tests \ -System.Configuration.ConfigurationManager.Tests \ -System.Console.Manual.Tests \ -System.Console.Tests \ -System.Data.Common.Tests \ -System.Data.DataSetExtensions.Tests \ -System.Data.Odbc.Tests \ -System.Data.SqlClient.ManualTesting.Tests \ -System.Data.SqlClient.Tests \ -System.Diagnostics.Contracts.Tests \ -System.Diagnostics.Debug.Tests \ -System.Diagnostics.DiagnosticSource.Tests \ -System.Diagnostics.FileVersionInfo.Tests \ -System.Diagnostics.Process.Tests \ -System.Diagnostics.StackTrace.Tests \ -System.Diagnostics.TextWriterTraceListener.Tests \ -System.Diagnostics.Tools.Tests \ -System.Diagnostics.TraceSource.Tests \ -System.Diagnostics.Tracing.Tests \ -System.Drawing.Common.Tests \ -System.Drawing.Primitives.Tests \ -System.Dynamic.Runtime.Tests \ -System.Globalization.Calendars.Tests \ -System.Globalization.CalendarsWithConfigSwitch.Tests \ -System.Globalization.Extensions.Tests \ -System.Globalization.Tests \ -System.IO.Compression.Brotli.Tests \ -System.IO.Compression.Tests \ -System.IO.Compression.ZipFile.Tests \ -System.IO.FileSystem.DriveInfo.Tests \ -System.IO.FileSystem.Primitives.Tests \ -System.IO.FileSystem.Tests \ -System.IO.FileSystem.Watcher.Tests \ -System.IO.IsolatedStorage.Tests \ -System.IO.MemoryMappedFiles.Tests \ -System.IO.Packaging.Tests \ -System.IO.Pipelines.Tests \ -System.IO.Pipes.Tests \ -System.IO.Ports.Tests \ -System.IO.Tests \ -System.IO.UnmanagedMemoryStream.Tests \ -System.Json.Tests \ -System.Linq.Expressions.Tests \ -System.Linq.Parallel.Tests \ -System.Linq.Queryable.Tests \ -System.Linq.Tests \ -System.Memory.Tests \ -System.Net.Http.Functional.Tests \ -System.Net.Http.Unit.Tests \ -System.Net.HttpListener.Tests \ -System.Net.Mail.Functional.Tests \ -System.Net.Mail.Unit.Tests \ -System.Net.NameResolution.Functional.Tests \ -System.Net.NameResolution.Pal.Tests \ -System.Net.NameResolution.Unit.Tests \ -System.Net.NetworkInformation.Functional.Tests \ -System.Net.Ping.Functional.Tests \ -System.Net.Primitives.Functional.Tests \ -System.Net.Primitives.Pal.Tests \ -System.Net.Primitives.UnitTests.Tests \ -System.Net.Quic.Tests \ -System.Net.Requests.Tests \ -System.Net.Security.Tests \ -System.Net.Security.Unit.Tests \ -System.Net.ServicePoint.Tests \ -System.Net.Sockets.Tests \ -System.Net.WebClient.Tests \ -System.Net.WebHeaderCollection.Tests \ -System.Net.WebProxy.Tests \ -System.Net.WebSockets.Client.Tests \ -System.Net.WebSockets.Tests \ -System.Net.WebSockets.WebSocketProtocol.Tests \ -System.Numerics.Tensors.Tests \ -System.Numerics.Vectors.Tests \ -System.ObjectModel.Tests \ -System.Private.Uri.ExtendedFunctional.Tests \ -System.Private.Uri.Functional.Tests \ -System.Private.Uri.Unit.Tests \ -System.Reflection.Context.Tests \ -System.Reflection.CoreCLR.Tests \ -System.Reflection.DispatchProxy.Tests \ -System.Reflection.Emit.ILGeneration.Tests \ -System.Reflection.Emit.Lightweight.Tests \ -System.Reflection.Emit.Tests \ -System.Reflection.Extensions.Tests \ -System.Reflection.Metadata.Tests \ -System.Reflection.MetadataLoadContext.Tests \ -System.Reflection.Tests \ -System.Reflection.TypeExtensions.CoreCLR.Tests \ -System.Reflection.TypeExtensions.Tests \ -System.Resources.Extensions.Tests \ -System.Resources.Reader.Tests \ -System.Resources.ResourceManager.Tests \ -System.Resources.Writer.Tests \ -System.Runtime.CompilerServices.Unsafe.Tests \ -System.Runtime.CompilerServices.VisualC.Tests \ -System.Runtime.Extensions.Tests \ -System.Runtime.Handles.Tests \ -System.Runtime.InteropServices.RuntimeInformation.Tests \ -System.Runtime.InteropServices.Tests \ -System.Runtime.InteropServices.WindowsRuntime.Tests \ -System.Runtime.Loader.DefaultContext.Tests \ -System.Runtime.Loader.RefEmitLoadContext.Tests \ -System.Runtime.Loader.Tests \ -System.Runtime.Numerics.Tests \ -System.Runtime.Serialization.Formatters.Tests \ -System.Runtime.Serialization.Json.ReflectionOnly.Tests \ -System.Runtime.Serialization.Json.Tests \ -System.Runtime.Serialization.Primitives.Tests \ -System.Runtime.Serialization.Xml.ReflectionOnly.Tests \ -System.Runtime.Serialization.Xml.Tests \ -System.Runtime.Tests \ -System.Security.Claims.Tests \ -System.Security.Cryptography.Algorithms.Tests \ -System.Security.Cryptography.Csp.Tests \ -System.Security.Cryptography.Encoding.Tests \ -System.Security.Cryptography.OpenSsl.Tests \ -System.Security.Cryptography.Pkcs.Tests \ -System.Security.Cryptography.Primitives.Tests \ -System.Security.Cryptography.X509Certificates.Tests \ -System.Security.Cryptography.Xml.Tests \ -System.Security.Permissions.Tests \ -System.Security.SecureString.Tests \ -System.ServiceModel.Syndication.Tests \ -System.Text.Encoding.CodePages.Tests \ -System.Text.Encoding.Extensions.Tests \ -System.Text.Encoding.Tests \ -System.Text.Encodings.Web.Tests \ -System.Text.Json.Tests \ -System.Text.RegularExpressions.Tests \ -System.Threading.Channels.Tests \ -System.Threading.Overlapped.Tests \ -System.Threading.Tasks.Dataflow.Tests \ -System.Threading.Tasks.Extensions.Tests \ -System.Threading.Tasks.Parallel.Tests \ -System.Threading.Tasks.Tests \ -System.Threading.Tests \ -System.Threading.Thread.Tests \ -System.Threading.ThreadPool.Tests \ -System.Threading.Timer.Tests \ -System.Transactions.Local.Tests \ -System.ValueTuple.Tests \ -System.Web.HttpUtility.Tests \ -System.Xml.Linq.Axes.Tests \ -System.Xml.Linq.Events.Tests \ -System.Xml.Linq.Misc.Tests \ -System.Xml.Linq.Properties.Tests \ -System.Xml.Linq.SDMSample.Tests \ -System.Xml.Linq.Streaming.Tests \ -System.Xml.Linq.TreeManipulation.Tests \ -System.Xml.Linq.xNodeBuilder.Tests \ -System.Xml.Linq.xNodeReader.Tests \ -System.Xml.Misc.Tests \ -System.Xml.RW.CharCheckingReader.Tests \ -System.Xml.RW.CustomReader.Tests \ -System.Xml.RW.FactoryReader.Tests \ -System.Xml.RW.NameTable.Tests \ -System.Xml.RW.ReaderSettings.Tests \ -System.Xml.RW.RwFactory.Tests \ -System.Xml.RW.SubtreeReader.Tests \ -System.Xml.RW.WrappedReader.Tests \ -System.Xml.RW.XmlConvert.Tests \ -System.Xml.RW.XmlReader.ReadContentAs.Tests \ -System.Xml.RW.XmlReader.Tests \ -System.Xml.RW.XmlSystemPathResolver.Tests \ -System.Xml.RW.XmlWriter.Tests \ -System.Xml.RW.XmlWriterApi.Tests \ -System.Xml.Schema.Extensions.Tests \ -System.Xml.XPath.Tests \ -System.Xml.XPath.XDocument.Tests \ -System.Xml.XPath.XmlDocument.Tests \ -System.Xml.XmlDocument.Tests \ -System.Xml.XmlNodeReader.Tests \ -System.Xml.XmlResolver.Tests \ -System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests \ -System.Xml.XmlSchemaSet.Tests \ -System.Xml.XmlSerializer.ReflectionOnly.Tests \ -System.Xml.XmlSerializer.Tests \ -System.Xml.Xsl.XslCompiledTransformApi.Tests \ -System.Xml.Xsl.XslTransformApi.Tests \ -XsltCompiler.Tests \ diff --git a/sdks/wasm/docs/development.md b/sdks/wasm/docs/development.md deleted file mode 100644 index f6b4b4d9f54..00000000000 --- a/sdks/wasm/docs/development.md +++ /dev/null @@ -1,15 +0,0 @@ -# NETCORE Support - -Currently, only local development is supported on osx. - -* Get a working ```dotnet/runtime``` repo. -* Build the 'Libs' subset in that repo. -* Add the following to ```sdks/Make.config```: -``` -ENABLE_WASM_NETCORE=1 -ENABLE_WASM_NETCORE_LOCAL_BUILD=1 -DOTNET_REPO_PATH= -``` -* ```make runtime-netcore``` will build the runtime and corelib for wasm and copy the result into ```out/wasm-runtime-netcore-release``` -where the rest of the build will pick it up similarly to the non-netcore case. -* See the ```run-interp-netcore-hello``` make target for a sample. diff --git a/sdks/wasm/init-tools.ps1 b/sdks/wasm/init-tools.ps1 deleted file mode 100644 index 1ef0c7f5809..00000000000 --- a/sdks/wasm/init-tools.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -function Write-Host {} - -. "..\..\eng\common\tools.ps1" - -InitializeDotNetCli $true \ No newline at end of file diff --git a/sdks/wasm/init-tools.sh b/sdks/wasm/init-tools.sh deleted file mode 100755 index 90246f469a7..00000000000 --- a/sdks/wasm/init-tools.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# always ignore system dotnet -export use_installed_dotnet_cli=false - -. "../../eng/common/tools.sh" - -InitializeDotNetCli true - -which dotnet \ No newline at end of file diff --git a/sdks/wasm/packager.cs b/sdks/wasm/packager.cs index 28d4f53dc65..aa73fce6315 100644 --- a/sdks/wasm/packager.cs +++ b/sdks/wasm/packager.cs @@ -285,7 +285,6 @@ class Driver { } if (resolved == null && is_sdk_assembly (ra)) - // FIXME: netcore assemblies have missing references continue; if (resolved != null) { @@ -403,8 +402,6 @@ class Driver { bool enable_fs = false; bool enable_threads = false; bool enable_dynamic_runtime = false; - bool is_netcore = false; - bool enable_simd = false; var il_strip = false; var linker_verbose = false; var runtimeTemplate = "runtime.js"; @@ -422,7 +419,6 @@ class Driver { var linkModeParm = "all"; var linkMode = LinkMode.All; var linkDescriptor = ""; - var framework = ""; var runtimepack_dir = ""; string coremode, usermode; string aot_profile = null; @@ -473,7 +469,6 @@ class Driver { { "preload-file=", s => preload_files.Add (s) }, { "embed-file=", s => embed_files.Add (s) }, { "extra-emcc-flags=", s => extra_emcc_flags = s }, - { "framework=", s => framework = s }, { "help", s => print_usage = true }, }; @@ -531,7 +526,6 @@ class Driver { enable_fs = opts.EnableFS; enable_threads = opts.EnableThreads; enable_dynamic_runtime = opts.EnableDynamicRuntime; - enable_simd = opts.Simd; if (ee_mode == ExecMode.Aot || ee_mode == ExecMode.AotInterp) enable_aot = true; @@ -562,38 +556,12 @@ class Driver { Console.Error.WriteLine ("The --link-icalls option requires the --linker option."); return 1; } - if (framework != "") { - if (framework.StartsWith ("net5")) { - is_netcore = true; - if (runtimepack_dir == "") { - Console.Error.WriteLine ("The --runtimepack-dir= argument is required."); - return 1; - } - if (!Directory.Exists (runtimepack_dir)) { - Console.Error.WriteLine ($"The directory '{runtimepack_dir}' doesn't exist."); - return 1; - } - if (!Directory.Exists (Path.Combine (runtimepack_dir, "runtimes", "browser-wasm"))) { - Console.Error.WriteLine ($"The directory '{runtimepack_dir}' doesn't contain a 'runtimes/browser-wasm' subdirectory."); - return 1; - } - runtimepack_dir = Path.Combine (runtimepack_dir, "runtimes", "browser-wasm"); - } else { - Console.Error.WriteLine ("The only valid value for --framework is 'net5...'"); - return 1; - } - } if (aot_profile != null && !File.Exists (aot_profile)) { Console.Error.WriteLine ($"AOT profile file '{aot_profile}' not found."); return 1; } - if (enable_simd && !is_netcore) { - Console.Error.WriteLine ("--simd is only supported with netcore."); - return 1; - } - var tool_prefix = Path.GetDirectoryName (typeof (Driver).Assembly.Location); //are we working from the tree? @@ -611,14 +579,7 @@ class Driver { bcl_tools_prefix = Path.Combine (bcl_root, "wasm_tools"); bcl_facades_prefix = Path.Combine (bcl_prefix, "Facades"); bcl_prefixes = new List (); - if (is_netcore) { - /* corelib */ - bcl_prefixes.Add (Path.Combine (runtimepack_dir, "native")); - /* .net runtime */ - bcl_prefixes.Add (Path.Combine (runtimepack_dir, "lib", "net5.0")); - } else { - bcl_prefixes.Add (bcl_prefix); - } + bcl_prefixes.Add (bcl_prefix); foreach (var ra in root_assemblies) { AssemblyKind kind; @@ -636,10 +597,7 @@ class Driver { if (enable_aot) { var to_aot = new Dictionary (); - if (is_netcore) - to_aot ["System.Private.CoreLib"] = true; - else - to_aot ["mscorlib"] = true; + to_aot ["mscorlib"] = true; if (aot_assemblies != "") { foreach (var s in aot_assemblies.Split (',')) to_aot [s] = true; @@ -732,19 +690,16 @@ class Driver { File.WriteAllText (config_js, config); string wasm_runtime_dir; - if (is_netcore) { - wasm_runtime_dir = Path.Combine (runtimepack_dir, "native", "wasm", "runtimes", use_release_runtime ? "release" : "debug"); - } else { - if (wasm_runtime_path == null) - wasm_runtime_path = Path.Combine (tool_prefix, "builds"); - - if (enable_threads) - wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "threads-release" : "threads-debug"); - else if (enable_dynamic_runtime) - wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "dynamic-release" : "dynamic-debug"); - else - wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "release" : "debug"); - } + if (wasm_runtime_path == null) + wasm_runtime_path = Path.Combine (tool_prefix, "builds"); + + if (enable_threads) + wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "threads-release" : "threads-debug"); + else if (enable_dynamic_runtime) + wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "dynamic-release" : "dynamic-debug"); + else + wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "release" : "debug"); + if (!emit_ninja) { var interp_files = new List { "dotnet.js", "dotnet.wasm" }; if (enable_threads) { @@ -798,13 +753,8 @@ class Driver { string runtime_dir; string runtime_libdir; - if (is_netcore) { - runtime_dir = "$runtimepack_dir/native"; - runtime_libdir = "$runtimepack_dir/native"; - } else { - runtime_dir = "$mono_sdkdir/wasm-runtime-release"; - runtime_libdir = $"{runtime_dir}/lib"; - } + runtime_dir = "$mono_sdkdir/wasm-runtime-release"; + runtime_libdir = $"{runtime_dir}/lib"; string runtime_libs = ""; if (ee_mode == ExecMode.Interp || ee_mode == ExecMode.AotInterp || link_icalls) { runtime_libs += $"$runtime_libdir/libmono-ee-interp.a $runtime_libdir/libmono-ilgen.a "; @@ -813,10 +763,7 @@ class Driver { runtime_libs += $"$runtime_libdir/libmono-icall-table.a "; } runtime_libs += $"$runtime_libdir/libmonosgen-2.0.a "; - if (is_netcore) - runtime_libs += $"$runtime_libdir/libSystem.Native.a"; - else - runtime_libs += $"$runtime_libdir/libmono-native.a"; + runtime_libs += $"$runtime_libdir/libmono-native.a"; string aot_args = "llvm-path=$emscripten_sdkdir/upstream/bin,"; string profiler_libs = ""; @@ -838,8 +785,6 @@ class Driver { aot_args += "interp,"; if (build_wasm) enable_zlib = true; - if (is_netcore) - enable_zlib = false; wasm_runtime_dir = Path.GetFullPath (wasm_runtime_dir); sdkdir = Path.GetFullPath (sdkdir); @@ -853,7 +798,7 @@ class Driver { string emcc_flags = ""; if (enable_lto) emcc_flags += "--llvm-lto 1 "; - if (enable_zlib || is_netcore) + if (enable_zlib) emcc_flags += "-s USE_ZLIB=1 "; if (enable_fs) emcc_flags += "-s FORCE_FILESYSTEM=1 "; @@ -869,10 +814,6 @@ class Driver { string strip_cmd = ""; if (opts.NativeStrip) strip_cmd = " && $wasm_opt --strip-dwarf $out_wasm -o $out_wasm"; - if (enable_simd) { - aot_args += "mattr=simd,"; - emcc_flags += "-s SIMD=1 "; - } if (!use_release_runtime) // -s ASSERTIONS=2 is very slow emcc_flags += "-s ASSERTIONS=1 "; @@ -885,8 +826,6 @@ class Driver { ninja.WriteLine ($"tool_prefix = {tool_prefix}"); ninja.WriteLine ($"appdir = {out_prefix}"); ninja.WriteLine ($"builddir = ."); - if (is_netcore) - ninja.WriteLine ($"runtimepack_dir = {runtimepack_dir}"); ninja.WriteLine ($"wasm_runtime_dir = {wasm_runtime_dir}"); ninja.WriteLine ($"runtime_libdir = {runtime_libdir}"); ninja.WriteLine ($"deploy_prefix = {deploy_prefix}"); @@ -904,10 +843,7 @@ class Driver { ninja.WriteLine ("wasm_core_support ="); ninja.WriteLine ("wasm_core_support_library ="); } - if (is_netcore) - ninja.WriteLine ("cross = $runtimepack_dir/native/cross/mono-aot-cross"); - else - ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-release/bin/wasm32-unknown-none-mono-sgen"); + ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-release/bin/wasm32-unknown-none-mono-sgen"); ninja.WriteLine ("emcc = source $emsdk_env && emcc"); ninja.WriteLine ("wasm_opt = $emscripten_sdkdir/upstream/bin/wasm-opt"); ninja.WriteLine ($"emcc_flags = -Oz -g {emcc_flags}-s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=134217728 -s NO_EXIT_RUNTIME=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s \"EXTRA_EXPORTED_RUNTIME_METHODS=[\'ccall\', \'cwrap\', \'setValue\', \'getValue\', \'UTF8ToString\']\" -s \"EXPORTED_FUNCTIONS=[\'___cxa_is_pointer_type\', \'___cxa_can_catch\']\" -s \"DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[\'setThrew\', \'memset\']\""); @@ -960,10 +896,7 @@ class Driver { if (build_wasm) { string src_prefix; - if (is_netcore) - src_prefix = Path.Combine (runtimepack_dir, "native", "wasm", "src"); - else - src_prefix = Path.Combine (tool_prefix, "src"); + src_prefix = Path.Combine (tool_prefix, "src"); var source_file = Path.GetFullPath (Path.Combine (src_prefix, "driver.c")); ninja.WriteLine ($"build $builddir/driver.c: cpifdiff {source_file}"); ninja.WriteLine ($"build $builddir/driver-gen.c: cpifdiff $builddir/driver-gen.c.in"); @@ -972,7 +905,7 @@ class Driver { source_file = Path.GetFullPath (Path.Combine (src_prefix, "pinvoke.h")); ninja.WriteLine ($"build $builddir/pinvoke.h: cpifdiff {source_file}"); - var pinvoke_file_name = is_netcore ? "pinvoke-table.h" : "pinvoke-tables-default.h"; + var pinvoke_file_name = "pinvoke-tables-default.h"; var pinvoke_file = Path.GetFullPath (Path.Combine (src_prefix, pinvoke_file_name)); ninja.WriteLine ($"build $builddir/pinvoke-tables-default.h: cpifdiff {pinvoke_file}"); driver_deps += $" $builddir/pinvoke-tables-default.h"; @@ -989,8 +922,6 @@ class Driver { } if (gen_pinvoke) driver_cflags += " -DGEN_PINVOKE "; - if (is_netcore) - driver_cflags += " -DENABLE_NETCORE "; ninja.WriteLine ("build $emsdk_env: create-emsdk-env"); ninja.WriteLine ($"build $builddir/driver.o: emcc $builddir/driver.c | $emsdk_env $builddir/driver-gen.c {driver_deps}"); diff --git a/sdks/wasm/sdk/Mono.WebAssembly.Runtime.Framework/Mono.WebAssembly.Runtime.csproj b/sdks/wasm/sdk/Mono.WebAssembly.Runtime.Framework/Mono.WebAssembly.Runtime.csproj index 541c2e663f6..c99d412391d 100644 --- a/sdks/wasm/sdk/Mono.WebAssembly.Runtime.Framework/Mono.WebAssembly.Runtime.csproj +++ b/sdks/wasm/sdk/Mono.WebAssembly.Runtime.Framework/Mono.WebAssembly.Runtime.csproj @@ -20,12 +20,6 @@ - - - - - - \ No newline at end of file diff --git a/sdks/wasm/sdk/NuGet.config b/sdks/wasm/sdk/NuGet.config deleted file mode 100644 index 98f608d2b7b..00000000000 --- a/sdks/wasm/sdk/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/sdks/wasm/src/driver.c b/sdks/wasm/src/driver.c index c4dd20b42a3..08cb9676d15 100644 --- a/sdks/wasm/src/driver.c +++ b/sdks/wasm/src/driver.c @@ -185,10 +185,6 @@ mono_wasm_setenv (const char *name, const char *value) monoeg_g_setenv (strdup (name), strdup (value), 1); } -#ifdef ENABLE_NETCORE -static void *sysglobal_native_handle; -#endif - static void* wasm_dl_load (const char *name, int flags, char **err, void *user_data) { @@ -196,11 +192,6 @@ wasm_dl_load (const char *name, int flags, char **err, void *user_data) if (handle) return handle; -#ifdef ENABLE_NETCORE - if (!strcmp (name, "System.Globalization.Native")) - return sysglobal_native_handle; -#endif - #if WASM_SUPPORTS_DLOPEN return dlopen(name, flags); #endif @@ -211,11 +202,6 @@ wasm_dl_load (const char *name, int flags, char **err, void *user_data) static void* wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data) { -#ifdef ENABLE_NETCORE - if (handle == sysglobal_native_handle) - assert (0); -#endif - #if WASM_SUPPORTS_DLOPEN if (!wasm_dl_is_pinvoke_tables (handle)) { return dlsym (handle, name); @@ -236,15 +222,6 @@ wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data) return NULL; } -#ifdef ENABLE_NETCORE -/* Missing System.Native symbols */ -int SystemNative_CloseNetworkChangeListenerSocket (int a) { return 0; } -int SystemNative_CreateNetworkChangeListenerSocket (int a) { return 0; } -void SystemNative_ReadEvents (int a,int b) {} -int SystemNative_SchedGetAffinity (int a,int b) { return 0; } -int SystemNative_SchedSetAffinity (int a,int b) { return 0; } -#endif - #if !defined(ENABLE_AOT) || defined(EE_MODE_LLVMONLY_INTERP) #define NEED_INTERP 1 #ifndef LINK_ICALLS @@ -369,9 +346,6 @@ mono_wasm_load_runtime (const char *managed_path, int enable_debugging) monoeg_g_setenv ("MONO_LOG_LEVEL", "debug", 0); monoeg_g_setenv ("MONO_LOG_MASK", "gc", 0); -#ifdef ENABLE_NETCORE - monoeg_g_setenv ("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", 0); -#endif mini_parse_debug_option ("top-runtime-invoke-unhandled"); diff --git a/sdks/wasm/tests/browser/src/Directory.Build.props b/sdks/wasm/tests/browser/src/Directory.Build.props index 4711d4aba76..b0ad32716d9 100644 --- a/sdks/wasm/tests/browser/src/Directory.Build.props +++ b/sdks/wasm/tests/browser/src/Directory.Build.props @@ -9,5 +9,4 @@ true - \ No newline at end of file diff --git a/sdks/wasm/tests/browser/src/NuGet.config b/sdks/wasm/tests/browser/src/NuGet.config deleted file mode 100644 index c77a9b67d25..00000000000 --- a/sdks/wasm/tests/browser/src/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/winconfig.h b/winconfig.h index 7d429a86e8a..fd3f6f6e512 100644 --- a/winconfig.h +++ b/winconfig.h @@ -25,52 +25,6 @@ /* No ENABLE_DEFINES below this point */ -/* Keep in sync with netcore runtime-preset in configure.ac */ -#ifdef ENABLE_NETCORE -#ifndef DISABLE_REMOTING -#define DISABLE_REMOTING 1 -#endif -#ifndef DISABLE_SIMD -// FIXME: disable SIMD support for Windows, see https://github.com/dotnet/runtime/issues/1933 -#define DISABLE_SIMD 1 -#endif -#ifndef DISABLE_REFLECTION_EMIT_SAVE -#define DISABLE_REFLECTION_EMIT_SAVE 1 -#endif -#ifndef DISABLE_APPDOMAINS -#define DISABLE_APPDOMAINS 1 -#endif -#ifndef DISABLE_CLEANUP -#define DISABLE_CLEANUP 1 -#endif -#ifndef DISABLE_DESKTOP_LOADER -#define DISABLE_DESKTOP_LOADER 1 -#endif -#ifndef DISABLE_SECURITY -#define DISABLE_SECURITY 1 -#endif -#ifndef DISABLE_MDB -#define DISABLE_MDB 1 -#endif -#ifndef DISABLE_COM -#define DISABLE_COM 1 -#endif -#ifndef DISABLE_GAC -#define DISABLE_GAC 1 -#endif -#ifndef DISABLE_PERFCOUNTERS -#define DISABLE_PERFCOUNTERS 1 -#endif -#ifndef DISABLE_ATTACH -#define DISABLE_ATTACH 1 -#endif -#ifndef DISABLE_DLLMAP -#define DISABLE_DLLMAP 1 -#endif -#ifndef DISABLE_CFGDIR_CONFIG -#define DISABLE_CFGDIR_CONFIG 1 -#endif -#endif /* Disable runtime state dumping */ #define DISABLE_CRASH_REPORTING 1 -- cgit v1.2.3