From aa01110c33eaeaef9de91b4099ed4f518783310a Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 16 May 2016 15:30:53 -0700 Subject: [PATCH] Remove The host build, consume the host build from core-setup --- Documentation/manpages/host/dotnet.1 | 152 - Microsoft.DotNet.Cli.sln | 38 - NuGet.Config | 4 +- .../project.json | 2 +- .../src/BrokenProjectPathSample/project.json | 2 +- .../src/EmptyConsoleApp/project.json | 2 +- .../src/EmptyNetCoreApp/project.json | 2 +- .../src/FailReleaseProject/project.json | 2 +- .../IncompatiblePackageSample/project.json | 2 +- .../src/Project1/project.json | 2 +- .../ToolWithOutputName/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../dotnet-desktop-and-portable/project.json | 2 +- .../dotnet-hello/v1/dotnet-hello/project.json | 2 +- .../dotnet-hello/v2/dotnet-hello/project.json | 2 +- .../TestPackages/dotnet-portable/project.json | 2 +- .../TestApp1/project.json | 2 +- .../TestApp2/project.json | 2 +- .../AppWithBomGlobalJson/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../AppWithDirectDependency/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../AppWithOutputAssemblyName/project.json | 2 +- .../AppWithToolDependency/project.json | 2 +- .../TestProjects/CompileFail/project.json | 2 +- .../PortableApp_Standalone/project.json | 2 +- .../DependencyContextFromTool/project.json | 2 +- .../DependencyContextValidator/project.json | 2 +- .../TestApp/project.json | 2 +- .../TestAppDeps/project.json | 2 +- .../TestAppPortable/project.json | 2 +- .../TestAppPortableDeps/project.json | 2 +- .../TestProjects/EndToEndTestApp/project.json | 2 +- .../CompileFailApp/project.json | 2 +- .../FSharpTestProjects/TestApp/project.json | 2 +- .../TestAppWithArgs/project.json | 2 +- .../KestrelPortable/project.json | 2 +- .../KestrelStandalone/project.json | 2 +- .../OutputStandardOutputAndError/project.json | 2 +- .../PortableTests/PortableApp/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../PortableAppWithNative/project.json | 2 +- .../ResourcesTests/TestApp/project.json | 2 +- .../TestAppMultiTarget/project.json | 2 +- .../TestApp/project.json | 2 +- .../TestProjects/TestAppSimple/project.json | 2 +- .../TestProjects/TestAppWithArgs/project.json | 2 +- .../App/project.json | 2 +- .../LibraryWithBuildDependency/project.json | 2 +- .../TestAppWithContentPackage/project.json | 2 +- .../TestAppWithContents/project.json | 2 +- .../TestAppWithLibrary/TestApp/project.json | 2 +- .../TestAppWithScripts/project.json | 2 +- .../TestApp/project.json | 2 +- .../TestAppWithUnicodéPath/project.json | 2 +- .../TestApp/project.json | 2 +- .../TestLibraryLesser/project.json | 2 +- .../TestMicrosoftCSharpReference/project.json | 2 +- .../project.json | 2 +- .../TestMscorlibReference/project.json | 2 +- .../project.json | 2 +- .../src/L0/project.json | 2 +- .../src/L11/project.json | 2 +- .../src/L12/project.json | 2 +- .../src/L21/project.json | 2 +- .../src/L22/project.json | 2 +- .../project.json | 2 +- .../TestProjectWithResource/project.json | 2 +- .../TestSimpleIncrementalApp/project.json | 2 +- .../TestSystemCoreReference/project.json | 2 +- .../TestSystemReference/project.json | 2 +- build.cmd | 2 +- build.sh | 2 - .../dotnet-cli-build/CompileTargets.cs | 331 +- build_projects/dotnet-cli-build/DebTargets.cs | 59 +- build_projects/dotnet-cli-build/MsiTargets.cs | 96 +- .../dotnet-cli-build/PackageTargets.cs | 23 - build_projects/dotnet-cli-build/PkgTargets.cs | 84 +- .../dotnet-cli-build/PrepareTargets.cs | 108 +- .../dotnet-cli-build/PublishTargets.cs | 147 +- .../dotnet-cli-build/TestTargets.cs | 46 +- .../dotnet-host-build/CompileTargets.cs | 239 - .../dotnet-host-build/PrepareTargets.cs | 198 - build_projects/dotnet-host-build/Program.cs | 17 - .../dotnet-host-build/StubPackageBuilder.cs | 75 - build_projects/dotnet-host-build/build.ps1 | 81 - build_projects/dotnet-host-build/build.sh | 118 - .../dotnet-host-build/dotnet-host-build.xproj | 18 - build_projects/dotnet-host-build/project.json | 40 - .../DependencyVersions.cs | 18 + .../HostArtifactNames.cs | 15 + .../Publishing/AzurePublisher.cs | 37 +- .../Utils/Crossgen.cs | 9 +- .../shared-build-targets-utils/Utils/Dirs.cs | 1 + .../Utils/Monikers.cs | 2 +- .../Utils/PublishMutationUtilties.cs | 81 + .../Utils/SharedFrameworkPublisher.cs | 219 + .../dotnet-sharedhost-debian_config.json | 39 - .../resources/cs.lproj/conclusion.html | 22 - .../resources/cs.lproj/eula.rtf | 114 - .../resources/cs.lproj/welcome.html | 17 - .../resources/de.lproj/conclusion.html | 22 - .../resources/de.lproj/eula.rtf | 114 - .../resources/de.lproj/welcome.html | 17 - .../resources/dotnetbackground.png | Bin 4054 -> 0 bytes .../resources/en.lproj/conclusion.html | 22 - .../resources/en.lproj/eula.rtf | 114 - .../resources/en.lproj/welcome.html | 17 - .../resources/es.lproj/conclusion.html | 22 - .../resources/es.lproj/eula.rtf | 114 - .../resources/es.lproj/welcome.html | 17 - .../resources/fr.lproj/conclusion.html | 22 - .../resources/fr.lproj/eula.rtf | 114 - .../resources/fr.lproj/welcome.html | 17 - .../resources/it.lproj/conclusion.html | 22 - .../resources/it.lproj/eula.rtf | 114 - .../resources/it.lproj/welcome.html | 17 - .../resources/ja.lproj/conclusion.html | 22 - .../resources/ja.lproj/eula.rtf | 114 - .../resources/ja.lproj/welcome.html | 17 - .../resources/ko.lproj/conclusion.html | 22 - .../resources/ko.lproj/eula.rtf | 114 - .../resources/ko.lproj/welcome.html | 17 - .../resources/pl.lproj/conclusion.html | 22 - .../resources/pl.lproj/eula.rtf | 114 - .../resources/pl.lproj/welcome.html | 17 - .../resources/pt-br.lproj/conclusion.html | 22 - .../resources/pt-br.lproj/eula.rtf | 114 - .../resources/pt-br.lproj/welcome.html | 17 - .../resources/ru.lproj/conclusion.html | 22 - .../resources/ru.lproj/eula.rtf | 114 - .../resources/ru.lproj/welcome.html | 17 - .../resources/tr.lproj/conclusion.html | 22 - .../resources/tr.lproj/eula.rtf | 114 - .../resources/tr.lproj/welcome.html | 17 - .../resources/zh-hans.lproj/conclusion.html | 22 - .../resources/zh-hans.lproj/eula.rtf | 114 - .../resources/zh-hans.lproj/welcome.html | 17 - .../resources/zh-hant.lproj/conclusion.html | 22 - .../resources/zh-hant.lproj/eula.rtf | 114 - .../resources/zh-hant.lproj/welcome.html | 17 - .../osx/sharedframework/scripts/postinstall | 13 - ...shared-framework-distribution-template.xml | 24 - packaging/osx/sharedhost/scripts/postinstall | 16 - .../dotnet-sharedframework-debian_config.json | 36 - packaging/windows/host/generatemsi.ps1 | 111 - packaging/windows/host/host.wxs | 45 - packaging/windows/host/provider.wxs | 9 - packaging/windows/host/registrykeys.wxs | 14 - packaging/windows/host/variables.wxi | 31 - packaging/windows/sharedframework/bundle.thm | 105 - packaging/windows/sharedframework/bundle.wxl | 59 - packaging/windows/sharedframework/bundle.wxs | 88 - .../sharedframework/generatebundle.ps1 | 109 - .../windows/sharedframework/generatemsi.ps1 | 153 - .../windows/sharedframework/provider.wxs | 9 - .../windows/sharedframework/registrykeys.wxs | 18 - .../sharedframework/sharedframework.wxs | 63 - .../windows/sharedframework/variables.wxi | 34 - pkg/.gitignore | 2 - pkg/BuildToolsVersion.txt | 1 - pkg/DotnetCLIVersion.txt | 1 - pkg/deps/project.json | 10 - pkg/dir.props | 60 - pkg/dir.targets | 16 - pkg/dir.traversal.targets | 20 - pkg/init-tools.cmd | 69 - pkg/init-tools.sh | 88 - pkg/pack.cmd | 85 - pkg/pack.sh | 130 - .../Microsoft.NETCore.App.builds | 10 - .../Microsoft.NETCore.App.pkgproj | 50 - .../Microsoft.NETCore.App/project.json | 46 - .../Microsoft.NETCore.DotNetHost.builds | 41 - .../Microsoft.NETCore.DotNetHost.pkgproj | 36 - .../Microsoft.NETCore.DotNetHostPolicy.builds | 41 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 39 - ...icrosoft.NETCore.DotNetHostResolver.builds | 41 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 39 - .../Microsoft.NETCore.DotNetHost.pkgproj | 22 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 26 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 26 - .../osx/Microsoft.NETCore.DotNetHost.pkgproj | 22 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 26 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 26 - .../rhel/Microsoft.NETCore.DotNetHost.pkgproj | 22 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 26 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 26 - .../Microsoft.NETCore.DotNetHost.pkgproj | 22 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 26 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 26 - .../win/Microsoft.NETCore.DotNetHost.pkgproj | 24 - ...Microsoft.NETCore.DotNetHostPolicy.pkgproj | 28 - ...crosoft.NETCore.DotNetHostResolver.pkgproj | 28 - pkg/projects/ThirdPartyNotices.txt | 31 - pkg/projects/descriptions.json | 27 - pkg/projects/dotnet_library_license.txt | 128 - pkg/projects/packages.builds | 10 - .../package/package-sharedframework-debian.sh | 160 - scripts/package/package-sharedhost-debian.sh | 154 - scripts/package/projectsToPack.ps1 | 0 .../update-dependencies/UpdateFilesTargets.cs | 21 +- src/compilers/project.json | 2 +- src/corehost/CMakeLists.txt | 2 - src/corehost/build.sh | 153 - src/corehost/cli/CMakeLists.txt | 63 - src/corehost/cli/args.cpp | 100 - src/corehost/cli/args.h | 120 - src/corehost/cli/breadcrumbs.cpp | 91 - src/corehost/cli/breadcrumbs.h | 27 - src/corehost/cli/coreclr.cpp | 110 - src/corehost/cli/coreclr.h | 39 - src/corehost/cli/deps_entry.cpp | 214 - src/corehost/cli/deps_entry.h | 52 - src/corehost/cli/deps_format.cpp | 395 - src/corehost/cli/deps_format.h | 122 - src/corehost/cli/deps_resolver.cpp | 642 -- src/corehost/cli/deps_resolver.h | 200 - src/corehost/cli/dll/CMakeLists.txt | 51 - src/corehost/cli/fxr/CMakeLists.txt | 49 - src/corehost/cli/fxr/fx_muxer.cpp | 847 -- src/corehost/cli/fxr/fx_muxer.h | 40 - src/corehost/cli/fxr/fx_ver.cpp | 198 - src/corehost/cli/fxr/fx_ver.h | 48 - src/corehost/cli/fxr/hostfxr.cpp | 98 - src/corehost/cli/hostpolicy.cpp | 276 - src/corehost/cli/json/casablanca/LICENSE.txt | 1 - .../include/cpprest/asyncrt_utils.h | 600 -- .../include/cpprest/details/SafeInt3.hpp | 7048 ----------------- .../include/cpprest/details/basic_types.h | 140 - .../include/cpprest/details/cpprest_compat.h | 97 - .../include/cpprest/details/nosal.h | 89 - .../json/casablanca/include/cpprest/json.h | 1936 ----- .../cli/json/casablanca/include/stdafx.h | 109 - .../cli/json/casablanca/src/json/json.cpp | 495 -- .../json/casablanca/src/json/json_parsing.cpp | 1312 --- .../src/json/json_serialization.cpp | 274 - .../src/utilities/asyncrt_utils.cpp | 496 -- src/corehost/cli/libhost.cpp | 135 - src/corehost/cli/libhost.h | 246 - src/corehost/cli/runtime_config.cpp | 220 - src/corehost/cli/runtime_config.h | 49 - src/corehost/cli/setup.cmake | 107 - src/corehost/common/pal.h | 190 - src/corehost/common/pal.unix.cpp | 317 - src/corehost/common/pal.windows.cpp | 345 - src/corehost/common/trace.cpp | 91 - src/corehost/common/trace.h | 22 - src/corehost/common/utils.cpp | 241 - src/corehost/common/utils.h | 34 - src/corehost/corehost.cpp | 120 - src/corehost/error_codes.h | 30 - src/dotnet-compile-fsc/project.json | 2 +- src/dotnet/project.json | 2 +- src/sharedframework/framework/Program.cs | 11 - .../framework/project.json.template | 19 - test/ArgumentForwardingTests/project.json | 2 +- test/ArgumentsReflector/project.json | 2 +- test/EndToEnd/project.json | 2 +- test/Kestrel.Tests/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- test/Performance/project.json | 2 +- test/ScriptExecutorTests/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- test/crossgen.Tests/project.json | 2 +- test/dotnet-build.Tests/project.json | 2 +- test/dotnet-compile-fsc.Tests/project.json | 2 +- test/dotnet-compile.Tests/project.json | 2 +- test/dotnet-compile.UnitTests/project.json | 2 +- test/dotnet-new.Tests/project.json | 2 +- test/dotnet-pack.Tests/project.json | 2 +- .../project.json | 2 +- test/dotnet-publish.Tests/project.json | 2 +- test/dotnet-resgen.Tests/project.json | 2 +- test/dotnet-run.Tests/project.json | 2 +- test/dotnet-run.UnitTests/project.json | 2 +- test/dotnet-test.Tests/project.json | 2 +- test/dotnet-test.UnitTests/project.json | 2 +- test/dotnet.Tests/project.json | 2 +- tools/MultiProjectValidator/project.json | 2 +- tools/RuntimeGraphGenerator/Program.cs | 105 - .../RuntimeGraphGenerator.xproj | 19 - .../RuntimeGraphManager.cs | 58 - tools/RuntimeGraphGenerator/project.json | 29 - 293 files changed, 650 insertions(+), 25590 deletions(-) delete mode 100644 Documentation/manpages/host/dotnet.1 delete mode 100644 build_projects/dotnet-host-build/CompileTargets.cs delete mode 100644 build_projects/dotnet-host-build/PrepareTargets.cs delete mode 100644 build_projects/dotnet-host-build/Program.cs delete mode 100644 build_projects/dotnet-host-build/StubPackageBuilder.cs delete mode 100644 build_projects/dotnet-host-build/build.ps1 delete mode 100755 build_projects/dotnet-host-build/build.sh delete mode 100644 build_projects/dotnet-host-build/dotnet-host-build.xproj delete mode 100644 build_projects/dotnet-host-build/project.json create mode 100644 build_projects/shared-build-targets-utils/DependencyVersions.cs create mode 100644 build_projects/shared-build-targets-utils/HostArtifactNames.cs create mode 100644 build_projects/shared-build-targets-utils/Utils/PublishMutationUtilties.cs create mode 100644 build_projects/shared-build-targets-utils/Utils/SharedFrameworkPublisher.cs delete mode 100644 packaging/host/debian/dotnet-sharedhost-debian_config.json delete mode 100644 packaging/osx/sharedframework/resources/cs.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/cs.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/cs.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/de.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/de.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/de.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/dotnetbackground.png delete mode 100644 packaging/osx/sharedframework/resources/en.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/en.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/en.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/es.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/es.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/es.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/fr.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/fr.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/fr.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/it.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/it.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/it.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/ja.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/ja.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/ja.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/ko.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/ko.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/ko.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/pl.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/pl.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/pl.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/pt-br.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/pt-br.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/pt-br.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/ru.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/ru.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/ru.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/tr.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/tr.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/tr.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/zh-hans.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/zh-hans.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/zh-hans.lproj/welcome.html delete mode 100644 packaging/osx/sharedframework/resources/zh-hant.lproj/conclusion.html delete mode 100644 packaging/osx/sharedframework/resources/zh-hant.lproj/eula.rtf delete mode 100644 packaging/osx/sharedframework/resources/zh-hant.lproj/welcome.html delete mode 100755 packaging/osx/sharedframework/scripts/postinstall delete mode 100644 packaging/osx/sharedframework/shared-framework-distribution-template.xml delete mode 100755 packaging/osx/sharedhost/scripts/postinstall delete mode 100644 packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json delete mode 100644 packaging/windows/host/generatemsi.ps1 delete mode 100644 packaging/windows/host/host.wxs delete mode 100644 packaging/windows/host/provider.wxs delete mode 100644 packaging/windows/host/registrykeys.wxs delete mode 100644 packaging/windows/host/variables.wxi delete mode 100644 packaging/windows/sharedframework/bundle.thm delete mode 100644 packaging/windows/sharedframework/bundle.wxl delete mode 100644 packaging/windows/sharedframework/bundle.wxs delete mode 100644 packaging/windows/sharedframework/generatebundle.ps1 delete mode 100644 packaging/windows/sharedframework/generatemsi.ps1 delete mode 100644 packaging/windows/sharedframework/provider.wxs delete mode 100644 packaging/windows/sharedframework/registrykeys.wxs delete mode 100644 packaging/windows/sharedframework/sharedframework.wxs delete mode 100644 packaging/windows/sharedframework/variables.wxi delete mode 100644 pkg/.gitignore delete mode 100644 pkg/BuildToolsVersion.txt delete mode 100644 pkg/DotnetCLIVersion.txt delete mode 100644 pkg/deps/project.json delete mode 100644 pkg/dir.props delete mode 100644 pkg/dir.targets delete mode 100644 pkg/dir.traversal.targets delete mode 100644 pkg/init-tools.cmd delete mode 100755 pkg/init-tools.sh delete mode 100644 pkg/pack.cmd delete mode 100755 pkg/pack.sh delete mode 100644 pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds delete mode 100644 pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.App/project.json delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.builds delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.builds delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.builds delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHost.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostPolicy.pkgproj delete mode 100644 pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostResolver.pkgproj delete mode 100644 pkg/projects/ThirdPartyNotices.txt delete mode 100644 pkg/projects/descriptions.json delete mode 100644 pkg/projects/dotnet_library_license.txt delete mode 100644 pkg/projects/packages.builds delete mode 100755 scripts/package/package-sharedframework-debian.sh delete mode 100755 scripts/package/package-sharedhost-debian.sh delete mode 100644 scripts/package/projectsToPack.ps1 delete mode 100644 src/corehost/CMakeLists.txt delete mode 100755 src/corehost/build.sh delete mode 100644 src/corehost/cli/CMakeLists.txt delete mode 100644 src/corehost/cli/args.cpp delete mode 100644 src/corehost/cli/args.h delete mode 100644 src/corehost/cli/breadcrumbs.cpp delete mode 100644 src/corehost/cli/breadcrumbs.h delete mode 100644 src/corehost/cli/coreclr.cpp delete mode 100644 src/corehost/cli/coreclr.h delete mode 100644 src/corehost/cli/deps_entry.cpp delete mode 100644 src/corehost/cli/deps_entry.h delete mode 100644 src/corehost/cli/deps_format.cpp delete mode 100644 src/corehost/cli/deps_format.h delete mode 100644 src/corehost/cli/deps_resolver.cpp delete mode 100644 src/corehost/cli/deps_resolver.h delete mode 100644 src/corehost/cli/dll/CMakeLists.txt delete mode 100644 src/corehost/cli/fxr/CMakeLists.txt delete mode 100644 src/corehost/cli/fxr/fx_muxer.cpp delete mode 100644 src/corehost/cli/fxr/fx_muxer.h delete mode 100644 src/corehost/cli/fxr/fx_ver.cpp delete mode 100644 src/corehost/cli/fxr/fx_ver.h delete mode 100644 src/corehost/cli/fxr/hostfxr.cpp delete mode 100644 src/corehost/cli/hostpolicy.cpp delete mode 100644 src/corehost/cli/json/casablanca/LICENSE.txt delete mode 100644 src/corehost/cli/json/casablanca/include/cpprest/asyncrt_utils.h delete mode 100755 src/corehost/cli/json/casablanca/include/cpprest/details/SafeInt3.hpp delete mode 100755 src/corehost/cli/json/casablanca/include/cpprest/details/basic_types.h delete mode 100755 src/corehost/cli/json/casablanca/include/cpprest/details/cpprest_compat.h delete mode 100755 src/corehost/cli/json/casablanca/include/cpprest/details/nosal.h delete mode 100755 src/corehost/cli/json/casablanca/include/cpprest/json.h delete mode 100644 src/corehost/cli/json/casablanca/include/stdafx.h delete mode 100644 src/corehost/cli/json/casablanca/src/json/json.cpp delete mode 100644 src/corehost/cli/json/casablanca/src/json/json_parsing.cpp delete mode 100644 src/corehost/cli/json/casablanca/src/json/json_serialization.cpp delete mode 100644 src/corehost/cli/json/casablanca/src/utilities/asyncrt_utils.cpp delete mode 100644 src/corehost/cli/libhost.cpp delete mode 100644 src/corehost/cli/libhost.h delete mode 100644 src/corehost/cli/runtime_config.cpp delete mode 100644 src/corehost/cli/runtime_config.h delete mode 100644 src/corehost/cli/setup.cmake delete mode 100644 src/corehost/common/pal.h delete mode 100644 src/corehost/common/pal.unix.cpp delete mode 100644 src/corehost/common/pal.windows.cpp delete mode 100644 src/corehost/common/trace.cpp delete mode 100644 src/corehost/common/trace.h delete mode 100644 src/corehost/common/utils.cpp delete mode 100644 src/corehost/common/utils.h delete mode 100644 src/corehost/corehost.cpp delete mode 100644 src/corehost/error_codes.h delete mode 100644 src/sharedframework/framework/Program.cs delete mode 100644 src/sharedframework/framework/project.json.template delete mode 100644 tools/RuntimeGraphGenerator/Program.cs delete mode 100644 tools/RuntimeGraphGenerator/RuntimeGraphGenerator.xproj delete mode 100644 tools/RuntimeGraphGenerator/RuntimeGraphManager.cs delete mode 100644 tools/RuntimeGraphGenerator/project.json diff --git a/Documentation/manpages/host/dotnet.1 b/Documentation/manpages/host/dotnet.1 deleted file mode 100644 index cb0f71b31..000000000 --- a/Documentation/manpages/host/dotnet.1 +++ /dev/null @@ -1,152 +0,0 @@ -.\" Automatically generated by Pandoc 1.15.1 -.\" -.hy -.TH "dotnet-cli" "1" "January 2016" "" "" -.SH NAME -.PP -dotnet \-\- general driver for running the command\-line commands -.SH SYNOPSIS -.PP -dotnet [\-\-version] [\-\-help] [\-\-verbose] < command > [< args >] -.SH DESCRIPTION -.PP -dotnet is a generic driver for the CLI toolchain. -Invoked on its own, it will give out brief usage instructions. -.PP -Each specific feature is implemented as a command. -In order to use the feature, it is specified after dotnet, i.e. -\f[C]dotnet\ compile\f[]. -All of the arguments following the command are command\[aq]s own -arguments. -.SH OPTIONS -.PP -\f[C]\-v,\ \-\-verbose\f[] -.IP -.nf -\f[C] -Enable\ verbose\ output. -\f[] -.fi -.PP -\f[C]\-\-version\f[] -.IP -.nf -\f[C] -Print\ out\ the\ version\ of\ the\ CLI\ tooling -\f[] -.fi -.PP -\f[C]\-h,\ \-\-help\f[] -.IP -.nf -\f[C] -Print\ out\ a\ short\ help\ and\ a\ list\ of\ current\ commands.\ -\f[] -.fi -.SH DOTNET COMMANDS -.PP -The following commands exist for dotnet. -.PP -\f[C]dotnet\-compile(1)\f[] -.IP -.nf -\f[C] -Compile\ the\ application\ to\ either\ an\ intermidiate\ language\ (IL)\ or\ to\ a\ native\ binary.\ -\f[] -.fi -.PP -\f[C]dotnet\-restore(1)\f[] -.IP -.nf -\f[C] -Restores\ the\ dependencies\ for\ a\ given\ application.\ -\f[] -.fi -.PP -\f[C]dotnet\-run(1)\f[] -.IP -.nf -\f[C] -Runs\ the\ application\ from\ source. -\f[] -.fi -.PP -\f[C]dotnet\-publish(1)\f[] -.IP -.nf -\f[C] -Publishes\ a\ flat\ directory\ that\ contains\ the\ application\ and\ its\ dependencies,\ including\ the\ runtime\ binaries.\ -\f[] -.fi -.PP -\f[C]dotnet\-test(1)\f[] -.IP -.nf -\f[C] -Runs\ tests\ using\ a\ test\ runner\ specified\ in\ project.json. -\f[] -.fi -.PP -\f[C]dotnet\-new(1)\f[] -.IP -.nf -\f[C] -Initializes\ a\ sample\ .NET\ Core\ console\ application.\ -\f[] -.fi -.SH EXAMPLES -.PP -\f[C]dotnew\ new\f[] -.IP -.nf -\f[C] -Initializes\ a\ sample\ .NET\ Core\ console\ application\ that\ can\ be\ compiled\ and\ ran. -\f[] -.fi -.PP -\f[C]dotnet\ restore\f[] -.IP -.nf -\f[C] -Restores\ dependencies\ for\ a\ given\ application.\ -\f[] -.fi -.PP -\f[C]dotnet\ compile\f[] -.IP -.nf -\f[C] -Compiles\ the\ application\ in\ a\ given\ directory.\ -\f[] -.fi -.SH ENVIRONMENT -.PP -\f[C]DOTNET_PACKAGES\f[] -.IP -.nf -\f[C] -The\ primary\ package\ cache.\ If\ not\ set,\ defaults\ to\ $HOME/.nuget/packages\ on\ Unix\ or\ %LOCALAPPDATA%\\NuGet\\Packages\ (TBD)\ on\ Windows. -\f[] -.fi -.PP -\f[C]DOTNET_PACKAGES_CACHE\f[] -.IP -.nf -\f[C] -The\ secondary\ cache.\ This\ is\ used\ by\ shared\ hosters\ (such\ as\ Azure)\ to\ provide\ a\ cache\ of\ pre\-downloaded\ common\ packages\ on\ a\ faster\ disk.\ If\ not\ set\ it\ is\ not\ used. -\f[] -.fi -.PP -\f[C]DOTNET_SERVICING\f[] -.IP -.nf -\f[C] -Specifies\ the\ location\ of\ the\ servicing\ index\ to\ use\ by\ the\ shared\ host\ when\ loading\ the\ runtime.\ -\f[] -.fi -.SH SEE ALSO -.PP -dotnet\-compile(1), dotnet\-run(1), dotnet\-publish(1), -dotnet\-restore(1) -.SH AUTHORS -Zlatko Knezevic zlakne\@microsoft.com. diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 38dae9bcb..cc0a734cd 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -79,8 +79,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "update-dependencies", "scri EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Utils.Tests", "test\Microsoft.DotNet.Cli.Utils.Tests\Microsoft.DotNet.Cli.Utils.Tests.xproj", "{09C52F96-EFDD-4448-95EC-6D362DD60BAA}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RuntimeGraphGenerator", "tools\RuntimeGraphGenerator\RuntimeGraphGenerator.xproj", "{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestingAbstractions", "TestingAbstractions", "{EB0F5F8C-0991-49AC-B188-A9869476C7DF}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestAppWithFullPdbs", "test\TestingAbstractions\TestAppWithFullPdbs\TestAppWithFullPdbs.xproj", "{0A37AB59-BDB5-4957-9BB8-D965F9A67A5B}" @@ -115,8 +113,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Build. EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "shared-build-targets-utils", "build_projects\shared-build-targets-utils\shared-build-targets-utils.xproj", "{B768BD29-12BF-4C7C-B093-03193FE244D1}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-host-build", "build_projects\dotnet-host-build\dotnet-host-build.xproj", "{1DBB7542-0345-4F4B-A84B-3B00B185D416}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -593,22 +589,6 @@ Global {09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.ActiveCfg = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.Build.0 = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.Build.0 = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.ActiveCfg = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.Build.0 = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {0A37AB59-BDB5-4957-9BB8-D965F9A67A5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0A37AB59-BDB5-4957-9BB8-D965F9A67A5B}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A37AB59-BDB5-4957-9BB8-D965F9A67A5B}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -833,22 +813,6 @@ Global {B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.ActiveCfg = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.Build.0 = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.Build.0 = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.ActiveCfg = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.Build.0 = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -885,7 +849,6 @@ Global {60C33D0A-A5D8-4AB0-9956-1F804654DF05} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {09C52F96-EFDD-4448-95EC-6D362DD60BAA} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} - {EFC4FE68-83EB-40E4-BFA8-61D0B4626F25} = {0722D325-24C8-4E83-B5AF-0A083E7F0749} {EB0F5F8C-0991-49AC-B188-A9869476C7DF} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {0A37AB59-BDB5-4957-9BB8-D965F9A67A5B} = {EB0F5F8C-0991-49AC-B188-A9869476C7DF} {7B0EFBB4-4669-4B83-B47C-7F3E6DB07AF9} = {EB0F5F8C-0991-49AC-B188-A9869476C7DF} @@ -903,6 +866,5 @@ Global {D7B9695D-23EB-4EA8-B8AB-707A0092E1D5} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} - {1DBB7542-0345-4F4B-A84B-3B00B185D416} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} EndGlobalSection EndGlobal diff --git a/NuGet.Config b/NuGet.Config index 71ce25afc..1cbcecba8 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,9 +1,9 @@ - + - + diff --git a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json index 320476340..12f902b6e 100644 --- a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json +++ b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } }, "imports": [ diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/BrokenProjectPathSample/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/BrokenProjectPathSample/project.json index 5c8e8046e..fcdc4152e 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/BrokenProjectPathSample/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/BrokenProjectPathSample/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "EmptyLibrary": "1.0.0-*" }, "frameworks": { diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyConsoleApp/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyConsoleApp/project.json index d977d6798..2a3454785 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyConsoleApp/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyConsoleApp/project.json @@ -3,7 +3,7 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "dnx451": {} diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json index 701b8d07e..d3457e983 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Newtonsoft.Json": "8.0.3" } diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/FailReleaseProject/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/FailReleaseProject/project.json index f82e9cd70..538180070 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/FailReleaseProject/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/FailReleaseProject/project.json @@ -3,7 +3,7 @@ "netcoreapp1.0": { "imports": "dnxcore50", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } } }, diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/IncompatiblePackageSample/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/IncompatiblePackageSample/project.json index db056a6d9..6319f0416 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/IncompatiblePackageSample/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/IncompatiblePackageSample/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "Microsoft.Web.Administration": "7.0.0" }, "frameworks": { diff --git a/TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json b/TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json index d6f40ecc2..bd0856ed8 100755 --- a/TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json +++ b/TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestPackages/ToolWithOutputName/project.json b/TestAssets/TestPackages/ToolWithOutputName/project.json index 87a65dd93..fed9ed997 100644 --- a/TestAssets/TestPackages/ToolWithOutputName/project.json +++ b/TestAssets/TestPackages/ToolWithOutputName/project.json @@ -9,7 +9,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestPackages/dotnet-dependency-context-test/project.json b/TestAssets/TestPackages/dotnet-dependency-context-test/project.json index 07a026053..bbda1564c 100644 --- a/TestAssets/TestPackages/dotnet-dependency-context-test/project.json +++ b/TestAssets/TestPackages/dotnet-dependency-context-test/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.Extensions.DependencyModel": { "target": "project" diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json index fecc6a07d..ccaace04d 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.Cli.Utils": { "target": "project" diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json index ab6cee465..e643e41ef 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } }, diff --git a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/project.json b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/project.json index ce1c1bbb2..acc670554 100644 --- a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/project.json +++ b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/project.json b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/project.json index 6e350c622..b73544cc0 100644 --- a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/project.json +++ b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestPackages/dotnet-portable/project.json b/TestAssets/TestPackages/dotnet-portable/project.json index 1370a8e44..0d4051849 100644 --- a/TestAssets/TestPackages/dotnet-portable/project.json +++ b/TestAssets/TestPackages/dotnet-portable/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/AppWithAppDependency/TestApp1/project.json b/TestAssets/TestProjects/AppWithAppDependency/TestApp1/project.json index 3f0ab3af7..5e52f72be 100644 --- a/TestAssets/TestProjects/AppWithAppDependency/TestApp1/project.json +++ b/TestAssets/TestProjects/AppWithAppDependency/TestApp1/project.json @@ -10,7 +10,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/AppWithAppDependency/TestApp2/project.json b/TestAssets/TestProjects/AppWithAppDependency/TestApp2/project.json index 0e34cfa33..4856c3d73 100644 --- a/TestAssets/TestProjects/AppWithAppDependency/TestApp2/project.json +++ b/TestAssets/TestProjects/AppWithAppDependency/TestApp2/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/AppWithBomGlobalJson/project.json b/TestAssets/TestProjects/AppWithBomGlobalJson/project.json index 7314b47c1..6d6ae8cd8 100644 --- a/TestAssets/TestProjects/AppWithBomGlobalJson/project.json +++ b/TestAssets/TestProjects/AppWithBomGlobalJson/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/AppWithDependencyOnToolWithOutputName/project.json b/TestAssets/TestProjects/AppWithDependencyOnToolWithOutputName/project.json index 20e372704..8854296b1 100644 --- a/TestAssets/TestProjects/AppWithDependencyOnToolWithOutputName/project.json +++ b/TestAssets/TestProjects/AppWithDependencyOnToolWithOutputName/project.json @@ -5,7 +5,7 @@ }, "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-rc3-*", + "version": "1.0.0-rc3-004306", "type": "platform" } }, diff --git a/TestAssets/TestProjects/AppWithDirectAndToolDependency/project.json b/TestAssets/TestProjects/AppWithDirectAndToolDependency/project.json index 67273c771..bd8f4fab2 100644 --- a/TestAssets/TestProjects/AppWithDirectAndToolDependency/project.json +++ b/TestAssets/TestProjects/AppWithDirectAndToolDependency/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "dotnet-hello": { "version": "1.0.0", "target": "package" diff --git a/TestAssets/TestProjects/AppWithDirectDependency/project.json b/TestAssets/TestProjects/AppWithDirectDependency/project.json index db58664ce..f66bb6dfd 100644 --- a/TestAssets/TestProjects/AppWithDirectDependency/project.json +++ b/TestAssets/TestProjects/AppWithDirectDependency/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "dotnet-hello": { "version": "1.0.0", "target": "package" diff --git a/TestAssets/TestProjects/AppWithDirectDependencyAndTypeBuild/project.json b/TestAssets/TestProjects/AppWithDirectDependencyAndTypeBuild/project.json index a96e6eebc..3b40c9294 100644 --- a/TestAssets/TestProjects/AppWithDirectDependencyAndTypeBuild/project.json +++ b/TestAssets/TestProjects/AppWithDirectDependencyAndTypeBuild/project.json @@ -5,7 +5,7 @@ }, "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-rc3-*", + "version": "1.0.0-rc3-004306", "type": "platform" }, "xunit.core": "2.1.0", diff --git a/TestAssets/TestProjects/AppWithDirectDependencyWithOutputName/project.json b/TestAssets/TestProjects/AppWithDirectDependencyWithOutputName/project.json index bf7cc216e..dd9d75d6d 100644 --- a/TestAssets/TestProjects/AppWithDirectDependencyWithOutputName/project.json +++ b/TestAssets/TestProjects/AppWithDirectDependencyWithOutputName/project.json @@ -8,7 +8,7 @@ "target": "package" }, "Microsoft.NETCore.App": { - "version": "1.0.0-rc3-*", + "version": "1.0.0-rc3-004306", "type": "platform" } }, diff --git a/TestAssets/TestProjects/AppWithOutputAssemblyName/project.json b/TestAssets/TestProjects/AppWithOutputAssemblyName/project.json index e2a3b41e9..5c59c08d9 100644 --- a/TestAssets/TestProjects/AppWithOutputAssemblyName/project.json +++ b/TestAssets/TestProjects/AppWithOutputAssemblyName/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/AppWithToolDependency/project.json b/TestAssets/TestProjects/AppWithToolDependency/project.json index 7be12ea79..0d13ce8d6 100644 --- a/TestAssets/TestProjects/AppWithToolDependency/project.json +++ b/TestAssets/TestProjects/AppWithToolDependency/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/CompileFail/project.json b/TestAssets/TestProjects/CompileFail/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/CompileFail/project.json +++ b/TestAssets/TestProjects/CompileFail/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/DependencyChangeTest/PortableApp_Standalone/project.json b/TestAssets/TestProjects/DependencyChangeTest/PortableApp_Standalone/project.json index 88e56d088..2646a2a7a 100644 --- a/TestAssets/TestProjects/DependencyChangeTest/PortableApp_Standalone/project.json +++ b/TestAssets/TestProjects/DependencyChangeTest/PortableApp_Standalone/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/DependencyContextFromTool/project.json b/TestAssets/TestProjects/DependencyContextFromTool/project.json index d2b1b271a..571237efc 100644 --- a/TestAssets/TestProjects/DependencyContextFromTool/project.json +++ b/TestAssets/TestProjects/DependencyContextFromTool/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/DependencyContextValidator/DependencyContextValidator/project.json b/TestAssets/TestProjects/DependencyContextValidator/DependencyContextValidator/project.json index 0ccd99619..5254cd619 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/DependencyContextValidator/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/DependencyContextValidator/project.json @@ -9,7 +9,7 @@ "netstandard1.5": { "imports": "dnxcore50", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "net451": {} diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestApp/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestApp/project.json index 80bf20d50..a13004d02 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestApp/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestApp/project.json @@ -5,7 +5,7 @@ "preserveCompilationContext": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "DependencyContextValidator": "1.0.0-*" }, "frameworks": { diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppDeps/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppDeps/project.json index 9f5b02ef4..f37f78513 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppDeps/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppDeps/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "DependencyContextValidator": "1.0.0-*" }, "frameworks": { diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json index 603f05f46..9e1d2ce85 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json index ef94440a4..c4daf76e8 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/EndToEndTestApp/project.json b/TestAssets/TestProjects/EndToEndTestApp/project.json index 42d449fbf..fe1c4c15f 100644 --- a/TestAssets/TestProjects/EndToEndTestApp/project.json +++ b/TestAssets/TestProjects/EndToEndTestApp/project.json @@ -14,7 +14,7 @@ } }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "packOptions": { "files": { diff --git a/TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/project.json b/TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/project.json index 52dfbd2af..afad3eaf0 100644 --- a/TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/project.json +++ b/TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/project.json @@ -11,7 +11,7 @@ }, "dependencies": { "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "tools": { "dotnet-compile-fsc": { diff --git a/TestAssets/TestProjects/FSharpTestProjects/TestApp/project.json b/TestAssets/TestProjects/FSharpTestProjects/TestApp/project.json index d2291bc8c..f357f184f 100644 --- a/TestAssets/TestProjects/FSharpTestProjects/TestApp/project.json +++ b/TestAssets/TestProjects/FSharpTestProjects/TestApp/project.json @@ -14,7 +14,7 @@ "version": "1.0.0-*", "target": "project" }, - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221" }, "tools": { diff --git a/TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/project.json b/TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/project.json index 764277daa..6a47e729e 100644 --- a/TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/project.json +++ b/TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/project.json @@ -11,7 +11,7 @@ }, "dependencies": { "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "tools": { "dotnet-compile-fsc": { diff --git a/TestAssets/TestProjects/KestrelSample/KestrelPortable/project.json b/TestAssets/TestProjects/KestrelSample/KestrelPortable/project.json index 7f3874df6..6bec45fda 100644 --- a/TestAssets/TestProjects/KestrelSample/KestrelPortable/project.json +++ b/TestAssets/TestProjects/KestrelSample/KestrelPortable/project.json @@ -18,7 +18,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } }, "imports": [ diff --git a/TestAssets/TestProjects/KestrelSample/KestrelStandalone/project.json b/TestAssets/TestProjects/KestrelSample/KestrelStandalone/project.json index 9939e66c9..2d079a113 100644 --- a/TestAssets/TestProjects/KestrelSample/KestrelStandalone/project.json +++ b/TestAssets/TestProjects/KestrelSample/KestrelStandalone/project.json @@ -16,7 +16,7 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "imports": [ "dnxcore50", diff --git a/TestAssets/TestProjects/OutputStandardOutputAndError/project.json b/TestAssets/TestProjects/OutputStandardOutputAndError/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/OutputStandardOutputAndError/project.json +++ b/TestAssets/TestProjects/OutputStandardOutputAndError/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/PortableTests/PortableApp/project.json b/TestAssets/TestProjects/PortableTests/PortableApp/project.json index 0a85262d7..e208c3e57 100644 --- a/TestAssets/TestProjects/PortableTests/PortableApp/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableApp/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json index b9802df52..cdeaaa5ce 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json index 506265e64..3e520b7e6 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Linq": "4.0.0" }, diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json index 3589d32b3..9089f3c50 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/ResourcesTests/TestApp/project.json b/TestAssets/TestProjects/ResourcesTests/TestApp/project.json index c2150c3fc..8aec4114d 100644 --- a/TestAssets/TestProjects/ResourcesTests/TestApp/project.json +++ b/TestAssets/TestProjects/ResourcesTests/TestApp/project.json @@ -7,7 +7,7 @@ "Microsoft.Data.OData": "5.6.4", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "TestLibraryWithResources": { "target": "project" diff --git a/TestAssets/TestProjects/RunTestsApps/TestAppMultiTarget/project.json b/TestAssets/TestProjects/RunTestsApps/TestAppMultiTarget/project.json index d52d2a0b3..71c2c8b05 100644 --- a/TestAssets/TestProjects/RunTestsApps/TestAppMultiTarget/project.json +++ b/TestAssets/TestProjects/RunTestsApps/TestAppMultiTarget/project.json @@ -7,7 +7,7 @@ "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-rc3-*", + "version": "1.0.0-rc3-004306", "type": "platform" } } diff --git a/TestAssets/TestProjects/TestAppCompilationContext/TestApp/project.json b/TestAssets/TestProjects/TestAppCompilationContext/TestApp/project.json index 609b39ab6..c09a9ca1e 100644 --- a/TestAssets/TestProjects/TestAppCompilationContext/TestApp/project.json +++ b/TestAssets/TestProjects/TestAppCompilationContext/TestApp/project.json @@ -6,7 +6,7 @@ }, "dependencies": { "TestLibrary": "1.0.0-*", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppSimple/project.json b/TestAssets/TestProjects/TestAppSimple/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/TestAppSimple/project.json +++ b/TestAssets/TestProjects/TestAppSimple/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithArgs/project.json b/TestAssets/TestProjects/TestAppWithArgs/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/TestAppWithArgs/project.json +++ b/TestAssets/TestProjects/TestAppWithArgs/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithBuildDependency/App/project.json b/TestAssets/TestProjects/TestAppWithBuildDependency/App/project.json index 9ab98ab5b..e24ee18aa 100644 --- a/TestAssets/TestProjects/TestAppWithBuildDependency/App/project.json +++ b/TestAssets/TestProjects/TestAppWithBuildDependency/App/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "LibraryWithBuildDependency": { "target": "project" diff --git a/TestAssets/TestProjects/TestAppWithBuildDependency/LibraryWithBuildDependency/project.json b/TestAssets/TestProjects/TestAppWithBuildDependency/LibraryWithBuildDependency/project.json index 78ade703f..5796c2aa6 100644 --- a/TestAssets/TestProjects/TestAppWithBuildDependency/LibraryWithBuildDependency/project.json +++ b/TestAssets/TestProjects/TestAppWithBuildDependency/LibraryWithBuildDependency/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.Net.Compilers": { "type": "build", diff --git a/TestAssets/TestProjects/TestAppWithContentPackage/project.json b/TestAssets/TestProjects/TestAppWithContentPackage/project.json index 52010078b..818c5a6b7 100644 --- a/TestAssets/TestProjects/TestAppWithContentPackage/project.json +++ b/TestAssets/TestProjects/TestAppWithContentPackage/project.json @@ -5,7 +5,7 @@ "outputName": "AppWithContentPackage" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "SharedContentA": "1.0.0-*" }, "frameworks": { diff --git a/TestAssets/TestProjects/TestAppWithContents/project.json b/TestAssets/TestProjects/TestAppWithContents/project.json index f82a42aa3..43b534c4e 100644 --- a/TestAssets/TestProjects/TestAppWithContents/project.json +++ b/TestAssets/TestProjects/TestAppWithContents/project.json @@ -7,7 +7,7 @@ } }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithLibrary/TestApp/project.json b/TestAssets/TestProjects/TestAppWithLibrary/TestApp/project.json index 7c414cb0e..890c28416 100644 --- a/TestAssets/TestProjects/TestAppWithLibrary/TestApp/project.json +++ b/TestAssets/TestProjects/TestAppWithLibrary/TestApp/project.json @@ -9,7 +9,7 @@ "target": "project", "version": "1.0.0-*" }, - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithScripts/project.json b/TestAssets/TestProjects/TestAppWithScripts/project.json index a5b7a1813..c20d52c00 100644 --- a/TestAssets/TestProjects/TestAppWithScripts/project.json +++ b/TestAssets/TestProjects/TestAppWithScripts/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithTransitiveAppDependency/TestApp/project.json b/TestAssets/TestProjects/TestAppWithTransitiveAppDependency/TestApp/project.json index 6f47d955d..89c6a46fe 100644 --- a/TestAssets/TestProjects/TestAppWithTransitiveAppDependency/TestApp/project.json +++ b/TestAssets/TestProjects/TestAppWithTransitiveAppDependency/TestApp/project.json @@ -9,7 +9,7 @@ "target": "project", "version": "1.0.0-*" }, - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithUnicodéPath/project.json b/TestAssets/TestProjects/TestAppWithUnicodéPath/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/TestAppWithUnicodéPath/project.json +++ b/TestAssets/TestProjects/TestAppWithUnicodéPath/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestAppWithWrapperProjectDependency/TestApp/project.json b/TestAssets/TestProjects/TestAppWithWrapperProjectDependency/TestApp/project.json index 7c414cb0e..890c28416 100644 --- a/TestAssets/TestProjects/TestAppWithWrapperProjectDependency/TestApp/project.json +++ b/TestAssets/TestProjects/TestAppWithWrapperProjectDependency/TestApp/project.json @@ -9,7 +9,7 @@ "target": "project", "version": "1.0.0-*" }, - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestBindingRedirectGeneration/TestLibraryLesser/project.json b/TestAssets/TestProjects/TestBindingRedirectGeneration/TestLibraryLesser/project.json index 2b7ee5619..d577ceb7d 100644 --- a/TestAssets/TestProjects/TestBindingRedirectGeneration/TestLibraryLesser/project.json +++ b/TestAssets/TestProjects/TestBindingRedirectGeneration/TestLibraryLesser/project.json @@ -13,7 +13,7 @@ "net451": {}, "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "imports": "portable-net45+win8" } diff --git a/TestAssets/TestProjects/TestMicrosoftCSharpReference/project.json b/TestAssets/TestProjects/TestMicrosoftCSharpReference/project.json index 10512a26f..ec0d7a59a 100644 --- a/TestAssets/TestProjects/TestMicrosoftCSharpReference/project.json +++ b/TestAssets/TestProjects/TestMicrosoftCSharpReference/project.json @@ -5,7 +5,7 @@ "netcoreapp1.0": { "imports": "dnxcore50", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "net451": { diff --git a/TestAssets/TestProjects/TestMicrosoftCSharpReferenceMissingFramework/project.json b/TestAssets/TestProjects/TestMicrosoftCSharpReferenceMissingFramework/project.json index 3bd1d8ddb..6d320f6a1 100644 --- a/TestAssets/TestProjects/TestMicrosoftCSharpReferenceMissingFramework/project.json +++ b/TestAssets/TestProjects/TestMicrosoftCSharpReferenceMissingFramework/project.json @@ -5,7 +5,7 @@ "netcoreapp1.0": { "imports": "dnxcore50", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "netcore50": { diff --git a/TestAssets/TestProjects/TestMscorlibReference/project.json b/TestAssets/TestProjects/TestMscorlibReference/project.json index 91e0f9f4c..2836696b9 100644 --- a/TestAssets/TestProjects/TestMscorlibReference/project.json +++ b/TestAssets/TestProjects/TestMscorlibReference/project.json @@ -4,7 +4,7 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "net451": { diff --git a/TestAssets/TestProjects/TestProjectContextBuildAllDedupe/project.json b/TestAssets/TestProjects/TestProjectContextBuildAllDedupe/project.json index 701c21ee5..29006a6e4 100644 --- a/TestAssets/TestProjects/TestProjectContextBuildAllDedupe/project.json +++ b/TestAssets/TestProjects/TestProjectContextBuildAllDedupe/project.json @@ -2,7 +2,7 @@ "version": "1.0.0-*", "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-rc3-*", + "version": "1.0.0-rc3-004306", "type": "platform" }, }, diff --git a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L0/project.json b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L0/project.json index acf5948ab..aef2b4528 100644 --- a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L0/project.json +++ b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L0/project.json @@ -6,7 +6,7 @@ "dependencies": { "L11": "1.0.0-*", "L12": "1.0.0-*", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L11/project.json b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L11/project.json index 652eb9c09..d69436ab1 100644 --- a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L11/project.json +++ b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L11/project.json @@ -3,7 +3,7 @@ "dependencies": { "L12": "1.0.0-*", "L21": "1.0.0-*", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netstandard1.5": { diff --git a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L12/project.json b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L12/project.json index 68bed26aa..0ca363e97 100644 --- a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L12/project.json +++ b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L12/project.json @@ -2,7 +2,7 @@ "version": "1.0.0-*", "dependencies": { "L22": "1.0.0-*", - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netstandard1.5": { diff --git a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L21/project.json b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L21/project.json index 6d4049a82..652a4b863 100644 --- a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L21/project.json +++ b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L21/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netstandard1.5": { diff --git a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L22/project.json b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L22/project.json index 6d4049a82..652a4b863 100644 --- a/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L22/project.json +++ b/TestAssets/TestProjects/TestProjectToProjectDependencies/src/L22/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netstandard1.5": { diff --git a/TestAssets/TestProjects/TestProjectWithCultureSpecificResource/project.json b/TestAssets/TestProjects/TestProjectWithCultureSpecificResource/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/TestProjectWithCultureSpecificResource/project.json +++ b/TestAssets/TestProjects/TestProjectWithCultureSpecificResource/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestProjectWithResource/project.json b/TestAssets/TestProjects/TestProjectWithResource/project.json index 49272f3d6..72019737a 100644 --- a/TestAssets/TestProjects/TestProjectWithResource/project.json +++ b/TestAssets/TestProjects/TestProjectWithResource/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestSimpleIncrementalApp/project.json b/TestAssets/TestProjects/TestSimpleIncrementalApp/project.json index 98078e739..3adfd24c5 100644 --- a/TestAssets/TestProjects/TestSimpleIncrementalApp/project.json +++ b/TestAssets/TestProjects/TestSimpleIncrementalApp/project.json @@ -5,7 +5,7 @@ "xmlDoc": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" }, "frameworks": { "netcoreapp1.0": {} diff --git a/TestAssets/TestProjects/TestSystemCoreReference/project.json b/TestAssets/TestProjects/TestSystemCoreReference/project.json index 5230fd66d..f7ff63933 100644 --- a/TestAssets/TestProjects/TestSystemCoreReference/project.json +++ b/TestAssets/TestProjects/TestSystemCoreReference/project.json @@ -4,7 +4,7 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "net451": { diff --git a/TestAssets/TestProjects/TestSystemReference/project.json b/TestAssets/TestProjects/TestSystemReference/project.json index 7af52480f..91601db32 100644 --- a/TestAssets/TestProjects/TestSystemReference/project.json +++ b/TestAssets/TestProjects/TestSystemReference/project.json @@ -4,7 +4,7 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*" + "Microsoft.NETCore.App": "1.0.0-rc3-004306" } }, "net451": { diff --git a/build.cmd b/build.cmd index 133def113..bd617d268 100644 --- a/build.cmd +++ b/build.cmd @@ -3,5 +3,5 @@ REM Copyright (c) .NET Foundation and contributors. All rights reserved. REM Licensed under the MIT license. See LICENSE file in the project root for full license information. -powershell -NoProfile -NoLogo -Command "%~dp0build_projects\dotnet-host-build\build.ps1 %*; exit $LastExitCode;" powershell -NoProfile -NoLogo -Command "%~dp0build_projects\dotnet-cli-build\build.ps1 %*; exit $LastExitCode;" +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/build.sh b/build.sh index 429086595..ae1cde343 100755 --- a/build.sh +++ b/build.sh @@ -49,7 +49,6 @@ args=($temp) dockerbuild() { - BUILD_COMMAND=/opt/code/build_projects/dotnet-host-build/build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@" BUILD_COMMAND=/opt/code/build_projects/dotnet-cli-build/build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@" } @@ -57,6 +56,5 @@ dockerbuild() if [ ! -z "$BUILD_IN_DOCKER" ]; then dockerbuild "${args[@]}" else - $DIR/build_projects/dotnet-host-build/build.sh "${args[@]}" $DIR/build_projects/dotnet-cli-build/build.sh "${args[@]}" fi diff --git a/build_projects/dotnet-cli-build/CompileTargets.cs b/build_projects/dotnet-cli-build/CompileTargets.cs index 04a1fa15a..d738d6d40 100644 --- a/build_projects/dotnet-cli-build/CompileTargets.cs +++ b/build_projects/dotnet-cli-build/CompileTargets.cs @@ -15,7 +15,6 @@ namespace Microsoft.DotNet.Cli.Build { public class CompileTargets { - public static readonly string CoreCLRVersion = "1.0.2-rc3-24123-01"; public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86; public static readonly string[] BinariesForCoreHost = new[] @@ -54,11 +53,7 @@ namespace Microsoft.DotNet.Cli.Build public const string SharedFrameworkName = "Microsoft.NETCore.App"; - public static Crossgen CrossgenUtil = new Crossgen(CoreCLRVersion); - - private static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}"; - private static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"; - private static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"; + public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion); // Updates the stage 2 with recent changes. [Target(nameof(PrepareTargets.Init), nameof(CompileStage2))] @@ -67,58 +62,12 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(PrepareTargets.Init), nameof(RestoreLockedCoreHost), nameof(CompileStage1), nameof(CompileStage2))] + [Target(nameof(PrepareTargets.Init), nameof(CompileStage1), nameof(CompileStage2))] public static BuildTargetResult Compile(BuildTargetContext c) { return c.Success(); } - [Target(nameof(PrepareTargets.Init))] - public static BuildTargetResult RestoreLockedCoreHost(BuildTargetContext c) - { - var hostVersion = c.BuildContext.Get("HostVersion"); - var lockedHostFxrVersion = hostVersion.LockedHostFxrVersion; - - var currentRid = HostPackagePlatformRid; - - string projectJson = $@"{{ - ""dependencies"": {{ - ""Microsoft.NETCore.DotNetHostResolver"" : ""{lockedHostFxrVersion}"" - }}, - ""frameworks"": {{ - ""netcoreapp1.0"": {{}} - }}, - ""runtimes"": {{ - ""{currentRid}"": {{}} - }} -}}"; - var tempPjDirectory = Path.Combine(Dirs.Intermediate, "lockedHostTemp"); - FS.Rmdir(tempPjDirectory); - Directory.CreateDirectory(tempPjDirectory); - var tempPjFile = Path.Combine(tempPjDirectory, "project.json"); - File.WriteAllText(tempPjFile, projectJson); - - DotNetCli.Stage0.Restore("--verbosity", "verbose", - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) - .WorkingDirectory(tempPjDirectory) - .Execute() - .EnsureSuccessful(); - - // Clean out before publishing locked binaries - FS.Rmdir(Dirs.CorehostLocked); - - // Use specific RIDS for non-backward compatible platforms. - (CurrentPlatform.IsWindows - ? DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build") - : DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build", "-r", currentRid)) - .WorkingDirectory(tempPjDirectory) - .Execute() - .EnsureSuccessful(); - - return c.Success(); - } - [Target(nameof(PrepareTargets.Init))] public static BuildTargetResult CompileStage1(BuildTargetContext c) { @@ -130,11 +79,9 @@ namespace Microsoft.DotNet.Cli.Build } Directory.CreateDirectory(Dirs.Stage1); - CopySharedHost(Dirs.Stage1); - PublishSharedFramework(c, Dirs.Stage1, DotNetCli.Stage0); var result = CompileCliSdk(c, dotnet: DotNetCli.Stage0, - outputDir: Dirs.Stage1); + rootOutputDirectory: Dirs.Stage1); CleanOutputDir(Path.Combine(Dirs.Stage1, "sdk")); FS.CopyRecursive(Dirs.Stage1, Dirs.Stage1Symbols); @@ -157,11 +104,9 @@ namespace Microsoft.DotNet.Cli.Build } Directory.CreateDirectory(Dirs.Stage2); - PublishSharedFramework(c, Dirs.Stage2, DotNetCli.Stage1); - CopySharedHost(Dirs.Stage2); var result = CompileCliSdk(c, dotnet: DotNetCli.Stage1, - outputDir: Dirs.Stage2); + rootOutputDirectory: Dirs.Stage2); if (!result.Success) { @@ -209,168 +154,24 @@ namespace Microsoft.DotNet.Cli.Build FS.RmFilesInDirRecursive(directory, "*.pdb"); } - private static void CopySharedHost(string outputDir) - { - File.Copy( - Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName), - Path.Combine(outputDir, DotnetHostBaseName), true); - File.Copy( - Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName), - Path.Combine(outputDir, DotnetHostFxrBaseName), true); - } - - public static void PublishSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli) - { - string SharedFrameworkTemplateSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); - string SharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - - string sharedFrameworkRid; - if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) - { - sharedFrameworkRid = $"win7-{RuntimeEnvironment.RuntimeArchitecture}"; - } - else - { - sharedFrameworkRid = RuntimeEnvironment.GetRuntimeIdentifier(); - } - - string SharedFrameworkSourceRoot = GenerateSharedFrameworkProject(c, SharedFrameworkTemplateSourceRoot, sharedFrameworkRid); - - dotnetCli.Restore( - "--verbosity", "verbose", - "--disable-parallel", - "--infer-runtimes", - "--fallbacksource", Dirs.CorehostLocalPackages) - .WorkingDirectory(SharedFrameworkSourceRoot) - .Execute() - .EnsureSuccessful(); - - // We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier. - string SharedFrameworkNameAndVersionRoot = Path.Combine(outputDir, "shared", SharedFrameworkName, SharedFrameworkNugetVersion); - c.BuildContext["SharedFrameworkPath"] = SharedFrameworkNameAndVersionRoot; - - if (Directory.Exists(SharedFrameworkNameAndVersionRoot)) - { - Utils.DeleteDirectory(SharedFrameworkNameAndVersionRoot); - } - - dotnetCli.Publish( - "--output", SharedFrameworkNameAndVersionRoot, - "-r", sharedFrameworkRid, - SharedFrameworkSourceRoot).Execute().EnsureSuccessful(); - - // Clean up artifacts that dotnet-publish generates which we don't need - DeleteMainPublishOutput(SharedFrameworkNameAndVersionRoot, "framework"); - File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.runtimeconfig.json")); - - // Rename the .deps file - var destinationDeps = Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps.json"); - File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps); - ChangeEntryPointLibraryName(destinationDeps, null); - - // Generate RID fallback graph - string runtimeGraphGeneratorRuntime = null; - switch (RuntimeEnvironment.OperatingSystemPlatform) - { - case Platform.Windows: - runtimeGraphGeneratorRuntime = "win"; - break; - case Platform.Linux: - runtimeGraphGeneratorRuntime = "linux"; - break; - case Platform.Darwin: - runtimeGraphGeneratorRuntime = "osx"; - break; - } - if (!string.IsNullOrEmpty(runtimeGraphGeneratorRuntime)) - { - var runtimeGraphGeneratorName = "RuntimeGraphGenerator"; - var runtimeGraphGeneratorProject = Path.Combine(Dirs.RepoRoot, "tools", runtimeGraphGeneratorName); - var runtimeGraphGeneratorOutput = Path.Combine(Dirs.Output, "tools", runtimeGraphGeneratorName); - - dotnetCli.Publish( - "--output", runtimeGraphGeneratorOutput, - runtimeGraphGeneratorProject).Execute().EnsureSuccessful(); - var runtimeGraphGeneratorExe = Path.Combine(runtimeGraphGeneratorOutput, $"{runtimeGraphGeneratorName}{Constants.ExeSuffix}"); - - Cmd(runtimeGraphGeneratorExe, "--project", SharedFrameworkSourceRoot, "--deps", destinationDeps, runtimeGraphGeneratorRuntime) - .Execute() - .EnsureSuccessful(); - } - else - { - c.Error($"Could not determine rid graph generation runtime for platform {RuntimeEnvironment.OperatingSystemPlatform}"); - } - - // TODO: Issue #2408: Remove corehost and hostfxr from the Shared FX. - File.Copy( - Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName), - Path.Combine(SharedFrameworkNameAndVersionRoot, $"corehost{Constants.ExeSuffix}"), true); - File.Copy( - Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName), - Path.Combine(SharedFrameworkNameAndVersionRoot, DotnetHostFxrBaseName), true); - - // Hostpolicy should be the latest and not the locked version as it is supposed to evolve for - // the framework and has a tight coupling with coreclr's API in the framework. - File.Copy( - Path.Combine(Dirs.CorehostLatest, HostPolicyBaseName), - Path.Combine(SharedFrameworkNameAndVersionRoot, HostPolicyBaseName), true); - - if (File.Exists(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll"))) - { - // Publish already places the crossgen'd version of mscorlib into the output, so we can - // remove the IL version - File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.dll")); - } - - CrossgenUtil.CrossgenDirectory(c, SharedFrameworkNameAndVersionRoot); - - // Generate .version file for sharedfx - var version = SharedFrameworkNugetVersion; - var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}"; - File.WriteAllText(Path.Combine(SharedFrameworkNameAndVersionRoot, ".version"), content); - } - - /// - /// Generates the real shared framework project that will get published. - /// - /// The "sharedFramework" source template folder. - private static string GenerateSharedFrameworkProject(BuildTargetContext c, string sharedFrameworkTemplatePath, string rid) - { - string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework"); - Utils.DeleteDirectory(sharedFrameworkProjectPath); - CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true); - - string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template"); - JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile); - sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; - ((JObject)sharedFrameworkProject["runtimes"]).RemoveAll(); - sharedFrameworkProject["runtimes"][rid] = new JObject(); - - string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json"); - JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath); - - Rm(templateFile); - - return sharedFrameworkProjectPath; - } - - private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir) + private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string rootOutputDirectory) { var configuration = c.BuildContext.Get("Configuration"); var buildVersion = c.BuildContext.Get("BuildVersion"); var srcDir = Path.Combine(c.BuildContext.BuildDirectory, "src"); - outputDir = Path.Combine(outputDir, "sdk", buildVersion.NuGetVersion); + var sdkOutputDirectory = Path.Combine(rootOutputDirectory, "sdk", buildVersion.NuGetVersion); + + CopySharedFramework(Dirs.SharedFrameworkPublish, rootOutputDirectory); FS.CleanBinObj(c, srcDir); - Rmdir(outputDir); - Mkdirp(outputDir); + Rmdir(sdkOutputDirectory); + Mkdirp(sdkOutputDirectory); foreach (var project in ProjectsToPublish) { dotnet.Publish( "--native-subdirectory", - "--output", outputDir, + "--output", sdkOutputDirectory, "--configuration", configuration, "--version-suffix", buildVersion.CommitCountString, Path.Combine(srcDir, project)) @@ -378,38 +179,36 @@ namespace Microsoft.DotNet.Cli.Build .EnsureSuccessful(); } - FixModeFlags(outputDir); + FixModeFlags(sdkOutputDirectory); string compilersProject = Path.Combine(Dirs.RepoRoot, "src", "compilers"); dotnet.Publish(compilersProject, "--output", - outputDir, + sdkOutputDirectory, "--framework", "netstandard1.5") .Execute() .EnsureSuccessful(); - var compilersDeps = Path.Combine(outputDir, "compilers.deps.json"); - var compilersRuntimeConfig = Path.Combine(outputDir, "compilers.runtimeconfig.json"); + var compilersDeps = Path.Combine(sdkOutputDirectory, "compilers.deps.json"); + var compilersRuntimeConfig = Path.Combine(sdkOutputDirectory, "compilers.runtimeconfig.json"); - File.Copy(Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName), Path.Combine(outputDir, $"corehost{Constants.ExeSuffix}"), overwrite: true); - File.Copy(Path.Combine(Dirs.CorehostLocked, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), overwrite: true); - File.Copy(Path.Combine(Dirs.CorehostLatest, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), overwrite: true); var binaryToCorehostifyRelDir = Path.Combine("runtimes", "any", "native"); - var binaryToCorehostifyOutDir = Path.Combine(outputDir, binaryToCorehostifyRelDir); + var binaryToCorehostifyOutDir = Path.Combine(sdkOutputDirectory, binaryToCorehostifyRelDir); // Corehostify binaries foreach (var binaryToCorehostify in BinariesForCoreHost) { try { // Yes, it is .exe even on Linux. This is the managed exe we're working with - File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(outputDir, $"{binaryToCorehostify}.dll")); + File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(sdkOutputDirectory, $"{binaryToCorehostify}.dll")); File.Delete(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe")); - File.Copy(compilersDeps, Path.Combine(outputDir, binaryToCorehostify + ".deps.json")); - File.Copy(compilersRuntimeConfig, Path.Combine(outputDir, binaryToCorehostify + ".runtimeconfig.json")); - var binaryToCoreHostifyDeps = Path.Combine(outputDir, binaryToCorehostify + ".deps.json"); - ChangeEntryPointLibraryName(binaryToCoreHostifyDeps, binaryToCorehostify); + var binaryToCoreHostifyDeps = Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json"); + + File.Copy(compilersDeps, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json")); + File.Copy(compilersRuntimeConfig, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".runtimeconfig.json")); + PublishMutationUtilties.ChangeEntryPointLibraryName(binaryToCoreHostifyDeps, binaryToCorehostify); foreach (var binaryToRemove in new string[] { "csc", "vbc" }) { var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/'); @@ -423,16 +222,40 @@ namespace Microsoft.DotNet.Cli.Build } // cleanup compilers project output we don't need - DeleteMainPublishOutput(outputDir, "compilers"); - File.Delete(compilersDeps); - File.Delete(compilersRuntimeConfig); + PublishMutationUtilties.CleanPublishOutput( + sdkOutputDirectory, + "compilers", + deleteRuntimeConfigJson: true, + deleteDepsJson: true); - CrossgenUtil.CrossgenDirectory(c, outputDir); + // Crossgen SDK directory + var sharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion; + var sharedFrameworkNameVersionPath = SharedFrameworkPublisher.GetSharedFrameworkPublishPath( + rootOutputDirectory, + sharedFrameworkNugetVersion); + + // Copy Host to SDK Directory + File.Copy( + Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostBaseName), + Path.Combine(sdkOutputDirectory, $"corehost{Constants.ExeSuffix}"), + overwrite: true); + File.Copy( + Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostFxrBaseName), + Path.Combine(sdkOutputDirectory, HostArtifactNames.DotnetHostFxrBaseName), + overwrite: true); + File.Copy( + Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.HostPolicyBaseName), + Path.Combine(sdkOutputDirectory, HostArtifactNames.HostPolicyBaseName), + overwrite: true); + + CrossgenUtil.CrossgenDirectory( + sharedFrameworkNameVersionPath, + sdkOutputDirectory); // Generate .version file var version = buildVersion.NuGetVersion; var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}"; - File.WriteAllText(Path.Combine(outputDir, ".version"), content); + File.WriteAllText(Path.Combine(sdkOutputDirectory, ".version"), content); return c.Success(); } @@ -471,57 +294,9 @@ namespace Microsoft.DotNet.Cli.Build } } - private static void ChangeEntryPointLibraryName(string depsFile, string newName) + private static void CopySharedFramework(string sharedFrameworkPublish, string rootOutputDirectory) { - JToken deps; - using (var file = File.OpenText(depsFile)) - using (JsonTextReader reader = new JsonTextReader(file)) - { - deps = JObject.ReadFrom(reader); - } - - string version = null; - foreach (JProperty target in deps["targets"]) - { - var targetLibrary = target.Value.Children().FirstOrDefault(); - if (targetLibrary == null) - { - continue; - } - version = targetLibrary.Name.Substring(targetLibrary.Name.IndexOf('/') + 1); - if (newName == null) - { - targetLibrary.Remove(); - } - else - { - targetLibrary.Replace(new JProperty(newName + '/' + version, targetLibrary.Value)); - } - } - if (version != null) - { - var library = deps["libraries"].Children().First(); - if (newName == null) - { - library.Remove(); - } - else - { - library.Replace(new JProperty(newName + '/' + version, library.Value)); - } - using (var file = File.CreateText(depsFile)) - using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented }) - { - deps.WriteTo(writer); - } - } - } - - private static void DeleteMainPublishOutput(string path, string name) - { - File.Delete(Path.Combine(path, $"{name}{Constants.ExeSuffix}")); - File.Delete(Path.Combine(path, $"{name}.dll")); - File.Delete(Path.Combine(path, $"{name}.pdb")); + CopyRecursive(sharedFrameworkPublish, rootOutputDirectory); } } } diff --git a/build_projects/dotnet-cli-build/DebTargets.cs b/build_projects/dotnet-cli-build/DebTargets.cs index a2e960e42..01ca7b648 100644 --- a/build_projects/dotnet-cli-build/DebTargets.cs +++ b/build_projects/dotnet-cli-build/DebTargets.cs @@ -12,9 +12,7 @@ namespace Microsoft.DotNet.Cli.Build { public class DebTargets { - [Target(nameof(GenerateSharedHostDeb), - nameof(GenerateSharedFrameworkDeb), - nameof(GenerateSdkDeb))] + [Target(nameof(GenerateSdkDeb))] [BuildPlatforms(BuildPlatform.Ubuntu)] public static BuildTargetResult GenerateDebs(BuildTargetContext c) { @@ -52,7 +50,7 @@ namespace Microsoft.DotNet.Cli.Build "-m", manPagesDir, "--framework-debian-package-name", sharedFxDebianPackageName, "--framework-nuget-name", Monikers.SharedFrameworkName, - "--framework-nuget-version", c.BuildContext.Get("SharedFrameworkNugetVersion"), + "--framework-nuget-version", DependencyVersions.SharedFrameworkVersion, "--previous-version-url", previousVersionURL, "--obj-root", objRoot) .Execute() @@ -60,59 +58,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c) - { - var packageName = Monikers.GetDebianSharedHostPackageName(c); - var version = c.BuildContext.Get("HostVersion").LockedHostVersion; - var inputRoot = c.BuildContext.Get("SharedHostPublishRoot"); - var debFile = c.BuildContext.Get("SharedHostInstallerFile"); - var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedhost"); - var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages"); - - if (Directory.Exists(objRoot)) - { - Directory.Delete(objRoot, true); - } - - Directory.CreateDirectory(objRoot); - - Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedhost-debian.sh"), - "--input", inputRoot, "--output", debFile, "-b", Monikers.SharedHostBrandName, - "--obj-root", objRoot, "--version", version, "-m", manPagesDir) - .Execute() - .EnsureSuccessful(); - return c.Success(); - } - - [Target(nameof(InstallSharedHost))] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c) - { - var packageName = Monikers.GetDebianSharedFrameworkPackageName(c); - var version = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var inputRoot = c.BuildContext.Get("SharedFrameworkPublishRoot"); - var debFile = c.BuildContext.Get("SharedFrameworkInstallerFile"); - var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedframework"); - - if (Directory.Exists(objRoot)) - { - Directory.Delete(objRoot, true); - } - - Directory.CreateDirectory(objRoot); - - Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"), - "--input", inputRoot, "--output", debFile, "--package-name", packageName, "-b", Monikers.SharedFxBrandName, - "--framework-nuget-name", Monikers.SharedFrameworkName, - "--framework-nuget-version", c.BuildContext.Get("SharedFrameworkNugetVersion"), - "--obj-root", objRoot, "--version", version) - .Execute() - .EnsureSuccessful(); - return c.Success(); - } - [Target(nameof(InstallSDK), nameof(RunE2ETest), nameof(RemovePackages))] diff --git a/build_projects/dotnet-cli-build/MsiTargets.cs b/build_projects/dotnet-cli-build/MsiTargets.cs index 1fa6a96ce..0f8610f3d 100644 --- a/build_projects/dotnet-cli-build/MsiTargets.cs +++ b/build_projects/dotnet-cli-build/MsiTargets.cs @@ -33,12 +33,8 @@ namespace Microsoft.DotNet.Cli.Build private static string SharedFrameworkMsi { get; set; } - private static string SharedFrameworkBundle { get; set; } - private static string SdkEngine { get; set; } - private static string SharedFrameworkEngine { get; set; } - private static string MsiVersion { get; set; } private static string CliDisplayVersion { get; set; } @@ -85,10 +81,8 @@ namespace Microsoft.DotNet.Cli.Build SdkMsi = Path.ChangeExtension(SdkBundle, "msi"); SdkEngine = GetEngineName(SdkBundle); - SharedFrameworkBundle = c.BuildContext.Get("CombinedFrameworkHostInstallerFile"); - SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get("SharedHostInstallerFile"), "msi"); SharedFrameworkMsi = Path.ChangeExtension(c.BuildContext.Get("SharedFrameworkInstallerFile"), "msi"); - SharedFrameworkEngine = GetEngineName(SharedFrameworkBundle); + SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get("SharedHostInstallerFile"), "msi"); var buildVersion = c.BuildContext.Get("BuildVersion"); MsiVersion = buildVersion.GenerateMsiVersion(); @@ -100,8 +94,6 @@ namespace Microsoft.DotNet.Cli.Build } [Target(nameof(MsiTargets.InitMsi), - nameof(GenerateDotnetSharedHostMsi), - nameof(GenerateDotnetSharedFrameworkMsi), nameof(GenerateCliSdkMsi))] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateMsis(BuildTargetContext c) @@ -110,8 +102,7 @@ namespace Microsoft.DotNet.Cli.Build } [Target(nameof(MsiTargets.InitMsi), - nameof(GenerateCliSdkBundle), - nameof(GenerateSharedFxBundle))] + nameof(GenerateCliSdkBundle))] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateBundles(BuildTargetContext c) { @@ -134,58 +125,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c) - { - var hostVersion = c.BuildContext.Get("HostVersion"); - var hostMsiVersion = hostVersion.GenerateMsiVersion(); - var hostNugetVersion = hostVersion.LockedHostVersion; - var inputDir = c.BuildContext.Get("SharedHostPublishRoot"); - var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost"); - var sharedHostBrandName = $"'{Monikers.SharedHostBrandName}'"; - - if (Directory.Exists(wixObjRoot)) - { - Utils.DeleteDirectory(wixObjRoot); - } - Directory.CreateDirectory(wixObjRoot); - - Cmd("powershell", "-NoProfile", "-NoLogo", - Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"), - inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, Arch, wixObjRoot) - .Execute() - .EnsureSuccessful(); - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c) - { - var inputDir = c.BuildContext.Get("SharedFrameworkPublishRoot"); - var sharedFrameworkNuGetName = Monikers.SharedFrameworkName; - var sharedFrameworkNuGetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var msiVerison = sharedFrameworkNuGetVersion.Split('-')[0]; - var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper(); - var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework"); - var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'"; - - if (Directory.Exists(wixObjRoot)) - { - Utils.DeleteDirectory(wixObjRoot); - } - Directory.CreateDirectory(wixObjRoot); - - Cmd("powershell", "-NoProfile", "-NoLogo", - Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"), - inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot) - .Execute() - .EnsureSuccessful(); - return c.Success(); - } - - [Target(nameof(MsiTargets.InitMsi))] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateCliSdkBundle(BuildTargetContext c) @@ -202,29 +141,11 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(MsiTargets.InitMsi))] - [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateSharedFxBundle(BuildTargetContext c) - { - var sharedFrameworkNuGetName = Monikers.SharedFrameworkName; - var sharedFrameworkNuGetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper(); - var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'"; - - Cmd("powershell", "-NoProfile", "-NoLogo", - Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"), - SharedFrameworkMsi, SharedHostMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, CliDisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch) - .Execute() - .EnsureSuccessful(); - return c.Success(); - } - [Target(nameof(MsiTargets.InitMsi))] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult ExtractEngineFromBundle(BuildTargetContext c) { ExtractEngineFromBundleHelper(SdkBundle, SdkEngine); - ExtractEngineFromBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine); return c.Success(); } @@ -233,16 +154,9 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult ReattachEngineToBundle(BuildTargetContext c) { ReattachEngineToBundleHelper(SdkBundle, SdkEngine); - ReattachEngineToBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine); return c.Success(); } - private static string GetEngineName(string bundle) - { - var engine = $"{Path.GetFileNameWithoutExtension(bundle)}-{ENGINE}"; - return Path.Combine(Path.GetDirectoryName(bundle), engine); - } - private static void ExtractEngineFromBundleHelper(string bundle, string engine) { Cmd($"{WixRoot}\\insignia.exe", "-ib", bundle, "-o", engine) @@ -258,5 +172,11 @@ namespace Microsoft.DotNet.Cli.Build File.Delete(engine); } + + private static string GetEngineName(string bundle) + { + var engine = $"{Path.GetFileNameWithoutExtension(bundle)}-{ENGINE}"; + return Path.Combine(Path.GetDirectoryName(bundle), engine); + } } } diff --git a/build_projects/dotnet-cli-build/PackageTargets.cs b/build_projects/dotnet-cli-build/PackageTargets.cs index 39ec7c54f..41014ad20 100644 --- a/build_projects/dotnet-cli-build/PackageTargets.cs +++ b/build_projects/dotnet-cli-build/PackageTargets.cs @@ -29,7 +29,6 @@ namespace Microsoft.DotNet.Cli.Build nameof(PackageTargets.CopySharedHostLayout), nameof(PackageTargets.CopySharedFxLayout), nameof(PackageTargets.CopyCombinedFrameworkSDKHostLayout), - nameof(PackageTargets.CopyCombinedFrameworkHostLayout), nameof(PackageTargets.CopyCombinedFrameworkSDKLayout))] public static BuildTargetResult InitPackage(BuildTargetContext c) { @@ -142,26 +141,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - public static BuildTargetResult CopyCombinedFrameworkHostLayout(BuildTargetContext c) - { - var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-host"); - if (Directory.Exists(combinedRoot)) - { - Utils.DeleteDirectory(combinedRoot); - } - - - string sharedFrameworkPublishRoot = c.BuildContext.Get("SharedFrameworkPublishRoot"); - Utils.CopyDirectoryRecursively(sharedFrameworkPublishRoot, combinedRoot); - - string sharedHostPublishRoot = c.BuildContext.Get("SharedHostPublishRoot"); - Utils.CopyDirectoryRecursively(sharedHostPublishRoot, combinedRoot); - - c.BuildContext["CombinedFrameworkHostRoot"] = combinedRoot; - return c.Success(); - } - [Target] public static BuildTargetResult CopyCombinedFrameworkSDKLayout(BuildTargetContext c) { @@ -192,7 +171,6 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult GenerateZip(BuildTargetContext c) { CreateZipFromDirectory(c.BuildContext.Get("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get("CombinedFrameworkSDKHostCompressedFile")); - CreateZipFromDirectory(c.BuildContext.Get("CombinedFrameworkHostRoot"), c.BuildContext.Get("CombinedFrameworkHostCompressedFile")); CreateZipFromDirectory(c.BuildContext.Get("CombinedFrameworkSDKRoot"), c.BuildContext.Get("CombinedFrameworkSDKCompressedFile")); CreateZipFromDirectory(Path.Combine(Dirs.Stage2Symbols, "sdk"), c.BuildContext.Get("SdkSymbolsCompressedFile")); @@ -204,7 +182,6 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult GenerateTarBall(BuildTargetContext c) { CreateTarBallFromDirectory(c.BuildContext.Get("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get("CombinedFrameworkSDKHostCompressedFile")); - CreateTarBallFromDirectory(c.BuildContext.Get("CombinedFrameworkHostRoot"), c.BuildContext.Get("CombinedFrameworkHostCompressedFile")); CreateTarBallFromDirectory(Path.Combine(Dirs.Stage2Symbols, "sdk"), c.BuildContext.Get("SdkSymbolsCompressedFile")); diff --git a/build_projects/dotnet-cli-build/PkgTargets.cs b/build_projects/dotnet-cli-build/PkgTargets.cs index 599533111..81440cd15 100644 --- a/build_projects/dotnet-cli-build/PkgTargets.cs +++ b/build_projects/dotnet-cli-build/PkgTargets.cs @@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli.Build SharedHostComponentId = $"com.microsoft.dotnet.sharedhost.component.osx.x64"; string sharedFrameworkNugetName = Monikers.SharedFrameworkName; - SharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + SharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion; SharedFxComponentId = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64"; SharedFxPkgId = $"com.microsoft.dotnet.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.osx.x64"; @@ -42,7 +42,7 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(InitPkg), nameof(GenerateSharedFrameworkProductArchive), nameof(GenerateCLISdkProductArchive))] + [Target(nameof(InitPkg), nameof(GenerateCLISdkProductArchive))] [BuildPlatforms(BuildPlatform.OSX)] public static BuildTargetResult GeneratePkgs(BuildTargetContext c) { @@ -107,85 +107,5 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - - [Target(nameof(GenerateSharedFrameworkPkg), nameof(GenerateSharedHostPkg))] - [BuildPlatforms(BuildPlatform.OSX)] - public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c) - { - string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "resources"); - string outFilePath = Path.Combine(PkgsIntermediateDir, c.BuildContext.Get("CombinedFrameworkHostInstallerFile")); - - string inputDistTemplatePath = Path.Combine( - Dirs.RepoRoot, - "packaging", - "osx", - "sharedframework", - "shared-framework-distribution-template.xml"); - string distTemplate = File.ReadAllText(inputDistTemplatePath); - string distributionPath = Path.Combine(PkgsIntermediateDir, "shared-framework-formatted-distribution.xml"); - string formattedDistContents = - distTemplate.Replace("{SharedFxComponentId}", SharedFxComponentId) - .Replace("{SharedHostComponentId}", SharedHostComponentId) - .Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName) - .Replace("{SharedFrameworkNugetVersion}", SharedFrameworkNugetVersion) - .Replace("{SharedFxBrandName}", Monikers.SharedFxBrandName) - .Replace("{SharedHostBrandName}", Monikers.SharedHostBrandName); - File.WriteAllText(distributionPath, formattedDistContents); - - Cmd("productbuild", - "--version", SharedFrameworkNugetVersion, - "--identifier", SharedFxPkgId, - "--package-path", PkgsIntermediateDir, - "--resources", resourcePath, - "--distribution", distributionPath, - outFilePath) - .Execute() - .EnsureSuccessful(); - - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.OSX)] - public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c) - { - string outFilePath = Path.Combine(PkgsIntermediateDir, SharedFxComponentId + ".pkg"); - string installLocation = "/usr/local/share/dotnet"; - string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "scripts"); - - Cmd("pkgbuild", - "--root", c.BuildContext.Get("SharedFrameworkPublishRoot"), - "--identifier", SharedFxComponentId, - "--version", SharedFrameworkNugetVersion, - "--install-location", installLocation, - "--scripts", scriptsLocation, - outFilePath) - .Execute() - .EnsureSuccessful(); - - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.OSX)] - public static BuildTargetResult GenerateSharedHostPkg(BuildTargetContext c) - { - string version = c.BuildContext.Get("HostVersion").LockedHostVersion; - string outFilePath = Path.Combine(PkgsIntermediateDir, SharedHostComponentId + ".pkg"); - string installLocation = "/usr/local/share/dotnet"; - string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedhost", "scripts"); - - Cmd("pkgbuild", - "--root", c.BuildContext.Get("SharedHostPublishRoot"), - "--identifier", SharedHostComponentId, - "--version", version, - "--install-location", installLocation, - "--scripts", scriptsLocation, - outFilePath) - .Execute() - .EnsureSuccessful(); - - return c.Success(); - } } } diff --git a/build_projects/dotnet-cli-build/PrepareTargets.cs b/build_projects/dotnet-cli-build/PrepareTargets.cs index 606aab114..b2bc2bc9f 100644 --- a/build_projects/dotnet-cli-build/PrepareTargets.cs +++ b/build_projects/dotnet-cli-build/PrepareTargets.cs @@ -12,12 +12,13 @@ using Newtonsoft.Json.Linq; using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; using static Microsoft.DotNet.Cli.Build.FS; using static Microsoft.DotNet.Cli.Build.Utils; +using System.IO.Compression; namespace Microsoft.DotNet.Cli.Build { public class PrepareTargets { - [Target(nameof(Init), nameof(RestorePackages))] + [Target(nameof(Init), nameof(DownloadHostAndSharedFxArtifacts), nameof(RestorePackages))] public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success(); [Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))] @@ -75,16 +76,10 @@ namespace Microsoft.DotNet.Cli.Build ReleaseSuffix = branchInfo["RELEASE_SUFFIX"], CommitCount = commitCount }; - - var hostVersion = new HostVersion() - { - CommitCount = commitCount - }; + c.BuildContext["BuildVersion"] = buildVersion; - c.BuildContext["HostVersion"] = hostVersion; c.BuildContext["CommitHash"] = commitHash; - c.BuildContext["SharedFrameworkNugetVersion"] = buildVersion.NetCoreAppVersion; c.Info($"Building Version: {buildVersion.SimpleVersion} (NuGet Packages: {buildVersion.NuGetVersion})"); c.Info($"From Commit: {commitHash}"); @@ -106,7 +101,7 @@ namespace Microsoft.DotNet.Cli.Build foreach (string templateFile in templateFiles) { JObject projectRoot = JsonUtils.ReadProject(templateFile); - projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; + projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = DependencyVersions.SharedFrameworkVersion; JsonUtils.WriteProject(projectRoot, Path.ChangeExtension(templateFile, "template")); } @@ -146,17 +141,91 @@ namespace Microsoft.DotNet.Cli.Build c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName); var cliVersion = c.BuildContext.Get("BuildVersion").NuGetVersion; - var sharedFrameworkVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); - var hostVersion = c.BuildContext.Get("HostVersion").LockedHostVersion; + var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion; + var hostVersion = DependencyVersions.SharedHostVersion; + // Generated Installers + Archives AddInstallerArtifactToContext(c, "dotnet-sdk", "Sdk", cliVersion); - AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion); - AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion); AddInstallerArtifactToContext(c, "dotnet-dev", "CombinedFrameworkSDKHost", cliVersion); - AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion); AddInstallerArtifactToContext(c, "dotnet-sharedframework-sdk", "CombinedFrameworkSDK", cliVersion); AddInstallerArtifactToContext(c, "dotnet-sdk-debug", "SdkSymbols", cliVersion); + //Downloaded Installers + Archives + AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion); + AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion); + AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion); + + return c.Success(); + } + + [Target( + nameof(ExpectedBuildArtifacts), + nameof(DownloadHostAndSharedFxArchives), + nameof(DownloadHostAndSharedFxInstallers))] + public static BuildTargetResult DownloadHostAndSharedFxArtifacts(BuildTargetContext c) => c.Success(); + + [Target] + public static BuildTargetResult DownloadHostAndSharedFxArchives(BuildTargetContext c) + { + var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion; + var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel; + + var combinedSharedHostAndFrameworkArchiveFile = c.BuildContext.Get("CombinedFrameworkHostCompressedFile"); + + Mkdirp(Path.GetDirectoryName(combinedSharedHostAndFrameworkArchiveFile)); + + AzurePublisher.DownloadFile( + AzurePublisher.CalculateArchiveBlob( + combinedSharedHostAndFrameworkArchiveFile, + sharedFrameworkChannel, + sharedFrameworkVersion), + combinedSharedHostAndFrameworkArchiveFile).Wait(); + + // Unpack the combined archive to shared framework publish directory + Rmdir(Dirs.SharedFrameworkPublish); + Mkdirp(Dirs.SharedFrameworkPublish); + if(CurrentPlatform.IsWindows) + { + ZipFile.ExtractToDirectory(combinedSharedHostAndFrameworkArchiveFile, Dirs.SharedFrameworkPublish); + } + else + { + Exec("tar", "xf", combinedSharedHostAndFrameworkArchiveFile, "-C", Dirs.SharedFrameworkPublish); + } + + return c.Success(); + } + + [Target] + [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX, BuildPlatform.Ubuntu)] + public static BuildTargetResult DownloadHostAndSharedFxInstallers(BuildTargetContext c) + { + var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion; + var hostVersion = DependencyVersions.SharedHostVersion; + + var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel; + var sharedHostChannel = DependencyVersions.SharedHostChannel; + + var sharedFrameworkInstallerFile = c.BuildContext.Get("SharedFrameworkInstallerFile"); + var sharedHostInstallerFile = c.BuildContext.Get("SharedHostInstallerFile"); + + Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerFile)); + Mkdirp(Path.GetDirectoryName(sharedHostInstallerFile)); + + AzurePublisher.DownloadFile( + AzurePublisher.CalculateInstallerBlob( + sharedFrameworkInstallerFile, + sharedFrameworkChannel, + sharedFrameworkVersion), + sharedFrameworkInstallerFile).Wait(); + + AzurePublisher.DownloadFile( + AzurePublisher.CalculateInstallerBlob( + sharedHostInstallerFile, + sharedHostChannel, + hostVersion), + sharedHostInstallerFile).Wait(); + return c.Success(); } @@ -231,7 +300,7 @@ namespace Microsoft.DotNet.Cli.Build { var dotnet = DotNetCli.Stage0; - dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.CorehostLocalPackages) + dotnet.Restore("--verbosity", "verbose", "--disable-parallel") .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) .Execute() .EnsureSuccessful(); @@ -424,7 +493,14 @@ cmake is required to build the native host 'corehost'"; switch (CurrentPlatform.Current) { case BuildPlatform.Windows: - installer = productName + ".exe"; + if (contextPrefix.Contains("Combined")) + { + installer = productName + ".exe"; + } + else + { + installer = productName + ".msi"; + } break; case BuildPlatform.OSX: installer = productName + ".pkg"; diff --git a/build_projects/dotnet-cli-build/PublishTargets.cs b/build_projects/dotnet-cli-build/PublishTargets.cs index fb796dfda..85187f9eb 100644 --- a/build_projects/dotnet-cli-build/PublishTargets.cs +++ b/build_projects/dotnet-cli-build/PublishTargets.cs @@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Cli.Build CliVersion = c.BuildContext.Get("BuildVersion").SimpleVersion; CliNuGetVersion = c.BuildContext.Get("BuildVersion").NuGetVersion; - SharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + SharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion; SharedHostNugetVersion = c.BuildContext.Get("HostVersion").LockedHostVersion; Channel = c.BuildContext.Get("Channel"); @@ -91,28 +91,15 @@ namespace Microsoft.DotNet.Cli.Build // Copy the latest CLI bits CopyBlobs($"{Channel}/Binaries/{CliNuGetVersion}/", targetContainer); - // Copy the shared framework - CopyBlobs($"{Channel}/Binaries/{SharedFrameworkNugetVersion}/", targetContainer); - // Copy the latest installer files CopyBlobs($"{Channel}/Installers/{CliNuGetVersion}/", $"{Channel}/Installers/Latest/"); - // Copy the shared framework installers - CopyBlobs($"{Channel}/Installers/{SharedFrameworkNugetVersion}/", $"{Channel}/Installers/Latest/"); - - // Copy the shared host installers - CopyBlobs($"{Channel}/Installers/{SharedHostNugetVersion}/", $"{Channel}/Installers/Latest/"); - - PublishCoreHostPackagesToFeed(); - - // Generate the CLI and SDK Version text files + // Generate the SDK Version text files List versionFiles = new List() { "win.x86.version", "win.x64.version", "ubuntu.x64.version", "rhel.x64.version", "osx.x64.version", "debian.x64.version", "centos.x64.version" }; string cliVersion = Utils.GetCliVersionFileContent(c); - string sfxVersion = Utils.GetSharedFrameworkVersionFileContent(c); foreach (string version in versionFiles) { AzurePublisherTool.PublishStringToBlob($"{Channel}/dnvm/latest.{version}", cliVersion); - AzurePublisherTool.PublishStringToBlob($"{Channel}/dnvm/latest.sharedfx.{version}", sfxVersion); } } finally @@ -130,26 +117,13 @@ namespace Microsoft.DotNet.Cli.Build { string source = blob.Replace("/dotnet/", ""); string targetName = Path.GetFileName(blob) - .Replace(CliNuGetVersion, "latest") - .Replace(SharedFrameworkNugetVersion, "latest") - .Replace(SharedHostNugetVersion, "latest"); + .Replace(CliNuGetVersion, "latest"); + string target = $"{destinationFolder}{targetName}"; AzurePublisherTool.CopyBlob(source, target); } } - private static void PublishCoreHostPackagesToFeed() - { - var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}"; - - Directory.CreateDirectory(Dirs.PackagesNoRID); - AzurePublisherTool.DownloadFiles(hostBlob, ".nupkg", Dirs.PackagesNoRID); - - string nugetFeedUrl = EnvVars.EnsureVariable("NUGET_FEED_URL"); - string apiKey = EnvVars.EnsureVariable("NUGET_API_KEY"); - NuGetUtil.PushPackages(Dirs.PackagesNoRID, nugetFeedUrl, apiKey); - } - private static bool CheckIfAllBuildsHavePublished() { Dictionary badges = new Dictionary() @@ -198,29 +172,22 @@ namespace Microsoft.DotNet.Cli.Build nameof(PublishTargets.PublishInstallerFilesToAzure), nameof(PublishTargets.PublishArchivesToAzure), /*nameof(PublishTargets.PublishDebFilesToDebianRepo),*/ //https://github.com/dotnet/cli/issues/2973 - nameof(PublishTargets.PublishCoreHostPackages), nameof(PublishTargets.PublishCliVersionBadge))] public static BuildTargetResult PublishArtifacts(BuildTargetContext c) => c.Success(); [Target( - nameof(PublishTargets.PublishSharedHostInstallerFileToAzure), - nameof(PublishTargets.PublishSharedFrameworkInstallerFileToAzure), nameof(PublishTargets.PublishSdkInstallerFileToAzure), - nameof(PublishTargets.PublishCombinedFrameworkSDKHostInstallerFileToAzure), - nameof(PublishTargets.PublishCombinedFrameworkHostInstallerFileToAzure))] + nameof(PublishTargets.PublishCombinedFrameworkSDKHostInstallerFileToAzure))] public static BuildTargetResult PublishInstallerFilesToAzure(BuildTargetContext c) => c.Success(); [Target( - nameof(PublishTargets.PublishCombinedHostFrameworkArchiveToAzure), nameof(PublishTargets.PublishCombinedHostFrameworkSdkArchiveToAzure), nameof(PublishTargets.PublishCombinedFrameworkSDKArchiveToAzure), nameof(PublishTargets.PublishSDKSymbolsArchiveToAzure))] public static BuildTargetResult PublishArchivesToAzure(BuildTargetContext c) => c.Success(); [Target( - nameof(PublishSdkDebToDebianRepo), - nameof(PublishSharedFrameworkDebToDebianRepo), - nameof(PublishSharedHostDebToDebianRepo))] + nameof(PublishSdkDebToDebianRepo))] [BuildPlatforms(BuildPlatform.Ubuntu)] public static BuildTargetResult PublishDebFilesToDebianRepo(BuildTargetContext c) { @@ -235,49 +202,7 @@ namespace Microsoft.DotNet.Cli.Build AzurePublisherTool.PublishFile(versionBadgeBlob, versionBadge); return c.Success(); } - - [Target] - public static BuildTargetResult PublishCoreHostPackages(BuildTargetContext c) - { - foreach (var file in Directory.GetFiles(Dirs.CorehostLocalPackages, "*.nupkg")) - { - var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}/{Path.GetFileName(file)}"; - AzurePublisherTool.PublishFile(hostBlob, file); - Console.WriteLine($"Publishing package {hostBlob} to Azure."); - } - - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu, BuildPlatform.Windows)] - public static BuildTargetResult PublishSharedHostInstallerFileToAzure(BuildTargetContext c) - { - var version = SharedHostNugetVersion; - var installerFile = c.BuildContext.Get("SharedHostInstallerFile"); - - if (CurrentPlatform.Current == BuildPlatform.Windows) - { - installerFile = Path.ChangeExtension(installerFile, "msi"); - } - - AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version); - - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult PublishSharedFrameworkInstallerFileToAzure(BuildTargetContext c) - { - var version = SharedFrameworkNugetVersion; - var installerFile = c.BuildContext.Get("SharedFrameworkInstallerFile"); - - AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version); - - return c.Success(); - } - + [Target] [BuildPlatforms(BuildPlatform.Ubuntu)] public static BuildTargetResult PublishSdkInstallerFileToAzure(BuildTargetContext c) @@ -290,18 +215,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)] - public static BuildTargetResult PublishCombinedFrameworkHostInstallerFileToAzure(BuildTargetContext c) - { - var version = SharedFrameworkNugetVersion; - var installerFile = c.BuildContext.Get("CombinedFrameworkHostInstallerFile"); - - AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version); - - return c.Success(); - } - [Target] [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)] public static BuildTargetResult PublishCombinedFrameworkSDKHostInstallerFileToAzure(BuildTargetContext c) @@ -348,16 +261,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - public static BuildTargetResult PublishCombinedHostFrameworkArchiveToAzure(BuildTargetContext c) - { - var version = SharedFrameworkNugetVersion; - var archiveFile = c.BuildContext.Get("CombinedFrameworkHostCompressedFile"); - - AzurePublisherTool.PublishArchive(archiveFile, Channel, version); - return c.Success(); - } - [Target] [BuildPlatforms(BuildPlatform.Ubuntu)] public static BuildTargetResult PublishSdkDebToDebianRepo(BuildTargetContext c) @@ -376,42 +279,6 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult PublishSharedFrameworkDebToDebianRepo(BuildTargetContext c) - { - var version = SharedFrameworkNugetVersion; - - var packageName = Monikers.GetDebianSharedFrameworkPackageName(c); - var installerFile = c.BuildContext.Get("SharedFrameworkInstallerFile"); - var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version); - - DebRepoPublisherTool.PublishDebFileToDebianRepo( - packageName, - version, - uploadUrl); - - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult PublishSharedHostDebToDebianRepo(BuildTargetContext c) - { - var version = SharedHostNugetVersion; - - var packageName = Monikers.GetDebianSharedHostPackageName(c); - var installerFile = c.BuildContext.Get("SharedHostInstallerFile"); - var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version); - - DebRepoPublisherTool.PublishDebFileToDebianRepo( - packageName, - version, - uploadUrl); - - return c.Success(); - } - [Target] [Environment("DOCKER_HUB_REPO")] [Environment("DOCKER_HUB_TRIGGER_TOKEN")] diff --git a/build_projects/dotnet-cli-build/TestTargets.cs b/build_projects/dotnet-cli-build/TestTargets.cs index 0d091d0bc..c130cf876 100644 --- a/build_projects/dotnet-cli-build/TestTargets.cs +++ b/build_projects/dotnet-cli-build/TestTargets.cs @@ -17,30 +17,14 @@ namespace Microsoft.DotNet.Cli.Build public static readonly string[] TestProjects = new[] { - "ArgumentForwardingTests", - "crossgen.Tests", - "EndToEnd", - "dotnet.Tests", - "dotnet-build.Tests", - "dotnet-compile.Tests", - "dotnet-compile.UnitTests", - "dotnet-compile-fsc.Tests", "dotnet-new.Tests", - "dotnet-pack.Tests", - "dotnet-projectmodel-server.Tests", - "dotnet-publish.Tests", - "dotnet-resgen.Tests", - "dotnet-run.Tests", - "dotnet-run.UnitTests", - "dotnet-test.Tests", - "dotnet-test.UnitTests", // TODO: https://github.com/dotnet/cli/issues/3216 //"Kestrel.Tests", - "Microsoft.DotNet.Cli.Utils.Tests", - "Microsoft.DotNet.Compiler.Common.Tests", - "Microsoft.DotNet.ProjectModel.Tests", - "Microsoft.Extensions.DependencyModel.Tests", - "Performance" + //"Microsoft.DotNet.Cli.Utils.Tests", + //"Microsoft.DotNet.Compiler.Common.Tests", + // "Microsoft.DotNet.ProjectModel.Tests", + // "Microsoft.Extensions.DependencyModel.Tests", + // "Performance" }; public static readonly string[] WindowsTestProjects = new[] @@ -83,9 +67,7 @@ namespace Microsoft.DotNet.Cli.Build CleanNuGetTempCache(); var dotnet = DotNetCli.Stage2; - dotnet.Restore("--verbosity", "verbose", - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) + dotnet.Restore("--verbosity", "verbose") .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages")) .Execute() .EnsureSuccessful(); @@ -104,9 +86,7 @@ namespace Microsoft.DotNet.Cli.Build var dotnet = DotNetCli.Stage2; dotnet.Restore( "--verbosity", "verbose", - "--fallbacksource", Dirs.TestPackages, - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) + "--fallbacksource", Dirs.TestPackages) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) .Execute() .EnsureSuccessful(); @@ -114,9 +94,7 @@ namespace Microsoft.DotNet.Cli.Build // The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output dotnet.Restore( "--verbosity", "verbose", - "--infer-runtimes", - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) + "--infer-runtimes") .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects")) .Execute(); @@ -137,9 +115,7 @@ namespace Microsoft.DotNet.Cli.Build dotnet.Restore("--verbosity", "verbose", "--infer-runtimes", - "--fallbacksource", Dirs.TestPackages, - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) + "--fallbacksource", Dirs.TestPackages) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects")) .Execute().EnsureSuccessful(); @@ -267,9 +243,7 @@ namespace Microsoft.DotNet.Cli.Build CleanNuGetTempCache(); DotNetCli.Stage2.Restore("--verbosity", "verbose", - "--fallbacksource", Dirs.TestPackages, - "--fallbacksource", Dirs.CorehostLocalPackages, - "--fallbacksource", Dirs.CorehostDummyPackages) + "--fallbacksource", Dirs.TestPackages) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test")) .Execute() .EnsureSuccessful(); diff --git a/build_projects/dotnet-host-build/CompileTargets.cs b/build_projects/dotnet-host-build/CompileTargets.cs deleted file mode 100644 index 1f7e0be2a..000000000 --- a/build_projects/dotnet-host-build/CompileTargets.cs +++ /dev/null @@ -1,239 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.DotNet.InternalAbstractions; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Microsoft.DotNet.Cli.Build; -using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; -using static Microsoft.DotNet.Cli.Build.FS; - -namespace Microsoft.DotNet.Host.Build -{ - public class CompileTargets - { - public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86; - - public static string HostPackagePlatformRid => HostPackageSupportedRids[ - (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) - ? $"win7-{RuntimeEnvironment.RuntimeArchitecture}" - : RuntimeEnvironment.GetRuntimeIdentifier()]; - - public static readonly Dictionary HostPackageSupportedRids = new Dictionary() - { - // Key: Current platform RID. Value: The actual publishable (non-dummy) package name produced by the build system for this RID. - { "win7-x64", "win7-x64" }, - { "win7-x86", "win7-x86" }, - { "osx.10.10-x64", "osx.10.10-x64" }, - { "osx.10.11-x64", "osx.10.10-x64" }, - { "ubuntu.14.04-x64", "ubuntu.14.04-x64" }, - { "centos.7-x64", "rhel.7-x64" }, - { "rhel.7-x64", "rhel.7-x64" }, - { "rhel.7.2-x64", "rhel.7-x64" }, - { "debian.8-x64", "debian.8-x64" } - }; - - - private static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}"; - private static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"; - private static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"; - - [Target(nameof(PrepareTargets.Init), - nameof(CompileCoreHost), - nameof(PackagePkgProjects))] - public static BuildTargetResult Compile(BuildTargetContext c) - { - return c.Success(); - } - - // We need to generate stub host packages so we can restore our standalone test assets against the metapackage - // we built earlier in the build - // https://github.com/dotnet/cli/issues/2438 - [Target] - public static BuildTargetResult GenerateStubHostPackages(BuildTargetContext c) - { - var hostVersion = c.BuildContext.Get("HostVersion"); - var currentRid = HostPackagePlatformRid; - - var stubPackageBuilder = new StubPackageBuilder(DotNetCli.Stage0, Dirs.Intermediate, Dirs.CorehostDummyPackages); - - foreach (var hostPackage in hostVersion.LatestHostPackages) - { - foreach (var rid in HostPackageSupportedRids.Values.Distinct()) - { - if (!rid.Equals(currentRid)) - { - var basePackageId = hostPackage.Key; - var packageVersion = hostPackage.Value; - - var packageId = $"runtime.{rid}.{basePackageId}"; - - stubPackageBuilder.GeneratePackage(packageId, packageVersion); - } - } - } - return c.Success(); - } - - [Target] - public static BuildTargetResult CompileCoreHost(BuildTargetContext c) - { - var hostVersion = c.BuildContext.Get("HostVersion"); - - // Generate build files - var cmakeOut = Path.Combine(Dirs.CorehostLatest, "cmake"); - - Rmdir(cmakeOut); - Mkdirp(cmakeOut); - - var configuration = c.BuildContext.Get("Configuration"); - - // Run the build - string rid = DotNetCli.Stage0.GetRuntimeId(); - string corehostSrcDir = Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost"); - string commitHash = c.BuildContext.Get("CommitHash"); - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - // Why does Windows directly call cmake but Linux/Mac calls "build.sh" in the corehost dir? - // See the comment in "src/corehost/build.sh" for details. It doesn't work for some reason. - var visualStudio = IsWinx86 ? "Visual Studio 14 2015" : "Visual Studio 14 2015 Win64"; - var archMacro = IsWinx86 ? "-DCLI_CMAKE_PLATFORM_ARCH_I386=1" : "-DCLI_CMAKE_PLATFORM_ARCH_AMD64=1"; - var ridMacro = $"-DCLI_CMAKE_RUNTIME_ID:STRING={rid}"; - var arch = IsWinx86 ? "x86" : "x64"; - var baseSupportedRid = $"win7-{arch}"; - var cmakeHostVer = $"-DCLI_CMAKE_HOST_VER:STRING={hostVersion.LatestHostVersion}"; - var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={hostVersion.LatestHostPolicyVersion}"; - var cmakeHostFxrVer = $"-DCLI_CMAKE_HOST_FXR_VER:STRING={hostVersion.LatestHostFxrVersion}"; - var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}"; - var cmakeCommitHash = $"-DCLI_CMAKE_COMMIT_HASH:STRING={commitHash}"; - - ExecIn(cmakeOut, "cmake", - corehostSrcDir, - archMacro, - ridMacro, - cmakeHostVer, - cmakeHostFxrVer, - cmakeHostPolicyVer, - cmakeBaseRid, - cmakeCommitHash, - "-G", - visualStudio); - - var pf32 = RuntimeInformation.OSArchitecture == Architecture.X64 ? - Environment.GetEnvironmentVariable("ProgramFiles(x86)") : - Environment.GetEnvironmentVariable("ProgramFiles"); - - if (configuration.Equals("Release")) - { - // Cmake calls it "RelWithDebInfo" in the generated MSBuild - configuration = "RelWithDebInfo"; - } - - Exec(Path.Combine(pf32, "MSBuild", "14.0", "Bin", "MSBuild.exe"), - Path.Combine(cmakeOut, "ALL_BUILD.vcxproj"), - $"/p:Configuration={configuration}"); - - // Copy the output out - File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.exe"), Path.Combine(Dirs.CorehostLatest, "dotnet.exe"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.pdb"), Path.Combine(Dirs.CorehostLatest, "dotnet.pdb"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.dll"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.dll"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.pdb"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.pdb"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.dll"), Path.Combine(Dirs.CorehostLatest, "hostfxr.dll"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.pdb"), Path.Combine(Dirs.CorehostLatest, "hostfxr.pdb"), overwrite: true); - } - else - { - ExecIn(cmakeOut, Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost", "build.sh"), - "--arch", - "x64", - "--hostver", - hostVersion.LatestHostVersion, - "--fxrver", - hostVersion.LatestHostFxrVersion, - "--policyver", - hostVersion.LatestHostPolicyVersion, - "--rid", - rid, - "--commithash", - commitHash); - - // Copy the output out - File.Copy(Path.Combine(cmakeOut, "cli", "dotnet"), Path.Combine(Dirs.CorehostLatest, "dotnet"), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "dll", HostPolicyBaseName), Path.Combine(Dirs.CorehostLatest, HostPolicyBaseName), overwrite: true); - File.Copy(Path.Combine(cmakeOut, "cli", "fxr", DotnetHostFxrBaseName), Path.Combine(Dirs.CorehostLatest, DotnetHostFxrBaseName), overwrite: true); - } - return c.Success(); - } - - [Target(nameof(CompileTargets.GenerateStubHostPackages))] - public static BuildTargetResult PackagePkgProjects(BuildTargetContext c) - { - var arch = IsWinx86 ? "x86" : "x64"; - - var hostVersion = c.BuildContext.Get("HostVersion"); - var hostNugetversion = hostVersion.LatestHostVersion; - var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{hostNugetversion}{Environment.NewLine}"; - var pkgDir = Path.Combine(c.BuildContext.BuildDirectory, "pkg"); - File.WriteAllText(Path.Combine(pkgDir, "version.txt"), content); - - if (CurrentPlatform.IsWindows) - { - Command.Create(Path.Combine(pkgDir, "pack.cmd")) - // Workaround to arg escaping adding backslashes for arguments to .cmd scripts. - .Environment("__WorkaroundCliCoreHostBuildArch", arch) - .Environment("__WorkaroundCliCoreHostBinDir", Dirs.CorehostLatest) - .Environment("__WorkaroundCliCoreHostPolicyVer", hostVersion.LatestHostPolicyVersionNoSuffix) - .Environment("__WorkaroundCliCoreHostFxrVer", hostVersion.LatestHostFxrVersionNoSuffix) - .Environment("__WorkaroundCliCoreHostVer", hostVersion.LatestHostVersionNoSuffix) - .Environment("__WorkaroundCliCoreHostBuildMajor", hostVersion.LatestHostBuildMajor) - .Environment("__WorkaroundCliCoreHostBuildMinor", hostVersion.LatestHostBuildMinor) - .Environment("__WorkaroundCliCoreHostVersionTag", hostVersion.LatestHostPrerelease) - .ForwardStdOut() - .ForwardStdErr() - .Execute() - .EnsureSuccessful(); - } - else - { - Exec(Path.Combine(pkgDir, "pack.sh"), - "--arch", - "x64", - "--hostbindir", - Dirs.CorehostLatest, - "--policyver", - hostVersion.LatestHostPolicyVersionNoSuffix, - "--fxrver", - hostVersion.LatestHostFxrVersionNoSuffix, - "--hostver", - hostVersion.LatestHostVersionNoSuffix, - "--build-major", - hostVersion.LatestHostBuildMajor, - "--build-minor", - hostVersion.LatestHostBuildMinor, - "--vertag", - hostVersion.LatestHostPrerelease); - } - foreach (var file in Directory.GetFiles(Path.Combine(pkgDir, "bin", "packages"), "*.nupkg")) - { - var fileName = Path.GetFileName(file); - File.Copy(file, Path.Combine(Dirs.CorehostLocalPackages, fileName), true); - - Console.WriteLine($"Copying package {fileName} to artifacts directory {Dirs.CorehostLocalPackages}."); - } - foreach (var item in hostVersion.LatestHostPackages) - { - var fileFilter = $"runtime.{HostPackagePlatformRid}.{item.Key}.{item.Value}.nupkg"; - if (Directory.GetFiles(Dirs.CorehostLocalPackages, fileFilter).Length == 0) - { - throw new BuildFailureException($"Nupkg for {fileFilter} was not created."); - } - } - return c.Success(); - } - } -} diff --git a/build_projects/dotnet-host-build/PrepareTargets.cs b/build_projects/dotnet-host-build/PrepareTargets.cs deleted file mode 100644 index fa5f5d44e..000000000 --- a/build_projects/dotnet-host-build/PrepareTargets.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.DotNet.InternalAbstractions; -using Newtonsoft.Json.Linq; -using Microsoft.DotNet.Cli.Build; -using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; -using static Microsoft.DotNet.Cli.Build.FS; -using static Microsoft.DotNet.Cli.Build.Utils; - -namespace Microsoft.DotNet.Host.Build -{ - public class PrepareTargets - { - [Target(nameof(Init))] - public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success(); - - [Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))] - public static BuildTargetResult CheckPrereqs(BuildTargetContext c) => c.Success(); - - [Target(nameof(CheckCoreclrPlatformDependencies))] - public static BuildTargetResult CheckPlatformDependencies(BuildTargetContext c) => c.Success(); - - [Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))] - public static BuildTargetResult CheckCoreclrPlatformDependencies(BuildTargetContext c) => c.Success(); - - // All major targets will depend on this in order to ensure variables are set up right if they are run independently - [Target(nameof(GenerateVersions), nameof(CheckPrereqs), nameof(LocateStage0), nameof(ExpectedBuildArtifacts))] - public static BuildTargetResult Init(BuildTargetContext c) - { - var configEnv = Environment.GetEnvironmentVariable("CONFIGURATION"); - - if (string.IsNullOrEmpty(configEnv)) - { - configEnv = "Debug"; - } - - c.BuildContext["Configuration"] = configEnv; - c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL"); - - c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}"); - c.Info("Build Environment:"); - c.Info($" Operating System: {RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}"); - c.Info($" Platform: {RuntimeEnvironment.OperatingSystemPlatform}"); - - return c.Success(); - } - - [Target] - public static BuildTargetResult GenerateVersions(BuildTargetContext c) - { - var commitCount = GitUtils.GetCommitCount(); - var commitHash = GitUtils.GetCommitHash(); - - var hostVersion = new HostVersion() - { - CommitCount = commitCount - }; - - c.BuildContext["HostVersion"] = hostVersion; - c.BuildContext["CommitHash"] = commitHash; - - c.Info($"Building Version: {hostVersion.LatestHostVersionNoSuffix} (NuGet Packages: {hostVersion.LatestHostVersion})"); - c.Info($"From Commit: {commitHash}"); - - return c.Success(); - } - - [Target] - public static BuildTargetResult LocateStage0(BuildTargetContext c) - { - // We should have been run in the repo root, so locate the stage 0 relative to current directory - var stage0 = DotNetCli.Stage0.BinPath; - - if (!Directory.Exists(stage0)) - { - return c.Failed($"Stage 0 directory does not exist: {stage0}"); - } - - // Identify the version - string versionFile = Directory.GetFiles(stage0, ".version", SearchOption.AllDirectories).FirstOrDefault(); - - if (string.IsNullOrEmpty(versionFile)) - { - throw new Exception($"'.version' file not found in '{stage0}' folder"); - } - - var version = File.ReadAllLines(versionFile); - c.Info($"Using Stage 0 Version: {version[1]}"); - - return c.Success(); - } - - [Target] - public static BuildTargetResult ExpectedBuildArtifacts(BuildTargetContext c) - { - var config = Environment.GetEnvironmentVariable("CONFIGURATION"); - var versionBadgeName = $"{CurrentPlatform.Current}_{CurrentArchitecture.Current}_{config}_version_badge.svg"; - c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName); - - var hostVersion = c.BuildContext.Get("HostVersion").LockedHostVersion; - return c.Success(); - } - - [Target] - [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult CheckUbuntuCoreclrAndCoreFxDependencies(BuildTargetContext c) - { - var errorMessageBuilder = new StringBuilder(); - var stage0 = DotNetCli.Stage0.BinPath; - - foreach (var package in PackageDependencies.UbuntuCoreclrAndCoreFxDependencies) - { - if (!AptDependencyUtility.PackageIsInstalled(package)) - { - errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing."); - errorMessageBuilder.Append(Environment.NewLine); - errorMessageBuilder.Append($"-> install with apt-get install {package}"); - errorMessageBuilder.Append(Environment.NewLine); - } - } - - if (errorMessageBuilder.Length == 0) - { - return c.Success(); - } - else - { - return c.Failed(errorMessageBuilder.ToString()); - } - } - - [Target] - [BuildPlatforms(BuildPlatform.CentOS)] - public static BuildTargetResult CheckCentOSCoreclrAndCoreFxDependencies(BuildTargetContext c) - { - var errorMessageBuilder = new StringBuilder(); - - foreach (var package in PackageDependencies.CentosCoreclrAndCoreFxDependencies) - { - if (!YumDependencyUtility.PackageIsInstalled(package)) - { - errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing."); - errorMessageBuilder.Append(Environment.NewLine); - errorMessageBuilder.Append($"-> install with yum install {package}"); - errorMessageBuilder.Append(Environment.NewLine); - } - } - - if (errorMessageBuilder.Length == 0) - { - return c.Success(); - } - else - { - return c.Failed(errorMessageBuilder.ToString()); - } - } - - [Target] - public static BuildTargetResult CheckPrereqCmakePresent(BuildTargetContext c) - { - try - { - Command.Create("cmake", "--version") - .CaptureStdOut() - .CaptureStdErr() - .Execute(); - } - catch (Exception ex) - { - string message = $@"Error running cmake: {ex.Message} -cmake is required to build the native host 'corehost'"; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - message += Environment.NewLine + "Download it from https://www.cmake.org"; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - message += Environment.NewLine + "Ubuntu: 'sudo apt-get install cmake'"; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - message += Environment.NewLine + "OS X w/Homebrew: 'brew install cmake'"; - } - return c.Failed(message); - } - - return c.Success(); - } - } -} diff --git a/build_projects/dotnet-host-build/Program.cs b/build_projects/dotnet-host-build/Program.cs deleted file mode 100644 index 129531b13..000000000 --- a/build_projects/dotnet-host-build/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.DotNet.Cli.Build.Framework; - -namespace Microsoft.DotNet.Host.Build -{ - public class Program - { - public static int Main(string[] args) - { - DebugHelper.HandleDebugSwitch(ref args); - - return BuildSetup.Create(".NET Core Host") - .UseStandardGoals() - .UseAllTargetsFromAssembly() - .Run(args); - } - } -} diff --git a/build_projects/dotnet-host-build/StubPackageBuilder.cs b/build_projects/dotnet-host-build/StubPackageBuilder.cs deleted file mode 100644 index 7ba94783f..000000000 --- a/build_projects/dotnet-host-build/StubPackageBuilder.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.IO; -using System.Text; -using Microsoft.DotNet.Cli.Build; - -namespace Microsoft.DotNet.Host.Build -{ - public class StubPackageBuilder - { - private DotNetCli _dotnet; - private string _intermediateDirectory; - private string _outputDirectory; - - private bool _dummyFileCreated; - - public StubPackageBuilder(DotNetCli dotnet, string intermediateDirectory, string outputDirectory) - { - _dotnet = dotnet; - _intermediateDirectory = intermediateDirectory; - _outputDirectory = outputDirectory; - } - - public void GeneratePackage(string packageId, string version) - { - if (!_dummyFileCreated) - { - CreateDummyFile(_dotnet, _intermediateDirectory); - } - - CreateStubPackage(_dotnet, packageId, version, _intermediateDirectory, _outputDirectory); - } - - private void CreateDummyFile(DotNetCli dotnet, string intermediateDirectory) - { - var dummyTxt = "dummy text"; - - var tempPjDirectory = Path.Combine(intermediateDirectory, "dummyNuGetPackageIntermediate"); - FS.Rmdir(tempPjDirectory); - - Directory.CreateDirectory(tempPjDirectory); - - var dummyTextFile = Path.Combine(tempPjDirectory, "dummy.txt"); - - File.WriteAllText(dummyTextFile, dummyTxt); - - _dummyFileCreated = true; - } - - private static void CreateStubPackage(DotNetCli dotnet, - string packageId, - string version, - string intermediateDirectory, - string outputDirectory) - { - var projectJson = new StringBuilder(); - projectJson.Append("{"); - projectJson.Append($" \"version\": \"{version}\","); - projectJson.Append($" \"name\": \"{packageId}\","); - projectJson.Append(" \"packOptions\": { \"files\": { \"include\": \"dummy.txt\" } },"); - projectJson.Append(" \"frameworks\": { \"netcoreapp1.0\": { } },"); - projectJson.Append("}"); - - var tempPjDirectory = Path.Combine(intermediateDirectory, "dummyNuGetPackageIntermediate"); - var tempPjFile = Path.Combine(tempPjDirectory, "project.json"); - - File.WriteAllText(tempPjFile, projectJson.ToString()); - - dotnet.Pack( - tempPjFile, "--no-build", - "--output", outputDirectory) - .WorkingDirectory(tempPjDirectory) - .Execute() - .EnsureSuccessful(); - } - } -} diff --git a/build_projects/dotnet-host-build/build.ps1 b/build_projects/dotnet-host-build/build.ps1 deleted file mode 100644 index 4e6ae8aa6..000000000 --- a/build_projects/dotnet-host-build/build.ps1 +++ /dev/null @@ -1,81 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -param( - [string]$Configuration="Debug", - [string]$Architecture="x64", - [string[]]$Targets=@("Default"), - [switch]$NoPackage, - [switch]$Help) - -if($Help) -{ - Write-Host "Usage: .\build.ps1 [-Configuration ] [-NoPackage] [-Help] [-Targets ]" - Write-Host "" - Write-Host "Options:" - Write-Host " -Configuration Build the specified Configuration (Debug or Release, default: Debug)" - Write-Host " -Architecture Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)" - Write-Host " -Targets Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)" - Write-Host " -NoPackage Skip packaging targets" - Write-Host " -Help Display this help message" - exit 0 -} - -$env:CONFIGURATION = $Configuration; -$RepoRoot = "$PSScriptRoot\..\.." - -if($NoPackage) -{ - $env:DOTNET_BUILD_SKIP_PACKAGING=1 -} -else -{ - $env:DOTNET_BUILD_SKIP_PACKAGING=0 -} - -# Load Branch Info -cat "$RepoRoot\branchinfo.txt" | ForEach-Object { - if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) { - $splat = $_.Split([char[]]@("="), 2) - Set-Content "env:\$($splat[0])" -Value $splat[1] - } -} - -# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot -if (!$env:DOTNET_INSTALL_DIR) -{ - $env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\Windows\$Architecture" -} - -if (!(Test-Path $env:DOTNET_INSTALL_DIR)) -{ - mkdir $env:DOTNET_INSTALL_DIR | Out-Null -} - -# Install a stage 0 -Write-Host "Installing .NET Core CLI Stage 0 from branchinfo channel" -& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel $env:CHANNEL -Architecture $Architecture -Verbose -if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } - -# Put the stage0 on the path -$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" - -# Restore the build scripts -Write-Host "Restoring Build Script projects..." -pushd "$PSScriptRoot\.." -dotnet restore --infer-runtimes -if($LASTEXITCODE -ne 0) { throw "Failed to restore" } -popd - -# Publish the builder -Write-Host "Compiling Build Scripts..." -dotnet publish "$PSScriptRoot" -o "$PSScriptRoot\bin" --framework netcoreapp1.0 -if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" } - -# Run the builder -Write-Host "Invoking Build Scripts..." -Write-Host " Configuration: $env:CONFIGURATION" -& "$PSScriptRoot\bin\dotnet-host-build.exe" @Targets -if($LASTEXITCODE -ne 0) { throw "Build failed" } diff --git a/build_projects/dotnet-host-build/build.sh b/build_projects/dotnet-host-build/build.sh deleted file mode 100755 index f214f6c27..000000000 --- a/build_projects/dotnet-host-build/build.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -set -e - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -OLDPATH="$PATH" - -REPOROOT="$DIR/../.." -source "$REPOROOT/scripts/common/_prettyprint.sh" - -while [[ $# > 0 ]]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -c|--configuration) - export CONFIGURATION=$2 - shift - ;; - --targets) - IFS=',' read -r -a targets <<< $2 - shift - ;; - --nopackage) - export DOTNET_BUILD_SKIP_PACKAGING=1 - ;; - --skip-prereqs) - # Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems - export DOTNET_INSTALL_SKIP_PREREQS=1 - ;; - --help) - echo "Usage: $0 [--configuration ] [--skip-prereqs] [--nopackage] [--docker ] [--help] [--targets ]" - echo "" - echo "Options:" - echo " --configuration Build the specified Configuration (Debug or Release, default: Debug)" - echo " --targets Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)" - echo " --nopackage Skip packaging targets" - echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install" - echo " --docker Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME" - echo " --help Display this help message" - echo " The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)" - exit 0 - ;; - *) - break - ;; - esac - - shift -done - -# Set up the environment to be used for building with clang. -if which "clang-3.5" > /dev/null 2>&1; then - export CC="$(which clang-3.5)" - export CXX="$(which clang++-3.5)" -elif which "clang-3.6" > /dev/null 2>&1; then - export CC="$(which clang-3.6)" - export CXX="$(which clang++-3.6)" -elif which clang > /dev/null 2>&1; then - export CC="$(which clang)" - export CXX="$(which clang++)" -else - error "Unable to find Clang Compiler" - error "Install clang-3.5 or clang3.6" - exit 1 -fi - -# Load Branch Info -while read line; do - if [[ $line != \#* ]]; then - IFS='=' read -ra splat <<< "$line" - export ${splat[0]}="${splat[1]}" - fi -done < "$REPOROOT/branchinfo.txt" - -# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot -[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$(uname) -[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR - -$REPOROOT/scripts/obtain/dotnet-install.sh --channel $CHANNEL --verbose - -# Put stage 0 on the PATH (for this shell only) -PATH="$DOTNET_INSTALL_DIR:$PATH" - -# Increases the file descriptors limit for this bash. It prevents an issue we were hitting during restore -FILE_DESCRIPTOR_LIMIT=$( ulimit -n ) -if [ $FILE_DESCRIPTOR_LIMIT -lt 1024 ] -then - echo "Increasing file description limit to 1024" - ulimit -n 1024 -fi - -# Restore the build scripts -echo "Restoring Build Script projects..." -( - cd "$DIR/.." - dotnet restore --infer-runtimes -) - -# Build the builder -echo "Compiling Build Scripts..." -dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0 - -export PATH="$OLDPATH" -# Run the builder -echo "Invoking Build Scripts..." -echo "Configuration: $CONFIGURATION" - -$DIR/bin/dotnet-host-build ${targets[@]} -exit $? diff --git a/build_projects/dotnet-host-build/dotnet-host-build.xproj b/build_projects/dotnet-host-build/dotnet-host-build.xproj deleted file mode 100644 index 253ab86b9..000000000 --- a/build_projects/dotnet-host-build/dotnet-host-build.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 1dbb7542-0345-4f4b-a84b-3b00b185d416 - Microsoft.DotNet.Cli.Build - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin - - - 2.0 - - - \ No newline at end of file diff --git a/build_projects/dotnet-host-build/project.json b/build_projects/dotnet-host-build/project.json deleted file mode 100644 index eabf5c126..000000000 --- a/build_projects/dotnet-host-build/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Build scripts for dotnet-cli", - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "NETStandard.Library": "1.5.0-rc3-24123-01", - "Microsoft.NETCore.Runtime": "1.0.2-rc3-24123-01", - "Microsoft.CSharp": "4.0.1-rc3-24123-01", - "System.Dynamic.Runtime": "4.0.11-rc3-24123-01", - "System.Reflection.Metadata": "1.3.0-rc3-24123-01", - "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", - "System.Xml.XmlSerializer": "4.0.11-rc3-24123-01", - "WindowsAzure.Storage": "6.2.2-preview", - "Microsoft.DotNet.Cli.Build.Framework": { - "target": "project" - }, - "shared-build-targets-utils": { - "target": "project" - } - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "runtimes": { - "win7-x64": {}, - "win7-x86": {}, - "osx.10.11-x64": {}, - "ubuntu.14.04-x64": {}, - "centos.7-x64": {}, - "rhel.7.2-x64": {}, - "debian.8-x64": {} - } -} diff --git a/build_projects/shared-build-targets-utils/DependencyVersions.cs b/build_projects/shared-build-targets-utils/DependencyVersions.cs new file mode 100644 index 000000000..dc87c108d --- /dev/null +++ b/build_projects/shared-build-targets-utils/DependencyVersions.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.DotNet.Cli.Build +{ + public class DependencyVersions + { + public static readonly string CoreCLRVersion = "1.0.2-rc3-24123-01"; + + public static readonly string SharedFrameworkVersion = "1.0.0-rc3-004306"; + public static readonly string SharedHostVersion = "1.0.1-rc3-004306-00"; + + public static readonly string SharedFrameworkChannel = "preview"; + public static readonly string SharedHostChannel = "preview"; + } +} diff --git a/build_projects/shared-build-targets-utils/HostArtifactNames.cs b/build_projects/shared-build-targets-utils/HostArtifactNames.cs new file mode 100644 index 000000000..c0e9a3cb1 --- /dev/null +++ b/build_projects/shared-build-targets-utils/HostArtifactNames.cs @@ -0,0 +1,15 @@ +using Microsoft.DotNet.Cli.Build.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.DotNet.Cli.Build +{ + public class HostArtifactNames + { + public static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}"; + public static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"; + public static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"; + } +} diff --git a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs index c73ac85f7..500e3d959 100644 --- a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs +++ b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs @@ -9,6 +9,7 @@ using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; +using System.Threading.Tasks; namespace Microsoft.DotNet.Cli.Build { @@ -22,7 +23,7 @@ namespace Microsoft.DotNet.Cli.Build public AzurePublisher() { - _connectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING").Trim('"'); + _connectionString = EnvVars.EnsureVariable("CONNECTION_STRING").Trim('"'); _blobContainer = GetDotnetBlobContainer(_connectionString); } @@ -173,22 +174,38 @@ namespace Microsoft.DotNet.Cli.Build return $"{s_dotnetBlobRootUrl}{CalculateInstallerBlob(installerFile, channel, version)}"; } - public string CalculateInstallerBlob(string installerFile, string channel, string version) + public static string CalculateInstallerBlob(string installerFile, string channel, string version) { return $"{channel}/Installers/{version}/{Path.GetFileName(installerFile)}"; } - public string CalculateArchiveUploadUrl(string archiveFile, string channel, string version) - { - return $"{s_dotnetBlobRootUrl}{CalculateArchiveBlob(archiveFile, channel, version)}"; - } - - public string CalculateArchiveBlob(string archiveFile, string channel, string version) + public static string CalculateArchiveBlob(string archiveFile, string channel, string version) { return $"{channel}/Binaries/{version}/{Path.GetFileName(archiveFile)}"; } - public void DownloadFiles(string blobVirtualDirectory, string fileExtension, string downloadPath) + public static async Task DownloadFile(string blobFilePath, string localDownloadPath) + { + var blobUrl = $"{s_dotnetBlobRootUrl}{blobFilePath}"; + + using (var client = new HttpClient()) + { + var request = new HttpRequestMessage(HttpMethod.Get, blobUrl); + var sendTask = client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + var response = sendTask.Result.EnsureSuccessStatusCode(); + + var httpStream = await response.Content.ReadAsStreamAsync(); + + using (var fileStream = File.Create(localDownloadPath)) + using (var reader = new StreamReader(httpStream)) + { + httpStream.CopyTo(fileStream); + fileStream.Flush(); + } + } + } + + public void DownloadFilesWithExtension(string blobVirtualDirectory, string fileExtension, string localDownloadPath) { CloudBlobDirectory blobDir = _blobContainer.GetDirectoryReference(blobVirtualDirectory); BlobContinuationToken continuationToken = new BlobContinuationToken(); @@ -199,7 +216,7 @@ namespace Microsoft.DotNet.Cli.Build { if (Path.GetExtension(blobFile.Uri.AbsoluteUri) == fileExtension) { - string localBlobFile = Path.Combine(downloadPath, Path.GetFileName(blobFile.Uri.AbsoluteUri)); + string localBlobFile = Path.Combine(localDownloadPath, Path.GetFileName(blobFile.Uri.AbsoluteUri)); Console.WriteLine($"Downloading {blobFile.Uri.AbsoluteUri} to {localBlobFile}..."); blobFile.DownloadToFileAsync(localBlobFile, FileMode.Create).Wait(); } diff --git a/build_projects/shared-build-targets-utils/Utils/Crossgen.cs b/build_projects/shared-build-targets-utils/Utils/Crossgen.cs index 1fc74481a..8b9d3290b 100644 --- a/build_projects/shared-build-targets-utils/Utils/Crossgen.cs +++ b/build_projects/shared-build-targets-utils/Utils/Crossgen.cs @@ -110,17 +110,18 @@ namespace Microsoft.DotNet.Cli.Build return rid; } - public void CrossgenDirectory(BuildTargetContext c, string pathToAssemblies) + public void CrossgenDirectory(string sharedFxPath, string pathToAssemblies) { // Check if we need to skip crossgen if (string.Equals(Environment.GetEnvironmentVariable("DISABLE_CROSSGEN"), "1")) { - c.Warn("Skipping crossgen for because DISABLE_CROSSGEN is set to 1"); + var originalColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("Skipping crossgen for because DISABLE_CROSSGEN is set to 1"); + Console.ForegroundColor = originalColor; return; } - string sharedFxPath = c.BuildContext.Get("SharedFrameworkPath"); - // HACK // The input directory can be a portable FAT app (example the CLI itself). // In that case there can be RID specific managed dependencies which are not right next to the app binary (example System.Diagnostics.TraceSource). diff --git a/build_projects/shared-build-targets-utils/Utils/Dirs.cs b/build_projects/shared-build-targets-utils/Utils/Dirs.cs index 0b17603f5..ee65f1d49 100644 --- a/build_projects/shared-build-targets-utils/Utils/Dirs.cs +++ b/build_projects/shared-build-targets-utils/Utils/Dirs.cs @@ -27,6 +27,7 @@ namespace Microsoft.DotNet.Cli.Build public static readonly string CorehostLocked = Path.Combine(Output, "corehost", "locked"); public static readonly string CorehostLocalPackages = Path.Combine(Output, "corehost"); public static readonly string CorehostDummyPackages = Path.Combine(Output, "corehostdummypackages"); + public static readonly string SharedFrameworkPublish = Path.Combine(Intermediate, "sharedFrameworkPublish"); public static readonly string TestOutput = Path.Combine(Output, "tests"); public static readonly string TestArtifacts = Path.Combine(TestOutput, "artifacts"); public static readonly string TestPackages = Path.Combine(TestOutput, "packages"); diff --git a/build_projects/shared-build-targets-utils/Utils/Monikers.cs b/build_projects/shared-build-targets-utils/Utils/Monikers.cs index 8dd2c04ba..58a504745 100644 --- a/build_projects/shared-build-targets-utils/Utils/Monikers.cs +++ b/build_projects/shared-build-targets-utils/Utils/Monikers.cs @@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build public static string GetDebianSharedFrameworkPackageName(BuildTargetContext c) { - var sharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + var sharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion; return $"dotnet-sharedframework-{SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower(); } diff --git a/build_projects/shared-build-targets-utils/Utils/PublishMutationUtilties.cs b/build_projects/shared-build-targets-utils/Utils/PublishMutationUtilties.cs new file mode 100644 index 000000000..d54a82bdf --- /dev/null +++ b/build_projects/shared-build-targets-utils/Utils/PublishMutationUtilties.cs @@ -0,0 +1,81 @@ +using Microsoft.DotNet.Cli.Build.Framework; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.DotNet.Cli.Build +{ + public class PublishMutationUtilties + { + public static void CleanPublishOutput( + string path, + string name, + bool deleteRuntimeConfigJson=false, + bool deleteDepsJson=false) + { + File.Delete(Path.Combine(path, $"{name}{Constants.ExeSuffix}")); + File.Delete(Path.Combine(path, $"{name}.dll")); + File.Delete(Path.Combine(path, $"{name}.pdb")); + + if (deleteRuntimeConfigJson) + { + File.Delete(Path.Combine(path, $"{name}.runtimeconfig.json")); + } + + if (deleteDepsJson) + { + File.Delete(Path.Combine(path, $"{name}.deps.json")); + } + } + + public static void ChangeEntryPointLibraryName(string depsFile, string newName) + { + JToken deps; + using (var file = File.OpenText(depsFile)) + using (JsonTextReader reader = new JsonTextReader(file)) + { + deps = JObject.ReadFrom(reader); + } + + string version = null; + foreach (JProperty target in deps["targets"]) + { + var targetLibrary = target.Value.Children().FirstOrDefault(); + if (targetLibrary == null) + { + continue; + } + version = targetLibrary.Name.Substring(targetLibrary.Name.IndexOf('/') + 1); + if (newName == null) + { + targetLibrary.Remove(); + } + else + { + targetLibrary.Replace(new JProperty(newName + '/' + version, targetLibrary.Value)); + } + } + if (version != null) + { + var library = deps["libraries"].Children().First(); + if (newName == null) + { + library.Remove(); + } + else + { + library.Replace(new JProperty(newName + '/' + version, library.Value)); + } + using (var file = File.CreateText(depsFile)) + using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented }) + { + deps.WriteTo(writer); + } + } + } + } +} diff --git a/build_projects/shared-build-targets-utils/Utils/SharedFrameworkPublisher.cs b/build_projects/shared-build-targets-utils/Utils/SharedFrameworkPublisher.cs new file mode 100644 index 000000000..57937cadb --- /dev/null +++ b/build_projects/shared-build-targets-utils/Utils/SharedFrameworkPublisher.cs @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using Microsoft.DotNet.InternalAbstractions; +using Microsoft.DotNet.Cli.Build.Framework; +using Newtonsoft.Json; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; +using static Microsoft.DotNet.Cli.Build.FS; + +namespace Microsoft.DotNet.Cli.Build +{ + public class SharedFrameworkPublisher + { + public static string s_sharedFrameworkName = "Microsoft.NETCore.App"; + + private string _sharedFrameworkTemplateSourceRoot; + private string _sharedFrameworkNugetVersion; + private string _sharedFrameworkRid; + private string _sharedFrameworkSourceRoot; + private string _repoRoot; + private string _corehostLockedDirectory; + private string _corehostLatestDirectory; + + private Crossgen _crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion); + private string _corehostPackageSource; + + public SharedFrameworkPublisher( + string repoRoot, + string corehostLockedDirectory, + string corehostLatestDirectory, + string corehostPackageSource, + string sharedFrameworkNugetVersion) + { + _repoRoot = repoRoot; + _corehostLockedDirectory = corehostLockedDirectory; + _corehostLatestDirectory = corehostLatestDirectory; + _corehostPackageSource = corehostPackageSource; + + _sharedFrameworkTemplateSourceRoot = Path.Combine(repoRoot, "src", "sharedframework", "framework"); + _sharedFrameworkNugetVersion = sharedFrameworkNugetVersion; + + _sharedFrameworkRid = ComputeSharedFrameworkRid(); + + _sharedFrameworkSourceRoot = GenerateSharedFrameworkProject( + _sharedFrameworkNugetVersion, + _sharedFrameworkTemplateSourceRoot, + _sharedFrameworkRid); + } + + public static string GetSharedFrameworkPublishPath(string outputRootDirectory, string sharedFrameworkNugetVersion) + { + return Path.Combine( + outputRootDirectory, + "shared", + s_sharedFrameworkName, + sharedFrameworkNugetVersion); + } + + private string ComputeSharedFrameworkRid() + { + return RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows + ? $"win7-{RuntimeEnvironment.RuntimeArchitecture}" + : RuntimeEnvironment.GetRuntimeIdentifier(); + } + + public void CopySharedHostArtifacts(string sharedFrameworkPublishRoot) + { + File.Copy( + Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName), + Path.Combine(sharedFrameworkPublishRoot, HostArtifactNames.DotnetHostBaseName), true); + + File.Copy( + Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostFxrBaseName), + Path.Combine(sharedFrameworkPublishRoot, HostArtifactNames.DotnetHostFxrBaseName), true); + + } + + public void PublishSharedFramework(string outputRootDirectory, string commitHash, DotNetCli dotnetCli) + { + dotnetCli.Restore( + "--verbosity", "verbose", + "--disable-parallel", + "--infer-runtimes", + "--fallbacksource", _corehostPackageSource) + .WorkingDirectory(_sharedFrameworkSourceRoot) + .Execute() + .EnsureSuccessful(); + + // We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier. + string sharedFrameworkNameAndVersionRoot = GetSharedFrameworkPublishPath(outputRootDirectory, _sharedFrameworkNugetVersion); + if (Directory.Exists(sharedFrameworkNameAndVersionRoot)) + { + Utils.DeleteDirectory(sharedFrameworkNameAndVersionRoot); + } + + dotnetCli.Publish( + "--output", sharedFrameworkNameAndVersionRoot, + "-r", _sharedFrameworkRid, + _sharedFrameworkSourceRoot) + .Execute() + .EnsureSuccessful(); + + // Clean up artifacts that dotnet-publish generates which we don't need + PublishMutationUtilties.CleanPublishOutput( + sharedFrameworkNameAndVersionRoot, + "framework", + deleteRuntimeConfigJson: true, + deleteDepsJson: false); + + // Rename the .deps file + var destinationDeps = Path.Combine(sharedFrameworkNameAndVersionRoot, $"{s_sharedFrameworkName}.deps.json"); + File.Move(Path.Combine(sharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps); + PublishMutationUtilties.ChangeEntryPointLibraryName(destinationDeps, null); + + // Generate RID fallback graph + GenerateRuntimeGraph(dotnetCli, destinationDeps); + + CopyHostArtifactsToSharedFramework(sharedFrameworkNameAndVersionRoot); + + if (File.Exists(Path.Combine(sharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll"))) + { + // Publish already places the crossgen'd version of mscorlib into the output, so we can + // remove the IL version + File.Delete(Path.Combine(sharedFrameworkNameAndVersionRoot, "mscorlib.dll")); + } + + _crossgenUtil.CrossgenDirectory(sharedFrameworkNameAndVersionRoot, sharedFrameworkNameAndVersionRoot); + + // Generate .version file for sharedfx + var version = _sharedFrameworkNugetVersion; + var content = $@"{commitHash}{Environment.NewLine}{version}{Environment.NewLine}"; + File.WriteAllText(Path.Combine(sharedFrameworkNameAndVersionRoot, ".version"), content); + + return; + } + + private void GenerateRuntimeGraph(DotNetCli dotnetCli, string destinationDeps) + { + string runtimeGraphGeneratorRuntime = null; + switch (RuntimeEnvironment.OperatingSystemPlatform) + { + case Platform.Windows: + runtimeGraphGeneratorRuntime = "win"; + break; + case Platform.Linux: + runtimeGraphGeneratorRuntime = "linux"; + break; + case Platform.Darwin: + runtimeGraphGeneratorRuntime = "osx"; + break; + } + if (!string.IsNullOrEmpty(runtimeGraphGeneratorRuntime)) + { + var runtimeGraphGeneratorName = "RuntimeGraphGenerator"; + var runtimeGraphGeneratorProject = Path.Combine(Dirs.RepoRoot, "tools", "independent", runtimeGraphGeneratorName); + var runtimeGraphGeneratorOutput = Path.Combine(Dirs.Output, "tools", "independent", runtimeGraphGeneratorName); + + dotnetCli.Publish( + "--output", runtimeGraphGeneratorOutput, + runtimeGraphGeneratorProject).Execute().EnsureSuccessful(); + var runtimeGraphGeneratorExe = Path.Combine(runtimeGraphGeneratorOutput, $"{runtimeGraphGeneratorName}{Constants.ExeSuffix}"); + + Cmd(runtimeGraphGeneratorExe, "--project", _sharedFrameworkSourceRoot, "--deps", destinationDeps, runtimeGraphGeneratorRuntime) + .Execute() + .EnsureSuccessful(); + } + else + { + throw new Exception($"Could not determine rid graph generation runtime for platform {RuntimeEnvironment.OperatingSystemPlatform}"); + } + } + + private void CopyHostArtifactsToSharedFramework(string sharedFrameworkNameAndVersionRoot) + { + File.Copy( + Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName), + Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.DotnetHostBaseName), true); + File.Copy( + Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName), + Path.Combine(sharedFrameworkNameAndVersionRoot, $"corehost{Constants.ExeSuffix}"), true); + File.Copy( + Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostFxrBaseName), + Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.DotnetHostFxrBaseName), true); + + // Hostpolicy should be the latest and not the locked version as it is supposed to evolve for + // the framework and has a tight coupling with coreclr's API in the framework. + File.Copy( + Path.Combine(_corehostLatestDirectory, HostArtifactNames.HostPolicyBaseName), + Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.HostPolicyBaseName), true); + } + + private string GenerateSharedFrameworkProject( + string sharedFrameworkNugetVersion, + string sharedFrameworkTemplatePath, + string rid) + { + string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework"); + Utils.DeleteDirectory(sharedFrameworkProjectPath); + CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true); + + string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template"); + JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile); + sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = sharedFrameworkNugetVersion; + ((JObject)sharedFrameworkProject["runtimes"]).RemoveAll(); + sharedFrameworkProject["runtimes"][rid] = new JObject(); + + string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json"); + JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath); + + Rm(templateFile); + + return sharedFrameworkProjectPath; + } + } +} diff --git a/packaging/host/debian/dotnet-sharedhost-debian_config.json b/packaging/host/debian/dotnet-sharedhost-debian_config.json deleted file mode 100644 index e144623ab..000000000 --- a/packaging/host/debian/dotnet-sharedhost-debian_config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "maintainer_name":"Microsoft", - "maintainer_email": "dotnetcore@microsoft.com", - - "package_name": "dotnet-host", - "install_root": "/usr/share/dotnet", - - "short_description": "%SHARED_HOST_BRAND_NAME%", - "long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.", - "homepage": "https://dotnet.github.io/core", - - "release":{ - "package_version":"1.0.0.0", - "package_revision":"1", - "urgency" : "low", - "changelog_message" : "Inital shared host." - }, - - "control": { - "priority":"standard", - "section":"libs", - "architecture":"amd64" - }, - - "copyright": "2015 Microsoft", - "license": { - "type": "MIT", - "full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." - }, - - "package_conflicts" : [ - "dotnet", - "dotnet-nightly" - ], - - "symlinks": { - "dotnet" : "/usr/bin/dotnet" - } -} diff --git a/packaging/osx/sharedframework/resources/cs.lproj/conclusion.html b/packaging/osx/sharedframework/resources/cs.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/cs.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/cs.lproj/eula.rtf b/packaging/osx/sharedframework/resources/cs.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/cs.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/cs.lproj/welcome.html b/packaging/osx/sharedframework/resources/cs.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/cs.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/de.lproj/conclusion.html b/packaging/osx/sharedframework/resources/de.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/de.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/de.lproj/eula.rtf b/packaging/osx/sharedframework/resources/de.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/de.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/de.lproj/welcome.html b/packaging/osx/sharedframework/resources/de.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/de.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/dotnetbackground.png b/packaging/osx/sharedframework/resources/dotnetbackground.png deleted file mode 100644 index 15ce07c36f2e009a6776b3b0a299d1b1600fcfff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4054 zcmeHJdpy&7AD@yF9_dCQJe@)pL&>EYDoJjmQ*l_BQ{*z17}F9_6iFqPhDE2#rdA&N%bIxDSAJ0GM``739{r!I5@B91ye7^6``>Gez zSwl@%4Fm#dxEwzC69}{f0RkzNELQ<${P1_rgFu>vE(iA?Lx1M=Npp^m7QP&uGdXIt zDr|}FNsApj2nRh1b{wZ|&TZ8k{=?XI!7{A`d2%HX0@JceDFRv+16NLbt#rz}|n4zZv*n z8MtS(^xW-kvH6yUl1D`6g!L=g+dYh@{m%1Ugb4M9|6 z1_(qAQP%sm+jrrAV)zc(pTim7M)meGW_(@i!%@clvgmdcvls7%EbK5kx%GlL_fSkE`rSB(jey;HRY-4nvO9a1VOse5p9EmYqj_mX==OF6!Jt8c~F zO#U1AcGE5DdTgYIQy~8RgA`s7(!=Ef_Crs|uOeNjR9a7zH#8L|iD%^L7y8@|P$HfI z+zgazlBQZ#BX+#vaJi0BeM{I0<22V%S}9T1)X|N0^-0qj^}IA_VaD6g!Sf?2tYjXIkFBnMOK=X)D(l<$=LtbxPUuU?RR zc@jB!b*I>x!`MeW?LgXmJl#uRbrmGXQK|OOcFDDBXo??@jUQ+^aAYK{cKTU zL0QiBt0YMRUtjIGN$IP0EGq)?+V76E^+I=E+AzMry?hP%2&!tE)(OwH#EsQF34h@< zD|;hq2LJYMVw{k`86k%BLg)N(;kE}qe?%?>pF)Se+Y}Tmoh1%G@E?qq@7ZH&?%zFe zg8q99zN102v%mL|&vRr~%ej}xV(>i<1gB=kQ6uQfjZS4b< z*CQZwunMgH%wV;!$Few&38f=Oco;U^xD1+Jhw%(OQ7P%tp^OX>`q*q!&VZi!$uCo?U8%9 zZQV0@L+_0VA6zec8o~$bihdRqRJ-3cW)tUUdg(!#9c1`;DG@O<927JbgEJ`6`dXG& zjG@;JVJ(L$+KTw77?D>{Z=E(a(ws4ra58$HRPpc{HP3%6bBmwFspD~UZ?bk5H+TM8 zbbLEhG+?#CIt#NT{X*pVllwg8XuTm%KUt(!8scV)^i{3NLJ(+bJ7cGkXsA@KYW2yA zR`h^}W39j&ER^lY_^eJEHR2xN<=0xLnqXGIP~rJn!Jg08dujMQKD1`%{;o67zF8(N zr<=p!G@Z2<+f-zL>O3}4ABnww7befcggO|Zr z5g9=0J`<-s`H#9XTQT8{Fw>x08ZDlf?N!=jSrmyjxPPDqbrpe=Fm zbq75sQ}weNsk+mqsL#y=IEr^_`9#$ZFp=^?w95;K{XFwy6>k}=U^gY;R>6I3WaTP+ zM-5s6T#Iml_#s&rL6aiq4WT5hZWv_ZDe=^6j{D=n!v=<0d~BZb=lF+4KDX>oRGFEY z`sJG9dbLLoE3Y@iK&O}j2>HRL?#=7;&Y%4fy83Le!`#rrm*vY~0`Vi0N_iMho;GTf zO-5eXYmi1Gr|~O(kCH30OiNn{K5~`*dY9gOBP&k&I{x3wcV@+8gU}#x7aKUDJ{0S z6RK2e&fd-gv`8&N&HA1!o9ec{u^W|HNEEX~&t#Wug?{0~bX#ZA7mR-y&CU=?RC;-Q z9ilKPcl;v7FiP}(x)(QE#5Y|(bvPX7mR1>sVxm8>FLQdzZL8ZfNqh}#Mml9_GQ4hr zs@?q7N!1!?y(7^?BTv&8QDyKo2++PgjNhiWG5QlD<8frli(^!4u8-TRd)&8ip?5FP z(fn#r*H+3&Z%z#UPR;N2_HK(g&_>XXF0r@E&$yFOr;R!XXfWTYaHQF7iC!# zle-0UgGJTu6ZZrY@K2z}(*ccL{&jOVVsles?%VB0E9WD*6)Ox?)+($*#d~<&9Gj?7 zALYKD@dP6DgBedgdB9wveLDW2Rs`jJthgXXm?Gr;|-)RghI?aOcL#ya5ei|?| zibnhb%R`z^x`N5qRm0^31-3ZY<35}u|06)re11q^NW zSO2M{>sa@t#=Z;%w#B_PFE&ndWQ0-H?C@T2fYrH;R8o*=tabKDdxFYL>a}AiU7hs=AnX&z%Sukd+AON`!__ z)+EqI!W*(QBR%wWwG?zK_XPigG;#a#XJea>`T`yy1*l+P89aQuX3L>+k8+vdqNkp? z>T9|9gb+uWO{^Xq8cE6)CEfK)YI}bARwyQvxX7LvhG>*s&avD0kqsf2iroFDY8PKj zZDtIW;RJ|qy>#&g)fm}Az&A{*5rVW@XL*8Yb>U^F?8Qu$m;c_~u-R1SsWHS#eAz2@ z_|grg$Vi=JyD19LGUzAvr$vkrT>CHq@l-1Mx-V06n^_pKnfY8Y>WvpOZ^AKi{aHa# ztWo{DKvk*%{)?;J^9AW1uI+yOQE84N7Q2%%8wk^d`gEN*LoCdeW5hQA`uA*Nn6)P| z(pZq1=EpT3fwW67;&0`3!feT7h;MGj&8-d?Vso(O`e?Zehb68mZhLK#`0zf2EwrX#g&L@vqv;V&%jo|TAE1r2}co`E~@%{MD7^LOE* zIsSut1^|Dx(0^i<0o(p>8~?}fdoy3S7P0Irn1pgKMPgqXD9n4Zx~er>@%T;Nl38(v hMhegUe;odu@}(%@7uUE9!GZ#Yixc!<#Q}KAzW{oKiPQi9 diff --git a/packaging/osx/sharedframework/resources/en.lproj/conclusion.html b/packaging/osx/sharedframework/resources/en.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/en.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/en.lproj/eula.rtf b/packaging/osx/sharedframework/resources/en.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/en.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/en.lproj/welcome.html b/packaging/osx/sharedframework/resources/en.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/en.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/es.lproj/conclusion.html b/packaging/osx/sharedframework/resources/es.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/es.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/es.lproj/eula.rtf b/packaging/osx/sharedframework/resources/es.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/es.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/es.lproj/welcome.html b/packaging/osx/sharedframework/resources/es.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/es.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/fr.lproj/conclusion.html b/packaging/osx/sharedframework/resources/fr.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/fr.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/fr.lproj/eula.rtf b/packaging/osx/sharedframework/resources/fr.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/fr.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/fr.lproj/welcome.html b/packaging/osx/sharedframework/resources/fr.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/fr.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/it.lproj/conclusion.html b/packaging/osx/sharedframework/resources/it.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/it.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/it.lproj/eula.rtf b/packaging/osx/sharedframework/resources/it.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/it.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/it.lproj/welcome.html b/packaging/osx/sharedframework/resources/it.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/it.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ja.lproj/conclusion.html b/packaging/osx/sharedframework/resources/ja.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/ja.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/ja.lproj/eula.rtf b/packaging/osx/sharedframework/resources/ja.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/ja.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ja.lproj/welcome.html b/packaging/osx/sharedframework/resources/ja.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/ja.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ko.lproj/conclusion.html b/packaging/osx/sharedframework/resources/ko.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/ko.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/ko.lproj/eula.rtf b/packaging/osx/sharedframework/resources/ko.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/ko.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ko.lproj/welcome.html b/packaging/osx/sharedframework/resources/ko.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/ko.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/pl.lproj/conclusion.html b/packaging/osx/sharedframework/resources/pl.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/pl.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/pl.lproj/eula.rtf b/packaging/osx/sharedframework/resources/pl.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/pl.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/pl.lproj/welcome.html b/packaging/osx/sharedframework/resources/pl.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/pl.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/pt-br.lproj/conclusion.html b/packaging/osx/sharedframework/resources/pt-br.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/pt-br.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/pt-br.lproj/eula.rtf b/packaging/osx/sharedframework/resources/pt-br.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/pt-br.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/pt-br.lproj/welcome.html b/packaging/osx/sharedframework/resources/pt-br.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/pt-br.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ru.lproj/conclusion.html b/packaging/osx/sharedframework/resources/ru.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/ru.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/ru.lproj/eula.rtf b/packaging/osx/sharedframework/resources/ru.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/ru.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/ru.lproj/welcome.html b/packaging/osx/sharedframework/resources/ru.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/ru.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/tr.lproj/conclusion.html b/packaging/osx/sharedframework/resources/tr.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/tr.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/tr.lproj/eula.rtf b/packaging/osx/sharedframework/resources/tr.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/tr.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/tr.lproj/welcome.html b/packaging/osx/sharedframework/resources/tr.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/tr.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/zh-hans.lproj/conclusion.html b/packaging/osx/sharedframework/resources/zh-hans.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/zh-hans.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/zh-hans.lproj/eula.rtf b/packaging/osx/sharedframework/resources/zh-hans.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/zh-hans.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/zh-hans.lproj/welcome.html b/packaging/osx/sharedframework/resources/zh-hans.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/zh-hans.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/zh-hant.lproj/conclusion.html b/packaging/osx/sharedframework/resources/zh-hant.lproj/conclusion.html deleted file mode 100644 index a86661ccb..000000000 --- a/packaging/osx/sharedframework/resources/zh-hant.lproj/conclusion.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Congratulations! You've successfully installed .NET Core! - - -
-

The installation was successful.

-

.NET Core was successfully installed.

-

- Install dependencies -

-

- In order to be able to use .NET Core on OS X, you need to install OpenSSL version 1.0.1/1.0.2. - There are many ways to install/update your libssl. Using Homebrew is the easiest. - You can view the instructions here or if you're updating, on this page. -

-
- - diff --git a/packaging/osx/sharedframework/resources/zh-hant.lproj/eula.rtf b/packaging/osx/sharedframework/resources/zh-hant.lproj/eula.rtf deleted file mode 100644 index 29257296c..000000000 --- a/packaging/osx/sharedframework/resources/zh-hant.lproj/eula.rtf +++ /dev/null @@ -1,114 +0,0 @@ -{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}} -{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;} -{\*\listtable -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 } -{\list\listhybrid -{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363} -{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 -\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par - -\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par - -\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par -{\pntext\f3\'B7\tab}supplements,\par -{\pntext\f3\'B7\tab}Internet-based services, and\par -{\pntext\f3\'B7\tab}support services\par - -\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par - -\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par - -\pard -{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par -{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par - -\pard -{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par -{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par - -\pard -{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par -{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par -{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par -{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par -{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par - -\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par -{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par -{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par -{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par -{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par -{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par -{\pntext\f3\'B7\tab}publish the software for others to copy;\par -{\pntext\f3\'B7\tab}rent, lease or lend the software;\par -{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par -{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par -\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par -\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par -\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par -\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par -\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par - -\pard -{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par -{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par - -\pard -{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}} -\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par -{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par - -\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par - -\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par - -\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par -{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par - -\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par -\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par -Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par -\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par -\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par -\lang9 Cette limitation concerne :\par - -\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par -{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par - -\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par -\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par -\b\fs20\lang1036\par -} - \ No newline at end of file diff --git a/packaging/osx/sharedframework/resources/zh-hant.lproj/welcome.html b/packaging/osx/sharedframework/resources/zh-hant.lproj/welcome.html deleted file mode 100644 index b4dc7dae9..000000000 --- a/packaging/osx/sharedframework/resources/zh-hant.lproj/welcome.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Welcome to the .NET Core Host installer. - - - -

- Microsoft .NET Core Host -

-

- .NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs. -

-
- - \ No newline at end of file diff --git a/packaging/osx/sharedframework/scripts/postinstall b/packaging/osx/sharedframework/scripts/postinstall deleted file mode 100755 index 50fd8f1b7..000000000 --- a/packaging/osx/sharedframework/scripts/postinstall +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -PACKAGE=$1 -INSTALL_DESTINATION=$2 - -# A temporary fix for the permissions issue(s) -chmod -R 755 $INSTALL_DESTINATION/shared - -exit 0 diff --git a/packaging/osx/sharedframework/shared-framework-distribution-template.xml b/packaging/osx/sharedframework/shared-framework-distribution-template.xml deleted file mode 100644 index ad7c12b7c..000000000 --- a/packaging/osx/sharedframework/shared-framework-distribution-template.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - {SharedFxBrandName} (x64) - - - - - - - - - - - - - - - - - - - {SharedFxComponentId}.pkg - {SharedHostComponentId}.pkg - diff --git a/packaging/osx/sharedhost/scripts/postinstall b/packaging/osx/sharedhost/scripts/postinstall deleted file mode 100755 index 262135ff1..000000000 --- a/packaging/osx/sharedhost/scripts/postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -PACKAGE=$1 -INSTALL_DESTINATION=$2 - -# A temporary fix for the permissions issue(s) -chmod 755 $INSTALL_DESTINATION/dotnet - -# Add the installation directory to the system-wide paths -echo $INSTALL_DESTINATION | tee -a /etc/paths.d/dotnet - -exit 0 diff --git a/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json b/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json deleted file mode 100644 index 570290cc5..000000000 --- a/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "maintainer_name":"Microsoft", - "maintainer_email": "dotnetcore@microsoft.com", - - "package_name": "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%", - "install_root": "/usr/share/dotnet", - - "short_description": "%SHARED_FRAMEWORK_BRAND_NAME% %SHARED_FRAMEWORK_NUGET_NAME% %SHARED_FRAMEWORK_NUGET_VERSION%", - "long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.", - "homepage": "https://dotnet.github.io/core", - - "release":{ - "package_version":"1.0.0.0", - "package_revision":"1", - "urgency" : "low", - "changelog_message" : "Inital shared framework." - }, - - "control": { - "priority":"standard", - "section":"libs", - "architecture":"amd64" - }, - - "copyright": "2015 Microsoft", - "license": { - "type": "MIT", - "full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." - }, - - "debian_dependencies":{ - "dotnet-host" : {}, - "libssl1.0.0" : {}, - "libcurl3" : {} - } -} diff --git a/packaging/windows/host/generatemsi.ps1 b/packaging/windows/host/generatemsi.ps1 deleted file mode 100644 index 32b741800..000000000 --- a/packaging/windows/host/generatemsi.ps1 +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -param( - [Parameter(Mandatory=$true)][string]$SharedHostPublishRoot, - [Parameter(Mandatory=$true)][string]$DotnetHostMSIOutput, - [Parameter(Mandatory=$true)][string]$WixRoot, - [Parameter(Mandatory=$true)][string]$ProductMoniker, - [Parameter(Mandatory=$true)][string]$SharedHostMSIVersion, - [Parameter(Mandatory=$true)][string]$SharedHostNugetVersion, - [Parameter(Mandatory=$true)][string]$Architecture, - [Parameter(Mandatory=$true)][string]$WixObjRoot -) - -. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" -$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." - -function RunCandle -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running candle.. - $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\host" - - .\candle.exe -nologo ` - -out "$WixObjRoot\" ` - -ext WixDependencyExtension.dll ` - -dHostSrc="$SharedHostPublishRoot" ` - -dMicrosoftEula="$RepoRoot\packaging\osx\clisdk\resources\en.lproj\eula.rtf" ` - -dProductMoniker="$ProductMoniker" ` - -dBuildVersion="$SharedHostMSIVersion" ` - -dNugetVersion="$SharedHostNugetVersion" ` - -arch $Architecture ` - "$AuthWsxRoot\host.wxs" ` - "$AuthWsxRoot\provider.wxs" ` - "$AuthWsxRoot\registrykeys.wxs" | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Candle failed with exit code $LastExitCode." - } - - popd - return $result -} - -function RunLight -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running light.. - - .\light.exe -nologo ` - -ext WixUIExtension.dll ` - -ext WixDependencyExtension.dll ` - -ext WixUtilExtension.dll ` - -cultures:en-us ` - "$WixObjRoot\host.wixobj" ` - "$WixObjRoot\provider.wixobj" ` - "$WixObjRoot\registrykeys.wixobj" ` - -out $DotnetHostMSIOutput | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Light failed with exit code $LastExitCode." - } - - popd - return $result -} - -if(!(Test-Path $SharedHostPublishRoot)) -{ - throw "$SharedHostPublishRoot not found" -} - -if(!(Test-Path $WixObjRoot)) -{ - throw "$WixObjRoot not found" -} - -Write-Host "Creating shared host MSI at $DotnetHostMSIOutput" - -if([string]::IsNullOrEmpty($WixRoot)) -{ - Exit -1 -} - -if(-Not (RunCandle)) -{ - Exit -1 -} - -if(-Not (RunLight)) -{ - Exit -1 -} - -if(!(Test-Path $DotnetHostMSIOutput)) -{ - throw "Unable to create the shared host msi." - Exit -1 -} - -Write-Host -ForegroundColor Green "Successfully created shared host MSI - $DotnetHostMSIOutput" - -exit $LastExitCode \ No newline at end of file diff --git a/packaging/windows/host/host.wxs b/packaging/windows/host/host.wxs deleted file mode 100644 index a1bff66ca..000000000 --- a/packaging/windows/host/host.wxs +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packaging/windows/host/provider.wxs b/packaging/windows/host/provider.wxs deleted file mode 100644 index dab1a27e7..000000000 --- a/packaging/windows/host/provider.wxs +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/packaging/windows/host/registrykeys.wxs b/packaging/windows/host/registrykeys.wxs deleted file mode 100644 index ac905881c..000000000 --- a/packaging/windows/host/registrykeys.wxs +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packaging/windows/host/variables.wxi b/packaging/windows/host/variables.wxi deleted file mode 100644 index fba50a8d0..000000000 --- a/packaging/windows/host/variables.wxi +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packaging/windows/sharedframework/bundle.thm b/packaging/windows/sharedframework/bundle.thm deleted file mode 100644 index 9c962acdf..000000000 --- a/packaging/windows/sharedframework/bundle.thm +++ /dev/null @@ -1,105 +0,0 @@ - - - #(loc.Caption) - Segoe UI - Segoe UI - Segoe UI - Segoe UI - Segoe UI - Segoe UI - - #(loc.Title) - - - - - #(loc.HelpHeader) - #(loc.HelpText) - - - - - - - - #(loc.Motto) - - - - #(loc.InstallAcceptCheckbox) - - - - - - - - - #(loc.OptionsHeader) - #(loc.OptionsLocationLabel) - - - - - - - - - #(loc.FilesInUseHeader) - #(loc.FilesInUseLabel) - - - - - - - - - - - - - - #(loc.ProgressHeader) - #(loc.ProgressLabel) - #(loc.OverallProgressPackageText) - - - - - - - - #(loc.ModifyHeader) - - - - - - - - - #(loc.SuccessHeader) - #(loc.SuccessInstallHeader) - #(loc.SuccessRepairHeader) - #(loc.SuccessUninstallHeader) - - #(loc.SuccessRestartText) - - - - - - - - #(loc.FailureHeader) - #(loc.FailureInstallHeader) - #(loc.FailureUninstallHeader) - #(loc.FailureRepairHeader) - #(loc.FailureHyperlinkLogText) - - #(loc.FailureRestartText) - - - - \ No newline at end of file diff --git a/packaging/windows/sharedframework/bundle.wxl b/packaging/windows/sharedframework/bundle.wxl deleted file mode 100644 index c7ade785c..000000000 --- a/packaging/windows/sharedframework/bundle.wxl +++ /dev/null @@ -1,59 +0,0 @@ - - - [WixBundleName] Setup - [BUNDLEMONIKER] - You just need a shell, a text editor and 10 minutes of your time. - -Ready? Set? Let's go! - Are you sure you want to cancel? - Previous version - Setup Help - /install | /repair | /uninstall | /layout [directory] - installs, repairs, uninstalls or - creates a complete local copy of the bundle in directory. Install is the default. - -/passive | /quiet - displays minimal UI with no prompts or displays no UI and - no prompts. By default UI and all prompts are displayed. - -/norestart - suppress any attempts to restart. By default UI will prompt before restart. -/log log.txt - logs to a specific file. By default a log file is created in %TEMP%. - &Close - I &agree to the license terms and conditions - &Options - &Install - &Close - Setup Options - Install location: - &Browse - &OK - &Cancel - Setup Progress - Processing: - Initializing... - &Cancel - Modify Setup - &Repair - &Uninstall - &Close - Repair Successfully Completed - Uninstall Successfully Completed - Installation Successfully Completed - Setup Successful - &Launch - You must restart your computer before you can use the software. - &Restart - &Close - Setup Failed - Setup Failed - Uninstall Failed - Repair Failed - One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>. - You must restart your computer to complete the rollback of the software. - &Restart - &Close - Files In Use - The following applications are using files that need to be updated: - Close the &applications and attempt to restart them. - &Do not close applications. A reboot will be required. - &OK - &Cancel - diff --git a/packaging/windows/sharedframework/bundle.wxs b/packaging/windows/sharedframework/bundle.wxs deleted file mode 100644 index 3acd9de66..000000000 --- a/packaging/windows/sharedframework/bundle.wxs +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eula.rtf - - - - - diff --git a/packaging/windows/sharedframework/generatebundle.ps1 b/packaging/windows/sharedframework/generatebundle.ps1 deleted file mode 100644 index 49f161095..000000000 --- a/packaging/windows/sharedframework/generatebundle.ps1 +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -param( - [Parameter(Mandatory=$true)][string]$SharedFxMSIFile, - [Parameter(Mandatory=$true)][string]$SharedHostMSIFile, - [Parameter(Mandatory=$true)][string]$DotnetBundleOutput, - [Parameter(Mandatory=$true)][string]$WixRoot, - [Parameter(Mandatory=$true)][string]$ProductMoniker, - [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, - [Parameter(Mandatory=$true)][string]$DotnetCLIVersion, - [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName, - [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion, - [Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode, - [Parameter(Mandatory=$true)][string]$Architecture -) - -. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" -$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." - -function RunCandleForBundle -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running candle for bundle.. - $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\sharedframework" - $SharedFrameworkComponentVersion = $SharedFrameworkNugetVersion.Replace('-', '_'); - - .\candle.exe -nologo ` - -dMicrosoftEula="$RepoRoot\packaging\osx\sharedframework\resources\en.lproj\eula.rtf" ` - -dProductMoniker="$ProductMoniker" ` - -dBuildVersion="$DotnetMSIVersion" ` - -dDisplayVersion="$DotnetCLIVersion" ` - -dSharedFXMsiSourcePath="$SharedFxMSIFile" ` - -dSharedHostMsiSourcePath="$SharedHostMSIFile" ` - -dFrameworkName="$SharedFrameworkNugetName" ` - -dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" ` - -dFrameworkComponentVersion="$SharedFrameworkComponentVersion" ` - -dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" ` - -arch "$Architecture" ` - -ext WixBalExtension.dll ` - -ext WixUtilExtension.dll ` - -ext WixTagExtension.dll ` - "$AuthWsxRoot\bundle.wxs" | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Candle failed with exit code $LastExitCode." - } - - popd - return $result -} - -function RunLightForBundle -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running light for bundle.. - $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\sharedframework" - - .\light.exe -nologo ` - -cultures:en-us ` - bundle.wixobj ` - -ext WixBalExtension.dll ` - -ext WixUtilExtension.dll ` - -ext WixTagExtension.dll ` - -b "$AuthWsxRoot" ` - -out $DotnetBundleOutput | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Light failed with exit code $LastExitCode." - } - - popd - return $result -} - -Write-Host "Creating shared framework bundle at $DotnetBundleOutput" - -if([string]::IsNullOrEmpty($WixRoot)) -{ - Exit -1 -} - -if(-Not (RunCandleForBundle)) -{ - Exit -1 -} - -if(-Not (RunLightForBundle)) -{ - Exit -1 -} - -if(!(Test-Path $DotnetBundleOutput)) -{ - throw "Unable to create the dotnet bundle." - Exit -1 -} - -Write-Host -ForegroundColor Green "Successfully created shared framework bundle - $DotnetBundleOutput" - -exit $LastExitCode diff --git a/packaging/windows/sharedframework/generatemsi.ps1 b/packaging/windows/sharedframework/generatemsi.ps1 deleted file mode 100644 index def4fddc6..000000000 --- a/packaging/windows/sharedframework/generatemsi.ps1 +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -param( - [Parameter(Mandatory=$true)][string]$SharedFrameworkPublishRoot, - [Parameter(Mandatory=$true)][string]$SharedFrameworkMSIOutput, - [Parameter(Mandatory=$true)][string]$WixRoot, - [Parameter(Mandatory=$true)][string]$ProductMoniker, - [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, - [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName, - [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion, - [Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode, - [Parameter(Mandatory=$true)][string]$Architecture, - [Parameter(Mandatory=$true)][string]$WixObjRoot -) - -. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" -$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." - -$InstallFileswsx = "$WixObjRoot\install-files.wxs" -$InstallFilesWixobj = "$WixObjRoot\install-files.wixobj" - - -function RunHeat -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running heat.. - - .\heat.exe dir `"$SharedFrameworkPublishRoot`" ` - -nologo ` - -template fragment ` - -sreg -gg ` - -var var.SharedFrameworkSource ` - -cg InstallFiles ` - -srd ` - -dr DOTNETHOME ` - -out $InstallFileswsx | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Heat failed with exit code $LastExitCode." - } - - popd - return $result -} - -function RunCandle -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running candle.. - $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\sharedframework" - $SharedFrameworkComponentVersion = $SharedFrameworkNugetVersion.Replace('-', '_'); - - .\candle.exe -nologo ` - -out "$WixObjRoot\" ` - -dSharedFrameworkSource="$SharedFrameworkPublishRoot" ` - -dMicrosoftEula="$RepoRoot\packaging\osx\sharedframework\resources\en.lproj\eula.rtf" ` - -dProductMoniker="$ProductMoniker" ` - -dFrameworkName="$SharedFrameworkNugetName" ` - -dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" ` - -dFrameworkComponentVersion="$SharedFrameworkComponentVersion" ` - -dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" ` - -dBuildVersion="$DotnetMSIVersion" ` - -arch $Architecture ` - -ext WixDependencyExtension.dll ` - "$AuthWsxRoot\sharedframework.wxs" ` - "$AuthWsxRoot\provider.wxs" ` - "$AuthWsxRoot\registrykeys.wxs" ` - $InstallFileswsx | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Candle failed with exit code $LastExitCode." - } - - popd - return $result -} - -function RunLight -{ - $result = $true - pushd "$WixRoot" - - Write-Host Running light.. - $CabCache = Join-Path $WixRoot "cabcache" - - .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` - -cultures:en-us ` - "$WixObjRoot\sharedframework.wixobj" ` - "$WixObjRoot\provider.wixobj" ` - "$WixObjRoot\registrykeys.wixobj" ` - "$InstallFilesWixobj" ` - -out $SharedFrameworkMSIOutput | Out-Host - - if($LastExitCode -ne 0) - { - $result = $false - Write-Host "Light failed with exit code $LastExitCode." - } - - popd - return $result -} - -if(!(Test-Path $SharedFrameworkPublishRoot)) -{ - throw "$SharedHostPublishRoot not found" -} - -if(!(Test-Path $WixObjRoot)) -{ - throw "$WixObjRoot not found" -} - -Write-Host "Creating dotnet shared framework MSI at $SharedFrameworkMSIOutput" - -if([string]::IsNullOrEmpty($WixRoot)) -{ - Exit -1 -} - -if(-Not (RunHeat)) -{ - Exit -1 -} - -if(-Not (RunCandle)) -{ - Exit -1 -} - -if(-Not (RunLight)) -{ - Exit -1 -} - -if(!(Test-Path $SharedFrameworkMSIOutput)) -{ - throw "Unable to create the dotnet shared framework msi." - Exit -1 -} - -Write-Host -ForegroundColor Green "Successfully created shared framework MSI - $SharedFrameworkMSIOutput" - -exit $LastExitCode diff --git a/packaging/windows/sharedframework/provider.wxs b/packaging/windows/sharedframework/provider.wxs deleted file mode 100644 index 02932a815..000000000 --- a/packaging/windows/sharedframework/provider.wxs +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packaging/windows/sharedframework/registrykeys.wxs b/packaging/windows/sharedframework/registrykeys.wxs deleted file mode 100644 index 8352debab..000000000 --- a/packaging/windows/sharedframework/registrykeys.wxs +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packaging/windows/sharedframework/sharedframework.wxs b/packaging/windows/sharedframework/sharedframework.wxs deleted file mode 100644 index ee0a53bdb..000000000 --- a/packaging/windows/sharedframework/sharedframework.wxs +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/windows/sharedframework/variables.wxi b/packaging/windows/sharedframework/variables.wxi deleted file mode 100644 index 200815b28..000000000 --- a/packaging/windows/sharedframework/variables.wxi +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pkg/.gitignore b/pkg/.gitignore deleted file mode 100644 index 7812b4bb4..000000000 --- a/pkg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Tools/ -version.txt diff --git a/pkg/BuildToolsVersion.txt b/pkg/BuildToolsVersion.txt deleted file mode 100644 index 76576ed6f..000000000 --- a/pkg/BuildToolsVersion.txt +++ /dev/null @@ -1 +0,0 @@ -1.0.25-prerelease-00228-02 diff --git a/pkg/DotnetCLIVersion.txt b/pkg/DotnetCLIVersion.txt deleted file mode 100644 index 936031c9c..000000000 --- a/pkg/DotnetCLIVersion.txt +++ /dev/null @@ -1 +0,0 @@ -1.0.0.001718 diff --git a/pkg/deps/project.json b/pkg/deps/project.json deleted file mode 100644 index 20a7d8a92..000000000 --- a/pkg/deps/project.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1-rc3-24123-01" - }, - "frameworks": { - "dnxcore50": { - "imports": "portable-net45+win8" - } - } -} diff --git a/pkg/dir.props b/pkg/dir.props deleted file mode 100644 index eeae9fde3..000000000 --- a/pkg/dir.props +++ /dev/null @@ -1,60 +0,0 @@ - - - $(MSBuildThisFileDirectory) - - - $(ProjectDir)bin/ - $(BinDir)tests/ - $(BinDir)packages/ - - - $(ProjectDir)packages/ - $(ProjectDir)Tools/ - $(ToolRuntimePath) - $(ProjectDir)Tools/ - $(ToolRuntimePath)dotnetcli/bin/ - $(ToolsDir)net45/ - false - - - - $(BinDir) - - - - $(PackagesOutDir) - $(ProjectDir)packages\Microsoft.NETCore.Platforms\1.0.1-rc3-24123-01\runtime.json - $(ProjectDir)projects/dotnet_library_license.txt - $(ProjectDir)projects/ThirdPartyNotices.txt - $(ProjectDir)projects/descriptions.json - $(Platform) - x64 - - - - - - true - - - true - - - - - $(HostPolicyVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) - $(HostResolverVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) - $(HostVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) - - - - - - - - - - - diff --git a/pkg/dir.targets b/pkg/dir.targets deleted file mode 100644 index 38bec20e4..000000000 --- a/pkg/dir.targets +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/pkg/dir.traversal.targets b/pkg/dir.traversal.targets deleted file mode 100644 index b68d12bdd..000000000 --- a/pkg/dir.traversal.targets +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/pkg/init-tools.cmd b/pkg/init-tools.cmd deleted file mode 100644 index 444f0098c..000000000 --- a/pkg/init-tools.cmd +++ /dev/null @@ -1,69 +0,0 @@ -@if "%_echo%" neq "on" echo off -setlocal - -set INIT_TOOLS_LOG=%~dp0init-tools.log -if [%PACKAGES_DIR%]==[] set PACKAGES_DIR=%~dp0packages\ -if [%TOOLRUNTIME_DIR%]==[] set TOOLRUNTIME_DIR=%~dp0Tools -set DOTNET_PATH=%TOOLRUNTIME_DIR%\dotnetcli\ -if [%DOTNET_CMD%]==[] set DOTNET_CMD=%DOTNET_PATH%bin\dotnet.exe -if [%BUILDTOOLS_SOURCE%]==[] set BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json -set /P BUILDTOOLS_VERSION=< %~dp0BuildToolsVersion.txt -set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib\ -set PROJECT_JSON_PATH=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION% -set PROJECT_JSON_FILE=%PROJECT_JSON_PATH%\project.json -set PROJECT_JSON_CONTENTS={ "dependencies": { "Microsoft.DotNet.BuildTools": "%BUILDTOOLS_VERSION%" }, "frameworks": { "dnxcore50": { } } } -set BUILD_TOOLS_SEMAPHORE=%PROJECT_JSON_PATH%\init-tools.completed - -:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated -if [%1]==[force] ( - if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" - if exist "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" -) - -:: If sempahore exists do nothing -if exist "%BUILD_TOOLS_SEMAPHORE%" ( - echo Tools are already initialized. - goto :EOF -) - -if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" - -if NOT exist "%PROJECT_JSON_PATH%" mkdir "%PROJECT_JSON_PATH%" -echo %PROJECT_JSON_CONTENTS% > %PROJECT_JSON_FILE% -echo Running %0 > %INIT_TOOLS_LOG% - -if exist "%DOTNET_CMD%" goto :afterdotnetrestore - -echo Installing dotnet cli... -if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%" -set /p DOTNET_VERSION=< %~dp0DotnetCLIVersion.txt -set DOTNET_ZIP_NAME=dotnet-win-x64.%DOTNET_VERSION%.zip -set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/%DOTNET_VERSION%/%DOTNET_ZIP_NAME% -set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME% -echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> %INIT_TOOLS_LOG% -powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> %INIT_TOOLS_LOG% -if NOT exist "%DOTNET_LOCAL_PATH%" ( - echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. - goto :EOF -) - -:afterdotnetrestore - -if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore -echo Restoring BuildTools version %BUILDTOOLS_VERSION%... -echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG% -call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG% -if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" ( - echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details. - goto :EOF -) - -:afterbuildtoolsrestore - -echo Initializing BuildTools ... -echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG% -call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG% - -:: Create sempahore file -echo Done initializing tools. -echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%" diff --git a/pkg/init-tools.sh b/pkg/init-tools.sh deleted file mode 100755 index ccb798d56..000000000 --- a/pkg/init-tools.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -__scriptpath=$(cd "$(dirname "$0")"; pwd -P) -__init_tools_log=$__scriptpath/init-tools.log -__PACKAGES_DIR=$__scriptpath/packages -__TOOLRUNTIME_DIR=$__scriptpath/Tools -__DOTNET_PATH=$__TOOLRUNTIME_DIR/dotnetcli -__DOTNET_CMD=$__DOTNET_PATH/bin/dotnet -if [ -z "$__BUILDTOOLS_SOURCE" ]; then __BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json; fi -__BUILD_TOOLS_PACKAGE_VERSION=$(cat $__scriptpath/BuildToolsVersion.txt) -__DOTNET_TOOLS_VERSION=$(cat $__scriptpath/DotnetCLIVersion.txt) -__BUILD_TOOLS_PATH=$__PACKAGES_DIR/Microsoft.DotNet.BuildTools/$__BUILD_TOOLS_PACKAGE_VERSION/lib -__PROJECT_JSON_PATH=$__TOOLRUNTIME_DIR/$__BUILD_TOOLS_PACKAGE_VERSION -__PROJECT_JSON_FILE=$__PROJECT_JSON_PATH/project.json -__PROJECT_JSON_CONTENTS="{ \"dependencies\": { \"Microsoft.DotNet.BuildTools\": \"$__BUILD_TOOLS_PACKAGE_VERSION\" }, \"frameworks\": { \"dnxcore50\": { } } }" - -OSName=$(uname -s) -case $OSName in - Darwin) - OS=OSX - __DOTNET_PKG=dotnet-osx-x64 - ulimit -n 2048 - ;; - - Linux) - OS=Linux - source /etc/os-release - if [ "$ID" == "centos" -o "$ID" == "rhel" ]; then - __DOTNET_PKG=dotnet-centos-x64 - elif [ "$ID" == "ubuntu" -o "$ID" == "debian" ]; then - __DOTNET_PKG=dotnet-ubuntu-x64 - else - echo "Unsupported Linux distribution '$ID' detected. Downloading ubuntu-x64 tools." - __DOTNET_PKG=dotnet-ubuntu-x64 - fi - ;; - - *) - echo "Unsupported OS '$OSName' detected. Downloading ubuntu-x64 tools." - OS=Linux - __DOTNET_PKG=dotnet-ubuntu-x64 - ;; -esac - -if [ ! -e $__PROJECT_JSON_FILE ]; then - if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi - echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log - if [ ! -e $__DOTNET_PATH ]; then - echo "Installing dotnet cli..." - __DOTNET_LOCATION="https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/${__DOTNET_TOOLS_VERSION}/${__DOTNET_PKG}.${__DOTNET_TOOLS_VERSION}.tar.gz" - # curl has HTTPS CA trust-issues less often than wget, so lets try that first. - echo "Installing '${__DOTNET_LOCATION}' to '$__DOTNET_PATH/dotnet.tar'" >> $__init_tools_log - which curl > /dev/null 2> /dev/null - if [ $? -ne 0 ]; then - mkdir -p "$__DOTNET_PATH" - wget -q -O $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION} - else - curl -sSL --create-dirs -o $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION} - fi - cd $__DOTNET_PATH - tar -xf $__DOTNET_PATH/dotnet.tar - if [ -n "$BUILDTOOLS_OVERRIDE_RUNTIME" ]; then - find $__DOTNET_PATH -name *.ni.* | xargs rm 2>/dev/null - cp -R $BUILDTOOLS_OVERRIDE_RUNTIME/* $__DOTNET_PATH/bin - cp -R $BUILDTOOLS_OVERRIDE_RUNTIME/* $__DOTNET_PATH/bin/dnx - cp -R $BUILDTOOLS_OVERRIDE_RUNTIME/* $__DOTNET_PATH/runtime/coreclr - fi - - cd $__scriptpath - fi - - if [ ! -d "$__PROJECT_JSON_PATH" ]; then mkdir "$__PROJECT_JSON_PATH"; fi - echo $__PROJECT_JSON_CONTENTS > "$__PROJECT_JSON_FILE" - - if [ ! -e $__BUILD_TOOLS_PATH ]; then - echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..." - echo "Running: $__DOTNET_CMD restore \"$__PROJECT_JSON_FILE\" --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE" >> $__init_tools_log - $__DOTNET_CMD restore "$__PROJECT_JSON_FILE" --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE >> $__init_tools_log - if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."; fi - fi - - echo "Initializing BuildTools..." - echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR" >> $__init_tools_log - $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log - echo "Done initializing tools." -else - echo "Tools are already initialized" -fi diff --git a/pkg/pack.cmd b/pkg/pack.cmd deleted file mode 100644 index 96ce7a682..000000000 --- a/pkg/pack.cmd +++ /dev/null @@ -1,85 +0,0 @@ -@echo off -setlocal EnableDelayedExpansion - -set __ProjectDir=%~dp0 -set __ThisScriptShort=%0 -set __ThisScriptFull="%~f0" - -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Adding environment variables to workaround the "Argument Escape" problem with passing arguments to -:: .cmd calls from dotnet-cli-build scripts. -:: -set __BuildArch=%__WorkaroundCliCoreHostBuildArch% -set __DotNetHostBinDir=%__WorkaroundCliCoreHostBinDir% -set __HostVer=%__WorkaroundCliCoreHostVer% -set __FxrVer=%__WorkaroundCliCoreHostFxrVer% -set __PolicyVer=%__WorkaroundCliCoreHostPolicyVer% -set __BuildMajor=%__WorkaroundCliCoreHostBuildMajor% -set __BuildMinor=%__WorkaroundCliCoreHostBuildMinor% -set __VersionTag=%__WorkaroundCliCoreHostVersionTag% -:: -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -:Arg_Loop -if "%1" == "" goto ArgsDone - -if /i "%1" == "/?" goto Usage -if /i "%1" == "-?" goto Usage -if /i "%1" == "/h" goto Usage -if /i "%1" == "-h" goto Usage -if /i "%1" == "/help" goto Usage -if /i "%1" == "-help" goto Usage - -if /i "%1" == "x64" (set __BuildArch=%1&shift&goto Arg_Loop) -if /i "%1" == "x86" (set __BuildArch=%1&shift&goto Arg_Loop) -if /i "%1" == "arm" (set __BuildArch=%1&shift&goto Arg_Loop) -if /i "%1" == "arm64" (set __BuildArch=%1&shift&goto Arg_Loop) -if /i "%1" == "/hostbindir" (set __DotNetHostBinDir=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/hostver" (set __HostVer=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/fxrver" (set __FxrVer=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/policyver" (set __PolicyVer=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/buildmajor" (set __BuildMajor=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/buildminor" (set __BuildMinor=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/vertag" (set __VersionTag=%2&shift&shift&goto Arg_Loop) - -echo Invalid command line argument: %1 -goto Usage - -:ArgsDone - -if [%__BuildArch%]==[] (goto Usage) -if [%__DotNetHostBinDir%]==[] (goto Usage) - -:: Initialize the MSBuild Tools -call "%__ProjectDir%\init-tools.cmd" - -:: Restore dependencies mainly to obtain runtime.json -pushd "%__ProjectDir%\deps" -"%__ProjectDir%\Tools\dotnetcli\bin\dotnet.exe" restore --source "https://dotnet.myget.org/F/dotnet-core" --packages "%__ProjectDir%\packages" -popd - -:: Clean up existing nupkgs -if exist "%__ProjectDir%\bin" (rmdir /s /q "%__ProjectDir%\bin") - -:: Package the assets using Tools - -copy /y "%__DotNetHostBinDir%\corehost.exe" "%__DotNetHostBinDir%\dotnet.exe" - -"%__ProjectDir%\Tools\corerun" "%__ProjectDir%\Tools\MSBuild.exe" "%__ProjectDir%\projects\packages.builds" /p:Platform=%__BuildArch% /p:DotNetHostBinDir=%__DotNetHostBinDir% /p:TargetsWindows=true /p:HostVersion=%__HostVer% /p:HostResolverVersion=%__FxrVer% /p:HostPolicyVersion=%__PolicyVer% /p:BuildNumberMajor=%__BuildMajor% /p:BuildNumberMinor=%__BuildMinor% /p:PreReleaseLabel=%__VersionTag% /p:CLIBuildVersion=%__BuildMajor% /verbosity:minimal - -if not ERRORLEVEL 0 goto :Error - -exit /b 0 - -:Usage -echo. -echo Package the dotnet host artifacts -echo. -echo Usage: -echo %__ThisScriptShort% [x64/x86/arm] /hostbindir path-to-binaries /hostver /fxrver /policyver /build /vertag -echo. -echo./? -? /h -h /help -help: view this message. - -:Error -echo An error occurred during packing. -exit /b 1 diff --git a/pkg/pack.sh b/pkg/pack.sh deleted file mode 100755 index 0199918f6..000000000 --- a/pkg/pack.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env bash - -usage() -{ - echo "Usage: ${BASH_SOURCE[0]} --arch x64/x86/arm --hostbindir path-to-binaries" --hostver --fxrver --policyver --build --vertag - exit 1 -} - -init_distro_name() -{ - # Detect Distro - if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then - export __distro_name=ubuntu - elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then - export __distro_name=rhel - elif [ "$(cat /etc/*-release | grep -cim1 rhel)" -eq 1 ]; then - export __distro_name=rhel - elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then - export __distro_name=debian - else - export __distro_name="" - fi -} - -set -e - -# determine current directory -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done - -# initialize variables -__project_dir="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -__build_arch= -__dotnet_host_bin_dir= -__distro_name= -__host_ver= -__fxr_ver= -__policy_ver= -__build_major= -__build_minor= -__version_tag= - -# parse arguments -while [ "$1" != "" ]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -h|--help) - usage - exit 1 - ;; - --arch) - shift - __build_arch=$1 - ;; - --hostbindir) - shift - __dotnet_host_bin_dir=$1 - ;; - --hostver) - shift - __host_ver=$1 - ;; - --fxrver) - shift - __fxr_ver=$1 - ;; - --policyver) - shift - __policy_ver=$1 - ;; - --build-major) - shift - __build_major=$1 - ;; - --build-minor) - shift - __build_minor=$1 - ;; - --vertag) - shift - __version_tag=$1 - ;; - *) - echo "Unknown argument to pack.sh $1"; exit 1 - esac - shift -done - -# validate args -if [ -z $__dotnet_host_bin_dir ]; then - usage -fi -if [ -z $__build_arch ]; then - usage -fi - -# setup msbuild -"$__project_dir/init-tools.sh" - -# acquire dependencies -pushd "$__project_dir/deps" -"$__project_dir/Tools/dotnetcli/bin/dotnet" restore --source "https://dotnet.myget.org/F/dotnet-core" --packages "$__project_dir/packages" -popd - -# cleanup existing packages -rm -rf $__project_dir/bin - -# build to produce nupkgs -__corerun="$__project_dir/Tools/corerun" -__msbuild="$__project_dir/Tools/MSBuild.exe" - -__targets_param= -if [ "$(uname -s)" == "Darwin" ]; then - __targets_param="TargetsOSX=true" -else - __targets_param="TargetsLinux=true" - init_distro_name -fi - -__common_parameters="/p:Platform=$__build_arch /p:DotNetHostBinDir=$__dotnet_host_bin_dir /p:$__targets_param /p:DistroName=$__distro_name /p:HostVersion=$__host_ver /p:HostResolverVersion=$__fxr_ver /p:HostPolicyVersion=$__policy_ver /p:BuildNumberMajor=$__build_major /p:BuildNumberMinor=$__build_minor /p:PreReleaseLabel=$__version_tag /p:CLIBuildVersion=$__build_major /verbosity:minimal" - -$__corerun $__msbuild $__project_dir/projects/packages.builds $__common_parameters || exit 1 - -cp -rf "$__project_dir/bin/packages" "$__dotnet_host_bin_dir" - -exit 0 diff --git a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds b/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds deleted file mode 100644 index be7a99d55..000000000 --- a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.pkgproj b/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.pkgproj deleted file mode 100644 index 3cea429e9..000000000 --- a/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.pkgproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - 1.0.0 - AnyCPU - - - - - .NETStandard1.0 - - - - - - - - - - - $([System.Text.RegularExpressions.Regex]::Match('%(Identity)', '(\w[^:"]*)')) - $([System.Text.RegularExpressions.Regex]::Match('%(Identity)', '(\d+\.\d+.\d+[^"]*)')) - - - - %(PackageVersion) - .NETStandard1.0 - - - - - Compile - - - Compile - - - Compile - - - - - -rc3-$(CLIBuildVersion) - - - - - \ No newline at end of file diff --git a/pkg/projects/Microsoft.NETCore.App/project.json b/pkg/projects/Microsoft.NETCore.App/project.json deleted file mode 100644 index c3e65392d..000000000 --- a/pkg/projects/Microsoft.NETCore.App/project.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "dependencies": { - "Microsoft.CodeAnalysis.CSharp": "1.3.0-beta1-20160429-01", - "Microsoft.CodeAnalysis.VisualBasic": "1.3.0-beta1-20160429-01", - "Microsoft.CSharp": "4.0.1-rc3-24123-01", - "Microsoft.NETCore.Runtime": "1.0.2-rc3-24123-01", - "Microsoft.VisualBasic": "10.0.1-rc3-24123-01", - "NETStandard.Library": "1.5.0-rc3-24123-01", - "System.Buffers": "4.0.0-rc3-24123-01", - "System.Collections.Immutable": "1.2.0-rc3-24123-01", - "System.ComponentModel": "4.0.1-rc3-24123-01", - "System.ComponentModel.Annotations": "4.1.0-rc3-24123-01", - "System.Diagnostics.DiagnosticSource": "4.0.0-rc3-24123-01", - "System.Diagnostics.Process": "4.1.0-rc3-24123-01", - "System.Dynamic.Runtime": "4.0.11-rc3-24123-01", - "System.Globalization.Extensions": "4.0.1-rc3-24123-01", - "System.IO.FileSystem.Watcher": "4.0.0-rc3-24123-01", - "System.IO.MemoryMappedFiles": "4.0.0-rc3-24123-01", - "System.IO.UnmanagedMemoryStream": "4.0.1-rc3-24123-01", - "System.Linq.Expressions": "4.1.0-rc3-24123-01", - "System.Linq.Parallel": "4.0.1-rc3-24123-01", - "System.Linq.Queryable": "4.0.1-rc3-24123-01", - "System.Net.NameResolution": "4.0.0-rc3-24123-01", - "System.Net.Requests": "4.0.11-rc3-24123-01", - "System.Net.Security": "4.0.0-rc3-24123-01", - "System.Net.WebHeaderCollection": "4.0.1-rc3-24123-01", - "System.Numerics.Vectors": "4.1.1-rc3-24123-01", - "System.Reflection.DispatchProxy": "4.0.1-rc3-24123-01", - "System.Reflection.Metadata": "1.3.0-rc3-24123-01", - "System.Reflection.TypeExtensions": "4.1.0-rc3-24123-01", - "System.Resources.Reader": "4.0.0-rc3-24123-01", - "System.Runtime.Loader": "4.0.0-rc3-24123-01", - "System.Security.Cryptography.Algorithms": "4.2.0-rc3-24123-01", - "System.Security.Cryptography.Encoding": "4.0.0-rc3-24123-01", - "System.Security.Cryptography.Primitives": "4.0.0-rc3-24123-01", - "System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24123-01", - "System.Threading.Tasks.Dataflow": "4.6.0-rc3-24123-01", - "System.Threading.Tasks.Extensions": "4.0.0-rc3-24123-01", - "System.Threading.Tasks.Parallel": "4.0.1-rc3-24123-01", - "System.Threading.Thread": "4.0.0-rc3-24123-01", - "System.Threading.ThreadPool": "4.0.10-rc3-24123-01" - }, - "frameworks": { - "netstandard1.5": {} - } -} diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.builds b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.builds deleted file mode 100644 index 343f13d78..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.builds +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - $(PackageOutputPath) - - - - - - - - Windows_NT - amd64 - - - Windows_NT - x86 - - - Linux - amd64 - - - Linux - amd64 - - - Linux - amd64 - - - OSX - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index 68795510c..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - $(HostVersion) - true - true - x64;x86; - $(PackagesOutputPath) - true - - - - - amd64 - - - x86 - - - amd64 - - - amd64 - - - amd64 - - - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.builds b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.builds deleted file mode 100644 index e2329abb5..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.builds +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - $(PackageOutputPath) - - - - - - - - Windows_NT - amd64 - - - Windows_NT - x86 - - - Linux - amd64 - - - Linux - amd64 - - - Linux - amd64 - - - OSX - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index ac3edf397..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - true - x64;x86; - $(PackagesOutputPath) - true - - - - - $(HostResolverFullVersion) - - - amd64 - - - x86 - - - amd64 - - - amd64 - - - amd64 - - - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.builds b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.builds deleted file mode 100644 index 0bcc0bd6c..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.builds +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - $(PackageOutputPath) - - - - - - - - Windows_NT - amd64 - - - Windows_NT - x86 - - - Linux - amd64 - - - Linux - amd64 - - - Linux - amd64 - - - OSX - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index b9a830ced..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - $(HostResolverVersion) - true - true - x64;x86; - $(PackagesOutputPath) - true - - - - - $(HostFullVersion) - - - amd64 - - - x86 - - - amd64 - - - amd64 - - - amd64 - - - amd64 - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index 4d3c1b9f5..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - $(HostVersion) - true - debian.8 - $(MinOSForArch)-$(PackagePlatform) - - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index e3e42e875..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - debian.8 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostResolverFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index 15624d978..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/debian/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostResolverVersion) - true - debian.8 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index 57818c5eb..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - $(HostVersion) - true - osx.10.10 - $(MinOSForArch)-$(PackagePlatform) - - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index 485110ab3..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - osx.10.10 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostResolverFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index ab858cbeb..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/osx/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostResolverVersion) - true - osx.10.10 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index 555abf911..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - $(HostVersion) - true - rhel.7 - $(MinOSForArch)-$(PackagePlatform) - - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index f5c84156c..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - rhel.7 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostResolverFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index 0e6650e04..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/rhel/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostResolverVersion) - true - rhel.7 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index d53ac003a..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - $(HostVersion) - true - ubuntu.14.04 - $(MinOSForArch)-$(PackagePlatform) - - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index 3613a42a7..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - ubuntu.14.04 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostResolverFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index 93274f7e0..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/ubuntu/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - $(HostResolverVersion) - true - ubuntu.14.04 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHost.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHost.pkgproj deleted file mode 100644 index d554a3885..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHost.pkgproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - $(HostVersion) - true - win7 - win8 - $(MinOSForArch)-$(PackagePlatform) - - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostPolicy.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostPolicy.pkgproj deleted file mode 100644 index 8fca779c1..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostPolicy.pkgproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - $(HostPolicyVersion) - true - win7 - win8 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostResolverFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - - diff --git a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostResolver.pkgproj b/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostResolver.pkgproj deleted file mode 100644 index 309bdcaa4..000000000 --- a/pkg/projects/Microsoft.NETCore.DotNetHost/win/Microsoft.NETCore.DotNetHostResolver.pkgproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - $(HostResolverVersion) - true - win7 - win8 - $(MinOSForArch)-$(PackagePlatform) - - - - - $(HostFullVersion) - - - - - - runtimes/$(PackageTargetRuntime)/native - - - - - - - diff --git a/pkg/projects/ThirdPartyNotices.txt b/pkg/projects/ThirdPartyNotices.txt deleted file mode 100644 index 55cfb2081..000000000 --- a/pkg/projects/ThirdPartyNotices.txt +++ /dev/null @@ -1,31 +0,0 @@ -This Microsoft .NET Library may incorporate components from the projects listed -below. Microsoft licenses these components under the Microsoft .NET Library -software license terms. The original copyright notices and the licenses under -which Microsoft received such components are set forth below for informational -purposes only. Microsoft reserves all rights not expressly granted herein, -whether by implication, estoppel or otherwise. - -1. .NET Core (https://github.com/dotnet/core/) - -.NET Core -Copyright (c) .NET Foundation and Contributors - -The MIT License (MIT) - -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. \ No newline at end of file diff --git a/pkg/projects/descriptions.json b/pkg/projects/descriptions.json deleted file mode 100644 index e4b13d25c..000000000 --- a/pkg/projects/descriptions.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "Name": "RuntimePackage", - "Description": "Internal implementation package not meant for direct consumption. Please do not reference directly.", - "CommonTypes": [ ] - }, - { - "Name": "Microsoft.NETCore.DotNetHostPolicy", - "Description": "Provides a CoreCLR hosting policy implementation -- configuration settings, assembly paths and assembly servicing", - "CommonTypes": [ ] - }, - { - "Name": "Microsoft.NETCore.DotNetHostResolver", - "Description": "Provides an implementation of framework resolution strategy used by Microsoft.NETCore.DotNetHost", - "CommonTypes": [ ] - }, - { - "Name": "Microsoft.NETCore.DotNetHost", - "Description": "Provides an executable implementation of the Microsoft DotNet Framework and SDK launcher module", - "CommonTypes": [ ] - }, - { - "Name": "Microsoft.NETCore.App", - "Description": "A set of .NET API's that are included in the default .NET Core application model.", - "CommonTypes": [ ] - }, -] diff --git a/pkg/projects/dotnet_library_license.txt b/pkg/projects/dotnet_library_license.txt deleted file mode 100644 index 92b6c443d..000000000 --- a/pkg/projects/dotnet_library_license.txt +++ /dev/null @@ -1,128 +0,0 @@ - -MICROSOFT SOFTWARE LICENSE TERMS - - -MICROSOFT .NET LIBRARY - -These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft - -· updates, - -· supplements, - -· Internet-based services, and - -· support services - -for this software, unless other terms accompany those items. If so, those terms apply. - -BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. - - -IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW. - -1. INSTALLATION AND USE RIGHTS. - -a. Installation and Use. You may install and use any number of copies of the software to design, develop and test your programs. - -b. Third Party Programs. The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only. - -2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS. - -a. DISTRIBUTABLE CODE. The software is comprised of Distributable Code. “Distributable Code” is code that you are permitted to distribute in programs you develop if you comply with the terms below. - -i. Right to Use and Distribute. - -· You may copy and distribute the object code form of the software. - -· Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs. - -ii. Distribution Requirements. For any Distributable Code you distribute, you must - -· add significant primary functionality to it in your programs; - -· require distributors and external end users to agree to terms that protect it at least as much as this agreement; - -· display your valid copyright notice on your programs; and - -· indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs. - -iii. Distribution Restrictions. You may not - -· alter any copyright, trademark or patent notice in the Distributable Code; - -· use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft; - -· include Distributable Code in malicious, deceptive or unlawful programs; or - -· modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that - -· the code be disclosed or distributed in source code form; or - -· others have the right to modify it. - -3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not - -· work around any technical limitations in the software; - -· reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation; - -· publish the software for others to copy; - -· rent, lease or lend the software; - -· transfer the software or this agreement to any third party; or - -· use the software for commercial software hosting services. - -4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software. - -5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes. - -6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting. - -7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it. - -8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services. - -9. APPLICABLE LAW. - -a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort. - -b. Outside the United States. If you acquired the software in any other country, the laws of that country apply. - -10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so. - -11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - -FOR AUSTRALIA – YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS. - -12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES. - -This limitation applies to - -· anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and - -· claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law. - -It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages. - -Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French. - -Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français. - -EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues. - -LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. - -Cette limitation concerne : - -· tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et - -· les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur. - -Elle s’applique également, même si Microsoft connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard. - -EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas. - - diff --git a/pkg/projects/packages.builds b/pkg/projects/packages.builds deleted file mode 100644 index 0b000500d..000000000 --- a/pkg/projects/packages.builds +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/scripts/package/package-sharedframework-debian.sh b/scripts/package/package-sharedframework-debian.sh deleted file mode 100755 index aad8101c2..000000000 --- a/scripts/package/package-sharedframework-debian.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -# Debian Packaging Script -# Currently Intended to build on ubuntu14.04 - -set -e - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -source "$DIR/../common/_common.sh" -REPOROOT="$DIR/../.." - -help(){ - echo "Usage: $0" - echo "" - echo "Options:" - echo " --input Package the entire contents of the directory tree." - echo " --output The full path to which the package will be written." - echo " --package-name Package to identify during installation. Example - 'dotnet-sharedframework'" - echo " --brand-name Brand name of the package, used for 'short_description' of the deb file. Example - '.NET Core'" - echo " --framework-nuget-name The name of the nuget package that produced this shared framework." - echo " --framework-nuget-version The versionf of the nuget package that produced this shared framework." - echo " --obj-root Root folder for intermediate objects." - echo " --version Version for the debain package." - exit 1 -} - -while [[ $# > 0 ]]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -o|--output) - OUTPUT_DEBIAN_FILE=$2 - shift - ;; - -i|--input) - REPO_BINARIES_DIR=$2 - shift - ;; - -p|--package-name) - SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME=$2 - shift - ;; - -b|--brand-name) - SHARED_FRAMEWORK_BRAND_NAME=$2 - shift - ;; - --framework-nuget-name) - SHARED_FRAMEWORK_NUGET_NAME=$2 - shift - ;; - --framework-nuget-version) - SHARED_FRAMEWORK_NUGET_VERSION=$2 - shift - ;; - --obj-root) - OBJECT_DIR=$2 - shift - ;; - --version) - SHARED_FRAMEWORK_DEBIAN_VERSION=$2 - shift - ;; - --help) - help - ;; - *) - break - ;; - esac - shift -done - -PACKAGING_ROOT="$REPOROOT/packaging/sharedframework/debian" -PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" - -PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" -PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" -TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" - -execute_build(){ - create_empty_debian_layout - copy_files_to_debian_layout - update_debian_json - create_debian_package -} - -create_empty_debian_layout(){ - header "Creating empty debian package layout" - - rm -rf "$PACKAGE_LAYOUT_DIR" - mkdir -p "$PACKAGE_LAYOUT_DIR" - - mkdir "$PACKAGE_LAYOUT_DIR/\$" - mkdir "$PACKAGE_LAYOUT_DIR/package_root" - mkdir "$PACKAGE_LAYOUT_DIR/samples" - mkdir "$PACKAGE_LAYOUT_DIR/docs" -} - -copy_files_to_debian_layout(){ - header "Copying files to debian layout" - - # Copy Built Binaries - cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root" - - # Copy config file - cp "$PACKAGING_ROOT/dotnet-sharedframework-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json" -} - -create_debian_package(){ - header "Packing .deb" - - mkdir -p "$PACKAGE_OUTPUT_DIR" - - "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -n "$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME" -v "$SHARED_FRAMEWORK_DEBIAN_VERSION" -} - -update_debian_json() -{ - header "Updating debian.json file" - sed -i "s/%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%/$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SHARED_FRAMEWORK_NUGET_NAME%/$SHARED_FRAMEWORK_NUGET_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SHARED_FRAMEWORK_NUGET_VERSION%/$SHARED_FRAMEWORK_NUGET_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json - sed -i "s/%SHARED_FRAMEWORK_BRAND_NAME%/$SHARED_FRAMEWORK_BRAND_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json -} - -test_debian_package(){ - header "Testing debian Shared Framework package" - - install_bats - run_package_integrity_tests -} - -install_bats() { - rm -rf $TEST_STAGE_DIR - git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR -} - -run_package_integrity_tests() { - # Set LAST_VERSION_URL to enable upgrade tests - # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" - - $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats -} - -execute_build - -DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") - -test_debian_package - -mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/scripts/package/package-sharedhost-debian.sh b/scripts/package/package-sharedhost-debian.sh deleted file mode 100755 index 64e6f1347..000000000 --- a/scripts/package/package-sharedhost-debian.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -# Debian Packaging Script -# Currently Intended to build on ubuntu14.04 - -set -e - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -source "$DIR/../common/_common.sh" -REPOROOT="$DIR/../.." - -help(){ - echo "Usage: $0" - echo "" - echo "Options:" - echo " --input Package the entire contents of the directory tree." - echo " --output The full path to which the package will be written." - echo " --package-name Package to identify during installation. Example - 'dotnet-sharedhost'" - echo " --brand-name Brand name of the package, used for 'short_description' of the deb file. Example - '.NET Core Host'" - echo " --obj-root Root folder for intermediate objects." - echo " --version Version for the debain package." - exit 1 -} - -while [[ $# > 0 ]]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -o|--output) - OUTPUT_DEBIAN_FILE=$2 - shift - ;; - -i|--input) - REPO_BINARIES_DIR=$2 - shift - ;; - -p|--package-name) - SHARED_HOST_DEBIAN_PACKAGE_NAME=$2 - shift - ;; - -b|--brand-name) - SHARED_HOST_BRAND_NAME=$2 - shift - ;; - --obj-root) - OBJECT_DIR=$2 - shift - ;; - --version) - SHARED_HOST_DEBIAN_VERSION=$2 - shift - ;; - --help) - help - ;; - -m|--manpages) - MANPAGE_DIR=$2 - shift - ;; - *) - break - ;; - esac - shift -done - -PACKAGING_ROOT="$REPOROOT/packaging/host/debian" -PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" - -PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" -PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" -TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" - -execute_build(){ - create_empty_debian_layout - copy_files_to_debian_layout - update_debian_json - create_debian_package -} - -create_empty_debian_layout(){ - header "Creating empty debian package layout" - - rm -rf "$PACKAGE_LAYOUT_DIR" - mkdir -p "$PACKAGE_LAYOUT_DIR" - - mkdir "$PACKAGE_LAYOUT_DIR/\$" - mkdir "$PACKAGE_LAYOUT_DIR/package_root" - mkdir "$PACKAGE_LAYOUT_DIR/samples" - mkdir "$PACKAGE_LAYOUT_DIR/docs" -} - -copy_files_to_debian_layout(){ - header "Copying files to debian layout" - - # Copy Built Binaries - cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root" - - # Copy config file - cp "$PACKAGING_ROOT/dotnet-sharedhost-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json" - - # Copy Manpages - cp -a "$MANPAGE_DIR/host/." "$PACKAGE_LAYOUT_DIR/docs" -} - -create_debian_package(){ - header "Packing .deb" - - mkdir -p "$PACKAGE_OUTPUT_DIR" - - "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -n "$SHARED_HOST_DEBIAN_PACKAGE_NAME" -v "$SHARED_HOST_DEBIAN_VERSION" -} - -update_debian_json() -{ - header "Updating debian.json file" - sed -i "s/%SHARED_HOST_BRAND_NAME%/$SHARED_HOST_BRAND_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json -} - -test_debian_package(){ - header "Testing debian Shared Host package" - - install_bats - run_package_integrity_tests -} - -install_bats() { - rm -rf $TEST_STAGE_DIR - git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR -} - -run_package_integrity_tests() { - # Set LAST_VERSION_URL to enable upgrade tests - # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" - - $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats -} - -execute_build - -DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") - -test_debian_package - -mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/scripts/package/projectsToPack.ps1 b/scripts/package/projectsToPack.ps1 deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/update-dependencies/UpdateFilesTargets.cs b/scripts/update-dependencies/UpdateFilesTargets.cs index bac6181f0..1be4b5642 100644 --- a/scripts/update-dependencies/UpdateFilesTargets.cs +++ b/scripts/update-dependencies/UpdateFilesTargets.cs @@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Scripts return c.Success(); } - [Target(nameof(ReplaceProjectJson), nameof(ReplaceCrossGen), nameof(ReplaceCoreHostPackaging))] + [Target(nameof(ReplaceProjectJson), nameof(ReplaceCrossGen))] public static BuildTargetResult ReplaceVersions(BuildTargetContext c) => c.Success(); /// @@ -190,7 +190,7 @@ namespace Microsoft.DotNet.Scripts [Target] public static BuildTargetResult ReplaceCrossGen(BuildTargetContext c) { - ReplaceFileContents(@"build_projects\dotnet-cli-build\CompileTargets.cs", compileTargetsContent => + ReplaceFileContents(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", compileTargetsContent => { DependencyInfo coreFXInfo = c.GetCoreFXDependency(); Regex regex = new Regex(@"CoreCLRVersion = ""(?\d.\d.\d)-(?.*)"";"); @@ -201,23 +201,6 @@ namespace Microsoft.DotNet.Scripts return c.Success(); } - /// - /// Replaces version number that is hard-coded in the corehost packaging dir.props file. - /// - [Target] - public static BuildTargetResult ReplaceCoreHostPackaging(BuildTargetContext c) - { - ReplaceFileContents(@"pkg\dir.props", contents => - { - DependencyInfo coreFXInfo = c.GetCoreFXDependency(); - Regex regex = new Regex(@"Microsoft\.NETCore\.Platforms\\(?\d\.\d\.\d)-(?.*)\\runtime\.json"); - - return regex.ReplaceGroupValue(contents, "release", coreFXInfo.NewReleaseVersion); - }); - - return c.Success(); - } - private static DependencyInfo GetCoreFXDependency(this BuildTargetContext c) { return c.GetDependencyInfos().Single(d => d.Name == "CoreFx"); diff --git a/src/compilers/project.json b/src/compilers/project.json index 2af0f5599..7fbfea77c 100644 --- a/src/compilers/project.json +++ b/src/compilers/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.CodeAnalysis.CSharp": "1.3.0-beta1-20160429-01", "Microsoft.Net.Compilers.netcore": "1.3.0-beta1-20160429-01", diff --git a/src/corehost/CMakeLists.txt b/src/corehost/CMakeLists.txt deleted file mode 100644 index 0a76ce4f4..000000000 --- a/src/corehost/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -add_subdirectory(cli) diff --git a/src/corehost/build.sh b/src/corehost/build.sh deleted file mode 100755 index 443a4322b..000000000 --- a/src/corehost/build.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env bash - -# Why is this a separate script? Why not just invoke 'cmake' and 'make' in the C# build scripts themselves? -# I really don't know, but it doesn't work when I do that. Something about SIGCHLD not getting from clang to cmake or something. -# -anurse - -init_distro_name_and_rid() -{ - # Detect Distro - if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then - export __distro_name=ubuntu - export __rid_plat=ubuntu.14.04 - elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then - export __distro_name=rhel - export __rid_plat=centos.7 - elif [ "$(cat /etc/*-release | grep -cim1 rhel)" -eq 1 ]; then - export __distro_name=rhel - export __rid_plat=rhel.7 - elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then - export __distro_name=debian - export __rid_plat=debian.8 - else - export __distro_name="" - export __rid_plat= - fi -} - -usage() -{ - echo "Usage: $0 --arch --rid --hostver --fxrver --policyver --commithash [--xcompiler ]" - echo "" - echo "Options:" - echo " --arch Target Architecture (amd64, x86, arm)" - echo " --rid Target Runtime Identifier" - echo " --hostver Version of the dotnet executable" - echo " --fxrver Version of the hostfxr library" - echo " --policyver Version of the hostpolicy library" - echo " --commithash Current commit hash of the repo at build time" - echo " --xcompiler Cross Compiler when the target is arm" - echo " e.g.) /usr/bin/arm-linux-gnueabi-g++-4.7" - - exit 1 -} - -set -e - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -__build_arch= -__runtime_id= -__host_ver= -__policy_ver= -__fxr_ver= -__CrossBuild=0 -__commit_hash= - -while [ "$1" != "" ]; do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -h|--help) - usage - exit 1 - ;; - --arch) - shift - __build_arch=$1 - ;; - --rid) - shift - __runtime_id=$1 - ;; - --hostver) - shift - __host_ver=$1 - ;; - --fxrver) - shift - __fxr_ver=$1 - ;; - --policyver) - shift - __policy_ver=$1 - ;; - --commithash) - shift - __commit_hash=$1 - ;; - --xcompiler) - shift - __CrossCompiler="$1" - __CrossBuild=1 - ;; - *) - echo "Unknown argument to build.sh $1"; exit 1 - esac - shift -done - -__cmake_defines= - -case $__build_arch in - amd64|x64) - __arch_define=-DCLI_CMAKE_PLATFORM_ARCH_AMD64=1 - ;; - x86) - __arch_define=-DCLI_CMAKE_PLATFORM_ARCH_I386=1 - ;; - arm) - __arch_define=-DCLI_CMAKE_PLATFORM_ARCH_ARM=1 - ;; - *) - echo "Unknown architecture $__build_arch"; exit 1 - ;; -esac -__cmake_defines="${__cmake_defines} ${__arch_define}" - - -# __rid_plat is the base RID that corehost is shipped for, effectively, the name of the folder in "runtimes/{__rid_plat}/native/" inside the nupkgs. -__rid_plat= -if [ "$(uname -s)" == "Darwin" ]; then - __rid_plat=osx.10.10 -else - init_distro_name_and_rid -fi - -if [ -z $__rid_plat ]; then - echo "Unknown base rid (eg.: osx.10.10, ubuntu.14.04) being targeted" - exit -1 -fi - -if [-z $__commit_hash ]; then - echo "Commit hash was not specified" - exit -1 -fi - -__build_arch_lowcase=$(echo "$__build_arch" | tr '[:upper:]' '[:lower:]') -__base_rid=$__rid_plat-$__build_arch_lowcase - -echo "Building Corehost from $DIR to $(pwd)" -set -x # turn on trace -if [ $__CrossBuild == 1 ]; then - cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_VER:STRING=$__host_ver -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash -DCMAKE_CXX_COMPILER="$__CrossCompiler" -else - cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_VER:STRING=$__host_ver -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash -fi -set +x # turn off trace -make diff --git a/src/corehost/cli/CMakeLists.txt b/src/corehost/cli/CMakeLists.txt deleted file mode 100644 index 03f3651ad..000000000 --- a/src/corehost/cli/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -cmake_minimum_required (VERSION 2.6) -project (corehost) - -if(WIN32) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MTd>) -else() - add_compile_options(-fPIE) -endif() - -include(setup.cmake) - -set (CMAKE_CXX_STANDARD 11) - -include_directories(..) -include_directories(../common) -include_directories(.) -include_directories(./fxr) -include_directories(./json/casablanca/include) - -# CMake does not recommend using globbing since it messes with the freshness checks -set(SOURCES - - #deps_format.cpp - #./json/casablanca/src/json/json.cpp - #./json/casablanca/src/json/json_parsing.cpp - #./json/casablanca/src/json/json_serialization.cpp - #./json/casablanca/src/utilities/asyncrt_utils.cpp - - - ./fxr/fx_ver.cpp - ../corehost.cpp - ../common/trace.cpp - ../common/utils.cpp) - - -if(WIN32) - list(APPEND SOURCES ../common/pal.windows.cpp) -else() - list(APPEND SOURCES ../common/pal.unix.cpp) -endif() - -add_executable(dotnet ${SOURCES}) -install(TARGETS dotnet DESTINATION bin) -add_definitions(-D_NO_ASYNCRTIMP) -add_definitions(-D_NO_PPLXIMP) - -# Older CMake doesn't support CMAKE_CXX_STANDARD and GCC/Clang need a switch to enable C++ 11 -if(${CMAKE_CXX_COMPILER_ID} MATCHES "(Clang|GNU)") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif() - -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - add_definitions(-D__LINUX__) - target_link_libraries (dotnet "dl" "pthread") -endif() - -add_subdirectory(dll) -add_subdirectory(fxr) diff --git a/src/corehost/cli/args.cpp b/src/corehost/cli/args.cpp deleted file mode 100644 index 246728e0e..000000000 --- a/src/corehost/cli/args.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "args.h" -#include "utils.h" -#include "coreclr.h" -#include "libhost.h" - -arguments_t::arguments_t() : - managed_application(_X("")), - own_path(_X("")), - app_dir(_X("")), - app_argc(0), - app_argv(nullptr), - dotnet_packages_cache(_X("")), - core_servicing(_X("")), - deps_path(_X("")) -{ -} - -bool parse_arguments( - const pal::string_t& deps_path, - const std::vector& probe_paths, - host_mode_t mode, - const int argc, const pal::char_t* argv[], arguments_t* arg_out) -{ - arguments_t& args = *arg_out; - // Get the full name of the application - if (!pal::get_own_executable_path(&args.own_path) || !pal::realpath(&args.own_path)) - { - trace::error(_X("Failed to resolve full path of the current executable [%s]"), args.own_path.c_str()); - return false; - } - - auto own_name = get_filename(args.own_path); - auto own_dir = get_directory(args.own_path); - - if (mode != host_mode_t::standalone) - { - // corerun mode. First argument is managed app - if (argc < 2) - { - return false; - } - args.managed_application = pal::string_t(argv[1]); - if (!pal::realpath(&args.managed_application)) - { - trace::error(_X("Failed to locate managed application [%s]"), args.managed_application.c_str()); - return false; - } - args.app_dir = get_directory(args.managed_application); - args.app_argc = argc - 2; - args.app_argv = &argv[2]; - } - else - { - // coreconsole mode. Find the managed app in the same directory - pal::string_t managed_app(own_dir); - managed_app.push_back(DIR_SEPARATOR); - managed_app.append(get_executable(own_name)); - managed_app.append(_X(".dll")); - args.managed_application = managed_app; - if (!pal::realpath(&args.managed_application)) - { - trace::error(_X("Failed to locate managed application [%s]"), args.managed_application.c_str()); - return false; - } - args.app_dir = own_dir; - args.app_argv = &argv[1]; - args.app_argc = argc - 1; - } - - if (!deps_path.empty()) - { - args.deps_path = deps_path; - args.app_dir = get_directory(args.deps_path); - } - - for (const auto& probe : probe_paths) - { - args.probe_paths.push_back(probe); - } - - if (args.deps_path.empty()) - { - const auto& app_base = args.app_dir; - auto app_name = get_filename(args.managed_application); - - args.deps_path.reserve(app_base.length() + 1 + app_name.length() + 5); - args.deps_path.append(app_base); - args.deps_path.push_back(DIR_SEPARATOR); - args.deps_path.append(app_name, 0, app_name.find_last_of(_X("."))); - args.deps_path.append(_X(".deps.json")); - } - - pal::getenv(_X("DOTNET_HOSTING_OPTIMIZATION_CACHE"), &args.dotnet_packages_cache); - pal::get_default_servicing_directory(&args.core_servicing); - - return true; -} diff --git a/src/corehost/cli/args.h b/src/corehost/cli/args.h deleted file mode 100644 index ac062d7dc..000000000 --- a/src/corehost/cli/args.h +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef ARGS_H -#define ARGS_H - -#include "utils.h" -#include "pal.h" -#include "trace.h" -#include "deps_format.h" -#include "libhost.h" - -struct probe_config_t -{ - pal::string_t probe_dir; - bool match_hash; - bool patch_roll_fwd; - bool prerelease_roll_fwd; - const deps_json_t* probe_deps_json; - - bool only_runtime_assets; - bool only_serviceable_assets; - - void print() const - { - trace::verbose(_X("probe_config_t: probe=[%s] match-hash=[%d] patch-roll-forward=[%d] prerelease-roll-forward=[%d] deps-json=[%p]"), - probe_dir.c_str(), match_hash, patch_roll_fwd, prerelease_roll_fwd, probe_deps_json); - } - bool is_roll_fwd_set() const - { - return patch_roll_fwd || prerelease_roll_fwd; - } - - probe_config_t( - const pal::string_t& probe_dir, - bool match_hash, - bool patch_roll_fwd, - bool prerelease_roll_fwd, - const deps_json_t* probe_deps_json, - bool only_serviceable_assets, - bool only_runtime_assets) - : probe_dir(probe_dir) - , match_hash(match_hash) - , patch_roll_fwd(patch_roll_fwd) - , prerelease_roll_fwd(prerelease_roll_fwd) - , probe_deps_json(probe_deps_json) - , only_serviceable_assets(only_serviceable_assets) - , only_runtime_assets(only_runtime_assets) - { - // Cannot roll forward and also match hash. - assert(!is_roll_fwd_set() || !match_hash); - // Will not roll forward within a deps json. - assert(!is_roll_fwd_set() || probe_deps_json == nullptr); - // Will not do hash match when probing a deps json. - assert(!match_hash || probe_deps_json == nullptr); - } - - static probe_config_t svc_ni(const pal::string_t& dir, bool patch_roll_fwd, bool prerelease_roll_fwd) - { - return probe_config_t(dir, false, patch_roll_fwd, prerelease_roll_fwd, nullptr, true, true); - } - - static probe_config_t svc(const pal::string_t& dir, bool patch_roll_fwd, bool prerelease_roll_fwd) - { - return probe_config_t(dir, false, patch_roll_fwd, prerelease_roll_fwd, nullptr, true, false); - } - - static probe_config_t cache_ni(const pal::string_t& dir) - { - return probe_config_t(dir, true, false, false, nullptr, false, true); - } - - static probe_config_t cache(const pal::string_t& dir) - { - return probe_config_t(dir, true, false, false, nullptr, false, false); - } - - static probe_config_t fx(const pal::string_t& dir, const deps_json_t* deps) - { - return probe_config_t(dir, false, false, false, deps, false, false); - } - - static probe_config_t additional(const pal::string_t& dir) - { - return probe_config_t(dir, false, false, false, nullptr, false, false); - } -}; - -struct arguments_t -{ - pal::string_t own_path; - pal::string_t app_dir; - pal::string_t deps_path; - pal::string_t core_servicing; - std::vector probe_paths; - pal::string_t dotnet_packages_cache; - pal::string_t managed_application; - - int app_argc; - const pal::char_t** app_argv; - - arguments_t(); - - inline void print() - { - if (trace::is_enabled()) - { - trace::verbose(_X("-- arguments_t: own_path=%s app_dir=%s deps=%s core_svc=%s packages_cache=%s mgd_app=%s"), - own_path.c_str(), app_dir.c_str(), deps_path.c_str(), core_servicing.c_str(), dotnet_packages_cache.c_str(), managed_application.c_str()); - for (const auto& probe : probe_paths) - { - trace::verbose(_X("-- arguments_t: probe dir: [%s]"), probe.c_str()); - } - } - } -}; - -bool parse_arguments(const pal::string_t& deps_path, const std::vector& probe_paths, host_mode_t mode, const int argc, const pal::char_t* argv[], arguments_t* args); - -#endif // ARGS_H diff --git a/src/corehost/cli/breadcrumbs.cpp b/src/corehost/cli/breadcrumbs.cpp deleted file mode 100644 index 1482d4fa2..000000000 --- a/src/corehost/cli/breadcrumbs.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include "pal.h" -#include "utils.h" -#include "trace.h" -#include "breadcrumbs.h" - -breadcrumb_writer_t::breadcrumb_writer_t(const std::unordered_set* files) - : m_status(false) - , m_files(files) -{ - if (!pal::get_default_breadcrumb_store(&m_breadcrumb_store)) - { - m_breadcrumb_store.clear(); - } -} - -// Begin breadcrumb writing: write synchronously or launch a -// thread to write breadcrumbs. -void breadcrumb_writer_t::begin_write() -{ - trace::verbose(_X("--- Begin breadcrumb write")); - if (m_breadcrumb_store.empty()) - { - trace::verbose(_X("Breadcrumb store was not obtained... skipping write.")); - m_status = false; - return; - } - - trace::verbose(_X("Number of breadcrumb files to write is %d"), m_files->size()); - if (m_files->empty()) - { - m_status = true; - return; - } - m_thread = std::thread(write_worker_callback, this); - trace::verbose(_X("Breadcrumbs will be written using a background thread")); -} - -// Write the breadcrumbs. This method should be called -// only from the background thread. -void breadcrumb_writer_t::write_callback() -{ - bool successful = true; - for (const auto& file : *m_files) - { - pal::string_t file_path = m_breadcrumb_store; - pal::string_t file_name = _X("netcore,") + file; - append_path(&file_path, file_name.c_str()); - if (!pal::file_exists(file_path)) - { - if (!pal::touch_file(file_path)) - { - successful = false; - } - } - } - // m_status should not be modified by anyone else. - m_status = successful; -} - -// ThreadProc for the background writer. -void breadcrumb_writer_t::write_worker_callback(breadcrumb_writer_t* p_this) -{ - try - { - trace::verbose(_X("Breadcrumb thread write callback...")); - p_this->write_callback(); - } - catch (...) - { - trace::warning(_X("An unexpected exception was thrown while leaving breadcrumbs")); - } -} - -// Wait for completion of the background tasks, if any. -bool breadcrumb_writer_t::end_write() -{ - if (m_thread.joinable()) - { - trace::verbose(_X("Waiting for breadcrumb thread to exit...")); - - // Block on the thread to exit. - m_thread.join(); - } - trace::verbose(_X("--- End breadcrumb write %d"), m_status); - return m_status; -} - diff --git a/src/corehost/cli/breadcrumbs.h b/src/corehost/cli/breadcrumbs.h deleted file mode 100644 index cae0ff788..000000000 --- a/src/corehost/cli/breadcrumbs.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __BREADCRUMBS_H__ -#define __BREADCRUMBS_H__ - -#include - -class breadcrumb_writer_t -{ -public: - breadcrumb_writer_t(const std::unordered_set* files); - - void begin_write(); - bool end_write(); - -private: - void write_callback(); - static void write_worker_callback(breadcrumb_writer_t* p_this); - - pal::string_t m_breadcrumb_store; - std::thread m_thread; - const std::unordered_set* m_files; - volatile bool m_status; -}; - -#endif // __BREADCRUMBS_H__ diff --git a/src/corehost/cli/coreclr.cpp b/src/corehost/cli/coreclr.cpp deleted file mode 100644 index c8aafc2fe..000000000 --- a/src/corehost/cli/coreclr.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include - -#include "coreclr.h" -#include "utils.h" - -static pal::dll_t g_coreclr = nullptr; - -// Prototype of the coreclr_initialize function from coreclr.dll -typedef pal::hresult_t(STDMETHODCALLTYPE *coreclr_initialize_fn)( - const char* exePath, - const char* appDomainFriendlyName, - int propertyCount, - const char** propertyKeys, - const char** propertyValues, - coreclr::host_handle_t* hostHandle, - unsigned int* domainId); - -// Prototype of the coreclr_shutdown function from coreclr.dll -typedef pal::hresult_t(STDMETHODCALLTYPE *coreclr_shutdown_fn)( - coreclr::host_handle_t hostHandle, - unsigned int domainId); - -// Prototype of the coreclr_execute_assembly function from coreclr.dll -typedef pal::hresult_t(STDMETHODCALLTYPE *coreclr_execute_assembly_fn)( - coreclr::host_handle_t hostHandle, - unsigned int domainId, - int argc, - const char** argv, - const char* managedAssemblyPath, - unsigned int* exitCode); - -static coreclr_shutdown_fn coreclr_shutdown = nullptr; -static coreclr_initialize_fn coreclr_initialize = nullptr; -static coreclr_execute_assembly_fn coreclr_execute_assembly = nullptr; - -bool coreclr::bind(const pal::string_t& libcoreclr_path) -{ - assert(g_coreclr == nullptr); - - pal::string_t coreclr_dll_path(libcoreclr_path); - append_path(&coreclr_dll_path, LIBCORECLR_NAME); - - if (!pal::load_library(coreclr_dll_path.c_str(), &g_coreclr)) - { - return false; - } - - coreclr_initialize = (coreclr_initialize_fn)pal::get_symbol(g_coreclr, "coreclr_initialize"); - coreclr_shutdown = (coreclr_shutdown_fn)pal::get_symbol(g_coreclr, "coreclr_shutdown"); - coreclr_execute_assembly = (coreclr_execute_assembly_fn)pal::get_symbol(g_coreclr, "coreclr_execute_assembly"); - - return true; -} - -void coreclr::unload() -{ - assert(g_coreclr != nullptr && coreclr_initialize != nullptr); - - pal::unload_library(g_coreclr); -} - -pal::hresult_t coreclr::initialize( - const char* exe_path, - const char* app_domain_friendly_name, - const char** property_keys, - const char** property_values, - int property_count, - host_handle_t* host_handle, - domain_id_t* domain_id) -{ - assert(g_coreclr != nullptr && coreclr_initialize != nullptr); - - return coreclr_initialize( - exe_path, - app_domain_friendly_name, - property_count, - property_keys, - property_values, - host_handle, - domain_id); -} - -pal::hresult_t coreclr::shutdown(host_handle_t host_handle, domain_id_t domain_id) -{ - assert(g_coreclr != nullptr && coreclr_shutdown != nullptr); - - return coreclr_shutdown(host_handle, domain_id); -} - -pal::hresult_t coreclr::execute_assembly( - host_handle_t host_handle, - domain_id_t domain_id, - int argc, - const char** argv, - const char* managed_assembly_path, - unsigned int* exit_code) -{ - assert(g_coreclr != nullptr && coreclr_execute_assembly != nullptr); - - return coreclr_execute_assembly( - host_handle, - domain_id, - argc, - argv, - managed_assembly_path, - exit_code); -} diff --git a/src/corehost/cli/coreclr.h b/src/corehost/cli/coreclr.h deleted file mode 100644 index 7b9ac6d7d..000000000 --- a/src/corehost/cli/coreclr.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef CLR_H -#define CLR_H - -#include "pal.h" -#include "trace.h" - -namespace coreclr -{ - typedef void* host_handle_t; - typedef unsigned int domain_id_t; - - bool bind(const pal::string_t& libcoreclr_path); - - void unload(); - - pal::hresult_t initialize( - const char* exe_path, - const char* app_domain_friendly_name, - const char** property_keys, - const char** property_values, - int property_count, - host_handle_t* host_handle, - domain_id_t* domain_id); - - pal::hresult_t shutdown(host_handle_t host_handle, domain_id_t domain_id); - - pal::hresult_t execute_assembly( - host_handle_t host_handle, - domain_id_t domain_id, - int argc, - const char** argv, - const char* managed_assembly_path, - unsigned int* exit_code); -}; - -#endif diff --git a/src/corehost/cli/deps_entry.cpp b/src/corehost/cli/deps_entry.cpp deleted file mode 100644 index 28ec8d62d..000000000 --- a/src/corehost/cli/deps_entry.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "utils.h" -#include "deps_entry.h" -#include "trace.h" - - -bool deps_entry_t::to_path(const pal::string_t& base, bool look_in_base, pal::string_t* str) const -{ - pal::string_t& candidate = *str; - - candidate.clear(); - - // Base directory must be present to obtain full path - if (base.empty()) - { - return false; - } - - // Entry relative path contains '/' separator, sanitize it to use - // platform separator. Perf: avoid extra copy if it matters. - pal::string_t pal_relative_path = relative_path; - if (_X('/') != DIR_SEPARATOR) - { - replace_char(&pal_relative_path, _X('/'), DIR_SEPARATOR); - } - - // Reserve space for the path below - candidate.reserve(base.length() + - pal_relative_path.length() + 3); - - candidate.assign(base); - pal::string_t sub_path = look_in_base ? get_filename(pal_relative_path) : pal_relative_path; - append_path(&candidate, sub_path.c_str()); - - bool exists = pal::file_exists(candidate); - const pal::char_t* query_type = look_in_base ? _X("Local") : _X("Relative"); - if (!exists) - { - trace::verbose(_X(" %s path query did not exist %s"), query_type, candidate.c_str()); - candidate.clear(); - } - else - { - trace::verbose(_X(" %s path query exists %s"), query_type, candidate.c_str()); - } - return exists; -} - -// ----------------------------------------------------------------------------- -// Given a "base" directory, yield the local path of this file -// -// Parameters: -// base - The base directory to look for the relative path of this entry -// str - If the method returns true, contains the file path for this deps -// entry relative to the "base" directory -// -// Returns: -// If the file exists in the path relative to the "base" directory. -// -bool deps_entry_t::to_dir_path(const pal::string_t& base, pal::string_t* str) const -{ - if (asset_type == asset_types::resources) - { - pal::string_t pal_relative_path = relative_path; - if (_X('/') != DIR_SEPARATOR) - { - replace_char(&pal_relative_path, _X('/'), DIR_SEPARATOR); - } - pal::string_t ietf_dir = get_directory(pal_relative_path); - pal::string_t ietf = get_filename(ietf_dir); - pal::string_t base_ietf_dir = base; - append_path(&base_ietf_dir, ietf.c_str()); - trace::verbose(_X("Detected a resource asset, will query dir/ietf-tag/resource base: %s asset: %s"), base_ietf_dir.c_str(), asset_name.c_str()); - return to_path(base_ietf_dir, true, str); - } - return to_path(base, true, str); -} -// ----------------------------------------------------------------------------- -// Given a "base" directory, yield the relative path of this file in the package -// layout. -// -// Parameters: -// base - The base directory to look for the relative path of this entry -// str - If the method returns true, contains the file path for this deps -// entry relative to the "base" directory -// -// Returns: -// If the file exists in the path relative to the "base" directory. -// -bool deps_entry_t::to_rel_path(const pal::string_t& base, pal::string_t* str) const -{ - return to_path(base, false, str); -} - -// ----------------------------------------------------------------------------- -// Given a "base" directory, yield the relative path of this file in the package -// layout. -// -// Parameters: -// base - The base directory to look for the relative path of this entry -// str - If the method returns true, contains the file path for this deps -// entry relative to the "base" directory -// -// Returns: -// If the file exists in the path relative to the "base" directory. -// -bool deps_entry_t::to_full_path(const pal::string_t& base, pal::string_t* str) const -{ - str->clear(); - - // Base directory must be present to obtain full path - if (base.empty()) - { - return false; - } - - pal::string_t new_base = base; - append_path(&new_base, library_name.c_str()); - append_path(&new_base, library_version.c_str()); - - return to_rel_path(new_base, str); -} - -// ----------------------------------------------------------------------------- -// Given a "base" directory, yield the relative path of this file in the package -// layout if the entry hash matches the hash file in the "base" directory -// -// Parameters: -// base - The base directory to look for the relative path of this entry and -// the hash file. -// str - If the method returns true, contains the file path for this deps -// entry relative to the "base" directory -// -// Description: -// Looks for a file named "{PackageName}.{PackageVersion}.nupkg.{HashAlgorithm}" -// If the deps entry's {HashAlgorithm}-{HashValue} matches the contents then -// yields the relative path of this entry in the "base" dir. -// -// Returns: -// If the file exists in the path relative to the "base" directory and there -// was hash file match with this deps entry. -// -// See: to_full_path(base, str) -// -bool deps_entry_t::to_hash_matched_path(const pal::string_t& base, pal::string_t* str) const -{ - pal::string_t& candidate = *str; - - candidate.clear(); - - // Base directory must be present to perform hash lookup. - if (base.empty()) - { - return false; - } - - // First detect position of hyphen in [Algorithm]-[Hash] in the string. - size_t pos = library_hash.find(_X("-")); - if (pos == 0 || pos == pal::string_t::npos) - { - trace::verbose(_X("Invalid hash %s value for deps file entry: %s"), library_hash.c_str(), library_name.c_str()); - return false; - } - - // Build the nupkg file name. Just reserve approx 8 char_t's for the algorithm name. - pal::string_t nupkg_filename; - nupkg_filename.reserve(library_name.length() + 1 + library_version.length() + 16); - nupkg_filename.append(library_name); - nupkg_filename.append(_X(".")); - nupkg_filename.append(library_version); - nupkg_filename.append(_X(".nupkg.")); - nupkg_filename.append(library_hash.substr(0, pos)); - - // Build the hash file path str. - pal::string_t hash_file; - hash_file.reserve(base.length() + library_name.length() + library_version.length() + nupkg_filename.length() + 3); - hash_file.assign(base); - append_path(&hash_file, library_name.c_str()); - append_path(&hash_file, library_version.c_str()); - append_path(&hash_file, nupkg_filename.c_str()); - - // Read the contents of the hash file. - pal::ifstream_t fstream(hash_file); - if (!fstream.good()) - { - trace::verbose(_X("The hash file is invalid [%s]"), hash_file.c_str()); - return false; - } - - // Obtain the hash from the file. - std::string hash; - hash.assign(pal::istreambuf_iterator_t(fstream), - pal::istreambuf_iterator_t()); - pal::string_t pal_hash; - if (!pal::utf8_palstring(hash.c_str(), &pal_hash)) - { - return false; - } - - // Check if contents match deps entry. - pal::string_t entry_hash = library_hash.substr(pos + 1); - if (entry_hash != pal_hash) - { - trace::verbose(_X("The file hash [%s][%d] did not match entry hash [%s][%d]"), - pal_hash.c_str(), pal_hash.length(), entry_hash.c_str(), entry_hash.length()); - return false; - } - - // All good, just append the relative dir to base. - return to_full_path(base, &candidate); -} diff --git a/src/corehost/cli/deps_entry.h b/src/corehost/cli/deps_entry.h deleted file mode 100644 index d016c2a21..000000000 --- a/src/corehost/cli/deps_entry.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __DEPS_ENTRY_H_ -#define __DEPS_ENTRY_H_ - -#include -#include -#include -#include "pal.h" - -struct deps_entry_t -{ - enum asset_types - { - runtime = 0, - resources, - native, - count - }; - - static const std::array s_known_asset_types; - - pal::string_t library_type; - pal::string_t library_name; - pal::string_t library_version; - pal::string_t library_hash; - asset_types asset_type; - pal::string_t asset_name; - pal::string_t relative_path; - bool is_serviceable; - bool is_rid_specific; - - - // Given a "base" dir, yield the filepath within this directory or relative to this directory based on "look_in_base" - bool to_path(const pal::string_t& base, bool look_in_base, pal::string_t* str) const; - - // Given a "base" dir, yield the file path within this directory. - bool to_dir_path(const pal::string_t& base, pal::string_t* str) const; - - // Given a "base" dir, yield the relative path in the package layout. - bool to_rel_path(const pal::string_t& base, pal::string_t* str) const; - - // Given a "base" dir, yield the relative path with package name, version in the package layout. - bool to_full_path(const pal::string_t& root, pal::string_t* str) const; - - // Given a "base" dir, yield the relative path with package name, version in the package layout only if - // the hash matches contents of the hash file. - bool to_hash_matched_path(const pal::string_t& root, pal::string_t* str) const; -}; - -#endif // __DEPS_ENTRY_H_ diff --git a/src/corehost/cli/deps_format.cpp b/src/corehost/cli/deps_format.cpp deleted file mode 100644 index 68e462c69..000000000 --- a/src/corehost/cli/deps_format.cpp +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "deps_entry.h" -#include "deps_format.h" -#include "utils.h" -#include "trace.h" -#include -#include -#include -#include -#include - -const std::array deps_entry_t::s_known_asset_types = { - _X("runtime"), _X("resources"), _X("native") -}; - -const deps_entry_t& deps_json_t::try_ni(const deps_entry_t& entry) const -{ - if (m_ni_entries.count(entry.asset_name)) - { - int index = m_ni_entries.at(entry.asset_name); - return m_deps_entries[deps_entry_t::asset_types::runtime][index]; - } - return entry; -} - -void deps_json_t::reconcile_libraries_with_targets( - const json_value& json, - const std::function& library_exists_fn, - const std::function&(const pal::string_t&, int, bool*)>& get_rel_paths_by_asset_type_fn) -{ - const auto& libraries = json.at(_X("libraries")).as_object(); - for (const auto& library : libraries) - { - trace::info(_X("Reconciling library %s"), library.first.c_str()); - - if (pal::to_lower(library.second.at(_X("type")).as_string()) != _X("package")) - { - trace::info(_X("Library %s is not a package"), library.first.c_str()); - continue; - } - if (!library_exists_fn(library.first)) - { - trace::info(_X("Library %s does not exist"), library.first.c_str()); - continue; - } - - const auto& properties = library.second.as_object(); - - const pal::string_t& hash = properties.at(_X("sha512")).as_string(); - bool serviceable = properties.at(_X("serviceable")).as_bool(); - - for (int i = 0; i < deps_entry_t::s_known_asset_types.size(); ++i) - { - bool rid_specific = false; - for (const auto& rel_path : get_rel_paths_by_asset_type_fn(library.first, i, &rid_specific)) - { - bool ni_dll = false; - auto asset_name = get_filename_without_ext(rel_path); - if (ends_with(asset_name, _X(".ni"), false)) - { - ni_dll = true; - asset_name = strip_file_ext(asset_name); - } - - deps_entry_t entry; - size_t pos = library.first.find(_X("/")); - entry.library_name = library.first.substr(0, pos); - entry.library_version = library.first.substr(pos + 1); - entry.library_type = _X("package"); - entry.library_hash = hash; - entry.asset_name = asset_name; - entry.asset_type = (deps_entry_t::asset_types) i; - entry.relative_path = rel_path; - entry.is_serviceable = serviceable; - entry.is_rid_specific = rid_specific; - - // TODO: Deps file does not follow spec. It uses '\\', should use '/' - replace_char(&entry.relative_path, _X('\\'), _X('/')); - - m_deps_entries[i].push_back(entry); - - if (ni_dll) - { - m_ni_entries[entry.asset_name] = m_deps_entries - [deps_entry_t::asset_types::runtime].size() - 1; - } - - trace::info(_X("Added %s %s deps entry [%d] [%s, %s, %s]"), deps_entry_t::s_known_asset_types[i], entry.asset_name.c_str(), m_deps_entries[i].size() - 1, entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - - if (i == deps_entry_t::asset_types::native && - entry.asset_name == LIBCORECLR_FILENAME) - { - m_coreclr_index = m_deps_entries[i].size() - 1; - trace::verbose(_X("Found CoreCLR from deps %d [%s, %s, %s]"), - m_coreclr_index, - entry.library_name.c_str(), - entry.library_version.c_str(), - entry.relative_path.c_str()); - } - - if (i == deps_entry_t::asset_types::native && - entry.asset_name == LIBHOSTPOLICY_FILENAME) - { - m_hostpolicy_index = m_deps_entries[i].size() - 1; - trace::verbose(_X("Found hostpolicy from deps %d [%s, %s, %s]"), - m_hostpolicy_index, - entry.library_name.c_str(), - entry.library_version.c_str(), - entry.relative_path.c_str()); - } - } - } - } -} - -pal::string_t get_own_rid() -{ -#if defined(TARGET_RUNTIME_ID) - return _STRINGIFY(TARGET_RUNTIME_ID); -#else -#error "Cannot build the host without knowing host's root RID" -#endif -} - -bool deps_json_t::perform_rid_fallback(rid_specific_assets_t* portable_assets, const rid_fallback_graph_t& rid_fallback_graph) -{ - pal::string_t host_rid = get_own_rid(); - for (auto& package : portable_assets->libs) - { - pal::string_t matched_rid = package.second.rid_assets.count(host_rid) ? host_rid : _X(""); - if (matched_rid.empty()) - { - if (rid_fallback_graph.count(host_rid) == 0) - { - trace::warning(_X("The targeted framework does not support the runtime '%s'. Some native libraries from [%s] may fail to load on this platform."), host_rid.c_str(), package.first.c_str()); - } - else - { - const auto& fallback_rids = rid_fallback_graph.find(host_rid)->second; - auto iter = std::find_if(fallback_rids.begin(), fallback_rids.end(), [&package](const pal::string_t& rid) { - return package.second.rid_assets.count(rid); - }); - if (iter != fallback_rids.end()) - { - matched_rid = *iter; - } - } - } - - if (matched_rid.empty()) - { - package.second.rid_assets.clear(); - } - - for (auto iter = package.second.rid_assets.begin(); iter != package.second.rid_assets.end(); /* */) - { - if (iter->first != matched_rid) - { - trace::verbose(_X("Chose %s, so removing rid (%s) specific assets for package %s"), matched_rid.c_str(), iter->first.c_str(), package.first.c_str()); - iter = package.second.rid_assets.erase(iter); - } - else - { - ++iter; - } - } - } - return true; -} - - -bool deps_json_t::process_runtime_targets(const json_value& json, const pal::string_t& target_name, const rid_fallback_graph_t& rid_fallback_graph, rid_specific_assets_t* p_assets) -{ - rid_specific_assets_t& assets = *p_assets; - for (const auto& package : json.at(_X("targets")).at(target_name).as_object()) - { - const auto& targets = package.second.as_object(); - auto iter = targets.find(_X("runtimeTargets")); - if (iter == targets.end()) - { - continue; - } - - const auto& files = iter->second.as_object(); - for (const auto& file : files) - { - const auto& type = file.second.at(_X("assetType")).as_string(); - for (int i = 0; i < deps_entry_t::s_known_asset_types.size(); ++i) - { - if (pal::strcasecmp(type.c_str(), deps_entry_t::s_known_asset_types[i]) == 0) - { - const auto& rid = file.second.at(_X("rid")).as_string(); - assets.libs[package.first].rid_assets[rid].by_type[i].vec.push_back(file.first); - } - } - } - } - - if (!perform_rid_fallback(&assets, rid_fallback_graph)) - { - return false; - } - - return true; -} - -bool deps_json_t::process_targets(const json_value& json, const pal::string_t& target_name, deps_assets_t* p_assets) -{ - deps_assets_t& assets = *p_assets; - for (const auto& package : json.at(_X("targets")).at(target_name).as_object()) - { - // if (package.second.at(_X("type")).as_string() != _X("package")) continue; - const auto& asset_types = package.second.as_object(); - for (int i = 0; i < deps_entry_t::s_known_asset_types.size(); ++i) - { - auto iter = asset_types.find(deps_entry_t::s_known_asset_types[i]); - if (iter != asset_types.end()) - { - for (const auto& file : iter->second.as_object()) - { - trace::info(_X("Adding %s asset %s from %s"), deps_entry_t::s_known_asset_types[i], file.first.c_str(), package.first.c_str()); - assets.libs[package.first].by_type[i].vec.push_back(file.first); - } - } - } - } - return true; -} - -bool deps_json_t::load_portable(const json_value& json, const pal::string_t& target_name, const rid_fallback_graph_t& rid_fallback_graph) -{ - if (!process_runtime_targets(json, target_name, rid_fallback_graph, &m_rid_assets)) - { - return false; - } - - if (!process_targets(json, target_name, &m_assets)) - { - return false; - } - - auto package_exists = [&](const pal::string_t& package) -> bool { - return m_rid_assets.libs.count(package) || m_assets.libs.count(package); - }; - - const std::vector empty; - auto get_relpaths = [&](const pal::string_t& package, int type_index, bool* rid_specific) -> const std::vector& { - - *rid_specific = false; - - // Is there any rid specific assets for this type ("native" or "runtime" or "resources") - if (m_rid_assets.libs.count(package) && !m_rid_assets.libs[package].rid_assets.empty()) - { - const auto& assets_by_type = m_rid_assets.libs[package].rid_assets.begin()->second.by_type[type_index].vec; - if (!assets_by_type.empty()) - { - *rid_specific = true; - return assets_by_type; - } - - trace::verbose(_X("There were no rid specific %s asset for %s"), deps_entry_t::s_known_asset_types[type_index], package.c_str()); - } - - if (m_assets.libs.count(package)) - { - return m_assets.libs[package].by_type[type_index].vec; - } - - return empty; - }; - - reconcile_libraries_with_targets(json, package_exists, get_relpaths); - - return true; -} - -bool deps_json_t::load_standalone(const json_value& json, const pal::string_t& target_name) -{ - if (!process_targets(json, target_name, &m_assets)) - { - return false; - } - - auto package_exists = [&](const pal::string_t& package) -> bool { - return m_assets.libs.count(package); - }; - - auto get_relpaths = [&](const pal::string_t& package, int type_index, bool* rid_specific) -> const std::vector& { - *rid_specific = false; - return m_assets.libs[package].by_type[type_index].vec; - }; - - reconcile_libraries_with_targets(json, package_exists, get_relpaths); - - const auto& json_object = json.as_object(); - const auto iter = json_object.find(_X("runtimes")); - if (iter != json_object.end()) - { - for (const auto& rid : iter->second.as_object()) - { - auto& vec = m_rid_fallback_graph[rid.first]; - for (const auto& fallback : rid.second.as_array()) - { - vec.push_back(fallback.as_string()); - } - } - } - - if (trace::is_enabled()) - { - trace::verbose(_X("The rid fallback graph is: {")); - for (const auto& rid : m_rid_fallback_graph) - { - trace::verbose(_X("%s => ["), rid.first.c_str()); - for (const auto& fallback : rid.second) - { - trace::verbose(_X("%s, "), fallback.c_str()); - } - trace::verbose(_X("]")); - } - trace::verbose(_X("}")); - } - return true; -} - -bool deps_json_t::has_package(const pal::string_t& name, const pal::string_t& ver) const -{ - pal::string_t pv = name; - pv.push_back(_X('/')); - pv.append(ver); - - auto iter = m_rid_assets.libs.find(pv); - if (iter != m_rid_assets.libs.end()) - { - if (!iter->second.rid_assets.empty()) - { - return true; - } - } - - return m_assets.libs.count(pv); -} - -// ----------------------------------------------------------------------------- -// Load the deps file and parse its "entry" lines which contain the "fields" of -// the entry. Populate an array of these entries. -// -bool deps_json_t::load(bool portable, const pal::string_t& deps_path, const rid_fallback_graph_t& rid_fallback_graph) -{ - m_file_exists = pal::file_exists(deps_path); - - // If file doesn't exist, then assume parsed. - if (!m_file_exists) - { - trace::verbose(_X("Could not locate the dependencies manifest file [%s]. Some libraries may fail to resolve."), deps_path.c_str()); - return true; - } - - // Somehow the file stream could not be opened. This is an error. - pal::ifstream_t file(deps_path); - if (!file.good()) - { - trace::error(_X("Could not open dependencies manifest file [%s]"), deps_path.c_str()); - return false; - } - - if (skip_utf8_bom(&file)) - { - trace::verbose(_X("UTF-8 BOM skipped while reading [%s]"), deps_path.c_str()); - } - - try - { - const auto json = json_value::parse(file); - - const auto& runtime_target = json.at(_X("runtimeTarget")); - - const pal::string_t& name = runtime_target.is_string()? - runtime_target.as_string(): - runtime_target.at(_X("name")).as_string(); - - trace::verbose(_X("Loading deps file... %s as portable=[%d]"), deps_path.c_str(), portable); - - return (portable) ? load_portable(json, name, rid_fallback_graph) : load_standalone(json, name); - } - catch (const std::exception& je) - { - pal::string_t jes; - (void) pal::utf8_palstring(je.what(), &jes); - trace::error(_X("A JSON parsing exception occurred in [%s]: %s"), deps_path.c_str(), jes.c_str()); - return false; - } -} diff --git a/src/corehost/cli/deps_format.h b/src/corehost/cli/deps_format.h deleted file mode 100644 index f577ef33c..000000000 --- a/src/corehost/cli/deps_format.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __DEPS_FORMAT_H_ -#define __DEPS_FORMAT_H_ - -#include -#include -#include -#include -#include "pal.h" -#include "deps_entry.h" -#include "cpprest/json.h" - -class deps_json_t -{ - typedef web::json::value json_value; - struct vec_t { std::vector vec; }; - struct assets_t { std::array by_type; }; - struct deps_assets_t { std::unordered_map libs; }; - struct rid_assets_t { std::unordered_map rid_assets; }; - struct rid_specific_assets_t { std::unordered_map libs; }; - - typedef std::unordered_map> str_to_vector_map_t; - typedef str_to_vector_map_t rid_fallback_graph_t; - - -public: - deps_json_t() - : m_valid(false) - , m_file_exists(false) - , m_coreclr_index(-1) - , m_hostpolicy_index(-1) - { - } - - deps_json_t(bool portable, const pal::string_t& deps_path) - : deps_json_t(portable, deps_path, m_rid_fallback_graph /* dummy */) - { - } - - deps_json_t(bool portable, const pal::string_t& deps_path, const rid_fallback_graph_t& graph) - : deps_json_t() - { - m_valid = load(portable, deps_path, graph); - } - - const std::vector& get_entries(deps_entry_t::asset_types type) - { - assert(type < deps_entry_t::asset_types::count); - return m_deps_entries[type]; - } - - bool has_package(const pal::string_t& name, const pal::string_t& ver) const; - - bool has_coreclr_entry() - { - return m_coreclr_index >= 0; - } - - bool has_hostpolicy_entry() - { - return m_hostpolicy_index >= 0; - } - - bool exists() - { - return m_file_exists; - } - - const deps_entry_t& get_coreclr_entry() - { - assert(has_coreclr_entry()); - return m_deps_entries[deps_entry_t::asset_types::native][m_coreclr_index]; - } - - const deps_entry_t& get_hostpolicy_entry() - { - assert(has_hostpolicy_entry()); - return m_deps_entries[deps_entry_t::asset_types::native][m_hostpolicy_index]; - } - - bool is_valid() - { - return m_valid; - } - - const rid_fallback_graph_t& get_rid_fallback_graph() - { - return m_rid_fallback_graph; - } - - const deps_entry_t& try_ni(const deps_entry_t& entry) const; - -private: - bool load_standalone(const json_value& json, const pal::string_t& target_name); - bool load_portable(const json_value& json, const pal::string_t& target_name, const rid_fallback_graph_t& rid_fallback_graph); - bool load(bool portable, const pal::string_t& deps_path, const rid_fallback_graph_t& rid_fallback_graph); - bool process_runtime_targets(const json_value& json, const pal::string_t& target_name, const rid_fallback_graph_t& rid_fallback_graph, rid_specific_assets_t* p_assets); - bool process_targets(const json_value& json, const pal::string_t& target_name, deps_assets_t* p_assets); - - void reconcile_libraries_with_targets( - const json_value& json, - const std::function& library_exists_fn, - const std::function&(const pal::string_t&, int, bool*)>& get_rel_paths_by_asset_type_fn); - - bool perform_rid_fallback(rid_specific_assets_t* portable_assets, const rid_fallback_graph_t& rid_fallback_graph); - - std::vector m_deps_entries[deps_entry_t::asset_types::count]; - - deps_assets_t m_assets; - rid_specific_assets_t m_rid_assets; - - std::unordered_map m_ni_entries; - rid_fallback_graph_t m_rid_fallback_graph; - int m_coreclr_index; - int m_hostpolicy_index; - bool m_file_exists; - bool m_valid; -}; - -#endif // __DEPS_FORMAT_H_ diff --git a/src/corehost/cli/deps_resolver.cpp b/src/corehost/cli/deps_resolver.cpp deleted file mode 100644 index 99ef5bbe0..000000000 --- a/src/corehost/cli/deps_resolver.cpp +++ /dev/null @@ -1,642 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include -#include - -#include "trace.h" -#include "deps_entry.h" -#include "deps_format.h" -#include "deps_resolver.h" -#include "utils.h" -#include "fx_ver.h" -#include "libhost.h" - -namespace -{ -// ----------------------------------------------------------------------------- -// A uniqifying append helper that doesn't let two entries with the same -// "asset_name" be part of the "output" paths. -// -void add_tpa_asset( - const pal::string_t& asset_name, - const pal::string_t& asset_path, - std::unordered_set* items, - pal::string_t* output) -{ - if (items->count(asset_name)) - { - return; - } - - trace::verbose(_X("Adding tpa entry: %s"), asset_path.c_str()); - - // Workaround for CoreFX not being able to resolve sym links. - pal::string_t real_asset_path = asset_path; - pal::realpath(&real_asset_path); - output->append(real_asset_path); - - output->push_back(PATH_SEPARATOR); - items->insert(asset_name); -} - -// ----------------------------------------------------------------------------- -// A uniqifying append helper that doesn't let two "paths" to be identical in -// the "output" string. -// -void add_unique_path( - deps_entry_t::asset_types asset_type, - const pal::string_t& path, - std::unordered_set* existing, - pal::string_t* serviced, - pal::string_t* non_serviced, - const pal::string_t& svc_dir) -{ - // Resolve sym links. - pal::string_t real = path; - pal::realpath(&real); - - if (existing->count(real)) - { - return; - } - - trace::verbose(_X("Adding to %s path: %s"), deps_entry_t::s_known_asset_types[asset_type], real.c_str()); - - if (starts_with(real, svc_dir, false)) - { - serviced->append(real); - serviced->push_back(PATH_SEPARATOR); - } - else - { - non_serviced->append(real); - non_serviced->push_back(PATH_SEPARATOR); - } - - - existing->insert(real); -} - -} // end of anonymous namespace - -// ----------------------------------------------------------------------------- -// Load local assemblies by priority order of their file extensions and -// unique-fied by their simple name. -// -void deps_resolver_t::get_dir_assemblies( - const pal::string_t& dir, - const pal::string_t& dir_name, - dir_assemblies_t* dir_assemblies) -{ - trace::verbose(_X("Adding files from %s dir %s"), dir_name.c_str(), dir.c_str()); - - // Managed extensions in priority order, pick DLL over EXE and NI over IL. - const pal::string_t managed_ext[] = { _X(".ni.dll"), _X(".dll"), _X(".ni.exe"), _X(".exe") }; - - // List of files in the dir - std::vector files; - pal::readdir(dir, &files); - - for (const auto& ext : managed_ext) - { - for (const auto& file : files) - { - // Nothing to do if file length is smaller than expected ext. - if (file.length() <= ext.length()) - { - continue; - } - - auto file_name = file.substr(0, file.length() - ext.length()); - auto file_ext = file.substr(file_name.length()); - - // Ext did not match expected ext, skip this file. - if (pal::strcasecmp(file_ext.c_str(), ext.c_str())) - { - continue; - } - - // Already added entry for this asset, by priority order skip this ext - if (dir_assemblies->count(file_name)) - { - trace::verbose(_X("Skipping %s because the %s already exists in %s assemblies"), file.c_str(), dir_assemblies->find(file_name)->second.c_str(), dir_name.c_str()); - continue; - } - - // Add entry for this asset - pal::string_t file_path = dir + DIR_SEPARATOR + file; - trace::verbose(_X("Adding %s to %s assembly set from %s"), file_name.c_str(), dir_name.c_str(), file_path.c_str()); - dir_assemblies->emplace(file_name, file_path); - } - } -} - -bool deps_resolver_t::try_roll_forward(const deps_entry_t& entry, - const pal::string_t& probe_dir, - bool patch_roll_fwd, - bool prerelease_roll_fwd, - pal::string_t* candidate) -{ - trace::verbose(_X("Attempting a roll forward for [%s/%s/%s] in [%s]"), entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str(), probe_dir.c_str()); - - const pal::string_t& lib_ver = entry.library_version; - - fx_ver_t cur_ver(-1, -1, -1); - if (!fx_ver_t::parse(lib_ver, &cur_ver, false)) - { - trace::verbose(_X("No roll forward as specified version [%s] could not be parsed"), lib_ver.c_str()); - return false; - } - pal::string_t path = probe_dir; - append_path(&path, entry.library_name.c_str()); - pal::string_t max_str = lib_ver; - if (cur_ver.is_prerelease() && prerelease_roll_fwd) - { - pal::string_t maj_min_pat_star = cur_ver.prerelease_glob(); - - pal::string_t cache_key = path; - append_path(&cache_key, maj_min_pat_star.c_str()); - - if (m_prerelease_roll_forward_cache.count(cache_key)) - { - max_str = m_prerelease_roll_forward_cache[cache_key]; - trace::verbose(_X("Found cached roll forward version [%s] -> [%s]"), lib_ver.c_str(), max_str.c_str()); - } - else - { - try_prerelease_roll_forward_in_dir(path, cur_ver, &max_str); - m_prerelease_roll_forward_cache[cache_key] = max_str; - } - } - if (!cur_ver.is_prerelease() && patch_roll_fwd) - { - // Extract glob string of the form: 1.0.* from the version 1.0.0-prerelease-00001. - pal::string_t maj_min_star = cur_ver.patch_glob(); - - pal::string_t cache_key = path; - append_path(&cache_key, maj_min_star.c_str()); - - if (m_patch_roll_forward_cache.count(cache_key)) - { - max_str = m_patch_roll_forward_cache[cache_key]; - trace::verbose(_X("Found cached roll forward version [%s] -> [%s]"), lib_ver.c_str(), max_str.c_str()); - } - else - { - try_patch_roll_forward_in_dir(path, cur_ver, &max_str); - m_patch_roll_forward_cache[cache_key] = max_str; - } - } - append_path(&path, max_str.c_str()); - - return entry.to_rel_path(path, candidate); -} - -void deps_resolver_t::setup_probe_config( - const hostpolicy_init_t& init, - const arguments_t& args) -{ - if (pal::directory_exists(args.core_servicing)) - { - pal::string_t ext_ni = args.core_servicing; - append_path(&ext_ni, get_arch()); - if (pal::directory_exists(ext_ni)) - { - // Servicing NI probe. - m_probes.push_back(probe_config_t::svc_ni(ext_ni, false, false)); - } - - // Servicing normal probe. - pal::string_t ext_pkgs = args.core_servicing; - append_path(&ext_pkgs, _X("pkgs")); - m_probes.push_back(probe_config_t::svc(ext_pkgs, false, false)); - } - - if (pal::directory_exists(args.dotnet_packages_cache)) - { - pal::string_t ni_packages_cache = args.dotnet_packages_cache; - append_path(&ni_packages_cache, get_arch()); - if (pal::directory_exists(ni_packages_cache)) - { - // Packages cache NI probe - m_probes.push_back(probe_config_t::cache_ni(ni_packages_cache)); - } - - // Packages cache probe - m_probes.push_back(probe_config_t::cache(args.dotnet_packages_cache)); - } - - if (pal::directory_exists(m_fx_dir)) - { - // FX probe - m_probes.push_back(probe_config_t::fx(m_fx_dir, m_fx_deps.get())); - } - - for (const auto& probe : m_additional_probes) - { - // Additional paths - m_probes.push_back(probe_config_t::additional(probe)); - } - - if (trace::is_enabled()) - { - trace::verbose(_X("-- Listing probe configurations...")); - for (const auto& pc : m_probes) - { - pc.print(); - } - } -} - -void deps_resolver_t::setup_additional_probes(const std::vector& probe_paths) -{ - m_additional_probes.assign(probe_paths.begin(), probe_paths.end()); - - for (auto iter = m_additional_probes.begin(); iter != m_additional_probes.end(); ) - { - if (pal::directory_exists(*iter)) - { - ++iter; - } - else - { - iter = m_additional_probes.erase(iter); - } - } -} - -bool deps_resolver_t::probe_entry_in_configs(const deps_entry_t& entry, pal::string_t* candidate) -{ - candidate->clear(); - for (const auto& config : m_probes) - { - trace::verbose(_X(" Considering entry [%s/%s/%s] and probe dir [%s]"), entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str(), config.probe_dir.c_str()); - - if (config.only_serviceable_assets && !entry.is_serviceable) - { - trace::verbose(_X(" Skipping... not serviceable asset")); - continue; - } - if (config.only_runtime_assets && entry.asset_type != deps_entry_t::asset_types::runtime) - { - trace::verbose(_X(" Skipping... not runtime asset")); - continue; - } - pal::string_t probe_dir = config.probe_dir; - if (config.match_hash) - { - if (entry.to_hash_matched_path(probe_dir, candidate)) - { - assert(!config.is_roll_fwd_set()); - trace::verbose(_X(" Matched hash for [%s]"), candidate->c_str()); - return true; - } - trace::verbose(_X(" Skipping... match hash failed")); - } - else if (config.probe_deps_json) - { - // If the deps json has it then someone has already done rid selection and put the right stuff in the dir. - // So checking just package name and version would suffice. No need to check further for the exact asset relative path. - if (config.probe_deps_json->has_package(entry.library_name, entry.library_version) && entry.to_dir_path(probe_dir, candidate)) - { - trace::verbose(_X(" Probed deps json and matched [%s]"), candidate->c_str()); - return true; - } - trace::verbose(_X(" Skipping... probe in deps json failed")); - } - else if (!config.is_roll_fwd_set()) - { - if (entry.to_full_path(probe_dir, candidate)) - { - trace::verbose(_X(" Specified no roll forward; matched [%s]"), candidate->c_str()); - return true; - } - trace::verbose(_X(" Skipping... not found in probe dir")); - } - else if (config.is_roll_fwd_set()) - { - if (try_roll_forward(entry, probe_dir, config.patch_roll_fwd, config.prerelease_roll_fwd, candidate)) - { - trace::verbose(_X(" Specified roll forward; matched [%s]"), candidate->c_str()); - return true; - } - trace::verbose(_X(" Skipping... could not roll forward and match in probe dir")); - } - - // continue to try next probe config - } - return false; -} - -/** - * Probe helper for a deps entry. Lookup all probe configurations and then - * lookup in the directory where the deps file is present. For app dirs, - * 1. RID specific entries are present in the package relative structure. - * 2. Non-RID entries are present in the directory path. - */ -bool deps_resolver_t::probe_deps_entry(const deps_entry_t& entry, const pal::string_t& deps_dir, pal::string_t* candidate) -{ - if (probe_entry_in_configs(entry, candidate)) - { - return true; - } - if (entry.is_rid_specific && entry.to_rel_path(deps_dir, candidate)) - { - return true; - } - if (!entry.is_rid_specific && entry.to_dir_path(deps_dir, candidate)) - { - return true; - } - return false; -} - -/** - * Helper for obtaining CoreCLR from a given deps file and the deps file's directory. - */ -bool deps_resolver_t::get_coreclr_dir_from_deps(const pal::string_t& deps_dir, deps_json_t* deps, pal::string_t* candidate) -{ - if (!deps->has_coreclr_entry()) - { - return false; - } - - pal::string_t coreclr; - if (probe_deps_entry(deps->get_coreclr_entry(), deps_dir, &coreclr)) - { - *candidate = get_directory(coreclr); - return true; - } - - return false; -} - - -/** - * Probe for coreclr relative to the app and then from the framework root. - * If deps does not exist, then just use the app base. - */ -bool deps_resolver_t::resolve_coreclr_dir(pal::string_t* clr_dir) -{ - trace::info(_X("-- Starting CoreCLR Probe from app deps.json")); - - if (get_coreclr_dir_from_deps(m_app_dir, m_deps.get(), clr_dir)) - { - return true; - } - - if (m_portable) - { - trace::info(_X("-- Starting CoreCLR Probe from FX deps.json")); - if (get_coreclr_dir_from_deps(m_fx_dir, m_fx_deps.get(), clr_dir)) - { - return true; - } - } - - if (!m_deps->exists()) - { - if (coreclr_exists_in_dir(m_app_dir)) - { - *clr_dir = m_app_dir; - return true; - } - } - - return false; -} - -/** - * Resovle the TPA assembly locations - */ -bool deps_resolver_t::resolve_tpa_list( - pal::string_t* output, - std::unordered_set* breadcrumb) -{ - const std::vector empty(0); - std::unordered_set items; - - auto process_entry = [&](const pal::string_t& deps_dir, deps_json_t* deps, const deps_entry_t& entry) -> bool - { - if (entry.is_serviceable) - { - breadcrumb->insert(entry.library_name + _X(",") + entry.library_version); - breadcrumb->insert(entry.library_name); - } - if (items.count(entry.asset_name)) - { - return true; - } - // Ignore placeholders - if (ends_with(entry.relative_path, _X("/_._"), false)) - { - return true; - } - - pal::string_t candidate; - - trace::info(_X("Processing TPA for deps entry [%s, %s, %s]"), entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - - if (probe_deps_entry(entry, deps_dir, &candidate)) - { - add_tpa_asset(entry.asset_name, candidate, &items, output); - } - // Leave the mscorlib error handling to the CoreCLR -- this is because apps might choose to use mscorlib.ni.dll - // and delete mscorlib.dll and vice-versa. - else if (entry.asset_name != _X("mscorlib")) - { - trace::error(_X("Error: assembly specified in the dependencies manifest was not found -- package: '%s', version: '%s', path: '%s'"), - entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - return false; - } - - return true; - }; - - // First add managed assembly to the TPA. - // TODO: Remove: the deps should contain the managed DLL. - // Workaround for: csc.deps.json doesn't have the csc.dll - pal::string_t managed_app_asset = get_filename_without_ext(m_managed_app); - add_tpa_asset(managed_app_asset, m_managed_app, &items, output); - - const auto& deps_entries = m_deps->get_entries(deps_entry_t::asset_types::runtime); - for (const auto& entry : deps_entries) - { - if (!process_entry(m_app_dir, m_deps.get(), entry)) - { - return false; - } - } - - // Finally, if the deps file wasn't present or has missing entries, then - // add the app local assemblies to the TPA. - if (!m_deps->exists()) - { - dir_assemblies_t local_assemblies; - - // Obtain the local assemblies in the app dir. - get_dir_assemblies(m_app_dir, _X("local"), &local_assemblies); - for (const auto& kv : local_assemblies) - { - add_tpa_asset(kv.first, kv.second, &items, output); - } - } - - // Probe FX deps entries after app assemblies are added. - const auto& fx_entries = m_portable ? m_fx_deps->get_entries(deps_entry_t::asset_types::runtime) : empty; - for (const auto& entry : fx_entries) - { - if (!process_entry(m_fx_dir, m_fx_deps.get(), entry)) - { - return false; - } - } - - return true; -} - -/** - * Resolve native and culture assembly directories based on "asset_type" parameter. - */ -bool deps_resolver_t::resolve_probe_dirs( - deps_entry_t::asset_types asset_type, - pal::string_t* output, - std::unordered_set* breadcrumb) -{ - bool is_resources = asset_type == deps_entry_t::asset_types::resources; - assert(is_resources || asset_type == deps_entry_t::asset_types::native); - - // For resources assemblies, we need to provide the base directory of the resources path. - // For example: .../Foo/en-US/Bar.dll, then, the resolved path is .../Foo - std::function resources = [] (const pal::string_t& str) { - return get_directory(get_directory(str)); - }; - // For native assemblies, obtain the directory path from the file path - std::function native = [] (const pal::string_t& str) { - return get_directory(str); - }; - // Action for post processing the resolved path - std::function& action = is_resources ? resources : native; - - // Set for de-duplication - std::unordered_set items; - - pal::string_t core_servicing = m_core_servicing; - pal::realpath(&core_servicing); - - // Filter out non-serviced assets so the paths can be added after servicing paths. - pal::string_t non_serviced; - - std::vector empty(0); - const auto& entries = m_deps->get_entries(asset_type); - const auto& fx_entries = m_portable ? m_fx_deps->get_entries(asset_type) : empty; - - pal::string_t candidate; - - auto add_package_cache_entry = [&](const deps_entry_t& entry, const pal::string_t& deps_dir) -> bool - { - if (entry.is_serviceable) - { - breadcrumb->insert(entry.library_name + _X(",") + entry.library_version); - breadcrumb->insert(entry.library_name); - } - if (items.count(entry.asset_name)) - { - return true; - } - // Ignore placeholders - if (ends_with(entry.relative_path, _X("/_._"), false)) - { - return true; - } - - trace::verbose(_X("Processing native/culture for deps entry [%s, %s, %s]"), - entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - - if (probe_deps_entry(entry, deps_dir, &candidate)) - { - add_unique_path(asset_type, action(candidate), &items, output, &non_serviced, core_servicing); - } - else - { - // For standalone apps, dotnet.exe will be renamed. Do not use the full package name - // because of rid-fallback could happen (ex: CentOS falling back to RHEL) - if (ends_with(entry.library_name, _X(".Microsoft.NETCore.DotNetHost"), false) && entry.asset_name == _X("dotnet")) - { - trace::warning(_X("Warning: assembly specified in the dependencies manifest was not found -- package: '%s', version: '%s', path: '%s'"), - entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - return true; - } - trace::error(_X("Error: assembly specified in the dependencies manifest was not found -- package: '%s', version: '%s', path: '%s'"), - entry.library_name.c_str(), entry.library_version.c_str(), entry.relative_path.c_str()); - return false; - } - - if (m_api_set_paths.empty() && pal::need_api_sets() && - ends_with(entry.library_name, _X("Microsoft.NETCore.Windows.ApiSets"), false)) - { - m_api_set_paths.insert(action(candidate)); - } - - return true; - }; - - for (const auto& entry : entries) - { - if (!add_package_cache_entry(entry, m_app_dir)) - { - return false; - } - } - - // If the deps file is missing add known locations. - if (!m_deps->exists()) - { - // App local path - add_unique_path(asset_type, m_app_dir, &items, output, &non_serviced, core_servicing); - } - - for (const auto& entry : fx_entries) - { - if (!add_package_cache_entry(entry, m_fx_dir)) - { - return false; - } - } - - output->append(non_serviced); - - return true; -} - - -// ----------------------------------------------------------------------------- -// Entrypoint to resolve TPA, native and resources path ordering to pass to CoreCLR. -// -// Parameters: -// app_dir - The application local directory -// package_dir - The directory path to where packages are restored -// package_cache_dir - The directory path to secondary cache for packages -// clr_dir - The directory where the host loads the CLR -// probe_paths - Pointer to struct containing fields that will contain -// resolved path ordering. -// -// -bool deps_resolver_t::resolve_probe_paths(probe_paths_t* probe_paths, std::unordered_set* breadcrumb) -{ - if (!resolve_tpa_list(&probe_paths->tpa, breadcrumb)) - { - return false; - } - if (!resolve_probe_dirs(deps_entry_t::asset_types::native, &probe_paths->native, breadcrumb)) - { - return false; - } - if (!resolve_probe_dirs(deps_entry_t::asset_types::resources, &probe_paths->resources, breadcrumb)) - { - return false; - } - return true; -} diff --git a/src/corehost/cli/deps_resolver.h b/src/corehost/cli/deps_resolver.h deleted file mode 100644 index 3a602ccd3..000000000 --- a/src/corehost/cli/deps_resolver.h +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef DEPS_RESOLVER_H -#define DEPS_RESOLVER_H - -#include - -#include "pal.h" -#include "args.h" -#include "trace.h" -#include "deps_format.h" -#include "deps_entry.h" -#include "runtime_config.h" - -// Probe paths to be resolved for ordering -struct probe_paths_t -{ - pal::string_t tpa; - pal::string_t native; - pal::string_t resources; -}; - -class deps_resolver_t -{ -public: - deps_resolver_t(const hostpolicy_init_t& init, const arguments_t& args) - : m_fx_dir(init.fx_dir) - , m_app_dir(args.app_dir) - , m_managed_app(args.managed_application) - , m_coreclr_index(-1) - , m_portable(init.is_portable) - , m_deps(nullptr) - , m_fx_deps(nullptr) - , m_core_servicing(args.core_servicing) - { - m_deps_file = args.deps_path; - if (m_portable) - { - m_fx_deps_file = get_fx_deps(m_fx_dir, init.fx_name); - trace::verbose(_X("Using %s FX deps file"), m_fx_deps_file.c_str()); - trace::verbose(_X("Using %s deps file"), m_deps_file.c_str()); - m_fx_deps = std::unique_ptr(new deps_json_t(false, m_fx_deps_file)); - m_deps = std::unique_ptr(new deps_json_t(true, m_deps_file, m_fx_deps->get_rid_fallback_graph())); - } - else - { - m_deps = std::unique_ptr(new deps_json_t(false, m_deps_file)); - } - - setup_additional_probes(args.probe_paths); - setup_probe_config(init, args); - } - - bool valid(pal::string_t* errors) - { - if (!m_deps->is_valid()) - { - errors->assign(_X("An error occurred while parsing ") + m_deps_file); - return false; - } - if (m_portable && !m_fx_deps->exists()) - { - errors->assign(_X("A fatal error was encountered, missing dependencies manifest at: ") + m_fx_deps_file); - return false; - } - if (m_portable && !m_fx_deps->is_valid()) - { - errors->assign(_X("An error occurred while parsing ") + m_fx_deps_file); - return false; - } - errors->clear(); - return true; - } - void setup_probe_config( - const hostpolicy_init_t& init, - const arguments_t& args); - - void setup_additional_probes(const std::vector& probe_paths); - - bool resolve_probe_paths( - probe_paths_t* probe_paths, - std::unordered_set* breadcrumb); - - bool get_coreclr_dir_from_deps(const pal::string_t& deps_dir, deps_json_t* deps, pal::string_t* candidate); - - bool resolve_coreclr_dir(pal::string_t* clr_dir); - - const pal::string_t& get_fx_deps_file() const - { - return m_fx_deps_file; - } - - const pal::string_t& get_deps_file() const - { - return m_deps_file; - } - - const std::unordered_set& get_api_sets() const - { - return m_api_set_paths; - } -private: - - static pal::string_t get_fx_deps(const pal::string_t& fx_dir, const pal::string_t& fx_name) - { - pal::string_t fx_deps = fx_dir; - pal::string_t fx_deps_name = fx_name + _X(".deps.json"); - append_path(&fx_deps, fx_deps_name.c_str()); - return fx_deps; - } - - // Resolve order for TPA lookup. - bool resolve_tpa_list( - pal::string_t* output, - std::unordered_set* breadcrumb); - - // Resolve order for culture and native DLL lookup. - bool resolve_probe_dirs( - deps_entry_t::asset_types asset_type, - pal::string_t* output, - std::unordered_set* breadcrumb); - - // Populate assemblies from the directory. - void get_dir_assemblies( - const pal::string_t& dir, - const pal::string_t& dir_name, - std::unordered_map* dir_assemblies); - - // Probe entry in probe configurations and deps dir. - bool probe_deps_entry( - const deps_entry_t& entry, - const pal::string_t& deps_dir, - pal::string_t* candidate); - - // Probe entry in probe configurations. - bool probe_entry_in_configs( - const deps_entry_t& entry, - pal::string_t* candidate); - - // Try auto roll forward, if not return entry in probe dir. - bool try_roll_forward( - const deps_entry_t& entry, - const pal::string_t& probe_dir, - bool patch_roll_fwd, - bool prerelease_roll_fwd, - pal::string_t* candidate); - - // Framework deps file. - pal::string_t m_fx_dir; - - pal::string_t m_app_dir; - - // Map of simple name -> full path of local/fx assemblies populated - // in priority order of their extensions. - typedef std::unordered_map dir_assemblies_t; - - std::unordered_map m_patch_roll_forward_cache; - std::unordered_map m_prerelease_roll_forward_cache; - - pal::string_t m_package_cache; - - // The managed application the dependencies are being resolved for. - pal::string_t m_managed_app; - - // Servicing root, could be empty on platforms that don't support or when errors occur. - pal::string_t m_core_servicing; - - // Special entry for api-sets - std::unordered_set m_api_set_paths; - - // Special entry for coreclr in the deps entries - int m_coreclr_index; - - // The filepath for the app deps - pal::string_t m_deps_file; - - // The filepath for the fx deps - pal::string_t m_fx_deps_file; - - // Deps files for the fx - std::unique_ptr m_fx_deps; - - // Deps files for the app - std::unique_ptr m_deps; - - // Various probe configurations. - std::vector m_probes; - - // Is the deps file valid - bool m_deps_valid; - - // Fallback probe dir - std::vector m_additional_probes; - - // Is the deps file portable app? - bool m_portable; -}; - -#endif // DEPS_RESOLVER_H diff --git a/src/corehost/cli/dll/CMakeLists.txt b/src/corehost/cli/dll/CMakeLists.txt deleted file mode 100644 index 78140db72..000000000 --- a/src/corehost/cli/dll/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -cmake_minimum_required (VERSION 2.6) -project(hostpolicy) - -if(WIN32) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MTd>) -else() - add_compile_options(-fPIC) -endif() - -include(../setup.cmake) - -include_directories(../../common) -include_directories(../json/casablanca/include) - -# CMake does not recommend using globbing since it messes with the freshness checks -set(SOURCES - ../../common/trace.cpp - ../../common/utils.cpp - ../libhost.cpp - ../runtime_config.cpp - ../json/casablanca/src/json/json.cpp - ../json/casablanca/src/json/json_parsing.cpp - ../json/casablanca/src/json/json_serialization.cpp - ../json/casablanca/src/utilities/asyncrt_utils.cpp - ../fxr/fx_ver.cpp - ../breadcrumbs.cpp - ../args.cpp - ../hostpolicy.cpp - ../coreclr.cpp - ../deps_resolver.cpp - ../deps_format.cpp - ../deps_entry.cpp) - - -if(WIN32) - list(APPEND SOURCES ../../common/pal.windows.cpp) -else() - list(APPEND SOURCES ../../common/pal.unix.cpp) -endif() - -add_definitions(-D_NO_ASYNCRTIMP) -add_definitions(-D_NO_PPLXIMP) -add_definitions(-DCOREHOST_MAKE_DLL=1) - -add_library(hostpolicy SHARED ${SOURCES}) - diff --git a/src/corehost/cli/fxr/CMakeLists.txt b/src/corehost/cli/fxr/CMakeLists.txt deleted file mode 100644 index 318c396b3..000000000 --- a/src/corehost/cli/fxr/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -cmake_minimum_required (VERSION 2.6) -project(hostpolicy) - -if(WIN32) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MT>) - add_compile_options($<$:/MTd>) -else() - add_compile_options(-fPIC) -endif() - -include(../setup.cmake) - -include_directories(../../common) -include_directories(../json/casablanca/include) - -# CMake does not recommend using globbing since it messes with the freshness checks -set(SOURCES - ../../common/trace.cpp - ../../common/utils.cpp - ../libhost.cpp - ../deps_format.cpp - ../deps_entry.cpp - ../runtime_config.cpp - ../json/casablanca/src/json/json.cpp - ../json/casablanca/src/json/json_parsing.cpp - ../json/casablanca/src/json/json_serialization.cpp - ../json/casablanca/src/utilities/asyncrt_utils.cpp - ./hostfxr.cpp - ./fx_ver.cpp - ./fx_muxer.cpp) - - -if(WIN32) - list(APPEND SOURCES ../../common/pal.windows.cpp) -else() - list(APPEND SOURCES ../../common/pal.unix.cpp) -endif() - -add_definitions(-D_NO_ASYNCRTIMP) -add_definitions(-D_NO_PPLXIMP) -add_definitions(-DCOREHOST_MAKE_DLL=1) - -add_library(hostfxr SHARED ${SOURCES}) - - diff --git a/src/corehost/cli/fxr/fx_muxer.cpp b/src/corehost/cli/fxr/fx_muxer.cpp deleted file mode 100644 index b59fb4f56..000000000 --- a/src/corehost/cli/fxr/fx_muxer.cpp +++ /dev/null @@ -1,847 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include "pal.h" -#include "utils.h" -#include "libhost.h" -#include "args.h" -#include "fx_ver.h" -#include "fx_muxer.h" -#include "trace.h" -#include "runtime_config.h" -#include "cpprest/json.h" -#include "error_codes.h" -#include "deps_format.h" - - -static const pal::char_t* s_dotnet_sdk_download_url = _X("http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409"); - -/** - * When the framework is not found, display detailed error message - * about available frameworks and installation of new framework. - */ -void handle_missing_framework_error(const pal::string_t& fx_name, const pal::string_t& fx_version, const pal::string_t& fx_dir) -{ - pal::string_t fx_ver_dirs = get_directory(fx_dir); - - // Display the error message about missing FX. - trace::error(_X("The specified framework '%s', version '%s' was not found."), fx_name.c_str(), fx_version.c_str()); - trace::error(_X(" - Check application dependencies and target a framework version installed at:")); - trace::error(_X(" %s"), fx_ver_dirs.c_str()); - - // Gather the list of versions installed at the shared FX location. - bool is_print_header = true; - std::vector versions; - pal::readdir(fx_ver_dirs, &versions); - for (const auto& ver : versions) - { - // Make sure we filter out any non-version folders at shared FX location. - fx_ver_t parsed(-1, -1, -1); - if (fx_ver_t::parse(ver, &parsed, false)) - { - // Print banner only once before printing the versions - if (is_print_header) - { - trace::error(_X(" - The following versions are installed:")); - is_print_header = false; - } - trace::error(_X(" %s"), ver.c_str()); - } - } - trace::error(_X(" - Alternatively, install the framework version '%s'."), fx_version.c_str()); -} - -/** - * Resolve the hostpolicy version from deps. - * - Scan the deps file's libraries section and find the hostpolicy version in the file. - */ -pal::string_t resolve_hostpolicy_version_from_deps(const pal::string_t& deps_json) -{ - trace::verbose(_X("--- Resolving %s version from deps json [%s]"), LIBHOSTPOLICY_NAME, deps_json.c_str()); - - pal::string_t retval; - if (!pal::file_exists(deps_json)) - { - trace::verbose(_X("Dependency manifest [%s] does not exist"), deps_json.c_str()); - return retval; - } - - pal::ifstream_t file(deps_json); - if (!file.good()) - { - trace::verbose(_X("Dependency manifest [%s] could not be opened"), deps_json.c_str()); - return retval; - } - - if (skip_utf8_bom(&file)) - { - trace::verbose(_X("UTF-8 BOM skipped while reading [%s]"), deps_json.c_str()); - } - - try - { - const auto root = json_value::parse(file); - const auto& json = root.as_object(); - const auto& libraries = json.at(_X("libraries")).as_object(); - - // Look up the root package instead of the "runtime" package because we can't do a full rid resolution. - // i.e., look for "Microsoft.NETCore.DotNetHostPolicy/" followed by version. - pal::string_t prefix = _X("Microsoft.NETCore.DotNetHostPolicy/"); - for (const auto& library : libraries) - { - if (starts_with(library.first, prefix, false)) - { - // Extract the version information that occurs after '/' - retval = library.first.substr(prefix.size()); - break; - } - } - } - catch (const std::exception& je) - { - pal::string_t jes; - (void)pal::utf8_palstring(je.what(), &jes); - trace::error(_X("A JSON parsing exception occurred in [%s]: %s"), deps_json.c_str(), jes.c_str()); - } - trace::verbose(_X("Resolved version %s from dependency manifest file [%s]"), retval.c_str(), deps_json.c_str()); - return retval; -} - -/** - * Given a directory and a version, find if the package relative - * dir under the given directory contains hostpolicy.dll - */ -bool to_hostpolicy_package_dir(const pal::string_t& dir, const pal::string_t& version, pal::string_t* candidate) -{ - assert(!version.empty()); - - candidate->clear(); - - // Ensure the relative dir contains platform directory separators. - pal::string_t rel_dir = _STRINGIFY(HOST_POLICY_PKG_REL_DIR); - if (DIR_SEPARATOR != '/') - { - replace_char(&rel_dir, '/', DIR_SEPARATOR); - } - - // Construct the path to directory containing hostpolicy. - pal::string_t path = dir; - append_path(&path, _STRINGIFY(HOST_POLICY_PKG_NAME)); // package name - append_path(&path, version.c_str()); // package version - append_path(&path, rel_dir.c_str()); // relative dir containing hostpolicy library - - // Check if "path" contains the required library. - if (!library_exists_in_dir(path, LIBHOSTPOLICY_NAME, nullptr)) - { - trace::verbose(_X("Did not find %s in directory %s"), LIBHOSTPOLICY_NAME, path.c_str()); - return false; - } - - // "path" contains the directory containing hostpolicy library. - *candidate = path; - - trace::verbose(_X("Found %s in directory %s"), LIBHOSTPOLICY_NAME, path.c_str()); - return true; -} - -/** - * Given a nuget version, detect if a serviced hostpolicy is available at - * platform servicing location. - */ -bool hostpolicy_exists_in_svc(const pal::string_t& version, pal::string_t* resolved_dir) -{ - if (version.empty()) - { - return false; - } - - pal::string_t svc_dir; - pal::get_default_servicing_directory(&svc_dir); - append_path(&svc_dir, _X("pkgs")); - return to_hostpolicy_package_dir(svc_dir, version, resolved_dir); -} - -/** - * Given path to app binary, say app.dll or app.exe, retrieve the app.deps.json. - */ -pal::string_t get_deps_from_app_binary(const pal::string_t& app) -{ - assert(app.find(DIR_SEPARATOR) != pal::string_t::npos); - assert(ends_with(app, _X(".dll"), false) || ends_with(app, _X(".exe"), false)); - - // First append directory. - pal::string_t deps_file; - deps_file.assign(get_directory(app)); - deps_file.push_back(DIR_SEPARATOR); - - // Then the app name and the file extension - pal::string_t app_name = get_filename(app); - deps_file.append(app_name, 0, app_name.find_last_of(_X("."))); - deps_file.append(_X(".deps.json")); - return deps_file; -} - -/** - * Given a version and probing paths, find if package layout - * directory containing hostpolicy exists. - */ -bool resolve_hostpolicy_dir_from_probe_paths(const pal::string_t& version, const std::vector& probe_realpaths, pal::string_t* candidate) -{ - if (probe_realpaths.empty() || version.empty()) - { - return false; - } - - // Check if the package relative directory containing hostpolicy exists. - for (const auto& probe_path : probe_realpaths) - { - trace::verbose(_X("Considering %s to probe for %s"), probe_path.c_str(), LIBHOSTPOLICY_NAME); - if (to_hostpolicy_package_dir(probe_path, version, candidate)) - { - return true; - } - } - - // Print detailed message about the file not found in the probe paths. - trace::error(_X("Could not find required library %s in %d probing paths:"), - LIBHOSTPOLICY_NAME, probe_realpaths.size()); - for (const auto& path : probe_realpaths) - { - trace::error(_X(" %s"), path.c_str()); - } - return false; -} - -/** - * Given FX location, app binary and specified --depsfile, return deps that contains hostpolicy.dll - */ -pal::string_t get_deps_file( - const pal::string_t& fx_dir, - const pal::string_t& app_candidate, - const pal::string_t& specified_deps_file, - const runtime_config_t& config) -{ - if (config.get_portable()) - { - // Portable app's hostpolicy is resolved from FX deps - return fx_dir + DIR_SEPARATOR + config.get_fx_name() + _X(".deps.json"); - } - else - { - // Standalone app's hostpolicy is from specified deps or from app deps. - return !specified_deps_file.empty() ? specified_deps_file : get_deps_from_app_binary(app_candidate); - } -} - -/** - * Given own location, FX location, app binary and specified --depsfile and probe paths - * return location that is expected to contain hostpolicy - */ -bool fx_muxer_t::resolve_hostpolicy_dir(host_mode_t mode, - const pal::string_t& own_dir, - const pal::string_t& fx_dir, - const pal::string_t& app_candidate, - const pal::string_t& specified_deps_file, - const pal::string_t& specified_fx_version, - const std::vector& probe_realpaths, - const runtime_config_t& config, - pal::string_t* impl_dir) -{ - // Obtain deps file for the given configuration. - pal::string_t resolved_deps = get_deps_file(fx_dir, app_candidate, specified_deps_file, config); - - // Resolve hostpolicy version out of the deps file. - pal::string_t version = resolve_hostpolicy_version_from_deps(resolved_deps); - if (trace::is_enabled() && version.empty() && pal::file_exists(resolved_deps)) - { - trace::warning(_X("Dependency manifest %s does not contain an entry for %s"), resolved_deps.c_str(), _STRINGIFY(HOST_POLICY_PKG_NAME)); - } - - // Check if the given version of the hostpolicy exists in servicing. - if (hostpolicy_exists_in_svc(version, impl_dir)) - { - return true; - } - - // Get the expected directory that would contain hostpolicy. - pal::string_t expected; - if (config.get_portable()) - { - if (!pal::directory_exists(fx_dir)) - { - pal::string_t fx_version = specified_fx_version.empty() ? config.get_fx_version() : specified_fx_version; - handle_missing_framework_error(config.get_fx_name(), fx_version, fx_dir); - return false; - } - - expected = fx_dir; - } - else - { - // Standalone apps can be activated by muxer or by standalone host or "corehost" - // 1. When activated with dotnet.exe or corehost.exe, check for hostpolicy in the deps dir or - // app dir. - // 2. When activated with app.exe, the standalone host, check own directory. - assert(mode == host_mode_t::muxer || mode == host_mode_t::standalone || mode == host_mode_t::split_fx); - expected = (mode == host_mode_t::standalone) - ? own_dir - : get_directory(specified_deps_file.empty() ? app_candidate : specified_deps_file); - } - - // Check if hostpolicy exists in "expected" directory. - trace::verbose(_X("The expected %s directory is [%s]"), LIBHOSTPOLICY_NAME, expected.c_str()); - if (library_exists_in_dir(expected, LIBHOSTPOLICY_NAME, nullptr)) - { - impl_dir->assign(expected); - return true; - } - - trace::verbose(_X("The %s was not found in [%s]"), LIBHOSTPOLICY_NAME, expected.c_str()); - - // Start probing for hostpolicy in the specified probe paths. - pal::string_t candidate; - if (resolve_hostpolicy_dir_from_probe_paths(version, probe_realpaths, &candidate)) - { - impl_dir->assign(candidate); - return true; - } - - // If it still couldn't be found, somebody upstack messed up. Flag an error for the "expected" location. - trace::error(_X("A fatal error was encountered. The library '%s' required to execute the application was not found in '%s'."), LIBHOSTPOLICY_NAME, expected.c_str()); - return false; -} - -pal::string_t fx_muxer_t::resolve_fx_dir(host_mode_t mode, const pal::string_t& own_dir, const runtime_config_t& config, const pal::string_t& specified_fx_version) -{ - // No FX resolution for standalone apps. - assert(mode != host_mode_t::standalone); - - // If invoking using FX dotnet.exe, use own directory. - if (mode == host_mode_t::split_fx) - { - return own_dir; - } - assert(mode == host_mode_t::muxer); - - trace::verbose(_X("--- Resolving FX directory from muxer dir '%s', specified '%s'"), own_dir.c_str(), specified_fx_version.c_str()); - const auto fx_name = config.get_fx_name(); - const auto fx_ver = specified_fx_version.empty() ? config.get_fx_version() : specified_fx_version; - - fx_ver_t specified(-1, -1, -1); - if (!fx_ver_t::parse(fx_ver, &specified, false)) - { - trace::error(_X("The specified framework version '%s' could not be parsed"), fx_ver.c_str()); - return pal::string_t(); - } - - auto fx_dir = own_dir; - append_path(&fx_dir, _X("shared")); - append_path(&fx_dir, fx_name.c_str()); - - bool do_roll_forward = false; - if (specified_fx_version.empty()) - { - if (!specified.is_prerelease()) - { - // If production and no roll forward use given version. - do_roll_forward = config.get_patch_roll_fwd(); - } - else - { - // Prerelease, but roll forward only if version doesn't exist. - pal::string_t ver_dir = fx_dir; - append_path(&ver_dir, fx_ver.c_str()); - do_roll_forward = !pal::directory_exists(ver_dir); - } - } - - if (!do_roll_forward) - { - trace::verbose(_X("Did not roll forward because specified version='%s', patch_roll_fwd=%d, chose [%s]"), specified_fx_version.c_str(), config.get_patch_roll_fwd(), fx_ver.c_str()); - append_path(&fx_dir, fx_ver.c_str()); - } - else - { - trace::verbose(_X("Attempting FX roll forward starting from [%s]"), fx_ver.c_str()); - - std::vector list; - pal::readdir(fx_dir, &list); - fx_ver_t most_compatible = specified; - for (const auto& version : list) - { - trace::verbose(_X("Inspecting version... [%s]"), version.c_str()); - fx_ver_t ver(-1, -1, -1); - if (!specified.is_prerelease() && fx_ver_t::parse(version, &ver, true) && // true -- only prod. prevents roll forward to prerelease. - ver.get_major() == specified.get_major() && - ver.get_minor() == specified.get_minor()) - { - // Pick the greatest production that differs only in patch. - most_compatible = std::max(ver, most_compatible); - } - if (specified.is_prerelease() && fx_ver_t::parse(version, &ver, false) && // false -- implies both production and prerelease. - ver.is_prerelease() && // prevent roll forward to production. - ver.get_major() == specified.get_major() && - ver.get_minor() == specified.get_minor() && - ver.get_patch() == specified.get_patch() && - ver > specified) - { - // Pick the smallest prerelease that is greater than specified. - most_compatible = (most_compatible == specified) ? ver : std::min(ver, most_compatible); - } - } - pal::string_t most_compatible_str = most_compatible.as_str(); - append_path(&fx_dir, most_compatible_str.c_str()); - } - - trace::verbose(_X("Chose FX version [%s]"), fx_dir.c_str()); - return fx_dir; -} - -pal::string_t fx_muxer_t::resolve_cli_version(const pal::string_t& global_json) -{ - trace::verbose(_X("--- Resolving CLI version from global json [%s]"), global_json.c_str()); - - pal::string_t retval; - if (!pal::file_exists(global_json)) - { - trace::verbose(_X("[%s] does not exist"), global_json.c_str()); - return retval; - } - - pal::ifstream_t file(global_json); - if (!file.good()) - { - trace::verbose(_X("[%s] could not be opened"), global_json.c_str()); - return retval; - } - - if (skip_utf8_bom(&file)) - { - trace::verbose(_X("UTF-8 BOM skipped while reading [%s]"), global_json.c_str()); - } - - try - { - const auto root = json_value::parse(file); - const auto& json = root.as_object(); - const auto sdk_iter = json.find(_X("sdk")); - if (sdk_iter == json.end() || sdk_iter->second.is_null()) - { - trace::verbose(_X("CLI '/sdk/version' field not present/null in [%s]"), global_json.c_str()); - return retval; - } - - const auto& sdk_obj = sdk_iter->second.as_object(); - const auto ver_iter = sdk_obj.find(_X("version")); - if (ver_iter == sdk_obj.end() || ver_iter->second.is_null()) - { - trace::verbose(_X("CLI 'sdk/version' field not present/null in [%s]"), global_json.c_str()); - return retval; - } - retval = ver_iter->second.as_string(); - } - catch (const std::exception& je) - { - pal::string_t jes; - (void) pal::utf8_palstring(je.what(), &jes); - trace::error(_X("A JSON parsing exception occurred in [%s]: %s"), global_json.c_str(), jes.c_str()); - } - trace::verbose(_X("CLI version is [%s] in global json file [%s]"), retval.c_str(), global_json.c_str()); - return retval; -} - -pal::string_t resolve_sdk_version(pal::string_t sdk_path) -{ - trace::verbose(_X("--- Resolving SDK version from SDK dir [%s]"), sdk_path.c_str()); - - pal::string_t retval; - std::vector versions; - - pal::readdir(sdk_path, &versions); - fx_ver_t max_ver(-1, -1, -1); - fx_ver_t max_pre(-1, -1, -1); - for (const auto& version : versions) - { - trace::verbose(_X("Considering version... [%s]"), version.c_str()); - - fx_ver_t ver(-1, -1, -1); - if (fx_ver_t::parse(version, &ver, true)) - { - max_ver = std::max(ver, max_ver); - } - if (fx_ver_t::parse(version, &ver, false)) - { - max_pre = std::max(ver, max_pre); - } - } - - // No production, use the max pre-release. - if (max_ver == fx_ver_t(-1, -1, -1)) - { - trace::verbose(_X("No production version found, so using latest prerelease")); - max_ver = max_pre; - } - - pal::string_t max_ver_str = max_ver.as_str(); - append_path(&sdk_path, max_ver_str.c_str()); - - trace::verbose(_X("Checking if resolved SDK dir [%s] exists"), sdk_path.c_str()); - if (pal::directory_exists(sdk_path)) - { - retval = sdk_path; - } - - trace::verbose(_X("Resolved SDK dir is [%s]"), retval.c_str()); - return retval; -} - -bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, pal::string_t* cli_sdk) -{ - trace::verbose(_X("--- Resolving dotnet from working dir")); - pal::string_t cwd; - pal::string_t global; - if (pal::getcwd(&cwd)) - { - for (pal::string_t parent_dir, cur_dir = cwd; true; cur_dir = parent_dir) - { - pal::string_t file = cur_dir; - append_path(&file, _X("global.json")); - - trace::verbose(_X("Probing path [%s] for global.json"), file.c_str()); - if (pal::file_exists(file)) - { - global = file; - trace::verbose(_X("Found global.json [%s]"), global.c_str()); - break; - } - parent_dir = get_directory(cur_dir); - if (parent_dir.empty() || parent_dir.size() == cur_dir.size()) - { - trace::verbose(_X("Terminating global.json search at [%s]"), parent_dir.c_str()); - break; - } - } - } - else - { - trace::verbose(_X("Failed to obtain current working dir")); - } - - pal::string_t retval; - if (!global.empty()) - { - pal::string_t cli_version = resolve_cli_version(global); - if (!cli_version.empty()) - { - pal::string_t sdk_path = own_dir; - append_path(&sdk_path, _X("sdk")); - append_path(&sdk_path, cli_version.c_str()); - - if (pal::directory_exists(sdk_path)) - { - trace::verbose(_X("CLI directory [%s] from global.json exists"), sdk_path.c_str()); - retval = sdk_path; - } - else - { - trace::verbose(_X("CLI directory [%s] from global.json doesn't exist"), sdk_path.c_str()); - } - } - } - if (retval.empty()) - { - pal::string_t sdk_path = own_dir; - append_path(&sdk_path, _X("sdk")); - retval = resolve_sdk_version(sdk_path); - } - cli_sdk->assign(retval); - trace::verbose(_X("Found CLI SDK in: %s"), cli_sdk->c_str()); - return !retval.empty(); -} - -int muxer_usage() -{ - trace::println(); - trace::println(_X("Microsoft .NET Core Shared Framework Host")); - trace::println(); - trace::println(_X(" Version : %s"), _STRINGIFY(HOST_FXR_PKG_VER)); - trace::println(_X(" Build : %s"), _STRINGIFY(REPO_COMMIT_HASH)); - trace::println(); - trace::println(_X("Usage: dotnet [common-options] [[options] path-to-application]")); - trace::println(); - trace::println(_X("Common Options:")); - trace::println(_X(" --help Display .NET Core Shared Framework Host help.")); - trace::println(_X(" --version Display .NET Core Shared Framework Host version.")); - trace::println(); - trace::println(_X("Options:")); - trace::println(_X(" --fx-version Version of the installed Shared Framework to use to run the application.")); - trace::println(_X(" --additionalprobingpath Path containing probing policy and assemblies to probe for.")); - trace::println(); - trace::println(_X("Path to Application:")); - trace::println(_X(" The path to a .NET Core managed application, dll or exe file to execute.")); - trace::println(); - trace::println(_X("If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.")); - trace::println(); - trace::println(_X("To get started on developing applications for .NET Core, install .NET SDK from:")); - trace::println(_X(" %s"), s_dotnet_sdk_download_url); - - return StatusCode::InvalidArgFailure; -} - -// Convert "path" to realpath (merging working dir if needed) and append to "realpaths" out param. -void append_realpath(const pal::string_t& path, std::vector* realpaths) -{ - pal::string_t real = path; - if (pal::realpath(&real)) - { - realpaths->push_back(real); - } -} - -int fx_muxer_t::parse_args_and_execute( - const pal::string_t& own_dir, - const pal::string_t& own_dll, - int argoff, int argc, const pal::char_t* argv[], bool exec_mode, host_mode_t mode, bool* is_an_app) -{ - *is_an_app = true; - - std::vector known_opts = { _X("--additionalprobingpath") }; - if (exec_mode || mode == host_mode_t::split_fx || mode == host_mode_t::standalone) - { - known_opts.push_back(_X("--depsfile")); - known_opts.push_back(_X("--runtimeconfig")); - } - if (mode == host_mode_t::muxer) - { - known_opts.push_back(_X("--fx-version")); - } - - // Parse the known arguments if any. - int num_parsed = 0; - std::unordered_map> opts; - if (!parse_known_args(argc - argoff, &argv[argoff], known_opts, &opts, &num_parsed)) - { - trace::error(_X("Failed to parse supported options or their values:")); - for (const auto& arg : known_opts) - { - trace::error(_X(" %s"), arg.c_str()); - } - return InvalidArgFailure; - } - - const pal::char_t** new_argv = argv; - int new_argc = argc; - std::vector vec_argv; - pal::string_t app_candidate = own_dll; - int cur_i = argoff + num_parsed; - if (mode != host_mode_t::standalone) - { - trace::verbose(_X("Detected a non-standalone application, expecting app.dll to execute.")); - if (cur_i >= argc) - { - return muxer_usage(); - } - - app_candidate = argv[cur_i]; - bool is_app_managed = (ends_with(app_candidate, _X(".dll"), false) || ends_with(app_candidate, _X(".exe"), false)) && pal::realpath(&app_candidate); - - if (!is_app_managed) - { - trace::verbose(_X("Application '%s' is not a managed executable."), app_candidate.c_str()); - - *is_an_app = false; - - if (exec_mode) - { - trace::error(_X("dotnet exec needs a managed .dll or .exe extension. The application specified was '%s'"), app_candidate.c_str()); - return InvalidArgFailure; - } - - // Route to CLI. - return AppArgNotRunnable; - } - } - - // App is managed executable. - trace::verbose(_X("Treating application '%s' as a managed executable."), app_candidate.c_str()); - - if (!pal::file_exists(app_candidate)) - { - trace::error(_X("The application to execute does not exist: '%s'"), app_candidate.c_str()); - return InvalidArgFailure; - } - - if (cur_i != 1) - { - vec_argv.resize(argc - cur_i + 1, 0); // +1 for dotnet - memcpy(vec_argv.data() + 1, argv + cur_i, (argc - cur_i) * sizeof(pal::char_t*)); - vec_argv[0] = argv[0]; - new_argv = vec_argv.data(); - new_argc = vec_argv.size(); - } - - // Transform dotnet [exec] [--additionalprobingpath path] [--depsfile file] [dll] [args] -> dotnet [dll] [args] - return read_config_and_execute(own_dir, app_candidate, opts, new_argc, new_argv, mode); -} - -int fx_muxer_t::read_config_and_execute( - const pal::string_t& own_dir, - const pal::string_t& app_candidate, - const std::unordered_map>& opts, - int new_argc, const pal::char_t** new_argv, host_mode_t mode) -{ - pal::string_t opts_fx_version = _X("--fx-version"); - pal::string_t opts_deps_file = _X("--depsfile"); - pal::string_t opts_probe_path = _X("--additionalprobingpath"); - pal::string_t opts_runtime_config = _X("--runtimeconfig"); - - pal::string_t fx_version = get_last_known_arg(opts, opts_fx_version, _X("")); - pal::string_t deps_file = get_last_known_arg(opts, opts_deps_file, _X("")); - pal::string_t runtime_config = get_last_known_arg(opts, opts_runtime_config, _X("")); - std::vector spec_probe_paths = opts.count(opts_probe_path) ? opts.find(opts_probe_path)->second : std::vector(); - - if (!deps_file.empty() && (!pal::realpath(&deps_file) || !pal::file_exists(deps_file))) - { - trace::error(_X("The specified deps.json [%s] does not exist"), deps_file.c_str()); - return StatusCode::InvalidArgFailure; - } - if (!runtime_config.empty() && (!pal::realpath(&runtime_config) || !pal::file_exists(runtime_config))) - { - trace::error(_X("The specified runtimeconfig.json [%s] does not exist"), runtime_config.c_str()); - return StatusCode::InvalidConfigFile; - } - - pal::string_t config_file, dev_config_file; - - if (runtime_config.empty()) - { - trace::verbose(_X("App runtimeconfig.json from [%s]"), app_candidate.c_str()); - get_runtime_config_paths_from_app(app_candidate, &config_file, &dev_config_file); - } - else - { - trace::verbose(_X("Specified runtimeconfig.json from [%s]"), runtime_config.c_str()); - get_runtime_config_paths_from_arg(runtime_config, &config_file, &dev_config_file); - } - - runtime_config_t config(config_file, dev_config_file); - if (!config.is_valid()) - { - trace::error(_X("Invalid runtimeconfig.json [%s] [%s]"), config.get_path().c_str(), config.get_dev_path().c_str()); - return StatusCode::InvalidConfigFile; - } - - // Append specified probe paths first and then config file probe paths into realpaths. - std::vector probe_realpaths; - for (const auto& path : spec_probe_paths) - { - append_realpath(path, &probe_realpaths); - } - for (const auto& path : config.get_probe_paths()) - { - append_realpath(path, &probe_realpaths); - } - - bool is_portable = config.get_portable(); - pal::string_t fx_dir = is_portable ? resolve_fx_dir(mode, own_dir, config, fx_version) : _X(""); - - trace::verbose(_X("Executing as a %s app as per config file [%s]"), - (is_portable ? _X("portable") : _X("standalone")), config_file.c_str()); - - pal::string_t impl_dir; - if (!resolve_hostpolicy_dir(mode, own_dir, fx_dir, app_candidate, deps_file, fx_version, probe_realpaths, config, &impl_dir)) - { - return CoreHostLibMissingFailure; - } - - corehost_init_t init(deps_file, probe_realpaths, fx_dir, mode, config); - return execute_app(impl_dir, &init, new_argc, new_argv); -} - -/* static */ -int fx_muxer_t::execute(const int argc, const pal::char_t* argv[]) -{ - pal::string_t own_path; - - // Get the full name of the application - if (!pal::get_own_executable_path(&own_path) || !pal::realpath(&own_path)) - { - trace::error(_X("Failed to resolve full path of the current executable [%s]"), own_path.c_str()); - return StatusCode::LibHostCurExeFindFailure; - } - pal::string_t own_name = get_filename(own_path); - pal::string_t own_dir = get_directory(own_path); - - pal::string_t own_dll_filename = get_executable(own_name) + _X(".dll"); - pal::string_t own_dll = own_dir; - append_path(&own_dll, own_dll_filename.c_str()); - - trace::info(_X("Own DLL path=[%s]"), own_dll.c_str()); - auto mode = detect_operating_mode(own_dir, own_dll, own_name); - bool is_an_app = true; - if (mode == host_mode_t::split_fx) - { - trace::verbose(_X("--- Executing in split/FX mode...")); - return parse_args_and_execute(own_dir, own_dll, 1, argc, argv, false, host_mode_t::split_fx, &is_an_app); - } - if (mode == host_mode_t::standalone) - { - trace::verbose(_X("--- Executing in standalone mode...")); - return parse_args_and_execute(own_dir, own_dll, 1, argc, argv, false, host_mode_t::standalone, &is_an_app); - } - - trace::verbose(_X("--- Executing in muxer mode...")); - - if (argc <= 1) - { - return muxer_usage(); - } - - if (pal::strcasecmp(_X("exec"), argv[1]) == 0) - { - return parse_args_and_execute(own_dir, own_dll, 2, argc, argv, true, host_mode_t::muxer, &is_an_app); // arg offset 2 for dotnet, exec - } - - int result = parse_args_and_execute(own_dir, own_dll, 1, argc, argv, false, host_mode_t::muxer, &is_an_app); // arg offset 1 for dotnet - if (is_an_app) - { - return result; - } - - // Could not execute as an app, try the CLI SDK dotnet.dll - pal::string_t sdk_dotnet; - if (!resolve_sdk_dotnet_path(own_dir, &sdk_dotnet)) - { - assert(argc > 1); - if (pal::strcasecmp(_X("--help"), argv[1]) == 0 || - pal::strcasecmp(_X("--version"), argv[1]) == 0 || - pal::strcasecmp(_X("-h"), argv[1]) == 0 || - pal::strcasecmp(_X("-v"), argv[1]) == 0) - { - return muxer_usage(); - } - trace::error(_X("Did you mean to run dotnet SDK commands? Please install dotnet SDK from: ")); - trace::error(_X(" %s"), s_dotnet_sdk_download_url); - return StatusCode::LibHostSdkFindFailure; - } - append_path(&sdk_dotnet, _X("dotnet.dll")); - - if (!pal::file_exists(sdk_dotnet)) - { - trace::error(_X("Found dotnet SDK, but did not find dotnet.dll at [%s]"), sdk_dotnet.c_str()); - return StatusCode::LibHostSdkFindFailure; - } - - // Transform dotnet [command] [args] -> dotnet dotnet.dll [command] [args] - - std::vector new_argv(argc + 1); - memcpy(&new_argv.data()[2], argv + 1, (argc - 1) * sizeof(pal::char_t*)); - new_argv[0] = argv[0]; - new_argv[1] = sdk_dotnet.c_str(); - - trace::verbose(_X("Using dotnet SDK dll=[%s]"), sdk_dotnet.c_str()); - return parse_args_and_execute(own_dir, own_dll, 1, new_argv.size(), new_argv.data(), false, host_mode_t::muxer, &is_an_app); -} - - diff --git a/src/corehost/cli/fxr/fx_muxer.h b/src/corehost/cli/fxr/fx_muxer.h deleted file mode 100644 index 5766fddfc..000000000 --- a/src/corehost/cli/fxr/fx_muxer.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -class corehost_init_t; -class runtime_config_t; -struct fx_ver_t; - -#include "libhost.h" - -int execute_app( - const pal::string_t& impl_dll_dir, - corehost_init_t* init, - const int argc, - const pal::char_t* argv[]); - -class fx_muxer_t -{ -public: - static int execute(const int argc, const pal::char_t* argv[]); -private: - static int read_config_and_execute( - const pal::string_t& own_dir, - const pal::string_t& app_candidate, - const std::unordered_map>& opts, - int new_argc, const pal::char_t** new_argv, host_mode_t mode); - static int parse_args_and_execute(const pal::string_t& own_dir, const pal::string_t& own_dll, int argoff, int argc, const pal::char_t* argv[], bool exec_mode, host_mode_t mode, bool* can_execute); - static bool resolve_hostpolicy_dir(host_mode_t mode, - const pal::string_t& own_dir, - const pal::string_t& fx_dir, - const pal::string_t& app_or_deps_dir, - const pal::string_t& specified_deps_file, - const pal::string_t& specified_fx_version, - const std::vector& probe_realpaths, - const runtime_config_t& config, - pal::string_t* impl_dir); - static pal::string_t resolve_fx_dir(host_mode_t mode, const pal::string_t& own_dir, const runtime_config_t& config, const pal::string_t& specified_fx_version); - static pal::string_t resolve_cli_version(const pal::string_t& global); - static bool resolve_sdk_dotnet_path(const pal::string_t& own_dir, pal::string_t* cli_sdk); -}; - diff --git a/src/corehost/cli/fxr/fx_ver.cpp b/src/corehost/cli/fxr/fx_ver.cpp deleted file mode 100644 index d6159fdb9..000000000 --- a/src/corehost/cli/fxr/fx_ver.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include "pal.h" -#include "fx_ver.h" - -fx_ver_t::fx_ver_t(int major, int minor, int patch, const pal::string_t& pre, const pal::string_t& build) - : m_major(major) - , m_minor(minor) - , m_patch(patch) - , m_pre(pre) - , m_build(build) -{ -} - -fx_ver_t::fx_ver_t(int major, int minor, int patch, const pal::string_t& pre) - : fx_ver_t(major, minor, patch, pre, _X("")) -{ -} - -fx_ver_t::fx_ver_t(int major, int minor, int patch) - : fx_ver_t(major, minor, patch, _X(""), _X("")) -{ -} - -bool fx_ver_t::operator ==(const fx_ver_t& b) const -{ - return compare(*this, b) == 0; -} - -bool fx_ver_t::operator !=(const fx_ver_t& b) const -{ - return !operator ==(b); -} - -bool fx_ver_t::operator <(const fx_ver_t& b) const -{ - return compare(*this, b) < 0; -} - -bool fx_ver_t::operator >(const fx_ver_t& b) const -{ - return compare(*this, b) > 0; -} - -pal::string_t fx_ver_t::as_str() const -{ - pal::stringstream_t stream; - stream << m_major << _X(".") << m_minor << _X(".") << m_patch; - if (!m_pre.empty()) - { - stream << m_pre; - } - if (!m_build.empty()) - { - stream << _X("+") << m_build; - } - return stream.str(); -} - -pal::string_t fx_ver_t::prerelease_glob() const -{ - pal::stringstream_t stream; - stream << m_major << _X(".") << m_minor << _X(".") << m_patch << _X("-*"); - return stream.str(); -} - -pal::string_t fx_ver_t::patch_glob() const -{ - pal::stringstream_t stream; - stream << m_major << _X(".") << m_minor << _X(".*"); - return stream.str(); -} - -/* static */ -int fx_ver_t::compare(const fx_ver_t&a, const fx_ver_t& b) -{ - // compare(u.v.w-p+b, x.y.z-q+c) - if (a.m_major != b.m_major) - { - return (a.m_major > b.m_major) ? 1 : -1; - } - - if (a.m_minor != b.m_minor) - { - return (a.m_minor > b.m_minor) ? 1 : -1; - } - - if (a.m_patch != b.m_patch) - { - return (a.m_patch > b.m_patch) ? 1 : -1; - } - - if (a.m_pre.empty() != b.m_pre.empty()) - { - // Either a is empty or b is empty - return a.m_pre.empty() ? 1 : -1; - } - - // Either both are empty or both are non-empty (may be equal) - int pre_cmp = a.m_pre.compare(b.m_pre); - if (pre_cmp != 0) - { - return pre_cmp; - } - - return a.m_build.compare(b.m_build); -} - -bool try_stou(const pal::string_t& str, unsigned* num) -{ - if (str.empty()) - { - return false; - } - if (str.find_first_not_of(_X("0123456789")) != pal::string_t::npos) - { - return false; - } - *num = (unsigned) std::stoul(str); - return true; -} - -bool parse_internal(const pal::string_t& ver, fx_ver_t* fx_ver, bool parse_only_production) -{ - size_t maj_start = 0; - size_t maj_sep = ver.find(_X('.')); - if (maj_sep == pal::string_t::npos) - { - return false; - } - unsigned major = 0; - if (!try_stou(ver.substr(maj_start, maj_sep), &major)) - { - return false; - } - - size_t min_start = maj_sep + 1; - size_t min_sep = ver.find(_X('.'), min_start); - if (min_sep == pal::string_t::npos) - { - return false; - } - - unsigned minor = 0; - if (!try_stou(ver.substr(min_start, min_sep - min_start), &minor)) - { - return false; - } - - unsigned patch = 0; - size_t pat_start = min_sep + 1; - size_t pat_sep = ver.find_first_not_of(_X("0123456789"), pat_start); - if (pat_sep == pal::string_t::npos) - { - if (!try_stou(ver.substr(pat_start), &patch)) - { - return false; - } - - *fx_ver = fx_ver_t(major, minor, patch); - return true; - } - - if (parse_only_production) - { - // This is a prerelease or has build suffix. - return false; - } - - if (!try_stou(ver.substr(pat_start, pat_sep - pat_start), &patch)) - { - return false; - } - - size_t pre_start = pat_sep; - size_t pre_sep = ver.find(_X('+'), pre_start); - if (pre_sep == pal::string_t::npos) - { - *fx_ver = fx_ver_t(major, minor, patch, ver.substr(pre_start)); - return true; - } - else - { - size_t build_start = pre_sep + 1; - *fx_ver = fx_ver_t(major, minor, patch, ver.substr(pre_start, pre_sep - pre_start), ver.substr(build_start)); - return true; - } -} - -/* static */ -bool fx_ver_t::parse(const pal::string_t& ver, fx_ver_t* fx_ver, bool parse_only_production) -{ - bool valid = parse_internal(ver, fx_ver, parse_only_production); - assert(!valid || fx_ver->as_str() == ver); - return valid; -} diff --git a/src/corehost/cli/fxr/fx_ver.h b/src/corehost/cli/fxr/fx_ver.h deleted file mode 100644 index 41912cfdb..000000000 --- a/src/corehost/cli/fxr/fx_ver.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __FX_VER_H__ -#define __FX_VER_H__ - -#include "pal.h" - -// Note: This is not SemVer (esp., in comparing pre-release part, fx_ver_t does not -// compare multiple dot separated identifiers individually.) ex: 1.0.0-beta.2 vs. 1.0.0-beta.11 -struct fx_ver_t -{ - fx_ver_t(int major, int minor, int patch); - fx_ver_t(int major, int minor, int patch, const pal::string_t& pre); - fx_ver_t(int major, int minor, int patch, const pal::string_t& pre, const pal::string_t& build); - - int get_major() const { return m_major; } - int get_minor() const { return m_minor; } - int get_patch() const { return m_patch; } - - void set_major(int m) { m_major = m; } - void set_minor(int m) { m_minor = m; } - void set_patch(int p) { m_patch = p; } - - bool is_prerelease() const { return !m_pre.empty(); } - - pal::string_t as_str() const; - pal::string_t prerelease_glob() const; - pal::string_t patch_glob() const; - - bool operator ==(const fx_ver_t& b) const; - bool operator !=(const fx_ver_t& b) const; - bool operator <(const fx_ver_t& b) const; - bool operator >(const fx_ver_t& b) const; - - static bool parse(const pal::string_t& ver, fx_ver_t* fx_ver, bool parse_only_production = false); - -private: - int m_major; - int m_minor; - int m_patch; - pal::string_t m_pre; - pal::string_t m_build; - - static int compare(const fx_ver_t&a, const fx_ver_t& b); -}; - -#endif // __FX_VER_H__ \ No newline at end of file diff --git a/src/corehost/cli/fxr/hostfxr.cpp b/src/corehost/cli/fxr/hostfxr.cpp deleted file mode 100644 index 010cadc86..000000000 --- a/src/corehost/cli/fxr/hostfxr.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include "trace.h" -#include "pal.h" -#include "utils.h" -#include "fx_ver.h" -#include "fx_muxer.h" -#include "error_codes.h" -#include "libhost.h" -#include "runtime_config.h" - -typedef int(*corehost_load_fn) (const host_interface_t* init); -typedef int(*corehost_main_fn) (const int argc, const pal::char_t* argv[]); -typedef int(*corehost_unload_fn) (); - -int load_host_library( - const pal::string_t& lib_dir, - pal::dll_t* h_host, - corehost_load_fn* load_fn, - corehost_main_fn* main_fn, - corehost_unload_fn* unload_fn) -{ - pal::string_t host_path; - if (!library_exists_in_dir(lib_dir, LIBHOSTPOLICY_NAME, &host_path)) - { - return StatusCode::CoreHostLibMissingFailure; - } - - // Load library - if (!pal::load_library(host_path.c_str(), h_host)) - { - trace::info(_X("Load library of %s failed"), host_path.c_str()); - return StatusCode::CoreHostLibLoadFailure; - } - - // Obtain entrypoint symbols - *load_fn = (corehost_load_fn)pal::get_symbol(*h_host, "corehost_load"); - *main_fn = (corehost_main_fn)pal::get_symbol(*h_host, "corehost_main"); - *unload_fn = (corehost_unload_fn)pal::get_symbol(*h_host, "corehost_unload"); - - return (*main_fn) && (*load_fn) && (*unload_fn) - ? StatusCode::Success - : StatusCode::CoreHostEntryPointFailure; -} - -int execute_app( - const pal::string_t& impl_dll_dir, - corehost_init_t* init, - const int argc, - const pal::char_t* argv[]) -{ - pal::dll_t corehost; - corehost_main_fn host_main = nullptr; - corehost_load_fn host_load = nullptr; - corehost_unload_fn host_unload = nullptr; - - int code = load_host_library(impl_dll_dir, &corehost, &host_load, &host_main, &host_unload); - - if (code != StatusCode::Success) - { - trace::error(_X("An error occurred while loading required library %s from [%s]"), LIBHOSTPOLICY_NAME, impl_dll_dir.c_str()); - return code; - } - - const host_interface_t& intf = init->get_host_init_data(); - if ((code = host_load(&intf)) == 0) - { - code = host_main(argc, argv); - (void)host_unload(); - } - - pal::unload_library(corehost); - - return code; -} - -static char sccsid[] = "@(#)" \ - HOST_PKG_VER \ - "; Commit Hash: " \ - REPO_COMMIT_HASH \ - "; Built on: " \ - __DATE__ \ - " " \ - __TIME__ \ - ; - -SHARED_API int hostfxr_main(const int argc, const pal::char_t* argv[]) -{ - trace::setup(); - - trace::info(_X("--- Invoked hostfxr [commit hash: %s] main"), _STRINGIFY(REPO_COMMIT_HASH)); - - fx_muxer_t muxer; - return muxer.execute(argc, argv); -} - diff --git a/src/corehost/cli/hostpolicy.cpp b/src/corehost/cli/hostpolicy.cpp deleted file mode 100644 index c01ebdbf2..000000000 --- a/src/corehost/cli/hostpolicy.cpp +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "args.h" -#include "trace.h" -#include "deps_resolver.h" -#include "fx_muxer.h" -#include "utils.h" -#include "coreclr.h" -#include "cpprest/json.h" -#include "libhost.h" -#include "error_codes.h" -#include "breadcrumbs.h" - -hostpolicy_init_t g_init; - -int run(const arguments_t& args) -{ - // Load the deps resolver - deps_resolver_t resolver(g_init, args); - - pal::string_t resolver_errors; - if (!resolver.valid(&resolver_errors)) - { - trace::error(_X("Error initializing the dependency resolver: %s"), resolver_errors.c_str()); - return StatusCode::ResolverInitFailure; - } - - pal::string_t clr_path; - if (!resolver.resolve_coreclr_dir(&clr_path) || clr_path.empty() || !pal::realpath(&clr_path)) - { - trace::error(_X("Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1"));; - return StatusCode::CoreClrResolveFailure; - } - else - { - trace::info(_X("CoreCLR directory: %s"), clr_path.c_str()); - } - - - // Setup breadcrumbs - pal::string_t policy_name = _STRINGIFY(HOST_POLICY_PKG_NAME); - pal::string_t policy_version = _STRINGIFY(HOST_POLICY_PKG_VER); - - // Always insert the hostpolicy that the code is running on. - std::unordered_set breadcrumbs; - breadcrumbs.insert(policy_name); - breadcrumbs.insert(policy_name + _X(",") + policy_version); - - probe_paths_t probe_paths; - if (!resolver.resolve_probe_paths(&probe_paths, &breadcrumbs)) - { - return StatusCode::ResolverResolveFailure; - } - - // Build CoreCLR properties - std::vector property_keys = { - "TRUSTED_PLATFORM_ASSEMBLIES", - "APP_PATHS", - "APP_NI_PATHS", - "NATIVE_DLL_SEARCH_DIRECTORIES", - "PLATFORM_RESOURCE_ROOTS", - "AppDomainCompatSwitch", - // Workaround: mscorlib does not resolve symlinks for AppContext.BaseDirectory dotnet/coreclr/issues/2128 - "APP_CONTEXT_BASE_DIRECTORY", - "APP_CONTEXT_DEPS_FILES", - "FX_DEPS_FILE" - }; - - std::vector tpa_paths_cstr, app_base_cstr, native_dirs_cstr, resources_dirs_cstr, fx_deps, deps; - pal::pal_clrstring(probe_paths.tpa, &tpa_paths_cstr); - pal::pal_clrstring(args.app_dir, &app_base_cstr); - pal::pal_clrstring(probe_paths.native, &native_dirs_cstr); - pal::pal_clrstring(probe_paths.resources, &resources_dirs_cstr); - - pal::pal_clrstring(resolver.get_fx_deps_file(), &fx_deps); - pal::pal_clrstring(resolver.get_deps_file() + _X(";") + resolver.get_fx_deps_file(), &deps); - - std::vector property_values = { - // TRUSTED_PLATFORM_ASSEMBLIES - tpa_paths_cstr.data(), - // APP_PATHS - app_base_cstr.data(), - // APP_NI_PATHS - app_base_cstr.data(), - // NATIVE_DLL_SEARCH_DIRECTORIES - native_dirs_cstr.data(), - // PLATFORM_RESOURCE_ROOTS - resources_dirs_cstr.data(), - // AppDomainCompatSwitch - "UseLatestBehaviorWhenTFMNotSpecified", - // APP_CONTEXT_BASE_DIRECTORY - app_base_cstr.data(), - // APP_CONTEXT_DEPS_FILES, - deps.data(), - // FX_DEPS_FILE - fx_deps.data() - }; - - for (int i = 0; i < g_init.cfg_keys.size(); ++i) - { - property_keys.push_back(g_init.cfg_keys[i].data()); - property_values.push_back(g_init.cfg_values[i].data()); - } - - size_t property_size = property_keys.size(); - assert(property_keys.size() == property_values.size()); - - // Add API sets to the process DLL search - pal::setup_api_sets(resolver.get_api_sets()); - - // Bind CoreCLR - if (!coreclr::bind(clr_path)) - { - trace::error(_X("Failed to bind to CoreCLR at [%s]"), clr_path.c_str()); - return StatusCode::CoreClrBindFailure; - } - - // Verbose logging - if (trace::is_enabled()) - { - for (size_t i = 0; i < property_size; ++i) - { - pal::string_t key, val; - pal::clr_palstring(property_keys[i], &key); - pal::clr_palstring(property_values[i], &val); - trace::verbose(_X("Property %s = %s"), key.c_str(), val.c_str()); - } - } - - std::vector own_path; - pal::pal_clrstring(args.own_path, &own_path); - - // Initialize CoreCLR - coreclr::host_handle_t host_handle; - coreclr::domain_id_t domain_id; - auto hr = coreclr::initialize( - own_path.data(), - "clrhost", - property_keys.data(), - property_values.data(), - property_size, - &host_handle, - &domain_id); - if (!SUCCEEDED(hr)) - { - trace::error(_X("Failed to initialize CoreCLR, HRESULT: 0x%X"), hr); - return StatusCode::CoreClrInitFailure; - } - - // Initialize clr strings for arguments - std::vector> argv_strs(args.app_argc); - std::vector argv(args.app_argc); - for (int i = 0; i < args.app_argc; i++) - { - pal::pal_clrstring(args.app_argv[i], &argv_strs[i]); - argv[i] = argv_strs[i].data(); - } - - if (trace::is_enabled()) - { - pal::string_t arg_str; - for (int i = 0; i < argv.size(); i++) - { - pal::string_t cur; - pal::clr_palstring(argv[i], &cur); - arg_str.append(cur); - arg_str.append(_X(",")); - } - trace::info(_X("Launch host: %s, app: %s, argc: %d, args: %s"), args.own_path.c_str(), - args.managed_application.c_str(), args.app_argc, arg_str.c_str()); - } - - std::vector managed_app; - pal::pal_clrstring(args.managed_application, &managed_app); - - // Leave breadcrumbs for servicing. - breadcrumb_writer_t writer(&breadcrumbs); - writer.begin_write(); - - // Execute the application - unsigned int exit_code = 1; - hr = coreclr::execute_assembly( - host_handle, - domain_id, - argv.size(), - argv.data(), - managed_app.data(), - &exit_code); - - if (!SUCCEEDED(hr)) - { - trace::error(_X("Failed to execute managed app, HRESULT: 0x%X"), hr); - return StatusCode::CoreClrExeFailure; - } - - // Shut down the CoreCLR - hr = coreclr::shutdown(host_handle, domain_id); - if (!SUCCEEDED(hr)) - { - trace::warning(_X("Failed to shut down CoreCLR, HRESULT: 0x%X"), hr); - } - - coreclr::unload(); - - // Finish breadcrumb writing - writer.end_write(); - - return exit_code; -} - -SHARED_API int corehost_load(host_interface_t* init) -{ - trace::setup(); - - if (!hostpolicy_init_t::init(init, &g_init)) - { - return StatusCode::LibHostInitFailure; - } - - return 0; -} - -static char sccsid[] = "@(#)" \ - HOST_PKG_VER \ - "; Commit Hash: " \ - REPO_COMMIT_HASH \ - "; Built on: " \ - __DATE__ \ - " " \ - __TIME__ \ - ; - -SHARED_API int corehost_main(const int argc, const pal::char_t* argv[]) -{ - if (trace::is_enabled()) - { - trace::info(_X("--- Invoked hostpolicy [commit hash: %s] [%s,%s,%s][%s] main = {"), - _STRINGIFY(REPO_COMMIT_HASH), - _STRINGIFY(HOST_POLICY_PKG_NAME), - _STRINGIFY(HOST_POLICY_PKG_VER), - _STRINGIFY(HOST_POLICY_PKG_REL_DIR), - get_arch()); - - for (int i = 0; i < argc; ++i) - { - trace::info(_X("%s"), argv[i]); - } - trace::info(_X("}")); - - trace::info(_X("Deps file: %s"), g_init.deps_file.c_str()); - for (const auto& probe : g_init.probe_paths) - { - trace::info(_X("Additional probe dir: %s"), probe.c_str()); - } - } - - // Take care of arguments - arguments_t args; - if (!parse_arguments(g_init.deps_file, g_init.probe_paths, g_init.host_mode, argc, argv, &args)) - { - return StatusCode::LibHostInvalidArgs; - } - if (trace::is_enabled()) - { - args.print(); - } - - return run(args); -} - -SHARED_API int corehost_unload() -{ - return 0; -} diff --git a/src/corehost/cli/json/casablanca/LICENSE.txt b/src/corehost/cli/json/casablanca/LICENSE.txt deleted file mode 100644 index 314f8097f..000000000 --- a/src/corehost/cli/json/casablanca/LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/Microsoft/cpprestsdk diff --git a/src/corehost/cli/json/casablanca/include/cpprest/asyncrt_utils.h b/src/corehost/cli/json/casablanca/include/cpprest/asyncrt_utils.h deleted file mode 100644 index c100ece52..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/asyncrt_utils.h +++ /dev/null @@ -1,600 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* Various common utilities. -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include "cpprest/details/basic_types.h" - -#if !defined(_WIN32) || (_MSC_VER >= 1700) -#include -#endif - -#ifndef _WIN32 -//#include -#if !defined(ANDROID) && !defined(__ANDROID__) // CodePlex 269 -#include -#endif -#endif - -/// Various utilities for string conversions and date and time manipulation. -namespace utility -{ - -// Left over from VS2010 support, remains to avoid breaking. -typedef std::chrono::seconds seconds; - -/// Functions for converting to/from std::chrono::seconds to xml string. -namespace timespan -{ - /// - /// Converts a timespan/interval in seconds to xml duration string as specified by - /// http://www.w3.org/TR/xmlschema-2/#duration - /// - _ASYNCRTIMP utility::string_t __cdecl seconds_to_xml_duration(utility::seconds numSecs); - - /// - /// Converts an xml duration to timespan/interval in seconds - /// http://www.w3.org/TR/xmlschema-2/#duration - /// - _ASYNCRTIMP utility::seconds __cdecl xml_duration_to_seconds(const utility::string_t ×panString); -} - -/// Functions for Unicode string conversions. -namespace conversions -{ - /// - /// Converts a UTF-16 string to a UTF-8 string. - /// - /// A two byte character UTF-16 string. - /// A single byte character UTF-8 string. - _ASYNCRTIMP std::string __cdecl utf16_to_utf8(const utf16string &w); - - /// - /// Converts a UTF-8 string to a UTF-16 - /// - /// A single byte character UTF-8 string. - /// A two byte character UTF-16 string. - _ASYNCRTIMP utf16string __cdecl utf8_to_utf16(const std::string &s); - - /// - /// Converts a ASCII (us-ascii) string to a UTF-16 string. - /// - /// A single byte character us-ascii string. - /// A two byte character UTF-16 string. - _ASYNCRTIMP utf16string __cdecl usascii_to_utf16(const std::string &s); - - /// - /// Converts a Latin1 (iso-8859-1) string to a UTF-16 string. - /// - /// A single byte character UTF-8 string. - /// A two byte character UTF-16 string. - _ASYNCRTIMP utf16string __cdecl latin1_to_utf16(const std::string &s); - - /// - /// Converts a Latin1 (iso-8859-1) string to a UTF-8 string. - /// - /// A single byte character UTF-8 string. - /// A single byte character UTF-8 string. - _ASYNCRTIMP utf8string __cdecl latin1_to_utf8(const std::string &s); - - /// - /// Converts to a platform dependent Unicode string type. - /// - /// A single byte character UTF-8 string. - /// A platform dependent string type. - _ASYNCRTIMP utility::string_t __cdecl to_string_t(std::string &&s); - - /// - /// Converts to a platform dependent Unicode string type. - /// - /// A two byte character UTF-16 string. - /// A platform dependent string type. - _ASYNCRTIMP utility::string_t __cdecl to_string_t(utf16string &&s); - - /// - /// Converts to a platform dependent Unicode string type. - /// - /// A single byte character UTF-8 string. - /// A platform dependent string type. - _ASYNCRTIMP utility::string_t __cdecl to_string_t(const std::string &s); - - /// - /// Converts to a platform dependent Unicode string type. - /// - /// A two byte character UTF-16 string. - /// A platform dependent string type. - _ASYNCRTIMP utility::string_t __cdecl to_string_t(const utf16string &s); - - /// - /// Converts to a UTF-16 from string. - /// - /// A single byte character UTF-8 string. - /// A two byte character UTF-16 string. - _ASYNCRTIMP utf16string __cdecl to_utf16string(const std::string &value); - - /// - /// Converts to a UTF-16 from string. - /// - /// A two byte character UTF-16 string. - /// A two byte character UTF-16 string. - _ASYNCRTIMP utf16string __cdecl to_utf16string(utf16string value); - - /// - /// Converts to a UTF-8 string. - /// - /// A single byte character UTF-8 string. - /// A single byte character UTF-8 string. - _ASYNCRTIMP std::string __cdecl to_utf8string(std::string value); - - /// - /// Converts to a UTF-8 string. - /// - /// A two byte character UTF-16 string. - /// A single byte character UTF-8 string. - _ASYNCRTIMP std::string __cdecl to_utf8string(const utf16string &value); - - /// - /// Encode the given byte array into a base64 string - /// - _ASYNCRTIMP utility::string_t __cdecl to_base64(const std::vector& data); - - /// - /// Encode the given 8-byte integer into a base64 string - /// - _ASYNCRTIMP utility::string_t __cdecl to_base64(uint64_t data); - - /// - /// Decode the given base64 string to a byte array - /// - _ASYNCRTIMP std::vector __cdecl from_base64(const utility::string_t& str); - - template - utility::string_t print_string(const Source &val, const std::locale &loc) - { - utility::ostringstream_t oss; - oss.imbue(loc); - oss << val; - if (oss.bad()) - { - throw std::bad_cast(); - } - return oss.str(); - } - - template - utility::string_t print_string(const Source &val) - { - return print_string(val, std::locale()); - } - - template - Target scan_string(const utility::string_t &str, const std::locale &loc) - { - Target t; - utility::istringstream_t iss(str); - iss.imbue(loc); - iss >> t; - if (iss.bad()) - { - throw std::bad_cast(); - } - return t; - } - - template - Target scan_string(const utility::string_t &str) - { - return scan_string(str, std::locale()); - } -} - -namespace details -{ - /// - /// Cross platform RAII container for setting thread local locale. - /// - class scoped_c_thread_locale - { - public: - _ASYNCRTIMP scoped_c_thread_locale(); - _ASYNCRTIMP ~scoped_c_thread_locale(); - -#if !defined(ANDROID) && !defined(__ANDROID__) // CodePlex 269 -#ifdef _WIN32 - typedef _locale_t xplat_locale; -#else - typedef locale_t xplat_locale; -#endif - - static _ASYNCRTIMP xplat_locale __cdecl c_locale(); -#endif - private: -#ifdef _WIN32 - std::string m_prevLocale; - int m_prevThreadSetting; -#elif !(defined(ANDROID) || defined(__ANDROID__)) - locale_t m_prevLocale; -#endif - scoped_c_thread_locale(const scoped_c_thread_locale &); - scoped_c_thread_locale & operator=(const scoped_c_thread_locale &); - }; - - /// - /// Our own implementation of alpha numeric instead of std::isalnum to avoid - /// taking global lock for performance reasons. - /// - inline bool __cdecl is_alnum(char ch) - { - return (ch >= '0' && ch <= '9') - || (ch >= 'A' && ch <= 'Z') - || (ch >= 'a' && ch <= 'z'); - } - - /// - /// Simplistic implementation of make_unique. A better implementation would be based on variadic templates - /// and therefore not be compatible with Dev10. - /// - template - std::unique_ptr<_Type> make_unique() { - return std::unique_ptr<_Type>(new _Type()); - } - - template - std::unique_ptr<_Type> make_unique(_Arg1&& arg1) { - return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1))); - } - - template - std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2) { - return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2))); - } - - template - std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2, _Arg3&& arg3) { - return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3))); - } - - template - std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2, _Arg3&& arg3, _Arg4&& arg4) { - return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3), std::forward<_Arg4>(arg4))); - } - - /// - /// Cross platform utility function for performing case insensitive string comparision. - /// - /// First string to compare. - /// Second strong to compare. - /// true if the strings are equivalent, false otherwise -/* inline bool str_icmp(const utility::string_t &left, const utility::string_t &right) - { -#ifdef _WIN32 - return _wcsicmp(left.c_str(), right.c_str()) == 0; -#else - return boost::iequals(left, right); -#endif - } -*/ -#ifdef _WIN32 - -/// -/// Category error type for Windows OS errors. -/// -class windows_category_impl : public std::error_category -{ -public: - virtual const char *name() const CPPREST_NOEXCEPT { return "windows"; } - - _ASYNCRTIMP virtual std::string message(int errorCode) const CPPREST_NOEXCEPT; - - _ASYNCRTIMP virtual std::error_condition default_error_condition(int errorCode) const CPPREST_NOEXCEPT; -}; - -/// -/// Gets the one global instance of the windows error category. -/// -/// An error category instance. -_ASYNCRTIMP const std::error_category & __cdecl windows_category(); - -#else - -/// -/// Gets the one global instance of the linux error category. -/// -/// An error category instance. -_ASYNCRTIMP const std::error_category & __cdecl linux_category(); - -#endif - -/// -/// Gets the one global instance of the current platform's error category. -/// -_ASYNCRTIMP const std::error_category & __cdecl platform_category(); - -/// -/// Creates an instance of std::system_error from a OS error code. -/// -inline std::system_error __cdecl create_system_error(unsigned long errorCode) -{ - std::error_code code((int)errorCode, platform_category()); - return std::system_error(code, code.message()); -} - -/// -/// Creates a std::error_code from a OS error code. -/// -inline std::error_code __cdecl create_error_code(unsigned long errorCode) -{ - return std::error_code((int)errorCode, platform_category()); -} - -/// -/// Creates the corresponding error message from a OS error code. -/// -inline utility::string_t __cdecl create_error_message(unsigned long errorCode) -{ - return utility::conversions::to_string_t(create_error_code(errorCode).message()); -} - -} - -class datetime -{ -public: - typedef uint64_t interval_type; - - /// - /// Defines the supported date and time string formats. - /// - enum date_format { RFC_1123, ISO_8601 }; - - /// - /// Returns the current UTC time. - /// - // static _ASYNCRTIMP datetime __cdecl utc_now(); - - /// - /// An invalid UTC timestamp value. - /// - enum:interval_type { utc_timestamp_invalid = static_cast(-1) }; - - /// - /// Returns seconds since Unix/POSIX time epoch at 01-01-1970 00:00:00. - /// If time is before epoch, utc_timestamp_invalid is returned. - /// - /* - static interval_type utc_timestamp() - { - const auto seconds = utc_now().to_interval() / _secondTicks; - if (seconds >= 11644473600LL) - { - return seconds - 11644473600LL; - } - else - { - return utc_timestamp_invalid; - } - } - */ - - datetime() : m_interval(0) - { - } - - /// - /// Creates datetime from a string representing time in UTC in RFC 1123 format. - /// - /// Returns a datetime of zero if not successful. - // static _ASYNCRTIMP datetime __cdecl from_string(const utility::string_t& timestring, date_format format = RFC_1123); - - /// - /// Returns a string representation of the datetime. - /// - _ASYNCRTIMP utility::string_t to_string(date_format format = RFC_1123) const; - - /// - /// Returns the integral time value. - /// - interval_type to_interval() const - { - return m_interval; - } - - datetime operator- (interval_type value) const - { - return datetime(m_interval - value); - } - - datetime operator+ (interval_type value) const - { - return datetime(m_interval + value); - } - - bool operator== (datetime dt) const - { - return m_interval == dt.m_interval; - } - - bool operator!= (const datetime& dt) const - { - return !(*this == dt); - } - - static interval_type from_milliseconds(unsigned int milliseconds) - { - return milliseconds*_msTicks; - } - - static interval_type from_seconds(unsigned int seconds) - { - return seconds*_secondTicks; - } - - static interval_type from_minutes(unsigned int minutes) - { - return minutes*_minuteTicks; - } - - static interval_type from_hours(unsigned int hours) - { - return hours*_hourTicks; - } - - static interval_type from_days(unsigned int days) - { - return days*_dayTicks; - } - - bool is_initialized() const - { - return m_interval != 0; - } - -private: - - friend int operator- (datetime t1, datetime t2); - - static const interval_type _msTicks = static_cast(10000); - static const interval_type _secondTicks = 1000*_msTicks; - static const interval_type _minuteTicks = 60*_secondTicks; - static const interval_type _hourTicks = 60*60*_secondTicks; - static const interval_type _dayTicks = 24*60*60*_secondTicks; - - -#ifdef _WIN32 - // void* to avoid pulling in windows.h - static _ASYNCRTIMP bool __cdecl datetime::system_type_to_datetime(/*SYSTEMTIME*/ void* psysTime, uint64_t seconds, datetime * pdt); -#else - static datetime timeval_to_datetime(const timeval &time); -#endif - - // Private constructor. Use static methods to create an instance. - datetime(interval_type interval) : m_interval(interval) - { - } - - // Storing as hundreds of nanoseconds 10e-7, i.e. 1 here equals 100ns. - interval_type m_interval; -}; - -#ifndef _WIN32 - -// temporary workaround for the fact that -// utf16char is not fully supported in GCC -class cmp -{ -public: - - static int icmp(std::string left, std::string right) - { - size_t i; - for (i = 0; i < left.size(); ++i) - { - if (i == right.size()) return 1; - - auto l = cmp::tolower(left[i]); - auto r = cmp::tolower(right[i]); - if (l > r) return 1; - if (l < r) return -1; - } - if (i < right.size()) return -1; - return 0; - } - -private: - static char tolower(char c) - { - if (c >= 'A' && c <= 'Z') - return static_cast(c - 'A' + 'a'); - return c; - } -}; - -#endif - -inline int operator- (datetime t1, datetime t2) -{ - auto diff = (t1.m_interval - t2.m_interval); - - // Round it down to seconds - diff /= 10 * 1000 * 1000; - - return static_cast(diff); -} - -/* -/// -/// Nonce string generator class. -/// -class nonce_generator -{ -public: - - /// - /// Define default nonce length. - /// - enum { default_length = 32 }; - - /// - /// Nonce generator constructor. - /// - /// Length of the generated nonce string. - nonce_generator(int length=default_length) : - m_random(static_cast(utility::datetime::utc_timestamp())), - m_length(length) - {} - - /// - /// Generate a nonce string containing random alphanumeric characters (A-Za-z0-9). - /// Length of the generated string is set by length(). - /// - /// The generated nonce string. - _ASYNCRTIMP utility::string_t generate(); - - /// - /// Get length of generated nonce string. - /// - /// Nonce string length. - int length() const { return m_length; } - - /// - /// Set length of the generated nonce string. - /// - /// Lenght of nonce string. - void set_length(int length) { m_length = length; } - -private: - static const utility::string_t c_allowed_chars; - std::mt19937 m_random; - int m_length; -}; -*/ -} // namespace utility; diff --git a/src/corehost/cli/json/casablanca/include/cpprest/details/SafeInt3.hpp b/src/corehost/cli/json/casablanca/include/cpprest/details/SafeInt3.hpp deleted file mode 100755 index 798012bed..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/details/SafeInt3.hpp +++ /dev/null @@ -1,7048 +0,0 @@ -/*----------------------------------------------------------------------------------------------------------- -SafeInt.hpp -Version 3.0.18p - -This software is licensed under the Microsoft Public License (Ms-PL). -For more information about Microsoft open source licenses, refer to -http://www.microsoft.com/opensource/licenses.mspx - -This license governs use of the accompanying software. If you use the software, you accept this license. -If you do not accept the license, do not use the software. - -Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here -as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to -the software. A "contributor" is any person that distributes its contribution under this license. -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -in the software or derivative works of the contribution in the software. - -Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, - or trademarks. -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the - software, your patent license from such contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and - attribution notices that are present in the software. -(D) If you distribute any portion of the software in source code form, you may do so only under this license - by including a complete copy of this license with your distribution. If you distribute any portion of the - software in compiled or object code form, you may only do so under a license that complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, - guarantees, or conditions. You may have additional consumer rights under your local laws which this license - cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties - of merchantability, fitness for a particular purpose and non-infringement. - - -Copyright (c) Microsoft Corporation. All rights reserved. - -This header implements an integer handling class designed to catch -unsafe integer operations - -This header compiles properly at Wall on Visual Studio, -Wall on gcc, and -Weverything on clang. - -Please read the leading comments before using the class. ----------------------------------------------------------------*/ -#pragma once - -// It is a bit tricky to sort out what compiler we are actually using, -// do this once here, and avoid cluttering the code -#define VISUAL_STUDIO_COMPILER 0 -#define CLANG_COMPILER 1 -#define GCC_COMPILER 2 -#define UNKNOWN_COMPILER -1 - -// Clang will sometimes pretend to be Visual Studio -// and does pretend to be gcc. Check it first, as nothing else pretends to be clang -#if defined __clang__ -#define SAFEINT_COMPILER CLANG_COMPILER -#elif defined __GNUC__ -#define SAFEINT_COMPILER GCC_COMPILER -#elif defined _MSC_VER -#define SAFEINT_COMPILER VISUAL_STUDIO_COMPILER -#else -#define SAFEINT_COMPILER UNKNOWN_COMPILER -#endif - -// Enable compiling with /Wall under VC -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning( push ) -// Disable warnings coming from headers -#pragma warning( disable:4987 4820 4987 4820 ) - -#endif - -// Need this for ptrdiff_t on some compilers -#include -#include - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER && defined _M_AMD64 - #include - #define SAFEINT_USE_INTRINSICS 1 -#else - #define SAFEINT_USE_INTRINSICS 0 -#endif - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning( pop ) -#endif - -// Various things needed for GCC -#if SAFEINT_COMPILER == GCC_COMPILER || SAFEINT_COMPILER == CLANG_COMPILER - -#define NEEDS_INT_DEFINED - -#if !defined NULL -#define NULL 0 -#endif - -// GCC warning suppression -#if SAFEINT_COMPILER == GCC_COMPILER -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#endif - -#include - -// clang only -#if SAFEINT_COMPILER == CLANG_COMPILER - -#if __has_feature(cxx_nullptr) - #define NEEDS_NULLPTR_DEFINED 0 -#endif - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc++11-long-long" -#pragma clang diagnostic ignored "-Wold-style-cast" -#pragma clang diagnostic ignored "-Wunused-local-typedef" -#endif - -#endif - -// If the user made a choice, respect it #if !defined -#if !defined NEEDS_NULLPTR_DEFINED - // Visual Studio 2010 and higher support this - #if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER - #if (_MSC_VER < 1600) - #define NEEDS_NULLPTR_DEFINED 1 - #else - #define NEEDS_NULLPTR_DEFINED 0 - #endif - #else - // Let everything else trigger based on whether we use c++11 or above - #if __cplusplus >= 201103L - #define NEEDS_NULLPTR_DEFINED 0 - #else - #define NEEDS_NULLPTR_DEFINED 1 - #endif - #endif -#endif - -#if NEEDS_NULLPTR_DEFINED -#define nullptr NULL -#endif - -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -// Let's test some assumptions -// We're assuming two's complement negative numbers -C_ASSERT( -1 == static_cast(0xffffffff) ); - -/************* Compiler Options ***************************************************************************************************** - -SafeInt supports several compile-time options that can change the behavior of the class. - -Compiler options: -SAFEINT_WARN_64BIT_PORTABILITY - this re-enables various warnings that happen when /Wp64 is used. Enabling this option is not - recommended. -NEEDS_INT_DEFINED - if your compiler does not support __int8, __int16, __int32 and __int64, you can enable this. -SAFEINT_ASSERT_ON_EXCEPTION - it is often easier to stop on an assert and figure out a problem than to try and figure out - how you landed in the catch block. -SafeIntDefaultExceptionHandler - if you'd like to replace the exception handlers SafeInt provides, define your replacement and - define this. Note - two built in (Windows-specific) options exist: - - SAFEINT_FAILFAST - bypasses all exception handlers, exits the app with an exception - - SAFEINT_RAISE_EXCEPTION - throws Win32 exceptions, which can be caught -SAFEINT_DISALLOW_UNSIGNED_NEGATION - Invoking the unary negation operator creates warnings, but if you'd like it to completely fail - to compile, define this. -ANSI_CONVERSIONS - This changes the class to use default comparison behavior, which may be unsafe. Enabling this - option is not recommended. -SAFEINT_DISABLE_BINARY_ASSERT - binary AND, OR or XOR operations on mixed size types can produce unexpected results. If you do - this, the default is to assert. Set this if you prefer not to assert under these conditions. -SIZE_T_CAST_NEEDED - some compilers complain if there is not a cast to size_t, others complain if there is one. - This lets you not have your compiler complain. -SAFEINT_DISABLE_SHIFT_ASSERT - Set this option if you don't want to assert when shifting more bits than the type has. Enabling - this option is not recommended. - -************************************************************************************************************************************/ - -/* -* The SafeInt class is designed to have as low an overhead as possible -* while still ensuring that all integer operations are conducted safely. -* Nearly every operator has been overloaded, with a very few exceptions. -* -* A usability-safety trade-off has been made to help ensure safety. This -* requires that every operation return either a SafeInt or a bool. If we -* allowed an operator to return a base integer type T, then the following -* can happen: -* -* char i = SafeInt(32) * 2 + SafeInt(16) * 4; -* -* The * operators take precedence, get overloaded, return a char, and then -* you have: -* -* char i = (char)64 + (char)64; //overflow! -* -* This situation would mean that safety would depend on usage, which isn't -* acceptable. -* -* One key operator that is missing is an implicit cast to type T. The reason for -* this is that if there is an implicit cast operator, then we end up with -* an ambiguous compile-time precedence. Because of this amiguity, there -* are two methods that are provided: -* -* Casting operators for every native integer type -* Version 3 note - it now compiles correctly for size_t without warnings -* -* SafeInt::Ptr() - returns the address of the internal integer -* Note - the '&' (address of) operator has been overloaded and returns -* the address of the internal integer. -* -* The SafeInt class should be used in any circumstances where ensuring -* integrity of the calculations is more important than performance. See Performance -* Notes below for additional information. -* -* Many of the conditionals will optimize out or be inlined for a release -* build (especially with /Ox), but it does have significantly more overhead, -* especially for signed numbers. If you do not _require_ negative numbers, use -* unsigned integer types - certain types of problems cannot occur, and this class -* performs most efficiently. -* -* Here's an example of when the class should ideally be used - -* -* void* AllocateMemForStructs(int StructSize, int HowMany) -* { -* SafeInt s(StructSize); -* -* s *= HowMany; -* -* return malloc(s); -* -* } -* -* Here's when it should NOT be used: -* -* void foo() -* { -* int i; -* -* for(i = 0; i < 0xffff; i++) -* .... -* } -* -* Error handling - a SafeInt class will throw exceptions if something -* objectionable happens. The exceptions are SafeIntException classes, -* which contain an enum as a code. -* -* Typical usage might be: -* -* bool foo() -* { -* SafeInt s; //note that s == 0 unless set -* -* try{ -* s *= 23; -* .... -* } -* catch(SafeIntException err) -* { -* //handle errors here -* } -* } -* -* Update for 3.0 - the exception class is now a template parameter. -* You can replace the exception class with any exception class you like. This is accomplished by: -* 1) Create a class that has the following interface: -* - template <> class YourSafeIntExceptionHandler < YourException > - { - public: - static __declspec(noreturn) void __stdcall SafeIntOnOverflow() - { - throw YourException( YourSafeIntArithmeticOverflowError ); - } - - static __declspec(noreturn) void __stdcall SafeIntOnDivZero() - { - throw YourException( YourSafeIntDivideByZeroError ); - } - }; -* -* Note that you don't have to throw C++ exceptions, you can throw Win32 exceptions, or do -* anything you like, just don't return from the call back into the code. -* -* 2) Either explicitly declare SafeInts like so: -* SafeInt< int, YourSafeIntExceptionHandler > si; -* or -* #define SafeIntDefaultExceptionHandler YourSafeIntExceptionHandler -* -* Performance: -* -* Due to the highly nested nature of this class, you can expect relatively poor -* performance in unoptimized code. In tests of optimized code vs. correct inline checks -* in native code, this class has been found to take approximately 8% more CPU time (this varies), -* most of which is due to exception handling. Solutions: -* -* 1) Compile optimized code - /Ox is best, /O2 also performs well. Interestingly, /O1 -* (optimize for size) does not work as well. -* 2) If that 8% hit is really a serious problem, walk through the code and inline the -* exact same checks as the class uses. -* 3) Some operations are more difficult than others - avoid using signed integers, and if -* possible keep them all the same size. 64-bit integers are also expensive. Mixing -* different integer sizes and types may prove expensive. Be aware that literals are -* actually ints. For best performance, cast literals to the type desired. -* -* -* Performance update -* The current version of SafeInt uses template specialization to force the compiler to invoke only the -* operator implementation needed for any given pair of types. This will dramatically improve the perf -* of debug builds. -* -* 3.0 update - not only have we maintained the specialization, there were some cases that were overly complex, -* and using some additional cases (e.g. signed __int64 and unsigned __int64) resulted in some simplification. -* Additionally, there was a lot of work done to better optimize the 64-bit multiplication. -* -* Binary Operators -* -* All of the binary operators have certain assumptions built into the class design. -* This is to ensure correctness. Notes on each class of operator follow: -* -* Arithmetic Operators (*,/,+,-,%) -* There are three possible variants: -* SafeInt< T, E > op SafeInt< T, E > -* SafeInt< T, E > op U -* U op SafeInt< T, E > -* -* The SafeInt< T, E > op SafeInt< U, E > variant is explicitly not supported, and if you try to do -* this the compiler with throw the following error: -* -* error C2593: 'operator *' is ambiguous -* -* This is because the arithmetic operators are required to return a SafeInt of some type. -* The compiler cannot know whether you'd prefer to get a type T or a type U returned. If -* you need to do this, you need to extract the value contained within one of the two using -* the casting operator. For example: -* -* SafeInt< T, E > t, result; -* SafeInt< U, E > u; -* -* result = t * (U)u; -* -* Comparison Operators -* Because each of these operators return type bool, mixing SafeInts of differing types is -* allowed. -* -* Shift Operators -* Shift operators always return the type on the left hand side of the operator. Mixed type -* operations are allowed because the return type is always known. -* -* Boolean Operators -* Like comparison operators, these overloads always return type bool, and mixed-type SafeInts -* are allowed. Additionally, specific overloads exist for type bool on both sides of the -* operator. -* -* Binary Operators -* Mixed-type operations are discouraged, however some provision has been made in order to -* enable things like: -* -* SafeInt c = 2; -* -* if(c & 0x02) -* ... -* -* The "0x02" is actually an int, and it needs to work. -* In the case of binary operations on integers smaller than 32-bit, or of mixed type, corner -* cases do exist where you could get unexpected results. In any case where SafeInt returns a different -* result than the underlying operator, it will call assert(). You should examine your code and cast things -* properly so that you are not programming with side effects. -* -* Documented issues: -* -* This header compiles correctly at /W4 using VC++ 8 (Version 14.00.50727.42) and later. -* As of this writing, I believe it will also work for VC 7.1, but not for VC 7.0 or below. -* If you need a version that will work with lower level compilers, try version 1.0.7. None -* of them work with Visual C++ 6, and gcc didn't work very well, either, though this hasn't -* been tried recently. -* -* It is strongly recommended that any code doing integer manipulation be compiled at /W4 -* - there are a number of warnings which pertain to integer manipulation enabled that are -* not enabled at /W3 (default for VC++) -* -* Perf note - postfix operators are slightly more costly than prefix operators. -* Unless you're actually assigning it to something, ++SafeInt is less expensive than SafeInt++ -* -* The comparison operator behavior in this class varies from the ANSI definition, which is -* arguably broken. As an example, consider the following: -* -* unsigned int l = 0xffffffff; -* char c = -1; -* -* if(c == l) -* printf("Why is -1 equal to 4 billion???\n"); -* -* The problem here is that c gets cast to an int, now has a value of 0xffffffff, and then gets -* cast again to an unsigned int, losing the true value. This behavior is despite the fact that -* an __int64 exists, and the following code will yield a different (and intuitively correct) -* answer: -* -* if((__int64)c == (__int64)l)) -* printf("Why is -1 equal to 4 billion???\n"); -* else -* printf("Why doesn't the compiler upcast to 64-bits when needed?\n"); -* -* Note that combinations with smaller integers won't display the problem - if you -* changed "unsigned int" above to "unsigned short", you'd get the right answer. -* -* If you prefer to retain the ANSI standard behavior insert -* #define ANSI_CONVERSIONS -* into your source. Behavior differences occur in the following cases: -* 8, 16, and 32-bit signed int, unsigned 32-bit int -* any signed int, unsigned 64-bit int -* Note - the signed int must be negative to show the problem -* -* -* Revision history: -* -* Oct 12, 2003 - Created -* Author - David LeBlanc - dleblanc@microsoft.com -* -* Oct 27, 2003 - fixed numerous items pointed out by michmarc and bdawson -* Dec 28, 2003 - 1.0 -* added support for mixed-type operations -* thanks to vikramh -* also fixed broken __int64 multiplication section -* added extended support for mixed-type operations where possible -* Jan 28, 2004 - 1.0.1 -* changed WCHAR to wchar_t -* fixed a construct in two mixed-type assignment overloads that was -* not compiling on some compilers -* Also changed name of private method to comply with standards on -* reserved names -* Thanks to Niels Dekker for the input -* Feb 12, 2004 - 1.0.2 -* Minor changes to remove dependency on Windows headers -* Consistently used __int16, __int32 and __int64 to ensure -* portability -* May 10, 2004 - 1.0.3 -* Corrected bug in one case of GreaterThan -* July 22, 2004 - 1.0.4 -* Tightened logic in addition check (saving 2 instructions) -* Pulled error handler out into function to enable user-defined replacement -* Made internal type of SafeIntException an enum (as per Niels' suggestion) -* Added casts for base integer types (as per Scott Meyers' suggestion) -* Updated usage information - see important new perf notes. -* Cleaned up several const issues (more thanks to Niels) -* -* Oct 1, 2004 - 1.0.5 -* Added support for SEH exceptions instead of C++ exceptions - Win32 only -* Made handlers for DIV0 and overflows individually overridable -* Commented out the destructor - major perf gains here -* Added cast operator for type long, since long != __int32 -* Corrected a couple of missing const modifiers -* Fixed broken >= and <= operators for type U op SafeInt< T, E > -* Nov 5, 2004 - 1.0.6 -* Implemented new logic in binary operators to resolve issues with -* implicit casts -* Fixed casting operator because char != signed char -* Defined __int32 as int instead of long -* Removed unsafe SafeInt::Value method -* Re-implemented casting operator as a result of removing Value method -* Dec 1, 2004 - 1.0.7 -* Implemented specialized operators for pointer arithmetic -* Created overloads for cases of U op= SafeInt. What you do with U -* after that may be dangerous. -* Fixed bug in corner case of MixedSizeModulus -* Fixed bug in MixedSizeMultiply and MixedSizeDivision with input of 0 -* Added throw() decorations -* -* Apr 12, 2005 - 2.0 -* Extensive revisions to leverage template specialization. -* April, 2007 Extensive revisions for version 3.0 -* Nov 22, 2009 Forked from MS internal code -* Changes needed to support gcc compiler - many thanks to Niels Dekker -* for determining not just the issues, but also suggesting fixes. -* Also updating some of the header internals to be the same as the upcoming Visual Studio version. -* -* Jan 16, 2010 64-bit gcc has long == __int64, which means that many of the existing 64-bit -* templates are over-specialized. This forces a redefinition of all the 64-bit -* multiplication routines to use pointers instead of references for return -* values. Also, let's use some intrinsics for x64 Microsoft compiler to -* reduce code size, and hopefully improve efficiency. -* -* June 21, 2014 Better support for clang, higher warning levels supported for all 3 primary supported - compilers (Visual Studio, clang, gcc). - Also started to converge the code base such that the public CodePlex version will - be a drop-in replacement for the Visual Studio version. - -* Note about code style - throughout this class, casts will be written using C-style (T), -* not C++ style static_cast< T >. This is because the class is nearly always dealing with integer -* types, and in this case static_cast and a C cast are equivalent. Given the large number of casts, -* the code is a little more readable this way. In the event a cast is needed where static_cast couldn't -* be substituted, we'll use the new templatized cast to make it explicit what the operation is doing. -* -************************************************************************************************************ -* Version 3.0 changes: -* -* 1) The exception type thrown is now replacable, and you can throw your own exception types. This should help -* those using well-developed exception classes. -* 2) The 64-bit multiplication code has had a lot of perf work done, and should be faster than 2.0. -* 3) There is now limited floating point support. You can initialize a SafeInt with a floating point type, -* and you can cast it out (or assign) to a float as well. -* 4) There is now an Align method. I noticed people use this a lot, and rarely check errors, so now you have one. -* -* Another major improvement is the addition of external functions - if you just want to check an operation, this can now happen: -* All of the following can be invoked without dealing with creating a class, or managing exceptions. This is especially handy -* for 64-bit porting, since SafeCast compiles away for a 32-bit cast from size_t to unsigned long, but checks it for 64-bit. -* -* inline bool SafeCast( const T From, U& To ) throw() -* inline bool SafeEquals( const T t, const U u ) throw() -* inline bool SafeNotEquals( const T t, const U u ) throw() -* inline bool SafeGreaterThan( const T t, const U u ) throw() -* inline bool SafeGreaterThanEquals( const T t, const U u ) throw() -* inline bool SafeLessThan( const T t, const U u ) throw() -* inline bool SafeLessThanEquals( const T t, const U u ) throw() -* inline bool SafeModulus( const T& t, const U& u, T& result ) throw() -* inline bool SafeMultiply( T t, U u, T& result ) throw() -* inline bool SafeDivide( T t, U u, T& result ) throw() -* inline bool SafeAdd( T t, U u, T& result ) throw() -* inline bool SafeSubtract( T t, U u, T& result ) throw() -* -*/ - -//use these if the compiler does not support _intXX -#ifdef NEEDS_INT_DEFINED -#define __int8 char -#define __int16 short -#define __int32 int -#define __int64 long long -#endif - -namespace msl -{ - -namespace safeint3 -{ - -// catch these to handle errors -// Currently implemented code values: -// ERROR_ARITHMETIC_OVERFLOW -// EXCEPTION_INT_DIVIDE_BY_ZERO -enum SafeIntError -{ - SafeIntNoError = 0, - SafeIntArithmeticOverflow, - SafeIntDivideByZero -}; - -} // safeint3 -} // msl - - -/* -* Error handler classes -* Using classes to deal with exceptions is going to allow the most -* flexibility, and we can mix different error handlers in the same project -* or even the same file. It isn't advisable to do this in the same function -* because a SafeInt< int, MyExceptionHandler > isn't the same thing as -* SafeInt< int, YourExceptionHander >. -* If for some reason you have to translate between the two, cast one of them back to its -* native type. -* -* To use your own exception class with SafeInt, first create your exception class, -* which may look something like the SafeIntException class below. The second step is to -* create a template specialization that implements SafeIntOnOverflow and SafeIntOnDivZero. -* For example: -* -* template <> class SafeIntExceptionHandler < YourExceptionClass > -* { -* static __declspec(noreturn) void __stdcall SafeIntOnOverflow() -* { -* throw YourExceptionClass( EXCEPTION_INT_OVERFLOW ); -* } -* -* static __declspec(noreturn) void __stdcall SafeIntOnDivZero() -* { -* throw YourExceptionClass( EXCEPTION_INT_DIVIDE_BY_ZERO ); -* } -* }; -* -* typedef SafeIntExceptionHandler < YourExceptionClass > YourSafeIntExceptionHandler -* You'd then declare your SafeInt objects like this: -* SafeInt< int, YourSafeIntExceptionHandler > -* -* Unfortunately, there is no such thing as partial template specialization in typedef -* statements, so you have three options if you find this cumbersome: -* -* 1) Create a holder class: -* -* template < typename T > -* class MySafeInt -* { -* public: -* SafeInt< T, MyExceptionClass> si; -* }; -* -* You'd then declare an instance like so: -* MySafeInt< int > i; -* -* You'd lose handy things like initialization - it would have to be initialized as: -* -* i.si = 0; -* -* 2) You could create a typedef for every int type you deal with: -* -* typedef SafeInt< int, MyExceptionClass > MySafeInt; -* typedef SafeInt< char, MyExceptionClass > MySafeChar; -* -* and so on. The second approach is probably more usable, and will just drop into code -* better, which is the original intent of the SafeInt class. -* -* 3) If you're going to consistently use a different class to handle your exceptions, -* you can override the default typedef like so: -* -* #define SafeIntDefaultExceptionHandler YourSafeIntExceptionHandler -* -* Overall, this is probably the best approach. -* */ - -// On the Microsoft compiler, violating a throw() annotation is a silent error. -// Other compilers might turn these into exceptions, and some users may want to not have throw() enabled. -// In addition, some error handlers may not throw C++ exceptions, which makes everything no throw. -#if defined SAFEINT_REMOVE_NOTHROW -#define SAFEINT_NOTHROW -#else -#define SAFEINT_NOTHROW throw() -#endif - -namespace msl -{ - -namespace safeint3 -{ - -// If you would like to use your own custom assert -// Define SAFEINT_ASSERT -#if !defined SAFEINT_ASSERT -#include -#define SAFEINT_ASSERT(x) assert(x) -#endif - -#if defined SAFEINT_ASSERT_ON_EXCEPTION - inline void SafeIntExceptionAssert() SAFEINT_NOTHROW { SAFEINT_ASSERT(false); } -#else - inline void SafeIntExceptionAssert() SAFEINT_NOTHROW {} -#endif - -#if SAFEINT_COMPILER == GCC_COMPILER || SAFEINT_COMPILER == CLANG_COMPILER - #define SAFEINT_NORETURN __attribute__((noreturn)) - #define SAFEINT_STDCALL - #define SAFEINT_VISIBLE __attribute__ ((__visibility__("default"))) - #define SAFEINT_WEAK __attribute__ ((weak)) -#else - #define SAFEINT_NORETURN __declspec(noreturn) - #define SAFEINT_STDCALL __stdcall - #define SAFEINT_VISIBLE - #define SAFEINT_WEAK -#endif - -class SAFEINT_VISIBLE SafeIntException -{ -public: - SafeIntException() SAFEINT_NOTHROW { m_code = SafeIntNoError; } - SafeIntException( SafeIntError code ) SAFEINT_NOTHROW - { - m_code = code; - } - SafeIntError m_code; -}; - -namespace SafeIntInternal -{ - // Visual Studio version of SafeInt provides for two possible error - // handlers: - // SafeIntErrorPolicy_SafeIntException - C++ exception, default if not otherwise defined - // SafeIntErrorPolicy_InvalidParameter - Calls fail fast (Windows-specific), bypasses any exception handlers, - // exits the app with a crash - template < typename E > class SafeIntExceptionHandler; - - template <> class SafeIntExceptionHandler < SafeIntException > - { - public: - - static SAFEINT_NORETURN void SAFEINT_STDCALL SafeIntOnOverflow() - { - SafeIntExceptionAssert(); - throw SafeIntException( SafeIntArithmeticOverflow ); - } - - static SAFEINT_NORETURN void SAFEINT_STDCALL SafeIntOnDivZero() - { - SafeIntExceptionAssert(); - throw SafeIntException( SafeIntDivideByZero ); - } - }; - -#if !defined _CRT_SECURE_INVALID_PARAMETER - // Calling fail fast is somewhat more robust than calling abort, - // but abort is the closest we can manage without Visual Studio support - // Need the header for abort() - #include - #define _CRT_SECURE_INVALID_PARAMETER(msg) abort() -#endif - - class SafeInt_InvalidParameter - { - public: - static SAFEINT_NORETURN void SafeIntOnOverflow() SAFEINT_NOTHROW - { - SafeIntExceptionAssert(); - _CRT_SECURE_INVALID_PARAMETER("SafeInt Arithmetic Overflow"); - } - - static SAFEINT_NORETURN void SafeIntOnDivZero() SAFEINT_NOTHROW - { - SafeIntExceptionAssert(); - _CRT_SECURE_INVALID_PARAMETER("SafeInt Divide By Zero"); - } - }; - -#if defined _WINDOWS_ - - class SafeIntWin32ExceptionHandler - { - public: - static SAFEINT_NORETURN void SAFEINT_STDCALL SafeIntOnOverflow() SAFEINT_NOTHROW - { - SafeIntExceptionAssert(); - RaiseException( static_cast(EXCEPTION_INT_OVERFLOW), EXCEPTION_NONCONTINUABLE, 0, 0); - } - - static SAFEINT_NORETURN void SAFEINT_STDCALL SafeIntOnDivZero() SAFEINT_NOTHROW - { - SafeIntExceptionAssert(); - RaiseException( static_cast(EXCEPTION_INT_DIVIDE_BY_ZERO), EXCEPTION_NONCONTINUABLE, 0, 0); - } - }; - -#endif - -} // namespace SafeIntInternal - -// both of these have cross-platform support -typedef SafeIntInternal::SafeIntExceptionHandler < SafeIntException > CPlusPlusExceptionHandler; -typedef SafeIntInternal::SafeInt_InvalidParameter InvalidParameterExceptionHandler; - -// This exception handler is no longer recommended, but is left here in order not to break existing users -#if defined _WINDOWS_ -typedef SafeIntInternal::SafeIntWin32ExceptionHandler Win32ExceptionHandler; -#endif - -// For Visual Studio compatibility -#if defined VISUAL_STUDIO_SAFEINT_COMPAT - typedef CPlusPlusExceptionHandler SafeIntErrorPolicy_SafeIntException; - typedef InvalidParameterExceptionHandler SafeIntErrorPolicy_InvalidParameter; -#endif - -// If the user hasn't defined a default exception handler, -// define one now, depending on whether they would like Win32 or C++ exceptions - -// This library will use conditional noexcept soon, but not in this release -// Some users might mix exception handlers, which is not advised, but is supported -#if !defined SafeIntDefaultExceptionHandler - #if defined SAFEINT_RAISE_EXCEPTION - #if !defined _WINDOWS_ - #error Include windows.h in order to use Win32 exceptions - #endif - - #define SafeIntDefaultExceptionHandler Win32ExceptionHandler - #elif defined SAFEINT_FAILFAST - #define SafeIntDefaultExceptionHandler InvalidParameterExceptionHandler - #else - #define SafeIntDefaultExceptionHandler CPlusPlusExceptionHandler - #if !defined SAFEINT_EXCEPTION_HANDLER_CPP - #define SAFEINT_EXCEPTION_HANDLER_CPP 1 - #endif - #endif -#endif - -#if !defined SAFEINT_EXCEPTION_HANDLER_CPP -#define SAFEINT_EXCEPTION_HANDLER_CPP 0 -#endif - -// If an error handler is chosen other than C++ exceptions, such as Win32 exceptions, fail fast, -// or abort, then all methods become no throw. Some teams track throw() annotations closely, -// and the following option provides for this. -#if SAFEINT_EXCEPTION_HANDLER_CPP -#define SAFEINT_CPP_THROW -#else -#define SAFEINT_CPP_THROW SAFEINT_NOTHROW -#endif - -// Turns out we can fool the compiler into not seeing compile-time constants with -// a simple template specialization -template < int method > class CompileConst; -template <> class CompileConst { public: static bool Value() SAFEINT_NOTHROW { return true; } }; -template <> class CompileConst { public: static bool Value() SAFEINT_NOTHROW { return false; } }; - -// The following template magic is because we're now not allowed -// to cast a float to an enum. This means that if we happen to assign -// an enum to a SafeInt of some type, it won't compile, unless we prevent -// isFloat = ( (T)( (float)1.1 ) > (T)1 ) -// from compiling in the case of an enum, which is the point of the specialization -// that follows. - -// If we have support for std, then we can do this easily, and detect enums as well -template < typename T > class NumericType; - -#if defined _LIBCPP_TYPE_TRAITS || defined _TYPE_TRAITS_ -// Continue to special case bool -template <> class NumericType { public: enum{ isBool = true, isFloat = false, isInt = false }; }; -template < typename T > class NumericType -{ - public: - enum - { - isBool = false, // We specialized out a bool - isFloat = std::is_floating_point::value, - // If it is an enum, then consider it an int type - // This does allow someone to make a SafeInt from an enum type, which is not recommended, - // but it also allows someone to add an enum value to a SafeInt, which is handy. - isInt = std::is_integral::value || std::is_enum::value - }; -}; - -#else - -template <> class NumericType { public: enum{ isBool = true, isFloat = false, isInt = false }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -#if defined SAFEINT_USE_WCHAR_T || defined _NATIVE_WCHAR_T_DEFINED -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -#endif -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType<__int64> { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = false, isInt = true }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = true, isInt = false }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = true, isInt = false }; }; -template <> class NumericType { public: enum{ isBool = false, isFloat = true, isInt = false }; }; -// Catch-all for anything not supported -template < typename T > class NumericType -{ -public: - // We have some unknown type, which could be an enum. For parity with the code that uses , - // We can try a static_cast - it if compiles, then it might be an enum, and should work. - // If it is something else that just happens to have a constructor that takes an int, and a casting operator, - // then it is possible something will go wrong, and for best results, cast it directly to an int before letting it - // interact with a SafeInt - - enum - { - isBool = false, - isFloat = false, - isInt = static_cast( static_cast(0) ) == 0 - }; -}; -#endif // type traits - -// Use this to avoid compile-time const truncation warnings -template < int fSigned, int bits > class SafeIntMinMax; - -template <> class SafeIntMinMax< true, 8 > { public: const static signed __int8 min = (-0x7f - 1); - const static signed __int8 max = 0x7f; }; -template <> class SafeIntMinMax< true, 16 > { public: const static __int16 min = ( -0x7fff - 1 ); - const static __int16 max = 0x7fff; }; -template <> class SafeIntMinMax< true, 32 > { public: const static __int32 min = ( -0x7fffffff -1 ); - const static __int32 max = 0x7fffffff; }; -template <> class SafeIntMinMax< true, 64 > { public: const static __int64 min = static_cast<__int64>(0x8000000000000000LL); - const static __int64 max = 0x7fffffffffffffffLL; }; - -template <> class SafeIntMinMax< false, 8 > { public: const static unsigned __int8 min = 0; - const static unsigned __int8 max = 0xff; }; -template <> class SafeIntMinMax< false, 16 > { public: const static unsigned __int16 min = 0; - const static unsigned __int16 max = 0xffff; }; -template <> class SafeIntMinMax< false, 32 > { public: const static unsigned __int32 min = 0; - const static unsigned __int32 max = 0xffffffff; }; -template <> class SafeIntMinMax< false, 64 > { public: const static unsigned __int64 min = 0; - const static unsigned __int64 max = 0xffffffffffffffffULL; }; - -template < typename T > class IntTraits -{ -public: - C_ASSERT( NumericType::isInt ); - enum - { - isSigned = ( (T)(-1) < 0 ), - is64Bit = ( sizeof(T) == 8 ), - is32Bit = ( sizeof(T) == 4 ), - is16Bit = ( sizeof(T) == 2 ), - is8Bit = ( sizeof(T) == 1 ), - isLT32Bit = ( sizeof(T) < 4 ), - isLT64Bit = ( sizeof(T) < 8 ), - isInt8 = ( sizeof(T) == 1 && isSigned ), - isUint8 = ( sizeof(T) == 1 && !isSigned ), - isInt16 = ( sizeof(T) == 2 && isSigned ), - isUint16 = ( sizeof(T) == 2 && !isSigned ), - isInt32 = ( sizeof(T) == 4 && isSigned ), - isUint32 = ( sizeof(T) == 4 && !isSigned ), - isInt64 = ( sizeof(T) == 8 && isSigned ), - isUint64 = ( sizeof(T) == 8 && !isSigned ), - bitCount = ( sizeof(T)*8 ), - isBool = ( (T)2 == (T)1 ) - }; - - // On version 13.10 enums cannot define __int64 values - // so we'll use const statics instead! - // These must be cast to deal with the possibility of a SafeInt being given an enum as an argument - const static T maxInt = static_cast(SafeIntMinMax< isSigned, bitCount >::max); - const static T minInt = static_cast(SafeIntMinMax< isSigned, bitCount >::min); -}; - -template < typename T > -const T IntTraits< T >::maxInt; -template < typename T > -const T IntTraits< T >::minInt; - -template < typename T, typename U > class SafeIntCompare -{ -public: - enum - { - isBothSigned = (IntTraits< T >::isSigned && IntTraits< U >::isSigned), - isBothUnsigned = (!IntTraits< T >::isSigned && !IntTraits< U >::isSigned), - isLikeSigned = ((bool)(IntTraits< T >::isSigned) == (bool)(IntTraits< U >::isSigned)), - isCastOK = ((isLikeSigned && sizeof(T) >= sizeof(U)) || - (IntTraits< T >::isSigned && sizeof(T) > sizeof(U))), - isBothLT32Bit = (IntTraits< T >::isLT32Bit && IntTraits< U >::isLT32Bit), - isBothLT64Bit = (IntTraits< T >::isLT64Bit && IntTraits< U >::isLT64Bit) - }; -}; - -//all of the arithmetic operators can be solved by the same code within -//each of these regions without resorting to compile-time constant conditionals -//most operators collapse the problem into less than the 22 zones, but this is used -//as the first cut -//using this also helps ensure that we handle all of the possible cases correctly - -template < typename T, typename U > class IntRegion -{ -public: - enum - { - //unsigned-unsigned zone - IntZone_UintLT32_UintLT32 = SafeIntCompare< T,U >::isBothUnsigned && SafeIntCompare< T,U >::isBothLT32Bit, - IntZone_Uint32_UintLT64 = SafeIntCompare< T,U >::isBothUnsigned && IntTraits< T >::is32Bit && IntTraits< U >::isLT64Bit, - IntZone_UintLT32_Uint32 = SafeIntCompare< T,U >::isBothUnsigned && IntTraits< T >::isLT32Bit && IntTraits< U >::is32Bit, - IntZone_Uint64_Uint = SafeIntCompare< T,U >::isBothUnsigned && IntTraits< T >::is64Bit, - IntZone_UintLT64_Uint64 = SafeIntCompare< T,U >::isBothUnsigned && IntTraits< T >::isLT64Bit && IntTraits< U >::is64Bit, - //unsigned-signed - IntZone_UintLT32_IntLT32 = !IntTraits< T >::isSigned && IntTraits< U >::isSigned && SafeIntCompare< T,U >::isBothLT32Bit, - IntZone_Uint32_IntLT64 = IntTraits< T >::isUint32 && IntTraits< U >::isSigned && IntTraits< U >::isLT64Bit, - IntZone_UintLT32_Int32 = !IntTraits< T >::isSigned && IntTraits< T >::isLT32Bit && IntTraits< U >::isInt32, - IntZone_Uint64_Int = IntTraits< T >::isUint64 && IntTraits< U >::isSigned && IntTraits< U >::isLT64Bit, - IntZone_UintLT64_Int64 = !IntTraits< T >::isSigned && IntTraits< T >::isLT64Bit && IntTraits< U >::isInt64, - IntZone_Uint64_Int64 = IntTraits< T >::isUint64 && IntTraits< U >::isInt64, - //signed-signed - IntZone_IntLT32_IntLT32 = SafeIntCompare< T,U >::isBothSigned && SafeIntCompare< T, U >::isBothLT32Bit, - IntZone_Int32_IntLT64 = SafeIntCompare< T,U >::isBothSigned && IntTraits< T >::is32Bit && IntTraits< U >::isLT64Bit, - IntZone_IntLT32_Int32 = SafeIntCompare< T,U >::isBothSigned && IntTraits< T >::isLT32Bit && IntTraits< U >::is32Bit, - IntZone_Int64_Int64 = SafeIntCompare< T,U >::isBothSigned && IntTraits< T >::isInt64 && IntTraits< U >::isInt64, - IntZone_Int64_Int = SafeIntCompare< T,U >::isBothSigned && IntTraits< T >::is64Bit && IntTraits< U >::isLT64Bit, - IntZone_IntLT64_Int64 = SafeIntCompare< T,U >::isBothSigned && IntTraits< T >::isLT64Bit && IntTraits< U >::is64Bit, - //signed-unsigned - IntZone_IntLT32_UintLT32 = IntTraits< T >::isSigned && !IntTraits< U >::isSigned && SafeIntCompare< T,U >::isBothLT32Bit, - IntZone_Int32_UintLT32 = IntTraits< T >::isInt32 && !IntTraits< U >::isSigned && IntTraits< U >::isLT32Bit, - IntZone_IntLT64_Uint32 = IntTraits< T >::isSigned && IntTraits< T >::isLT64Bit && IntTraits< U >::isUint32, - IntZone_Int64_UintLT64 = IntTraits< T >::isInt64 && !IntTraits< U >::isSigned && IntTraits< U >::isLT64Bit, - IntZone_Int_Uint64 = IntTraits< T >::isSigned && IntTraits< U >::isUint64 && IntTraits< T >::isLT64Bit, - IntZone_Int64_Uint64 = IntTraits< T >::isInt64 && IntTraits< U >::isUint64 - }; -}; - - -// In all of the following functions, we have two versions -// One for SafeInt, which throws C++ (or possibly SEH) exceptions -// The non-throwing versions are for use by the helper functions that return success and failure. -// Some of the non-throwing functions are not used, but are maintained for completeness. - -// There's no real alternative to duplicating logic, but keeping the two versions -// immediately next to one another will help reduce problems - - -// useful function to help with getting the magnitude of a negative number -enum AbsMethod -{ - AbsMethodInt, - AbsMethodInt64, - AbsMethodNoop -}; - -template < typename T > -class GetAbsMethod -{ -public: - enum - { - method = IntTraits< T >::isLT64Bit && IntTraits< T >::isSigned ? AbsMethodInt : - IntTraits< T >::isInt64 ? AbsMethodInt64 : AbsMethodNoop - }; -}; - -// let's go ahead and hard-code a dependency on the -// representation of negative numbers to keep compilers from getting overly -// happy with optimizing away things like -MIN_INT. -template < typename T, int > class AbsValueHelper; - -template < typename T > class AbsValueHelper < T, AbsMethodInt> -{ -public: - static unsigned __int32 Abs( T t ) SAFEINT_NOTHROW - { - SAFEINT_ASSERT( t < 0 ); - return ~(unsigned __int32)t + 1; - } -}; - -template < typename T > class AbsValueHelper < T, AbsMethodInt64 > -{ -public: - static unsigned __int64 Abs( T t ) SAFEINT_NOTHROW - { - SAFEINT_ASSERT( t < 0 ); - return ~(unsigned __int64)t + 1; - } -}; - -template < typename T > class AbsValueHelper < T, AbsMethodNoop > -{ -public: - static T Abs( T t ) SAFEINT_NOTHROW - { - // Why are you calling Abs on an unsigned number ??? - SAFEINT_ASSERT( false ); - return t; - } -}; - -template < typename T, bool > class NegationHelper; -// Previous versions had an assert that the type being negated was 32-bit or higher -// In retrospect, this seems like something to just document -// Negation will normally upcast to int -// For example -(unsigned short)0xffff == (int)0xffff0001 -// This class will retain the type, and will truncate, which may not be what -// you wanted -// If you want normal operator casting behavior, do this: -// SafeInt ss = 0xffff; -// then: -// -(SafeInt(ss)) -// will then emit a signed int with the correct value and bitfield - -template < typename T > class NegationHelper // Signed -{ -public: - template - static T NegativeThrow( T t ) SAFEINT_CPP_THROW - { - // corner case - if( t != IntTraits< T >::minInt ) - { - // cast prevents unneeded checks in the case of small ints - return -t; - } - E::SafeIntOnOverflow(); - } - - static bool Negative( T t, T& ret ) SAFEINT_NOTHROW - { - // corner case - if( t != IntTraits< T >::minInt ) - { - // cast prevents unneeded checks in the case of small ints - ret = -t; - return true; - } - return false; - } -}; - -// Helper classes to work keep compilers from -// optimizing away negation -template < typename T > class SignedNegation; - -template <> -class SignedNegation -{ -public: - static signed __int32 Value(unsigned __int64 in) SAFEINT_NOTHROW - { - return (signed __int32)(~(unsigned __int32)in + 1); - } - - static signed __int32 Value(unsigned __int32 in) SAFEINT_NOTHROW - { - return (signed __int32)(~in + 1); - } -}; - -template <> -class SignedNegation -{ -public: - static signed __int64 Value(unsigned __int64 in) SAFEINT_NOTHROW - { - return (signed __int64)(~in + 1); - } -}; - -template < typename T > class NegationHelper // unsigned -{ -public: - template - static T NegativeThrow( T t ) SAFEINT_CPP_THROW - { -#if defined SAFEINT_DISALLOW_UNSIGNED_NEGATION - C_ASSERT( sizeof(T) == 0 ); -#endif - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning(push) -//this avoids warnings from the unary '-' operator being applied to unsigned numbers -#pragma warning(disable:4146) -#endif - // Note - this could be quenched on gcc - // by doing something like: - // return (T)-((__int64)t); - // but it seems like you would want a warning when doing this. - return (T)-t; - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning(pop) -#endif - } - - static bool Negative( T t, T& ret ) SAFEINT_NOTHROW - { - if( IntTraits::isLT32Bit ) - { - // See above - SAFEINT_ASSERT( false ); - } -#if defined SAFEINT_DISALLOW_UNSIGNED_NEGATION - C_ASSERT( sizeof(T) == 0 ); -#endif - // Do it this way to avoid warning - ret = -t; - return true; - } -}; - -//core logic to determine casting behavior -enum CastMethod -{ - CastOK = 0, - CastCheckLTZero, - CastCheckGTMax, - CastCheckSafeIntMinMaxUnsigned, - CastCheckSafeIntMinMaxSigned, - CastToFloat, - CastFromFloat, - CastToBool, - CastFromBool -}; - - -template < typename ToType, typename FromType > -class GetCastMethod -{ -public: - enum - { - method = ( IntTraits< FromType >::isBool && - !IntTraits< ToType >::isBool ) ? CastFromBool : - - ( !IntTraits< FromType >::isBool && - IntTraits< ToType >::isBool ) ? CastToBool : - - ( SafeIntCompare< ToType, FromType >::isCastOK ) ? CastOK : - - ( ( IntTraits< ToType >::isSigned && - !IntTraits< FromType >::isSigned && - sizeof( FromType ) >= sizeof( ToType ) ) || - ( SafeIntCompare< ToType, FromType >::isBothUnsigned && - sizeof( FromType ) > sizeof( ToType ) ) ) ? CastCheckGTMax : - - ( !IntTraits< ToType >::isSigned && - IntTraits< FromType >::isSigned && - sizeof( ToType ) >= sizeof( FromType ) ) ? CastCheckLTZero : - - ( !IntTraits< ToType >::isSigned ) ? CastCheckSafeIntMinMaxUnsigned - : CastCheckSafeIntMinMaxSigned - }; -}; - -template < typename FromType > class GetCastMethod < float, FromType > -{ -public: - enum{ method = CastOK }; -}; - -template < typename FromType > class GetCastMethod < double, FromType > -{ -public: - enum{ method = CastOK }; -}; - -template < typename FromType > class GetCastMethod < long double, FromType > -{ -public: - enum{ method = CastOK }; -}; - -template < typename ToType > class GetCastMethod < ToType, float > -{ -public: - enum{ method = CastFromFloat }; -}; - -template < typename ToType > class GetCastMethod < ToType, double > -{ -public: - enum{ method = CastFromFloat }; -}; - -template < typename ToType > class GetCastMethod < ToType, long double > -{ -public: - enum{ method = CastFromFloat }; -}; - -template < typename T, typename U, int > class SafeCastHelper; - -template < typename T, typename U > class SafeCastHelper < T, U, CastOK > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - t = (T)u; - return true; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - t = (T)u; - } -}; - -// special case floats and doubles -// tolerate loss of precision -template < typename T, typename U > class SafeCastHelper < T, U, CastFromFloat > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - if( u <= (U)IntTraits< T >::maxInt && - u >= (U)IntTraits< T >::minInt ) - { - t = (T)u; - return true; - } - return false; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - if( u <= (U)IntTraits< T >::maxInt && - u >= (U)IntTraits< T >::minInt ) - { - t = (T)u; - return; - } - E::SafeIntOnOverflow(); - } -}; - -// Match on any method where a bool is cast to type T -template < typename T > class SafeCastHelper < T, bool, CastFromBool > -{ -public: - static bool Cast( bool b, T& t ) SAFEINT_NOTHROW - { - t = (T)( b ? 1 : 0 ); - return true; - } - - template < typename E > - static void CastThrow( bool b, T& t ) SAFEINT_CPP_THROW - { - t = (T)( b ? 1 : 0 ); - } -}; - -template < typename T > class SafeCastHelper < bool, T, CastToBool > -{ -public: - static bool Cast( T t, bool& b ) SAFEINT_NOTHROW - { - b = !!t; - return true; - } - - template < typename E > - static void CastThrow( bool b, T& t ) SAFEINT_CPP_THROW - { - b = !!t; - } -}; - -template < typename T, typename U > class SafeCastHelper < T, U, CastCheckLTZero > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - if( u < 0 ) - return false; - - t = (T)u; - return true; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - if( u < 0 ) - E::SafeIntOnOverflow(); - - t = (T)u; - } -}; - -template < typename T, typename U > class SafeCastHelper < T, U, CastCheckGTMax > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - if( u > (U)IntTraits< T >::maxInt ) - return false; - - t = (T)u; - return true; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - if( u > (U)IntTraits< T >::maxInt ) - E::SafeIntOnOverflow(); - - t = (T)u; - } -}; - -template < typename T, typename U > class SafeCastHelper < T, U, CastCheckSafeIntMinMaxUnsigned > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - // U is signed - T could be either signed or unsigned - if( u > IntTraits< T >::maxInt || u < 0 ) - return false; - - t = (T)u; - return true; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - // U is signed - T could be either signed or unsigned - if( u > IntTraits< T >::maxInt || u < 0 ) - E::SafeIntOnOverflow(); - - t = (T)u; - } -}; - -template < typename T, typename U > class SafeCastHelper < T, U, CastCheckSafeIntMinMaxSigned > -{ -public: - static bool Cast( U u, T& t ) SAFEINT_NOTHROW - { - // T, U are signed - if( u > IntTraits< T >::maxInt || u < IntTraits< T >::minInt ) - return false; - - t = (T)u; - return true; - } - - template < typename E > - static void CastThrow( U u, T& t ) SAFEINT_CPP_THROW - { - //T, U are signed - if( u > IntTraits< T >::maxInt || u < IntTraits< T >::minInt ) - E::SafeIntOnOverflow(); - - t = (T)u; - } -}; - -//core logic to determine whether a comparison is valid, or needs special treatment -enum ComparisonMethod -{ - ComparisonMethod_Ok = 0, - ComparisonMethod_CastInt, - ComparisonMethod_CastInt64, - ComparisonMethod_UnsignedT, - ComparisonMethod_UnsignedU -}; - - // Note - the standard is arguably broken in the case of some integer - // conversion operations - // For example, signed char a = -1 = 0xff - // unsigned int b = 0xffffffff - // If you then test if a < b, a value-preserving cast - // is made, and you're essentially testing - // (unsigned int)a < b == false - // - // I do not think this makes sense - if you perform - // a cast to an __int64, which can clearly preserve both value and signedness - // then you get a different and intuitively correct answer - // IMHO, -1 should be less than 4 billion - // If you prefer to retain the ANSI standard behavior - // insert #define ANSI_CONVERSIONS into your source - // Behavior differences occur in the following cases: - // 8, 16, and 32-bit signed int, unsigned 32-bit int - // any signed int, unsigned 64-bit int - // Note - the signed int must be negative to show the problem - -template < typename T, typename U > -class ValidComparison -{ -public: - enum - { -#ifdef ANSI_CONVERSIONS - method = ComparisonMethod_Ok -#else - method = ( ( SafeIntCompare< T, U >::isLikeSigned ) ? ComparisonMethod_Ok : - ( ( IntTraits< T >::isSigned && sizeof(T) < 8 && sizeof(U) < 4 ) || - ( IntTraits< U >::isSigned && sizeof(T) < 4 && sizeof(U) < 8 ) ) ? ComparisonMethod_CastInt : - ( ( IntTraits< T >::isSigned && sizeof(U) < 8 ) || - ( IntTraits< U >::isSigned && sizeof(T) < 8 ) ) ? ComparisonMethod_CastInt64 : - ( !IntTraits< T >::isSigned ) ? ComparisonMethod_UnsignedT : - ComparisonMethod_UnsignedU ) -#endif - }; -}; - -template class EqualityTest; - -template < typename T, typename U > class EqualityTest< T, U, ComparisonMethod_Ok > -{ -public: - static bool IsEquals( const T t, const U u ) SAFEINT_NOTHROW { return ( t == u ); } -}; - -template < typename T, typename U > class EqualityTest< T, U, ComparisonMethod_CastInt > -{ -public: - static bool IsEquals( const T t, const U u ) SAFEINT_NOTHROW { return ( (int)t == (int)u ); } -}; - -template < typename T, typename U > class EqualityTest< T, U, ComparisonMethod_CastInt64 > -{ -public: - static bool IsEquals( const T t, const U u ) SAFEINT_NOTHROW { return ( (__int64)t == (__int64)u ); } -}; - -template < typename T, typename U > class EqualityTest< T, U, ComparisonMethod_UnsignedT > -{ -public: - static bool IsEquals( const T t, const U u ) SAFEINT_NOTHROW - { - //one operand is 32 or 64-bit unsigned, and the other is signed and the same size or smaller - if( u < 0 ) - return false; - - //else safe to cast to type T - return ( t == (T)u ); - } -}; - -template < typename T, typename U > class EqualityTest< T, U, ComparisonMethod_UnsignedU> -{ -public: - static bool IsEquals( const T t, const U u ) SAFEINT_NOTHROW - { - //one operand is 32 or 64-bit unsigned, and the other is signed and the same size or smaller - if( t < 0 ) - return false; - - //else safe to cast to type U - return ( (U)t == u ); - } -}; - -template class GreaterThanTest; - -template < typename T, typename U > class GreaterThanTest< T, U, ComparisonMethod_Ok > -{ -public: - static bool GreaterThan( const T t, const U u ) SAFEINT_NOTHROW { return ( t > u ); } -}; - -template < typename T, typename U > class GreaterThanTest< T, U, ComparisonMethod_CastInt > -{ -public: - static bool GreaterThan( const T t, const U u ) SAFEINT_NOTHROW { return ( (int)t > (int)u ); } -}; - -template < typename T, typename U > class GreaterThanTest< T, U, ComparisonMethod_CastInt64 > -{ -public: - static bool GreaterThan( const T t, const U u ) SAFEINT_NOTHROW { return ( (__int64)t > (__int64)u ); } -}; - -template < typename T, typename U > class GreaterThanTest< T, U, ComparisonMethod_UnsignedT > -{ -public: - static bool GreaterThan( const T t, const U u ) SAFEINT_NOTHROW - { - // one operand is 32 or 64-bit unsigned, and the other is signed and the same size or smaller - if( u < 0 ) - return true; - - // else safe to cast to type T - return ( t > (T)u ); - } -}; - -template < typename T, typename U > class GreaterThanTest< T, U, ComparisonMethod_UnsignedU > -{ -public: - static bool GreaterThan( const T t, const U u ) SAFEINT_NOTHROW - { - // one operand is 32 or 64-bit unsigned, and the other is signed and the same size or smaller - if( t < 0 ) - return false; - - // else safe to cast to type U - return ( (U)t > u ); - } -}; - -// Modulus is simpler than comparison, but follows much the same logic -// using this set of functions, it can't fail except in a div 0 situation -template class ModulusHelper; - -template class ModulusHelper -{ -public: - static SafeIntError Modulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if(u == 0) - return SafeIntDivideByZero; - - //trap corner case - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - // Some compilers don't notice that this only compiles when u is signed - // Add cast to make them happy - if( u == (U)-1 ) - { - result = 0; - return SafeIntNoError; - } - } - - result = (T)(t % u); - return SafeIntNoError; - } - - template < typename E > - static void ModulusThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - E::SafeIntOnDivZero(); - - //trap corner case - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - if( u == (U)-1 ) - { - result = 0; - return; - } - } - - result = (T)(t % u); - } -}; - -template class ModulusHelper -{ -public: - static SafeIntError Modulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if(u == 0) - return SafeIntDivideByZero; - - //trap corner case - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - if( u == (U)-1 ) - { - result = 0; - return SafeIntNoError; - } - } - - result = (T)(t % u); - return SafeIntNoError; - } - - template < typename E > - static void ModulusThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - E::SafeIntOnDivZero(); - - //trap corner case - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - if( u == (U)-1 ) - { - result = 0; - return; - } - } - - result = (T)(t % u); - } -}; - -template < typename T, typename U > class ModulusHelper< T, U, ComparisonMethod_CastInt64> -{ -public: - static SafeIntError Modulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if(u == 0) - return SafeIntDivideByZero; - - //trap corner case - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - if( u == (U)-1 ) - { - result = 0; - return SafeIntNoError; - } - } - - result = (T)((__int64)t % (__int64)u); - return SafeIntNoError; - } - - template < typename E > - static void ModulusThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - E::SafeIntOnDivZero(); - - if( CompileConst< IntTraits< U >::isSigned >::Value() ) - { - if( u == (U)-1 ) - { - result = 0; - return; - } - } - - result = (T)((__int64)t % (__int64)u); - } -}; - -// T is unsigned __int64, U is any signed int -template < typename T, typename U > class ModulusHelper< T, U, ComparisonMethod_UnsignedT> -{ -public: - static SafeIntError Modulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if(u == 0) - return SafeIntDivideByZero; - - // u could be negative - if so, need to convert to positive - // casts below are always safe due to the way modulus works - if(u < 0) - result = (T)(t % AbsValueHelper< U, GetAbsMethod< U >::method >::Abs(u)); - else - result = (T)(t % u); - - return SafeIntNoError; - } - - template < typename E > - static void ModulusThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - E::SafeIntOnDivZero(); - - // u could be negative - if so, need to convert to positive - if(u < 0) - result = (T)(t % AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( u )); - else - result = (T)(t % u); - } -}; - -// U is unsigned __int64, T any signed int -template < typename T, typename U > class ModulusHelper< T, U, ComparisonMethod_UnsignedU> -{ -public: - static SafeIntError Modulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if(u == 0) - return SafeIntDivideByZero; - - //t could be negative - if so, need to convert to positive - if(t < 0) - result = (T)( ~( AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( t ) % u ) + 1 ); - else - result = (T)((T)t % u); - - return SafeIntNoError; - } - - template < typename E > - static void ModulusThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - E::SafeIntOnDivZero(); - - //t could be negative - if so, need to convert to positive - if(t < 0) - result = (T)( ~( AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( t ) % u ) + 1); - else - result = (T)( (T)t % u ); - } -}; - -//core logic to determine method to check multiplication -enum MultiplicationState -{ - MultiplicationState_CastInt = 0, // One or both signed, smaller than 32-bit - MultiplicationState_CastInt64, // One or both signed, smaller than 64-bit - MultiplicationState_CastUint, // Both are unsigned, smaller than 32-bit - MultiplicationState_CastUint64, // Both are unsigned, both 32-bit or smaller - MultiplicationState_Uint64Uint, // Both are unsigned, lhs 64-bit, rhs 32-bit or smaller - MultiplicationState_Uint64Uint64, // Both are unsigned int64 - MultiplicationState_Uint64Int, // lhs is unsigned int64, rhs int32 - MultiplicationState_Uint64Int64, // lhs is unsigned int64, rhs signed int64 - MultiplicationState_UintUint64, // Both are unsigned, lhs 32-bit or smaller, rhs 64-bit - MultiplicationState_UintInt64, // lhs unsigned 32-bit or less, rhs int64 - MultiplicationState_Int64Uint, // lhs int64, rhs unsigned int32 - MultiplicationState_Int64Int64, // lhs int64, rhs int64 - MultiplicationState_Int64Int, // lhs int64, rhs int32 - MultiplicationState_IntUint64, // lhs int, rhs unsigned int64 - MultiplicationState_IntInt64, // lhs int, rhs int64 - MultiplicationState_Int64Uint64, // lhs int64, rhs uint64 - MultiplicationState_Error -}; - -template < typename T, typename U > -class MultiplicationMethod -{ -public: - enum - { - // unsigned-unsigned - method = (IntRegion< T,U >::IntZone_UintLT32_UintLT32 ? MultiplicationState_CastUint : - (IntRegion< T,U >::IntZone_Uint32_UintLT64 || - IntRegion< T,U >::IntZone_UintLT32_Uint32) ? MultiplicationState_CastUint64 : - SafeIntCompare< T,U >::isBothUnsigned && - IntTraits< T >::isUint64 && IntTraits< U >::isUint64 ? MultiplicationState_Uint64Uint64 : - (IntRegion< T,U >::IntZone_Uint64_Uint) ? MultiplicationState_Uint64Uint : - (IntRegion< T,U >::IntZone_UintLT64_Uint64) ? MultiplicationState_UintUint64 : - // unsigned-signed - (IntRegion< T,U >::IntZone_UintLT32_IntLT32) ? MultiplicationState_CastInt : - (IntRegion< T,U >::IntZone_Uint32_IntLT64 || - IntRegion< T,U >::IntZone_UintLT32_Int32) ? MultiplicationState_CastInt64 : - (IntRegion< T,U >::IntZone_Uint64_Int) ? MultiplicationState_Uint64Int : - (IntRegion< T,U >::IntZone_UintLT64_Int64) ? MultiplicationState_UintInt64 : - (IntRegion< T,U >::IntZone_Uint64_Int64) ? MultiplicationState_Uint64Int64 : - // signed-signed - (IntRegion< T,U >::IntZone_IntLT32_IntLT32) ? MultiplicationState_CastInt : - (IntRegion< T,U >::IntZone_Int32_IntLT64 || - IntRegion< T,U >::IntZone_IntLT32_Int32) ? MultiplicationState_CastInt64 : - (IntRegion< T,U >::IntZone_Int64_Int64) ? MultiplicationState_Int64Int64 : - (IntRegion< T,U >::IntZone_Int64_Int) ? MultiplicationState_Int64Int : - (IntRegion< T,U >::IntZone_IntLT64_Int64) ? MultiplicationState_IntInt64 : - // signed-unsigned - (IntRegion< T,U >::IntZone_IntLT32_UintLT32) ? MultiplicationState_CastInt : - (IntRegion< T,U >::IntZone_Int32_UintLT32 || - IntRegion< T,U >::IntZone_IntLT64_Uint32) ? MultiplicationState_CastInt64 : - (IntRegion< T,U >::IntZone_Int64_UintLT64) ? MultiplicationState_Int64Uint : - (IntRegion< T,U >::IntZone_Int_Uint64) ? MultiplicationState_IntUint64 : - (IntRegion< T,U >::IntZone_Int64_Uint64 ? MultiplicationState_Int64Uint64 : - MultiplicationState_Error ) ) - }; -}; - -template class MultiplicationHelper; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_CastInt> -{ -public: - //accepts signed, both less than 32-bit - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - int tmp = t * u; - - if( tmp > IntTraits< T >::maxInt || tmp < IntTraits< T >::minInt ) - return false; - - ret = (T)tmp; - return true; - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - int tmp = t * u; - - if( tmp > IntTraits< T >::maxInt || tmp < IntTraits< T >::minInt ) - E::SafeIntOnOverflow(); - - ret = (T)tmp; - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_CastUint > -{ -public: - //accepts unsigned, both less than 32-bit - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - unsigned int tmp = (unsigned int)(t * u); - - if( tmp > IntTraits< T >::maxInt ) - return false; - - ret = (T)tmp; - return true; - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - unsigned int tmp = (unsigned int)( t * u ); - - if( tmp > IntTraits< T >::maxInt ) - E::SafeIntOnOverflow(); - - ret = (T)tmp; - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_CastInt64> -{ -public: - //mixed signed or both signed where at least one argument is 32-bit, and both a 32-bit or less - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - __int64 tmp = (__int64)t * (__int64)u; - - if(tmp > (__int64)IntTraits< T >::maxInt || tmp < (__int64)IntTraits< T >::minInt) - return false; - - ret = (T)tmp; - return true; - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - __int64 tmp = (__int64)t * (__int64)u; - - if(tmp > (__int64)IntTraits< T >::maxInt || tmp < (__int64)IntTraits< T >::minInt) - E::SafeIntOnOverflow(); - - ret = (T)tmp; - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_CastUint64> -{ -public: - //both unsigned where at least one argument is 32-bit, and both are 32-bit or less - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - unsigned __int64 tmp = (unsigned __int64)t * (unsigned __int64)u; - - if(tmp > (unsigned __int64)IntTraits< T >::maxInt) - return false; - - ret = (T)tmp; - return true; - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - unsigned __int64 tmp = (unsigned __int64)t * (unsigned __int64)u; - - if(tmp > (unsigned __int64)IntTraits< T >::maxInt) - E::SafeIntOnOverflow(); - - ret = (T)tmp; - } -}; - -// T = left arg and return type -// U = right arg -template < typename T, typename U > class LargeIntRegMultiply; - -#if SAFEINT_USE_INTRINSICS -// As usual, unsigned is easy -inline bool IntrinsicMultiplyUint64( const unsigned __int64& a, const unsigned __int64& b, unsigned __int64* pRet ) SAFEINT_NOTHROW -{ - unsigned __int64 ulHigh = 0; - *pRet = _umul128(a , b, &ulHigh); - return ulHigh == 0; -} - -// Signed, is not so easy -inline bool IntrinsicMultiplyInt64( const signed __int64& a, const signed __int64& b, signed __int64* pRet ) SAFEINT_NOTHROW -{ - __int64 llHigh = 0; - *pRet = _mul128(a , b, &llHigh); - - // Now we need to figure out what we expect - // If llHigh is 0, then treat *pRet as unsigned - // If llHigh is < 0, then treat *pRet as signed - - if( (a ^ b) < 0 ) - { - // Negative result expected - if( llHigh == -1 && *pRet < 0 || - llHigh == 0 && *pRet == 0 ) - { - // Everything is within range - return true; - } - } - else - { - // Result should be positive - // Check for overflow - if( llHigh == 0 && (unsigned __int64)*pRet <= IntTraits< signed __int64 >::maxInt ) - return true; - } - return false; -} - -#endif - -template<> class LargeIntRegMultiply< unsigned __int64, unsigned __int64 > -{ -public: - static bool RegMultiply( const unsigned __int64& a, const unsigned __int64& b, unsigned __int64* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyUint64( a, b, pRet ); -#else - unsigned __int32 aHigh, aLow, bHigh, bLow; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * (bHigh * 2^32 + bLow) - // => (aHigh * bHigh * 2^64) + (aLow * bHigh * 2^32) + (aHigh * bLow * 2^32) + (aLow * bLow) - // Note - same approach applies for 128 bit math on a 64-bit system - - aHigh = (unsigned __int32)(a >> 32); - aLow = (unsigned __int32)a; - bHigh = (unsigned __int32)(b >> 32); - bLow = (unsigned __int32)b; - - *pRet = 0; - - if(aHigh == 0) - { - if(bHigh != 0) - { - *pRet = (unsigned __int64)aLow * (unsigned __int64)bHigh; - } - } - else if(bHigh == 0) - { - if(aHigh != 0) - { - *pRet = (unsigned __int64)aHigh * (unsigned __int64)bLow; - } - } - else - { - return false; - } - - if(*pRet != 0) - { - unsigned __int64 tmp; - - if((unsigned __int32)(*pRet >> 32) != 0) - return false; - - *pRet <<= 32; - tmp = (unsigned __int64)aLow * (unsigned __int64)bLow; - *pRet += tmp; - - if(*pRet < tmp) - return false; - - return true; - } - - *pRet = (unsigned __int64)aLow * (unsigned __int64)bLow; - return true; -#endif - } - - template < typename E > - static void RegMultiplyThrow( const unsigned __int64& a, const unsigned __int64& b, unsigned __int64* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyUint64( a, b, pRet ) ) - E::SafeIntOnOverflow(); -#else - unsigned __int32 aHigh, aLow, bHigh, bLow; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * (bHigh * 2^32 + bLow) - // => (aHigh * bHigh * 2^64) + (aLow * bHigh * 2^32) + (aHigh * bLow * 2^32) + (aLow * bLow) - // Note - same approach applies for 128 bit math on a 64-bit system - - aHigh = (unsigned __int32)(a >> 32); - aLow = (unsigned __int32)a; - bHigh = (unsigned __int32)(b >> 32); - bLow = (unsigned __int32)b; - - *pRet = 0; - - if(aHigh == 0) - { - if(bHigh != 0) - { - *pRet = (unsigned __int64)aLow * (unsigned __int64)bHigh; - } - } - else if(bHigh == 0) - { - if(aHigh != 0) - { - *pRet = (unsigned __int64)aHigh * (unsigned __int64)bLow; - } - } - else - { - E::SafeIntOnOverflow(); - } - - if(*pRet != 0) - { - unsigned __int64 tmp; - - if((unsigned __int32)(*pRet >> 32) != 0) - E::SafeIntOnOverflow(); - - *pRet <<= 32; - tmp = (unsigned __int64)aLow * (unsigned __int64)bLow; - *pRet += tmp; - - if(*pRet < tmp) - E::SafeIntOnOverflow(); - - return; - } - - *pRet = (unsigned __int64)aLow * (unsigned __int64)bLow; -#endif - } -}; - -template<> class LargeIntRegMultiply< unsigned __int64, unsigned __int32 > -{ -public: - static bool RegMultiply( const unsigned __int64& a, unsigned __int32 b, unsigned __int64* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ); -#else - unsigned __int32 aHigh, aLow; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * b - // => (aHigh * b * 2^32) + (aLow * b) - - aHigh = (unsigned __int32)(a >> 32); - aLow = (unsigned __int32)a; - - *pRet = 0; - - if(aHigh != 0) - { - *pRet = (unsigned __int64)aHigh * (unsigned __int64)b; - - unsigned __int64 tmp; - - if((unsigned __int32)(*pRet >> 32) != 0) - return false; - - *pRet <<= 32; - tmp = (unsigned __int64)aLow * (unsigned __int64)b; - *pRet += tmp; - - if(*pRet < tmp) - return false; - - return true; - } - - *pRet = (unsigned __int64)aLow * (unsigned __int64)b; - return true; -#endif - } - - template < typename E > - static void RegMultiplyThrow( const unsigned __int64& a, unsigned __int32 b, unsigned __int64* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ) ) - E::SafeIntOnOverflow(); -#else - unsigned __int32 aHigh, aLow; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * b - // => (aHigh * b * 2^32) + (aLow * b) - - aHigh = (unsigned __int32)(a >> 32); - aLow = (unsigned __int32)a; - - *pRet = 0; - - if(aHigh != 0) - { - *pRet = (unsigned __int64)aHigh * (unsigned __int64)b; - - unsigned __int64 tmp; - - if((unsigned __int32)(*pRet >> 32) != 0) - E::SafeIntOnOverflow(); - - *pRet <<= 32; - tmp = (unsigned __int64)aLow * (unsigned __int64)b; - *pRet += tmp; - - if(*pRet < tmp) - E::SafeIntOnOverflow(); - - return; - } - - *pRet = (unsigned __int64)aLow * (unsigned __int64)b; - return; -#endif - } -}; - -template<> class LargeIntRegMultiply< unsigned __int64, signed __int32 > -{ -public: - // Intrinsic not needed - static bool RegMultiply( const unsigned __int64& a, signed __int32 b, unsigned __int64* pRet ) SAFEINT_NOTHROW - { - if( b < 0 && a != 0 ) - return false; - -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ); -#else - return LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::RegMultiply(a, (unsigned __int32)b, pRet); -#endif - } - - template < typename E > - static void RegMultiplyThrow( const unsigned __int64& a, signed __int32 b, unsigned __int64* pRet ) SAFEINT_CPP_THROW - { - if( b < 0 && a != 0 ) - E::SafeIntOnOverflow(); - -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ) ) - E::SafeIntOnOverflow(); -#else - LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::template RegMultiplyThrow< E >( a, (unsigned __int32)b, pRet ); -#endif - } -}; - -template<> class LargeIntRegMultiply< unsigned __int64, signed __int64 > -{ -public: - static bool RegMultiply( const unsigned __int64& a, signed __int64 b, unsigned __int64* pRet ) SAFEINT_NOTHROW - { - if( b < 0 && a != 0 ) - return false; - -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ); -#else - return LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::RegMultiply(a, (unsigned __int64)b, pRet); -#endif - } - - template < typename E > - static void RegMultiplyThrow( const unsigned __int64& a, signed __int64 b, unsigned __int64* pRet ) SAFEINT_CPP_THROW - { - if( b < 0 && a != 0 ) - E::SafeIntOnOverflow(); - -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyUint64( a, (unsigned __int64)b, pRet ) ) - E::SafeIntOnOverflow(); -#else - LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::template RegMultiplyThrow< E >( a, (unsigned __int64)b, pRet ); -#endif - } -}; - -template<> class LargeIntRegMultiply< signed __int32, unsigned __int64 > -{ -public: - // Devolves into ordinary 64-bit calculation - static bool RegMultiply( signed __int32 a, const unsigned __int64& b, signed __int32* pRet ) SAFEINT_NOTHROW - { - unsigned __int32 bHigh, bLow; - bool fIsNegative = false; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * (bHigh * 2^32 + bLow) - // => (aHigh * bHigh * 2^64) + (aLow * bHigh * 2^32) + (aHigh * bLow * 2^32) + (aLow * bLow) - // aHigh == 0 implies: - // ( aLow * bHigh * 2^32 ) + ( aLow + bLow ) - // If the first part is != 0, fail - - bHigh = (unsigned __int32)(b >> 32); - bLow = (unsigned __int32)b; - - *pRet = 0; - - if(bHigh != 0 && a != 0) - return false; - - if( a < 0 ) - { - - a = (signed __int32)AbsValueHelper< signed __int32, GetAbsMethod< signed __int32 >::method >::Abs(a); - fIsNegative = true; - } - - unsigned __int64 tmp = (unsigned __int32)a * (unsigned __int64)bLow; - - if( !fIsNegative ) - { - if( tmp <= (unsigned __int64)IntTraits< signed __int32 >::maxInt ) - { - *pRet = (signed __int32)tmp; - return true; - } - } - else - { - if( tmp <= (unsigned __int64)IntTraits< signed __int32 >::maxInt+1 ) - { - *pRet = SignedNegation< signed __int32 >::Value( tmp ); - return true; - } - } - - return false; - } - - template < typename E > - static void RegMultiplyThrow( signed __int32 a, const unsigned __int64& b, signed __int32* pRet ) SAFEINT_CPP_THROW - { - unsigned __int32 bHigh, bLow; - bool fIsNegative = false; - - // Consider that a*b can be broken up into: - // (aHigh * 2^32 + aLow) * (bHigh * 2^32 + bLow) - // => (aHigh * bHigh * 2^64) + (aLow * bHigh * 2^32) + (aHigh * bLow * 2^32) + (aLow * bLow) - - bHigh = (unsigned __int32)(b >> 32); - bLow = (unsigned __int32)b; - - *pRet = 0; - - if(bHigh != 0 && a != 0) - E::SafeIntOnOverflow(); - - if( a < 0 ) - { - a = (signed __int32)AbsValueHelper< signed __int32, GetAbsMethod< signed __int32 >::method >::Abs(a); - fIsNegative = true; - } - - unsigned __int64 tmp = (unsigned __int32)a * (unsigned __int64)bLow; - - if( !fIsNegative ) - { - if( tmp <= (unsigned __int64)IntTraits< signed __int32 >::maxInt ) - { - *pRet = (signed __int32)tmp; - return; - } - } - else - { - if( tmp <= (unsigned __int64)IntTraits< signed __int32 >::maxInt+1 ) - { - *pRet = SignedNegation< signed __int32 >::Value( tmp ); - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template<> class LargeIntRegMultiply< unsigned __int32, unsigned __int64 > -{ -public: - // Becomes ordinary 64-bit multiplication, intrinsic not needed - static bool RegMultiply( unsigned __int32 a, const unsigned __int64& b, unsigned __int32* pRet ) SAFEINT_NOTHROW - { - // Consider that a*b can be broken up into: - // (bHigh * 2^32 + bLow) * a - // => (bHigh * a * 2^32) + (bLow * a) - // In this case, the result must fit into 32-bits - // If bHigh != 0 && a != 0, immediate error. - - if( (unsigned __int32)(b >> 32) != 0 && a != 0 ) - return false; - - unsigned __int64 tmp = b * (unsigned __int64)a; - - if( (unsigned __int32)(tmp >> 32) != 0 ) // overflow - return false; - - *pRet = (unsigned __int32)tmp; - return true; - } - - template < typename E > - static void RegMultiplyThrow( unsigned __int32 a, const unsigned __int64& b, unsigned __int32* pRet ) SAFEINT_CPP_THROW - { - if( (unsigned __int32)(b >> 32) != 0 && a != 0 ) - E::SafeIntOnOverflow(); - - unsigned __int64 tmp = b * (unsigned __int64)a; - - if( (unsigned __int32)(tmp >> 32) != 0 ) // overflow - E::SafeIntOnOverflow(); - - *pRet = (unsigned __int32)tmp; - } -}; - -template<> class LargeIntRegMultiply< unsigned __int32, signed __int64 > -{ -public: - static bool RegMultiply( unsigned __int32 a, const signed __int64& b, unsigned __int32* pRet ) SAFEINT_NOTHROW - { - if( b < 0 && a != 0 ) - return false; - return LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::RegMultiply( a, (unsigned __int64)b, pRet ); - } - - template < typename E > - static void RegMultiplyThrow( unsigned __int32 a, const signed __int64& b, unsigned __int32* pRet ) SAFEINT_CPP_THROW - { - if( b < 0 && a != 0 ) - E::SafeIntOnOverflow(); - - LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::template RegMultiplyThrow< E >( a, (unsigned __int64)b, pRet ); - } -}; - -template<> class LargeIntRegMultiply< signed __int64, signed __int64 > -{ -public: - static bool RegMultiply( const signed __int64& a, const signed __int64& b, signed __int64* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyInt64( a, b, pRet ); -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int64 tmp; - __int64 a1 = a; - __int64 b1 = b; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( b1 < 0 ) - { - bNegative = true; - b1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(b1); - } - - if( LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::RegMultiply( (unsigned __int64)a1, (unsigned __int64)b1, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return true; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return true; - } - } - } - - return false; -#endif - } - - template < typename E > - static void RegMultiplyThrow( const signed __int64& a, const signed __int64& b, signed __int64* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyInt64( a, b, pRet ) ) - E::SafeIntOnOverflow(); -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int64 tmp; - __int64 a1 = a; - __int64 b1 = b; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( b1 < 0 ) - { - bNegative = true; - b1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(b1); - } - - LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::template RegMultiplyThrow< E >( (unsigned __int64)a1, (unsigned __int64)b1, &tmp ); - - // The unsigned multiplication didn't overflow or we'd be in the exception handler - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return; - } - } - - E::SafeIntOnOverflow(); -#endif - } -}; - -template<> class LargeIntRegMultiply< signed __int64, unsigned __int32 > -{ -public: - static bool RegMultiply( const signed __int64& a, unsigned __int32 b, signed __int64* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyInt64( a, (signed __int64)b, pRet ); -#else - bool aNegative = false; - unsigned __int64 tmp; - __int64 a1 = a; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::RegMultiply( (unsigned __int64)a1, b, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return true; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return true; - } - } - } - - return false; -#endif - } - - template < typename E > - static void RegMultiplyThrow( const signed __int64& a, unsigned __int32 b, signed __int64* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyInt64( a, (signed __int64)b, pRet ) ) - E::SafeIntOnOverflow(); -#else - bool aNegative = false; - unsigned __int64 tmp; - __int64 a1 = a; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::template RegMultiplyThrow< E >( (unsigned __int64)a1, b, &tmp ); - - // The unsigned multiplication didn't overflow - if( aNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return; - } - } - - E::SafeIntOnOverflow(); -#endif - } -}; - -template<> class LargeIntRegMultiply< signed __int64, signed __int32 > -{ -public: - static bool RegMultiply( const signed __int64& a, signed __int32 b, signed __int64* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - return IntrinsicMultiplyInt64( a, (signed __int64)b, pRet ); -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int64 tmp; - __int64 a1 = a; - __int64 b1 = b; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( b1 < 0 ) - { - bNegative = true; - b1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(b1); - } - - if( LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::RegMultiply( (unsigned __int64)a1, (unsigned __int32)b1, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return true; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return true; - } - } - } - - return false; -#endif - } - - template < typename E > - static void RegMultiplyThrow( signed __int64 a, signed __int32 b, signed __int64* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - if( !IntrinsicMultiplyInt64( a, (signed __int64)b, pRet ) ) - E::SafeIntOnOverflow(); -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int64 tmp; - - if( a < 0 ) - { - aNegative = true; - a = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a); - } - - if( b < 0 ) - { - bNegative = true; - b = (signed __int32)AbsValueHelper< signed __int32, GetAbsMethod< signed __int32 >::method >::Abs(b); - } - - LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::template RegMultiplyThrow< E >( (unsigned __int64)a, (unsigned __int32)b, &tmp ); - - // The unsigned multiplication didn't overflow - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return; - } - } - - E::SafeIntOnOverflow(); -#endif - } -}; - -template<> class LargeIntRegMultiply< signed __int32, signed __int64 > -{ -public: - static bool RegMultiply( signed __int32 a, const signed __int64& b, signed __int32* pRet ) SAFEINT_NOTHROW - { -#if SAFEINT_USE_INTRINSICS - __int64 tmp; - - if( IntrinsicMultiplyInt64( a, b, &tmp ) ) - { - if( tmp > IntTraits< signed __int32 >::maxInt || - tmp < IntTraits< signed __int32 >::minInt ) - { - return false; - } - - *pRet = (__int32)tmp; - return true; - } - return false; -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int32 tmp; - __int64 b1 = b; - - if( a < 0 ) - { - aNegative = true; - a = (signed __int32)AbsValueHelper< signed __int32, GetAbsMethod< signed __int32 >::method >::Abs(a); - } - - if( b1 < 0 ) - { - bNegative = true; - b1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(b1); - } - - if( LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::RegMultiply( (unsigned __int32)a, (unsigned __int64)b1, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int32)IntTraits< signed __int32 >::minInt ) - { - *pRet = SignedNegation< signed __int32 >::Value( tmp ); - return true; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int32)IntTraits< signed __int32 >::maxInt ) - { - *pRet = (signed __int32)tmp; - return true; - } - } - } - - return false; -#endif - } - - template < typename E > - static void RegMultiplyThrow( signed __int32 a, const signed __int64& b, signed __int32* pRet ) SAFEINT_CPP_THROW - { -#if SAFEINT_USE_INTRINSICS - __int64 tmp; - - if( IntrinsicMultiplyInt64( a, b, &tmp ) ) - { - if( tmp > IntTraits< signed __int32 >::maxInt || - tmp < IntTraits< signed __int32 >::minInt ) - { - E::SafeIntOnOverflow(); - } - - *pRet = (__int32)tmp; - return; - } - E::SafeIntOnOverflow(); -#else - bool aNegative = false; - bool bNegative = false; - - unsigned __int32 tmp; - signed __int64 b2 = b; - - if( a < 0 ) - { - aNegative = true; - a = (signed __int32)AbsValueHelper< signed __int32, GetAbsMethod< signed __int32 >::method >::Abs(a); - } - - if( b < 0 ) - { - bNegative = true; - b2 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(b2); - } - - LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::template RegMultiplyThrow< E >( (unsigned __int32)a, (unsigned __int64)b2, &tmp ); - - // The unsigned multiplication didn't overflow - if( aNegative ^ bNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int32)IntTraits< signed __int32 >::minInt ) - { - *pRet = SignedNegation< signed __int32 >::Value( tmp ); - return; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int32)IntTraits< signed __int32 >::maxInt ) - { - *pRet = (signed __int32)tmp; - return; - } - } - - E::SafeIntOnOverflow(); -#endif - } -}; - -template<> class LargeIntRegMultiply< signed __int64, unsigned __int64 > -{ -public: - // Leave this one as-is - will call unsigned intrinsic internally - static bool RegMultiply( const signed __int64& a, const unsigned __int64& b, signed __int64* pRet ) SAFEINT_NOTHROW - { - bool aNegative = false; - - unsigned __int64 tmp; - __int64 a1 = a; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::RegMultiply( (unsigned __int64)a1, (unsigned __int64)b, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return true; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return true; - } - } - } - - return false; - } - - template < typename E > - static void RegMultiplyThrow( const signed __int64& a, const unsigned __int64& b, signed __int64* pRet ) SAFEINT_CPP_THROW - { - bool aNegative = false; - unsigned __int64 tmp; - __int64 a1 = a; - - if( a1 < 0 ) - { - aNegative = true; - a1 = (signed __int64)AbsValueHelper< signed __int64, GetAbsMethod< signed __int64 >::method >::Abs(a1); - } - - if( LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::RegMultiply( (unsigned __int64)a1, (unsigned __int64)b, &tmp ) ) - { - // The unsigned multiplication didn't overflow - if( aNegative ) - { - // Result must be negative - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::minInt ) - { - *pRet = SignedNegation< signed __int64 >::Value( tmp ); - return; - } - } - else - { - // Result must be positive - if( tmp <= (unsigned __int64)IntTraits< signed __int64 >::maxInt ) - { - *pRet = (signed __int64)tmp; - return; - } - } - } - - E::SafeIntOnOverflow(); - } -}; - -// In all of the following functions where LargeIntRegMultiply methods are called, -// we need to properly transition types. The methods need __int64, __int32, etc. -// but the variables being passed to us could be long long, long int, or long, depending on -// the compiler. Microsoft compiler knows that long long is the same type as __int64, but gcc doesn't - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Uint64Uint64 > -{ -public: - // T, U are unsigned __int64 - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 && IntTraits::isUint64 ); - unsigned __int64 t1 = t; - unsigned __int64 u1 = u; - return LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::RegMultiply( t1, u1, reinterpret_cast(&ret) ); - } - - template < typename E > - static void MultiplyThrow(const unsigned __int64& t, const unsigned __int64& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 && IntTraits::isUint64 ); - unsigned __int64 t1 = t; - unsigned __int64 u1 = u; - LargeIntRegMultiply< unsigned __int64, unsigned __int64 >::template RegMultiplyThrow< E >( t1, u1, reinterpret_cast(&ret) ); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Uint64Uint > -{ -public: - // T is unsigned __int64 - // U is any unsigned int 32-bit or less - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 t1 = t; - return LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::RegMultiply( t1, (unsigned __int32)u, reinterpret_cast(&ret) ); - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 t1 = t; - LargeIntRegMultiply< unsigned __int64, unsigned __int32 >::template RegMultiplyThrow< E >( t1, (unsigned __int32)u, reinterpret_cast(&ret) ); - } -}; - -// converse of the previous function -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_UintUint64 > -{ -public: - // T is any unsigned int up to 32-bit - // U is unsigned __int64 - static bool Multiply(const T& t, const U& u, T& ret) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 u1 = u; - unsigned __int32 tmp; - - if( LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::RegMultiply( t, u1, &tmp ) && - SafeCastHelper< T, unsigned __int32, GetCastMethod< T, unsigned __int32 >::method >::Cast(tmp, ret) ) - { - return true; - } - - return false; - } - - template < typename E > - static void MultiplyThrow(const T& t, const U& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 u1 = u; - unsigned __int32 tmp; - - LargeIntRegMultiply< unsigned __int32, unsigned __int64 >::template RegMultiplyThrow< E >( t, u1, &tmp ); - SafeCastHelper< T, unsigned __int32, GetCastMethod< T, unsigned __int32 >::method >::template CastThrow< E >(tmp, ret); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Uint64Int > -{ -public: - // T is unsigned __int64 - // U is any signed int, up to 64-bit - static bool Multiply(const T& t, const U& u, T& ret) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 t1 = t; - return LargeIntRegMultiply< unsigned __int64, signed __int32 >::RegMultiply(t1, (signed __int32)u, reinterpret_cast< unsigned __int64* >(&ret)); - } - - template < typename E > - static void MultiplyThrow(const T& t, const U& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 t1 = t; - LargeIntRegMultiply< unsigned __int64, signed __int32 >::template RegMultiplyThrow< E >(t1, (signed __int32)u, reinterpret_cast< unsigned __int64* >(&ret)); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Uint64Int64 > -{ -public: - // T is unsigned __int64 - // U is __int64 - static bool Multiply(const T& t, const U& u, T& ret) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 && IntTraits::isInt64 ); - unsigned __int64 t1 = t; - __int64 u1 = u; - return LargeIntRegMultiply< unsigned __int64, __int64 >::RegMultiply(t1, u1, reinterpret_cast< unsigned __int64* >(&ret)); - } - - template < typename E > - static void MultiplyThrow(const T& t, const U& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 && IntTraits::isInt64 ); - unsigned __int64 t1 = t; - __int64 u1 = u; - LargeIntRegMultiply< unsigned __int64, __int64 >::template RegMultiplyThrow< E >(t1, u1, reinterpret_cast< unsigned __int64* >(&ret)); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_UintInt64 > -{ -public: - // T is unsigned up to 32-bit - // U is __int64 - static bool Multiply(const T& t, const U& u, T& ret) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 u1 = u; - unsigned __int32 tmp; - - if( LargeIntRegMultiply< unsigned __int32, __int64 >::RegMultiply( (unsigned __int32)t, u1, &tmp ) && - SafeCastHelper< T, unsigned __int32, GetCastMethod< T, unsigned __int32 >::method >::Cast(tmp, ret) ) - { - return true; - } - - return false; - } - - template < typename E > - static void MultiplyThrow(const T& t, const U& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 u1 = u; - unsigned __int32 tmp; - - LargeIntRegMultiply< unsigned __int32, __int64 >::template RegMultiplyThrow< E >( (unsigned __int32)t, u1, &tmp ); - SafeCastHelper< T, unsigned __int32, GetCastMethod< T, unsigned __int32 >::method >::template CastThrow< E >(tmp, ret); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Int64Uint > -{ -public: - // T is __int64 - // U is unsigned up to 32-bit - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 t1 = t; - return LargeIntRegMultiply< __int64, unsigned __int32 >::RegMultiply( t1, (unsigned __int32)u, reinterpret_cast< __int64* >(&ret) ); - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 t1 = t; - LargeIntRegMultiply< __int64, unsigned __int32 >::template RegMultiplyThrow< E >( t1, (unsigned __int32)u, reinterpret_cast< __int64* >(&ret) ); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Int64Int64 > -{ -public: - // T, U are __int64 - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 && IntTraits::isInt64 ); - __int64 t1 = t; - __int64 u1 = u; - return LargeIntRegMultiply< __int64, __int64 >::RegMultiply( t1, u1, reinterpret_cast< __int64* >(&ret) ); - } - - template < typename E > - static void MultiplyThrow( const T& t, const U& u, T& ret ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 && IntTraits::isInt64 ); - __int64 t1 = t; - __int64 u1 = u; - LargeIntRegMultiply< __int64, __int64 >::template RegMultiplyThrow< E >( t1, u1, reinterpret_cast< __int64* >(&ret)); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Int64Int > -{ -public: - // T is __int64 - // U is signed up to 32-bit - static bool Multiply( const T& t, U u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 t1 = t; - return LargeIntRegMultiply< __int64, __int32 >::RegMultiply( t1, (__int32)u, reinterpret_cast< __int64* >(&ret)); - } - - template < typename E > - static void MultiplyThrow( const __int64& t, U u, T& ret ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 t1 = t; - LargeIntRegMultiply< __int64, __int32 >::template RegMultiplyThrow< E >(t1, (__int32)u, reinterpret_cast< __int64* >(&ret)); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_IntUint64 > -{ -public: - // T is signed up to 32-bit - // U is unsigned __int64 - static bool Multiply(T t, const U& u, T& ret) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 u1 = u; - __int32 tmp; - - if( LargeIntRegMultiply< __int32, unsigned __int64 >::RegMultiply( (__int32)t, u1, &tmp ) && - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::Cast( tmp, ret ) ) - { - return true; - } - - return false; - } - - template < typename E > - static void MultiplyThrow(T t, const unsigned __int64& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isUint64 ); - unsigned __int64 u1 = u; - __int32 tmp; - - LargeIntRegMultiply< __int32, unsigned __int64 >::template RegMultiplyThrow< E >( (__int32)t, u1, &tmp ); - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::template CastThrow< E >( tmp, ret ); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_Int64Uint64> -{ -public: - // T is __int64 - // U is unsigned __int64 - static bool Multiply( const T& t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 && IntTraits::isUint64 ); - __int64 t1 = t; - unsigned __int64 u1 = u; - return LargeIntRegMultiply< __int64, unsigned __int64 >::RegMultiply( t1, u1, reinterpret_cast< __int64* >(&ret) ); - } - - template < typename E > - static void MultiplyThrow( const __int64& t, const unsigned __int64& u, T& ret ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 && IntTraits::isUint64 ); - __int64 t1 = t; - unsigned __int64 u1 = u; - LargeIntRegMultiply< __int64, unsigned __int64 >::template RegMultiplyThrow< E >( t1, u1, reinterpret_cast< __int64* >(&ret) ); - } -}; - -template < typename T, typename U > class MultiplicationHelper< T, U, MultiplicationState_IntInt64> -{ -public: - // T is signed, up to 32-bit - // U is __int64 - static bool Multiply( T t, const U& u, T& ret ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 u1 = u; - __int32 tmp; - - if( LargeIntRegMultiply< __int32, __int64 >::RegMultiply( (__int32)t, u1, &tmp ) && - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::Cast( tmp, ret ) ) - { - return true; - } - - return false; - } - - template < typename E > - static void MultiplyThrow(T t, const U& u, T& ret) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits::isInt64 ); - __int64 u1 = u; - __int32 tmp; - - LargeIntRegMultiply< __int32, __int64 >::template RegMultiplyThrow< E >( (__int32)t, u1, &tmp ); - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::template CastThrow< E >( tmp, ret ); - } -}; - -enum DivisionState -{ - DivisionState_OK, - DivisionState_UnsignedSigned, - DivisionState_SignedUnsigned32, - DivisionState_SignedUnsigned64, - DivisionState_SignedUnsigned, - DivisionState_SignedSigned -}; - -template < typename T, typename U > class DivisionMethod -{ -public: - enum - { - method = (SafeIntCompare< T, U >::isBothUnsigned ? DivisionState_OK : - (!IntTraits< T >::isSigned && IntTraits< U >::isSigned) ? DivisionState_UnsignedSigned : - (IntTraits< T >::isSigned && - IntTraits< U >::isUint32 && - IntTraits< T >::isLT64Bit) ? DivisionState_SignedUnsigned32 : - (IntTraits< T >::isSigned && IntTraits< U >::isUint64) ? DivisionState_SignedUnsigned64 : - (IntTraits< T >::isSigned && !IntTraits< U >::isSigned) ? DivisionState_SignedUnsigned : - DivisionState_SignedSigned) - }; -}; - -template < typename T, typename U, int state > class DivisionHelper; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_OK > -{ -public: - static SafeIntError Divide( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if( u == 0 ) - return SafeIntDivideByZero; - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - result = (T)( t/u ); - return SafeIntNoError; - } - - template < typename E > - static void DivideThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if( u == 0 ) - E::SafeIntOnDivZero(); - - if( t == 0 ) - { - result = 0; - return; - } - - result = (T)( t/u ); - } -}; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_UnsignedSigned> -{ -public: - static SafeIntError Divide( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - - if( u == 0 ) - return SafeIntDivideByZero; - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - if( u > 0 ) - { - result = (T)( t/u ); - return SafeIntNoError; - } - - // it is always an error to try and divide an unsigned number by a negative signed number - // unless u is bigger than t - if( AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( u ) > t ) - { - result = 0; - return SafeIntNoError; - } - - return SafeIntArithmeticOverflow; - } - - template < typename E > - static void DivideThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - - if( u == 0 ) - E::SafeIntOnDivZero(); - - if( t == 0 ) - { - result = 0; - return; - } - - if( u > 0 ) - { - result = (T)( t/u ); - return; - } - - // it is always an error to try and divide an unsigned number by a negative signed number - // unless u is bigger than t - if( AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( u ) > t ) - { - result = 0; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_SignedUnsigned32 > -{ -public: - static SafeIntError Divide( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if( u == 0 ) - return SafeIntDivideByZero; - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - // Test for t > 0 - // If t < 0, must explicitly upcast, or implicit upcast to ulong will cause errors - // As it turns out, 32-bit division is about twice as fast, which justifies the extra conditional - - if( t > 0 ) - result = (T)( t/u ); - else - result = (T)( (__int64)t/(__int64)u ); - - return SafeIntNoError; - } - - template < typename E > - static void DivideThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if( u == 0 ) - { - E::SafeIntOnDivZero(); - } - - if( t == 0 ) - { - result = 0; - return; - } - - // Test for t > 0 - // If t < 0, must explicitly upcast, or implicit upcast to ulong will cause errors - // As it turns out, 32-bit division is about twice as fast, which justifies the extra conditional - - if( t > 0 ) - result = (T)( t/u ); - else - result = (T)( (__int64)t/(__int64)u ); - } -}; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_SignedUnsigned64 > -{ -public: - static SafeIntError Divide( const T& t, const unsigned __int64& u, T& result ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits< U >::isUint64 ); - - if( u == 0 ) - { - return SafeIntDivideByZero; - } - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - if( u <= (unsigned __int64)IntTraits< T >::maxInt ) - { - // Else u can safely be cast to T - if( CompileConst< sizeof( T ) < sizeof( __int64 )>::Value() ) - result = (T)( (int)t/(int)u ); - else - result = (T)((__int64)t/(__int64)u); - } - else // Corner case - if( t == IntTraits< T >::minInt && u == (unsigned __int64)IntTraits< T >::minInt ) - { - // Min int divided by it's own magnitude is -1 - result = -1; - } - else - { - result = 0; - } - return SafeIntNoError; - } - - template < typename E > - static void DivideThrow( const T& t, const unsigned __int64& u, T& result ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits< U >::isUint64 ); - - if( u == 0 ) - { - E::SafeIntOnDivZero(); - } - - if( t == 0 ) - { - result = 0; - return; - } - - if( u <= (unsigned __int64)IntTraits< T >::maxInt ) - { - // Else u can safely be cast to T - if( CompileConst< sizeof( T ) < sizeof( __int64 ) >::Value() ) - result = (T)( (int)t/(int)u ); - else - result = (T)((__int64)t/(__int64)u); - } - else // Corner case - if( t == IntTraits< T >::minInt && u == (unsigned __int64)IntTraits< T >::minInt ) - { - // Min int divided by it's own magnitude is -1 - result = -1; - } - else - { - result = 0; - } - } -}; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_SignedUnsigned> -{ -public: - // T is any signed, U is unsigned and smaller than 32-bit - // In this case, standard operator casting is correct - static SafeIntError Divide( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if( u == 0 ) - { - return SafeIntDivideByZero; - } - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - result = (T)( t/u ); - return SafeIntNoError; - } - - template < typename E > - static void DivideThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if( u == 0 ) - { - E::SafeIntOnDivZero(); - } - - if( t == 0 ) - { - result = 0; - return; - } - - result = (T)( t/u ); - } -}; - -template < typename T, typename U > class DivisionHelper< T, U, DivisionState_SignedSigned> -{ -public: - static SafeIntError Divide( const T& t, const U& u, T& result ) SAFEINT_NOTHROW - { - if( u == 0 ) - { - return SafeIntDivideByZero; - } - - if( t == 0 ) - { - result = 0; - return SafeIntNoError; - } - - // Must test for corner case - if( t == IntTraits< T >::minInt && u == (U)-1 ) - return SafeIntArithmeticOverflow; - - result = (T)( t/u ); - return SafeIntNoError; - } - - template < typename E > - static void DivideThrow( const T& t, const U& u, T& result ) SAFEINT_CPP_THROW - { - if(u == 0) - { - E::SafeIntOnDivZero(); - } - - if( t == 0 ) - { - result = 0; - return; - } - - // Must test for corner case - if( t == IntTraits< T >::minInt && u == (U)-1 ) - E::SafeIntOnOverflow(); - - result = (T)( t/u ); - } -}; - -enum AdditionState -{ - AdditionState_CastIntCheckMax, - AdditionState_CastUintCheckOverflow, - AdditionState_CastUintCheckOverflowMax, - AdditionState_CastUint64CheckOverflow, - AdditionState_CastUint64CheckOverflowMax, - AdditionState_CastIntCheckSafeIntMinMax, - AdditionState_CastInt64CheckSafeIntMinMax, - AdditionState_CastInt64CheckMax, - AdditionState_CastUint64CheckSafeIntMinMax, - AdditionState_CastUint64CheckSafeIntMinMax2, - AdditionState_CastInt64CheckOverflow, - AdditionState_CastInt64CheckOverflowSafeIntMinMax, - AdditionState_CastInt64CheckOverflowMax, - AdditionState_ManualCheckInt64Uint64, - AdditionState_ManualCheck, - AdditionState_Error -}; - -template< typename T, typename U > -class AdditionMethod -{ -public: - enum - { - //unsigned-unsigned - method = (IntRegion< T,U >::IntZone_UintLT32_UintLT32 ? AdditionState_CastIntCheckMax : - (IntRegion< T,U >::IntZone_Uint32_UintLT64) ? AdditionState_CastUintCheckOverflow : - (IntRegion< T,U >::IntZone_UintLT32_Uint32) ? AdditionState_CastUintCheckOverflowMax : - (IntRegion< T,U >::IntZone_Uint64_Uint) ? AdditionState_CastUint64CheckOverflow : - (IntRegion< T,U >::IntZone_UintLT64_Uint64) ? AdditionState_CastUint64CheckOverflowMax : - //unsigned-signed - (IntRegion< T,U >::IntZone_UintLT32_IntLT32) ? AdditionState_CastIntCheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Uint32_IntLT64 || - IntRegion< T,U >::IntZone_UintLT32_Int32) ? AdditionState_CastInt64CheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Uint64_Int || - IntRegion< T,U >::IntZone_Uint64_Int64) ? AdditionState_CastUint64CheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_UintLT64_Int64) ? AdditionState_CastUint64CheckSafeIntMinMax2 : - //signed-signed - (IntRegion< T,U >::IntZone_IntLT32_IntLT32) ? AdditionState_CastIntCheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Int32_IntLT64 || - IntRegion< T,U >::IntZone_IntLT32_Int32) ? AdditionState_CastInt64CheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Int64_Int || - IntRegion< T,U >::IntZone_Int64_Int64) ? AdditionState_CastInt64CheckOverflow : - (IntRegion< T,U >::IntZone_IntLT64_Int64) ? AdditionState_CastInt64CheckOverflowSafeIntMinMax : - //signed-unsigned - (IntRegion< T,U >::IntZone_IntLT32_UintLT32) ? AdditionState_CastIntCheckMax : - (IntRegion< T,U >::IntZone_Int32_UintLT32 || - IntRegion< T,U >::IntZone_IntLT64_Uint32) ? AdditionState_CastInt64CheckMax : - (IntRegion< T,U >::IntZone_Int64_UintLT64) ? AdditionState_CastInt64CheckOverflowMax : - (IntRegion< T,U >::IntZone_Int64_Uint64) ? AdditionState_ManualCheckInt64Uint64 : - (IntRegion< T,U >::IntZone_Int_Uint64) ? AdditionState_ManualCheck : - AdditionState_Error) - }; -}; - -template < typename T, typename U, int method > class AdditionHelper; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastIntCheckMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - //16-bit or less unsigned addition - __int32 tmp = lhs + rhs; - - if( tmp <= (__int32)IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - //16-bit or less unsigned addition - __int32 tmp = lhs + rhs; - - if( tmp <= (__int32)IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUintCheckOverflow > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // 32-bit or less - both are unsigned - unsigned __int32 tmp = (unsigned __int32)lhs + (unsigned __int32)rhs; - - //we added didn't get smaller - if( tmp >= lhs ) - { - result = (T)tmp; - return true; - } - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // 32-bit or less - both are unsigned - unsigned __int32 tmp = (unsigned __int32)lhs + (unsigned __int32)rhs; - - //we added didn't get smaller - if( tmp >= lhs ) - { - result = (T)tmp; - return; - } - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUintCheckOverflowMax> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // 32-bit or less - both are unsigned - unsigned __int32 tmp = (unsigned __int32)lhs + (unsigned __int32)rhs; - - // We added and it didn't get smaller or exceed maxInt - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - //32-bit or less - both are unsigned - unsigned __int32 tmp = (unsigned __int32)lhs + (unsigned __int32)rhs; - - // We added and it didn't get smaller or exceed maxInt - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUint64CheckOverflow> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs unsigned __int64, rhs unsigned - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it didn't get smaller - if(tmp >= lhs) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs unsigned __int64, rhs unsigned - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it didn't get smaller - if(tmp >= lhs) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUint64CheckOverflowMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - //lhs unsigned __int64, rhs unsigned - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it didn't get smaller - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - //lhs unsigned __int64, rhs unsigned - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it didn't get smaller - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastIntCheckSafeIntMinMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // 16-bit or less - one or both are signed - __int32 tmp = lhs + rhs; - - if( tmp <= (__int32)IntTraits< T >::maxInt && tmp >= (__int32)IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // 16-bit or less - one or both are signed - __int32 tmp = lhs + rhs; - - if( tmp <= (__int32)IntTraits< T >::maxInt && tmp >= (__int32)IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastInt64CheckSafeIntMinMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // 32-bit or less - one or both are signed - __int64 tmp = (__int64)lhs + (__int64)rhs; - - if( tmp <= (__int64)IntTraits< T >::maxInt && tmp >= (__int64)IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // 32-bit or less - one or both are signed - __int64 tmp = (__int64)lhs + (__int64)rhs; - - if( tmp <= (__int64)IntTraits< T >::maxInt && tmp >= (__int64)IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastInt64CheckMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // 32-bit or less - lhs signed, rhs unsigned - __int64 tmp = (__int64)lhs + (__int64)rhs; - - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // 32-bit or less - lhs signed, rhs unsigned - __int64 tmp = (__int64)lhs + (__int64)rhs; - - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUint64CheckSafeIntMinMax > -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is unsigned __int64, rhs signed - unsigned __int64 tmp; - - if( rhs < 0 ) - { - // So we're effectively subtracting - tmp = AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( rhs ); - - if( tmp <= lhs ) - { - result = lhs - tmp; - return true; - } - } - else - { - // now we know that rhs can be safely cast into an unsigned __int64 - tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it did not become smaller - if( tmp >= lhs ) - { - result = (T)tmp; - return true; - } - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is unsigned __int64, rhs signed - unsigned __int64 tmp; - - if( rhs < 0 ) - { - // So we're effectively subtracting - tmp = AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( rhs ); - - if( tmp <= lhs ) - { - result = lhs - tmp; - return; - } - } - else - { - // now we know that rhs can be safely cast into an unsigned __int64 - tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // We added and it did not become smaller - if( tmp >= lhs ) - { - result = (T)tmp; - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastUint64CheckSafeIntMinMax2> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is unsigned and < 64-bit, rhs signed __int64 - if( rhs < 0 ) - { - if( lhs >= ~(unsigned __int64)( rhs ) + 1 )//negation is safe, since rhs is 64-bit - { - result = (T)( lhs + rhs ); - return true; - } - } - else - { - // now we know that rhs can be safely cast into an unsigned __int64 - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // special case - rhs cannot be larger than 0x7fffffffffffffff, lhs cannot be larger than 0xffffffff - // it is not possible for the operation above to overflow, so just check max - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is unsigned and < 64-bit, rhs signed __int64 - if( rhs < 0 ) - { - if( lhs >= ~(unsigned __int64)( rhs ) + 1) //negation is safe, since rhs is 64-bit - { - result = (T)( lhs + rhs ); - return; - } - } - else - { - // now we know that rhs can be safely cast into an unsigned __int64 - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - // special case - rhs cannot be larger than 0x7fffffffffffffff, lhs cannot be larger than 0xffffffff - // it is not possible for the operation above to overflow, so just check max - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastInt64CheckOverflow> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is signed __int64, rhs signed - __int64 tmp = (__int64)((unsigned __int64)lhs + (unsigned __int64)rhs); - - if( lhs >= 0 ) - { - // mixed sign cannot overflow - if( rhs >= 0 && tmp < lhs ) - return false; - } - else - { - // lhs negative - if( rhs < 0 && tmp > lhs ) - return false; - } - - result = (T)tmp; - return true; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is signed __int64, rhs signed - __int64 tmp = (__int64)((unsigned __int64)lhs + (unsigned __int64)rhs); - - if( lhs >= 0 ) - { - // mixed sign cannot overflow - if( rhs >= 0 && tmp < lhs ) - E::SafeIntOnOverflow(); - } - else - { - // lhs negative - if( rhs < 0 && tmp > lhs ) - E::SafeIntOnOverflow(); - } - - result = (T)tmp; - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastInt64CheckOverflowSafeIntMinMax> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - //rhs is signed __int64, lhs signed - __int64 tmp; - - if( AdditionHelper< __int64, __int64, AdditionState_CastInt64CheckOverflow >::Addition( (__int64)lhs, (__int64)rhs, tmp ) && - tmp <= IntTraits< T >::maxInt && - tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - //rhs is signed __int64, lhs signed - __int64 tmp; - - AdditionHelper< __int64, __int64, AdditionState_CastInt64CheckOverflow >::AdditionThrow< E >( (__int64)lhs, (__int64)rhs, tmp ); - - if( tmp <= IntTraits< T >::maxInt && - tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_CastInt64CheckOverflowMax> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - //lhs is signed __int64, rhs unsigned < 64-bit - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - if( (__int64)tmp >= lhs ) - { - result = (T)(__int64)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is signed __int64, rhs unsigned < 64-bit - // Some compilers get optimization-happy, let's thwart them - - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)rhs; - - if( (__int64)tmp >= lhs ) - { - result = (T)(__int64)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_ManualCheckInt64Uint64 > -{ -public: - static bool Addition( const __int64& lhs, const unsigned __int64& rhs, __int64& result ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits< T >::isInt64 && IntTraits< U >::isUint64 ); - // rhs is unsigned __int64, lhs __int64 - // cast everything to unsigned, perform addition, then - // cast back for check - this is done to stop optimizers from removing the code - unsigned __int64 tmp = (unsigned __int64)lhs + rhs; - - if( (__int64)tmp >= lhs ) - { - result = (__int64)tmp; - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const __int64& lhs, const unsigned __int64& rhs, T& result ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits< T >::isInt64 && IntTraits< U >::isUint64 ); - // rhs is unsigned __int64, lhs __int64 - unsigned __int64 tmp = (unsigned __int64)lhs + rhs; - - if( (__int64)tmp >= lhs ) - { - result = (__int64)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class AdditionHelper < T, U, AdditionState_ManualCheck> -{ -public: - static bool Addition( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // rhs is unsigned __int64, lhs signed, 32-bit or less - if( (unsigned __int32)( rhs >> 32 ) == 0 ) - { - // Now it just happens to work out that the standard behavior does what we want - // Adding explicit casts to show exactly what's happening here - // Note - this is tweaked to keep optimizers from tossing out the code. - unsigned __int32 tmp = (unsigned __int32)rhs + (unsigned __int32)lhs; - - if( (__int32)tmp >= lhs && SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::Cast( (__int32)tmp, result ) ) - return true; - } - - return false; - } - - template < typename E > - static void AdditionThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // rhs is unsigned __int64, lhs signed, 32-bit or less - - if( (unsigned __int32)( rhs >> 32 ) == 0 ) - { - // Now it just happens to work out that the standard behavior does what we want - // Adding explicit casts to show exactly what's happening here - unsigned __int32 tmp = (unsigned __int32)rhs + (unsigned __int32)lhs; - - if( (__int32)tmp >= lhs ) - { - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::template CastThrow< E >( (__int32)tmp, result ); - return; - } - } - E::SafeIntOnOverflow(); - } -}; - -enum SubtractionState -{ - SubtractionState_BothUnsigned, - SubtractionState_CastIntCheckSafeIntMinMax, - SubtractionState_CastIntCheckMin, - SubtractionState_CastInt64CheckSafeIntMinMax, - SubtractionState_CastInt64CheckMin, - SubtractionState_Uint64Int, - SubtractionState_UintInt64, - SubtractionState_Int64Int, - SubtractionState_IntInt64, - SubtractionState_Int64Uint, - SubtractionState_IntUint64, - SubtractionState_Int64Uint64, - // states for SubtractionMethod2 - SubtractionState_BothUnsigned2, - SubtractionState_CastIntCheckSafeIntMinMax2, - SubtractionState_CastInt64CheckSafeIntMinMax2, - SubtractionState_Uint64Int2, - SubtractionState_UintInt642, - SubtractionState_Int64Int2, - SubtractionState_IntInt642, - SubtractionState_Int64Uint2, - SubtractionState_IntUint642, - SubtractionState_Int64Uint642, - SubtractionState_Error -}; - -template < typename T, typename U > class SubtractionMethod -{ -public: - enum - { - // unsigned-unsigned - method = ((IntRegion< T,U >::IntZone_UintLT32_UintLT32 || - (IntRegion< T,U >::IntZone_Uint32_UintLT64) || - (IntRegion< T,U >::IntZone_UintLT32_Uint32) || - (IntRegion< T,U >::IntZone_Uint64_Uint) || - (IntRegion< T,U >::IntZone_UintLT64_Uint64)) ? SubtractionState_BothUnsigned : - // unsigned-signed - (IntRegion< T,U >::IntZone_UintLT32_IntLT32) ? SubtractionState_CastIntCheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Uint32_IntLT64 || - IntRegion< T,U >::IntZone_UintLT32_Int32) ? SubtractionState_CastInt64CheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Uint64_Int || - IntRegion< T,U >::IntZone_Uint64_Int64) ? SubtractionState_Uint64Int : - (IntRegion< T,U >::IntZone_UintLT64_Int64) ? SubtractionState_UintInt64 : - // signed-signed - (IntRegion< T,U >::IntZone_IntLT32_IntLT32) ? SubtractionState_CastIntCheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Int32_IntLT64 || - IntRegion< T,U >::IntZone_IntLT32_Int32) ? SubtractionState_CastInt64CheckSafeIntMinMax : - (IntRegion< T,U >::IntZone_Int64_Int || - IntRegion< T,U >::IntZone_Int64_Int64) ? SubtractionState_Int64Int : - (IntRegion< T,U >::IntZone_IntLT64_Int64) ? SubtractionState_IntInt64 : - // signed-unsigned - (IntRegion< T,U >::IntZone_IntLT32_UintLT32) ? SubtractionState_CastIntCheckMin : - (IntRegion< T,U >::IntZone_Int32_UintLT32 || - IntRegion< T,U >::IntZone_IntLT64_Uint32) ? SubtractionState_CastInt64CheckMin : - (IntRegion< T,U >::IntZone_Int64_UintLT64) ? SubtractionState_Int64Uint : - (IntRegion< T,U >::IntZone_Int_Uint64) ? SubtractionState_IntUint64 : - (IntRegion< T,U >::IntZone_Int64_Uint64) ? SubtractionState_Int64Uint64 : - SubtractionState_Error) - }; -}; - -// this is for the case of U - SafeInt< T, E > -template < typename T, typename U > class SubtractionMethod2 -{ -public: - enum - { - // unsigned-unsigned - method = ((IntRegion< T,U >::IntZone_UintLT32_UintLT32 || - (IntRegion< T,U >::IntZone_Uint32_UintLT64) || - (IntRegion< T,U >::IntZone_UintLT32_Uint32) || - (IntRegion< T,U >::IntZone_Uint64_Uint) || - (IntRegion< T,U >::IntZone_UintLT64_Uint64)) ? SubtractionState_BothUnsigned2 : - // unsigned-signed - (IntRegion< T,U >::IntZone_UintLT32_IntLT32) ? SubtractionState_CastIntCheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Uint32_IntLT64 || - IntRegion< T,U >::IntZone_UintLT32_Int32) ? SubtractionState_CastInt64CheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Uint64_Int || - IntRegion< T,U >::IntZone_Uint64_Int64) ? SubtractionState_Uint64Int2 : - (IntRegion< T,U >::IntZone_UintLT64_Int64) ? SubtractionState_UintInt642 : - // signed-signed - (IntRegion< T,U >::IntZone_IntLT32_IntLT32) ? SubtractionState_CastIntCheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Int32_IntLT64 || - IntRegion< T,U >::IntZone_IntLT32_Int32) ? SubtractionState_CastInt64CheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Int64_Int || - IntRegion< T,U >::IntZone_Int64_Int64) ? SubtractionState_Int64Int2 : - (IntRegion< T,U >::IntZone_IntLT64_Int64) ? SubtractionState_IntInt642 : - // signed-unsigned - (IntRegion< T,U >::IntZone_IntLT32_UintLT32) ? SubtractionState_CastIntCheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Int32_UintLT32 || - IntRegion< T,U >::IntZone_IntLT64_Uint32) ? SubtractionState_CastInt64CheckSafeIntMinMax2 : - (IntRegion< T,U >::IntZone_Int64_UintLT64) ? SubtractionState_Int64Uint2 : - (IntRegion< T,U >::IntZone_Int_Uint64) ? SubtractionState_IntUint642 : - (IntRegion< T,U >::IntZone_Int64_Uint64) ? SubtractionState_Int64Uint642 : - SubtractionState_Error) - }; -}; - -template < typename T, typename U, int method > class SubtractionHelper; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_BothUnsigned > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // both are unsigned - easy case - if( rhs <= lhs ) - { - result = (T)( lhs - rhs ); - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // both are unsigned - easy case - if( rhs <= lhs ) - { - result = (T)( lhs - rhs ); - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_BothUnsigned2 > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, U& result ) SAFEINT_NOTHROW - { - // both are unsigned - easy case - // Except we do have to check for overflow - lhs could be larger than result can hold - if( rhs <= lhs ) - { - T tmp = (T)(lhs - rhs); - return SafeCastHelper< U, T, GetCastMethod::method>::Cast( tmp, result); - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, U& result ) SAFEINT_CPP_THROW - { - // both are unsigned - easy case - if( rhs <= lhs ) - { - T tmp = (T)(lhs - rhs); - SafeCastHelper< U, T, GetCastMethod::method >::template CastThrow( tmp, result); - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_CastIntCheckSafeIntMinMax > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 16-bit or less - // rhs is signed, so could end up increasing or decreasing - __int32 tmp = lhs - rhs; - - if( SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::Cast( tmp, result ) ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 16-bit or less - // rhs is signed, so could end up increasing or decreasing - __int32 tmp = lhs - rhs; - - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::template CastThrow< E >( tmp, result ); - } -}; - -template class SubtractionHelper< U, T, SubtractionState_CastIntCheckSafeIntMinMax2 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 16-bit or less - // rhs is signed, so could end up increasing or decreasing - __int32 tmp = lhs - rhs; - - return SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::Cast( tmp, result ); - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 16-bit or less - // rhs is signed, so could end up increasing or decreasing - __int32 tmp = lhs - rhs; - - SafeCastHelper< T, __int32, GetCastMethod< T, __int32 >::method >::template CastThrow< E >( tmp, result ); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_CastIntCheckMin > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 16-bit or less - // rhs is unsigned - check only minimum - __int32 tmp = lhs - rhs; - - if( tmp >= (__int32)IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 16-bit or less - // rhs is unsigned - check only minimum - __int32 tmp = lhs - rhs; - - if( tmp >= (__int32)IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_CastInt64CheckSafeIntMinMax > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 32-bit or less - // rhs is signed, so could end up increasing or decreasing - __int64 tmp = (__int64)lhs - (__int64)rhs; - - return SafeCastHelper< T, __int64, GetCastMethod< T, __int64 >::method >::Cast( tmp, result ); - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 32-bit or less - // rhs is signed, so could end up increasing or decreasing - __int64 tmp = (__int64)lhs - (__int64)rhs; - - SafeCastHelper< T, __int64, GetCastMethod< T, __int64 >::method >::template CastThrow< E >( tmp, result ); - } -}; - -template class SubtractionHelper< U, T, SubtractionState_CastInt64CheckSafeIntMinMax2 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 32-bit or less - // rhs is signed, so could end up increasing or decreasing - __int64 tmp = (__int64)lhs - (__int64)rhs; - - return SafeCastHelper< T, __int64, GetCastMethod< T, __int64 >::method >::Cast( tmp, result ); - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 32-bit or less - // rhs is signed, so could end up increasing or decreasing - __int64 tmp = (__int64)lhs - (__int64)rhs; - - SafeCastHelper< T, __int64, GetCastMethod< T, __int64 >::method >::template CastThrow< E >( tmp, result ); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_CastInt64CheckMin > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // both values are 32-bit or less - // rhs is unsigned - check only minimum - __int64 tmp = (__int64)lhs - (__int64)rhs; - - if( tmp >= (__int64)IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // both values are 32-bit or less - // rhs is unsigned - check only minimum - __int64 tmp = (__int64)lhs - (__int64)rhs; - - if( tmp >= (__int64)IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_Uint64Int > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is an unsigned __int64, rhs signed - // must first see if rhs is positive or negative - if( rhs >= 0 ) - { - if( (unsigned __int64)rhs <= lhs ) - { - result = (T)( lhs - (unsigned __int64)rhs ); - return true; - } - } - else - { - T tmp = lhs; - // we're now effectively adding - result = lhs + AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( rhs ); - - if(result >= tmp) - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is an unsigned __int64, rhs signed - // must first see if rhs is positive or negative - if( rhs >= 0 ) - { - if( (unsigned __int64)rhs <= lhs ) - { - result = (T)( lhs - (unsigned __int64)rhs ); - return; - } - } - else - { - T tmp = lhs; - // we're now effectively adding - result = lhs + AbsValueHelper< U, GetAbsMethod< U >::method >::Abs( rhs ); - - if(result >= tmp) - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_Uint64Int2 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // U is unsigned __int64, T is signed - if( rhs < 0 ) - { - // treat this as addition - unsigned __int64 tmp; - - tmp = lhs + (unsigned __int64)AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( rhs ); - - // must check for addition overflow and max - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - else if( (unsigned __int64)rhs > lhs ) // now both are positive, so comparison always works - { - // result is negative - // implies that lhs must fit into T, and result cannot overflow - // Also allows us to drop to 32-bit math, which is faster on a 32-bit system - result = (T)lhs - (T)rhs; - return true; - } - else - { - // result is positive - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - - return false; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // U is unsigned __int64, T is signed - if( rhs < 0 ) - { - // treat this as addition - unsigned __int64 tmp; - - tmp = lhs + (unsigned __int64)AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( rhs ); - - // must check for addition overflow and max - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - else if( (unsigned __int64)rhs > lhs ) // now both are positive, so comparison always works - { - // result is negative - // implies that lhs must fit into T, and result cannot overflow - // Also allows us to drop to 32-bit math, which is faster on a 32-bit system - result = (T)lhs - (T)rhs; - return; - } - else - { - // result is positive - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_UintInt64 > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is an unsigned int32 or smaller, rhs signed __int64 - // must first see if rhs is positive or negative - if( rhs >= 0 ) - { - if( (unsigned __int64)rhs <= lhs ) - { - result = (T)( lhs - (T)rhs ); - return true; - } - } - else - { - // we're now effectively adding - // since lhs is 32-bit, and rhs cannot exceed 2^63 - // this addition cannot overflow - unsigned __int64 tmp = lhs + ~(unsigned __int64)( rhs ) + 1; // negation safe - - // but we could exceed MaxInt - if(tmp <= IntTraits< T >::maxInt) - { - result = (T)tmp; - return true; - } - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is an unsigned int32 or smaller, rhs signed __int64 - // must first see if rhs is positive or negative - if( rhs >= 0 ) - { - if( (unsigned __int64)rhs <= lhs ) - { - result = (T)( lhs - (T)rhs ); - return; - } - } - else - { - // we're now effectively adding - // since lhs is 32-bit, and rhs cannot exceed 2^63 - // this addition cannot overflow - unsigned __int64 tmp = lhs + ~(unsigned __int64)( rhs ) + 1; // negation safe - - // but we could exceed MaxInt - if(tmp <= IntTraits< T >::maxInt) - { - result = (T)tmp; - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template class SubtractionHelper< U, T, SubtractionState_UintInt642 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // U unsigned 32-bit or less, T __int64 - if( rhs >= 0 ) - { - // overflow not possible - result = (T)( (__int64)lhs - rhs ); - return true; - } - else - { - // we effectively have an addition - // which cannot overflow internally - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)( -rhs ); - - if( tmp <= (unsigned __int64)IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - - return false; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // U unsigned 32-bit or less, T __int64 - if( rhs >= 0 ) - { - // overflow not possible - result = (T)( (__int64)lhs - rhs ); - return; - } - else - { - // we effectively have an addition - // which cannot overflow internally - unsigned __int64 tmp = (unsigned __int64)lhs + (unsigned __int64)( -rhs ); - - if( tmp <= (unsigned __int64)IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_Int64Int > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is an __int64, rhs signed (up to 64-bit) - // we have essentially 4 cases: - // - // 1) lhs positive, rhs positive - overflow not possible - // 2) lhs positive, rhs negative - equivalent to addition - result >= lhs or error - // 3) lhs negative, rhs positive - check result <= lhs - // 4) lhs negative, rhs negative - overflow not possible - - __int64 tmp = (__int64)((unsigned __int64)lhs - (unsigned __int64)rhs); - - // Note - ideally, we can order these so that true conditionals - // lead to success, which enables better pipelining - // It isn't practical here - if( ( lhs >= 0 && rhs < 0 && tmp < lhs ) || // condition 2 - ( rhs >= 0 && tmp > lhs ) ) // condition 3 - { - return false; - } - - result = (T)tmp; - return true; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is an __int64, rhs signed (up to 64-bit) - // we have essentially 4 cases: - // - // 1) lhs positive, rhs positive - overflow not possible - // 2) lhs positive, rhs negative - equivalent to addition - result >= lhs or error - // 3) lhs negative, rhs positive - check result <= lhs - // 4) lhs negative, rhs negative - overflow not possible - - __int64 tmp = (__int64)((unsigned __int64)lhs - (unsigned __int64)rhs); - - // Note - ideally, we can order these so that true conditionals - // lead to success, which enables better pipelining - // It isn't practical here - if( ( lhs >= 0 && rhs < 0 && tmp < lhs ) || // condition 2 - ( rhs >= 0 && tmp > lhs ) ) // condition 3 - { - E::SafeIntOnOverflow(); - } - - result = (T)tmp; - } -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_Int64Int2 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs __int64, rhs any signed int (including __int64) - __int64 tmp = lhs - rhs; - - // we have essentially 4 cases: - // - // 1) lhs positive, rhs positive - overflow not possible in tmp - // 2) lhs positive, rhs negative - equivalent to addition - result >= lhs or error - // 3) lhs negative, rhs positive - check result <= lhs - // 4) lhs negative, rhs negative - overflow not possible in tmp - - if( lhs >= 0 ) - { - // if both positive, overflow to negative not possible - // which is why we'll explicitly check maxInt, and not call SafeCast - if( ( IntTraits< T >::isLT64Bit && tmp > IntTraits< T >::maxInt ) || - ( rhs < 0 && tmp < lhs ) ) - { - return false; - } - } - else - { - // lhs negative - if( ( IntTraits< T >::isLT64Bit && tmp < IntTraits< T >::minInt) || - ( rhs >=0 && tmp > lhs ) ) - { - return false; - } - } - - result = (T)tmp; - return true; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs __int64, rhs any signed int (including __int64) - __int64 tmp = lhs - rhs; - - // we have essentially 4 cases: - // - // 1) lhs positive, rhs positive - overflow not possible in tmp - // 2) lhs positive, rhs negative - equivalent to addition - result >= lhs or error - // 3) lhs negative, rhs positive - check result <= lhs - // 4) lhs negative, rhs negative - overflow not possible in tmp - - if( lhs >= 0 ) - { - // if both positive, overflow to negative not possible - // which is why we'll explicitly check maxInt, and not call SafeCast - if( ( CompileConst< IntTraits< T >::isLT64Bit >::Value() && tmp > IntTraits< T >::maxInt ) || - ( rhs < 0 && tmp < lhs ) ) - { - E::SafeIntOnOverflow(); - } - } - else - { - // lhs negative - if( ( CompileConst< IntTraits< T >::isLT64Bit >::Value() && tmp < IntTraits< T >::minInt) || - ( rhs >=0 && tmp > lhs ) ) - { - E::SafeIntOnOverflow(); - } - } - - result = (T)tmp; - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_IntInt64 > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is a 32-bit int or less, rhs __int64 - // we have essentially 4 cases: - // - // lhs positive, rhs positive - rhs could be larger than lhs can represent - // lhs positive, rhs negative - additive case - check tmp >= lhs and tmp > max int - // lhs negative, rhs positive - check tmp <= lhs and tmp < min int - // lhs negative, rhs negative - addition cannot internally overflow, check against max - - __int64 tmp = (__int64)((unsigned __int64)lhs - (unsigned __int64)rhs); - - if( lhs >= 0 ) - { - // first case - if( rhs >= 0 ) - { - if( tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - } - else - { - // second case - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - } - else - { - // lhs < 0 - // third case - if( rhs >= 0 ) - { - if( tmp <= lhs && tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return true; - } - } - else - { - // fourth case - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return true; - } - } - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is a 32-bit int or less, rhs __int64 - // we have essentially 4 cases: - // - // lhs positive, rhs positive - rhs could be larger than lhs can represent - // lhs positive, rhs negative - additive case - check tmp >= lhs and tmp > max int - // lhs negative, rhs positive - check tmp <= lhs and tmp < min int - // lhs negative, rhs negative - addition cannot internally overflow, check against max - - __int64 tmp = (__int64)((unsigned __int64)lhs - (unsigned __int64)rhs); - - if( lhs >= 0 ) - { - // first case - if( rhs >= 0 ) - { - if( tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - } - else - { - // second case - if( tmp >= lhs && tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - } - else - { - // lhs < 0 - // third case - if( rhs >= 0 ) - { - if( tmp <= lhs && tmp >= IntTraits< T >::minInt ) - { - result = (T)tmp; - return; - } - } - else - { - // fourth case - if( tmp <= IntTraits< T >::maxInt ) - { - result = (T)tmp; - return; - } - } - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_IntInt642 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is any signed int32 or smaller, rhs is int64 - __int64 tmp = (__int64)lhs - rhs; - - if( ( lhs >= 0 && rhs < 0 && tmp < lhs ) || - ( rhs > 0 && tmp > lhs ) ) - { - return false; - //else OK - } - - result = (T)tmp; - return true; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is any signed int32 or smaller, rhs is int64 - __int64 tmp = (__int64)lhs - rhs; - - if( ( lhs >= 0 && rhs < 0 && tmp < lhs ) || - ( rhs > 0 && tmp > lhs ) ) - { - E::SafeIntOnOverflow(); - //else OK - } - - result = (T)tmp; - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_Int64Uint > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is a 64-bit int, rhs unsigned int32 or smaller - // perform test as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( (__int64)tmp <= lhs ) - { - result = (T)(__int64)tmp; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is a 64-bit int, rhs unsigned int32 or smaller - // perform test as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( (__int64)tmp <= lhs ) - { - result = (T)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_Int64Uint2 > -{ -public: - // lhs is __int64, rhs is unsigned 32-bit or smaller - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // Do this as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( (__int64)tmp <= IntTraits< T >::maxInt && (__int64)tmp >= IntTraits< T >::minInt ) - { - result = (T)(__int64)tmp; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // Do this as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - (unsigned __int64)rhs; - - if( (__int64)tmp <= IntTraits< T >::maxInt && (__int64)tmp >= IntTraits< T >::minInt ) - { - result = (T)(__int64)tmp; - return; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_IntUint64 > -{ -public: - static bool Subtract( const T& lhs, const U& rhs, T& result ) SAFEINT_NOTHROW - { - // lhs is any signed int, rhs unsigned int64 - // check against available range - - // We need the absolute value of IntTraits< T >::minInt - // This will give it to us without extraneous compiler warnings - const unsigned __int64 AbsMinIntT = (unsigned __int64)IntTraits< T >::maxInt + 1; - - if( lhs < 0 ) - { - if( rhs <= AbsMinIntT - AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( lhs ) ) - { - result = (T)( lhs - rhs ); - return true; - } - } - else - { - if( rhs <= AbsMinIntT + (unsigned __int64)lhs ) - { - result = (T)( lhs - rhs ); - return true; - } - } - - return false; - } - - template < typename E > - static void SubtractThrow( const T& lhs, const U& rhs, T& result ) SAFEINT_CPP_THROW - { - // lhs is any signed int, rhs unsigned int64 - // check against available range - - // We need the absolute value of IntTraits< T >::minInt - // This will give it to us without extraneous compiler warnings - const unsigned __int64 AbsMinIntT = (unsigned __int64)IntTraits< T >::maxInt + 1; - - if( lhs < 0 ) - { - if( rhs <= AbsMinIntT - AbsValueHelper< T, GetAbsMethod< T >::method >::Abs( lhs ) ) - { - result = (T)( lhs - rhs ); - return; - } - } - else - { - if( rhs <= AbsMinIntT + (unsigned __int64)lhs ) - { - result = (T)( lhs - rhs ); - return; - } - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_IntUint642 > -{ -public: - static bool Subtract( const U& lhs, const T& rhs, T& result ) SAFEINT_NOTHROW - { - // We run into upcasting problems on comparison - needs 2 checks - if( lhs >= 0 && (T)lhs >= rhs ) - { - result = (T)((U)lhs - (U)rhs); - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const U& lhs, const T& rhs, T& result ) SAFEINT_CPP_THROW - { - // We run into upcasting problems on comparison - needs 2 checks - if( lhs >= 0 && (T)lhs >= rhs ) - { - result = (T)((U)lhs - (U)rhs); - return; - } - - E::SafeIntOnOverflow(); - } - -}; - -template < typename T, typename U > class SubtractionHelper< T, U, SubtractionState_Int64Uint64 > -{ -public: - static bool Subtract( const __int64& lhs, const unsigned __int64& rhs, __int64& result ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits< T >::isInt64 && IntTraits< U >::isUint64 ); - // if we subtract, and it gets larger, there's a problem - // Perform test as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - rhs; - - if( (__int64)tmp <= lhs ) - { - result = (__int64)tmp; - return true; - } - return false; - } - - template < typename E > - static void SubtractThrow( const __int64& lhs, const unsigned __int64& rhs, T& result ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits< T >::isInt64 && IntTraits< U >::isUint64 ); - // if we subtract, and it gets larger, there's a problem - // Perform test as unsigned to prevent unwanted optimizations - unsigned __int64 tmp = (unsigned __int64)lhs - rhs; - - if( (__int64)tmp <= lhs ) - { - result = (__int64)tmp; - return; - } - - E::SafeIntOnOverflow(); - } - -}; - -template < typename U, typename T > class SubtractionHelper< U, T, SubtractionState_Int64Uint642 > -{ -public: - // If lhs is negative, immediate problem - return must be positive, and subtracting only makes it - // get smaller. If rhs > lhs, then it would also go negative, which is the other case - static bool Subtract( const __int64& lhs, const unsigned __int64& rhs, T& result ) SAFEINT_NOTHROW - { - C_ASSERT( IntTraits< T >::isUint64 && IntTraits< U >::isInt64 ); - if( lhs >= 0 && (unsigned __int64)lhs >= rhs ) - { - result = (unsigned __int64)lhs - rhs; - return true; - } - - return false; - } - - template < typename E > - static void SubtractThrow( const __int64& lhs, const unsigned __int64& rhs, T& result ) SAFEINT_CPP_THROW - { - C_ASSERT( IntTraits< T >::isUint64 && IntTraits< U >::isInt64 ); - if( lhs >= 0 && (unsigned __int64)lhs >= rhs ) - { - result = (unsigned __int64)lhs - rhs; - return; - } - - E::SafeIntOnOverflow(); - } - -}; - -enum BinaryState -{ - BinaryState_OK, - BinaryState_Int8, - BinaryState_Int16, - BinaryState_Int32 -}; - -template < typename T, typename U > class BinaryMethod -{ -public: - enum - { - // If both operands are unsigned OR - // return type is smaller than rhs OR - // return type is larger and rhs is unsigned - // Then binary operations won't produce unexpected results - method = ( sizeof( T ) <= sizeof( U ) || - SafeIntCompare< T, U >::isBothUnsigned || - !IntTraits< U >::isSigned ) ? BinaryState_OK : - IntTraits< U >::isInt8 ? BinaryState_Int8 : - IntTraits< U >::isInt16 ? BinaryState_Int16 - : BinaryState_Int32 - }; -}; - -#ifdef SAFEINT_DISABLE_BINARY_ASSERT -#define BinaryAssert(x) -#else -#define BinaryAssert(x) SAFEINT_ASSERT(x) -#endif - -template < typename T, typename U, int method > class BinaryAndHelper; - -template < typename T, typename U > class BinaryAndHelper< T, U, BinaryState_OK > -{ -public: - static T And( T lhs, U rhs ) SAFEINT_NOTHROW { return (T)( lhs & rhs ); } -}; - -template < typename T, typename U > class BinaryAndHelper< T, U, BinaryState_Int8 > -{ -public: - static T And( T lhs, U rhs ) SAFEINT_NOTHROW - { - // cast forces sign extension to be zeros - BinaryAssert( ( lhs & rhs ) == ( lhs & (unsigned __int8)rhs ) ); - return (T)( lhs & (unsigned __int8)rhs ); - } -}; - -template < typename T, typename U > class BinaryAndHelper< T, U, BinaryState_Int16 > -{ -public: - static T And( T lhs, U rhs ) SAFEINT_NOTHROW - { - //cast forces sign extension to be zeros - BinaryAssert( ( lhs & rhs ) == ( lhs & (unsigned __int16)rhs ) ); - return (T)( lhs & (unsigned __int16)rhs ); - } -}; - -template < typename T, typename U > class BinaryAndHelper< T, U, BinaryState_Int32 > -{ -public: - static T And( T lhs, U rhs ) SAFEINT_NOTHROW - { - //cast forces sign extension to be zeros - BinaryAssert( ( lhs & rhs ) == ( lhs & (unsigned __int32)rhs ) ); - return (T)( lhs & (unsigned __int32)rhs ); - } -}; - -template < typename T, typename U, int method > class BinaryOrHelper; - -template < typename T, typename U > class BinaryOrHelper< T, U, BinaryState_OK > -{ -public: - static T Or( T lhs, U rhs ) SAFEINT_NOTHROW { return (T)( lhs | rhs ); } -}; - -template < typename T, typename U > class BinaryOrHelper< T, U, BinaryState_Int8 > -{ -public: - static T Or( T lhs, U rhs ) SAFEINT_NOTHROW - { - //cast forces sign extension to be zeros - BinaryAssert( ( lhs | rhs ) == ( lhs | (unsigned __int8)rhs ) ); - return (T)( lhs | (unsigned __int8)rhs ); - } -}; - -template < typename T, typename U > class BinaryOrHelper< T, U, BinaryState_Int16 > -{ -public: - static T Or( T lhs, U rhs ) SAFEINT_NOTHROW - { - //cast forces sign extension to be zeros - BinaryAssert( ( lhs | rhs ) == ( lhs | (unsigned __int16)rhs ) ); - return (T)( lhs | (unsigned __int16)rhs ); - } -}; - -template < typename T, typename U > class BinaryOrHelper< T, U, BinaryState_Int32 > -{ -public: - static T Or( T lhs, U rhs ) SAFEINT_NOTHROW - { - //cast forces sign extension to be zeros - BinaryAssert( ( lhs | rhs ) == ( lhs | (unsigned __int32)rhs ) ); - return (T)( lhs | (unsigned __int32)rhs ); - } -}; - -template class BinaryXorHelper; - -template < typename T, typename U > class BinaryXorHelper< T, U, BinaryState_OK > -{ -public: - static T Xor( T lhs, U rhs ) SAFEINT_NOTHROW { return (T)( lhs ^ rhs ); } -}; - -template < typename T, typename U > class BinaryXorHelper< T, U, BinaryState_Int8 > -{ -public: - static T Xor( T lhs, U rhs ) SAFEINT_NOTHROW - { - // cast forces sign extension to be zeros - BinaryAssert( ( lhs ^ rhs ) == ( lhs ^ (unsigned __int8)rhs ) ); - return (T)( lhs ^ (unsigned __int8)rhs ); - } -}; - -template < typename T, typename U > class BinaryXorHelper< T, U, BinaryState_Int16 > -{ -public: - static T Xor( T lhs, U rhs ) SAFEINT_NOTHROW - { - // cast forces sign extension to be zeros - BinaryAssert( ( lhs ^ rhs ) == ( lhs ^ (unsigned __int16)rhs ) ); - return (T)( lhs ^ (unsigned __int16)rhs ); - } -}; - -template < typename T, typename U > class BinaryXorHelper< T, U, BinaryState_Int32 > -{ -public: - static T Xor( T lhs, U rhs ) SAFEINT_NOTHROW - { - // cast forces sign extension to be zeros - BinaryAssert( ( lhs ^ rhs ) == ( lhs ^ (unsigned __int32)rhs ) ); - return (T)( lhs ^ (unsigned __int32)rhs ); - } -}; - -/***************** External functions ****************************************/ - -// External functions that can be used where you only need to check one operation -// non-class helper function so that you can check for a cast's validity -// and handle errors how you like -template < typename T, typename U > -inline bool SafeCast( const T From, U& To ) SAFEINT_NOTHROW -{ - return SafeCastHelper< U, T, GetCastMethod< U, T >::method >::Cast( From, To ); -} - -template < typename T, typename U > -inline bool SafeEquals( const T t, const U u ) SAFEINT_NOTHROW -{ - return EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( t, u ); -} - -template < typename T, typename U > -inline bool SafeNotEquals( const T t, const U u ) SAFEINT_NOTHROW -{ - return !EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( t, u ); -} - -template < typename T, typename U > -inline bool SafeGreaterThan( const T t, const U u ) SAFEINT_NOTHROW -{ - return GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( t, u ); -} - -template < typename T, typename U > -inline bool SafeGreaterThanEquals( const T t, const U u ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( u, t ); -} - -template < typename T, typename U > -inline bool SafeLessThan( const T t, const U u ) SAFEINT_NOTHROW -{ - return GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( u, t ); -} - -template < typename T, typename U > -inline bool SafeLessThanEquals( const T t, const U u ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( t, u ); -} - -template < typename T, typename U > -inline bool SafeModulus( const T& t, const U& u, T& result ) SAFEINT_NOTHROW -{ - return ( ModulusHelper< T, U, ValidComparison< T, U >::method >::Modulus( t, u, result ) == SafeIntNoError ); -} - -template < typename T, typename U > -inline bool SafeMultiply( T t, U u, T& result ) SAFEINT_NOTHROW -{ - return MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::Multiply( t, u, result ); -} - -template < typename T, typename U > -inline bool SafeDivide( T t, U u, T& result ) SAFEINT_NOTHROW -{ - return ( DivisionHelper< T, U, DivisionMethod< T, U >::method >::Divide( t, u, result ) == SafeIntNoError ); -} - -template < typename T, typename U > -inline bool SafeAdd( T t, U u, T& result ) SAFEINT_NOTHROW -{ - return AdditionHelper< T, U, AdditionMethod< T, U >::method >::Addition( t, u, result ); -} - -template < typename T, typename U > -inline bool SafeSubtract( T t, U u, T& result ) SAFEINT_NOTHROW -{ - return SubtractionHelper< T, U, SubtractionMethod< T, U >::method >::Subtract( t, u, result ); -} - -/***************** end external functions ************************************/ - -// Main SafeInt class -// Assumes exceptions can be thrown -template < typename T, typename E = SafeIntDefaultExceptionHandler > class SafeInt -{ -public: - SafeInt() SAFEINT_NOTHROW - { - C_ASSERT( NumericType< T >::isInt ); - m_int = 0; - } - - // Having a constructor for every type of int - // avoids having the compiler evade our checks when doing implicit casts - - // e.g., SafeInt s = 0x7fffffff; - SafeInt( const T& i ) SAFEINT_NOTHROW - { - C_ASSERT( NumericType< T >::isInt ); - //always safe - m_int = i; - } - - // provide explicit boolean converter - SafeInt( bool b ) SAFEINT_NOTHROW - { - C_ASSERT( NumericType< T >::isInt ); - m_int = (T)( b ? 1 : 0 ); - } - - template < typename U > - SafeInt(const SafeInt< U, E >& u) SAFEINT_CPP_THROW - { - C_ASSERT( NumericType< T >::isInt ); - *this = SafeInt< T, E >( (U)u ); - } - - template < typename U > - SafeInt( const U& i ) SAFEINT_CPP_THROW - { - C_ASSERT( NumericType< T >::isInt ); - // SafeCast will throw exceptions if i won't fit in type T - SafeCastHelper< T, U, GetCastMethod< T, U >::method >::template CastThrow< E >( i, m_int ); - } - - // The destructor is intentionally commented out - no destructor - // vs. a do-nothing destructor makes a huge difference in - // inlining characteristics. It wasn't doing anything anyway. - // ~SafeInt(){}; - - - // now start overloading operators - // assignment operator - // constructors exist for all int types and will ensure safety - - template < typename U > - SafeInt< T, E >& operator =( const U& rhs ) SAFEINT_CPP_THROW - { - // use constructor to test size - // constructor is optimized to do minimal checking based - // on whether T can contain U - // note - do not change this - *this = SafeInt< T, E >( rhs ); - return *this; - } - - SafeInt< T, E >& operator =( const T& rhs ) SAFEINT_NOTHROW - { - m_int = rhs; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator =( const SafeInt< U, E >& rhs ) SAFEINT_CPP_THROW - { - SafeCastHelper< T, U, GetCastMethod< T, U >::method >::template CastThrow< E >( rhs.Ref(), m_int ); - return *this; - } - - SafeInt< T, E >& operator =( const SafeInt< T, E >& rhs ) SAFEINT_NOTHROW - { - m_int = rhs.m_int; - return *this; - } - - // Casting operators - - operator bool() const SAFEINT_NOTHROW - { - return !!m_int; - } - - operator char() const SAFEINT_CPP_THROW - { - char val; - SafeCastHelper< char, T, GetCastMethod< char, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator signed char() const SAFEINT_CPP_THROW - { - signed char val; - SafeCastHelper< signed char, T, GetCastMethod< signed char, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator unsigned char() const SAFEINT_CPP_THROW - { - unsigned char val; - SafeCastHelper< unsigned char, T, GetCastMethod< unsigned char, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator __int16() const SAFEINT_CPP_THROW - { - __int16 val; - SafeCastHelper< __int16, T, GetCastMethod< __int16, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator unsigned __int16() const SAFEINT_CPP_THROW - { - unsigned __int16 val; - SafeCastHelper< unsigned __int16, T, GetCastMethod< unsigned __int16, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator __int32() const SAFEINT_CPP_THROW - { - __int32 val; - SafeCastHelper< __int32, T, GetCastMethod< __int32, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator unsigned __int32() const SAFEINT_CPP_THROW - { - unsigned __int32 val; - SafeCastHelper< unsigned __int32, T, GetCastMethod< unsigned __int32, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - // The compiler knows that int == __int32 - // but not that long == __int32 - operator long() const SAFEINT_CPP_THROW - { - long val; - SafeCastHelper< long, T, GetCastMethod< long, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator unsigned long() const SAFEINT_CPP_THROW - { - unsigned long val; - SafeCastHelper< unsigned long, T, GetCastMethod< unsigned long, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator __int64() const SAFEINT_CPP_THROW - { - __int64 val; - SafeCastHelper< __int64, T, GetCastMethod< __int64, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator unsigned __int64() const SAFEINT_CPP_THROW - { - unsigned __int64 val; - SafeCastHelper< unsigned __int64, T, GetCastMethod< unsigned __int64, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - -#if defined SAFEINT_USE_WCHAR_T || defined _NATIVE_WCHAR_T_DEFINED - operator wchar_t() const SAFEINT_CPP_THROW - { - wchar_t val; - SafeCastHelper< wchar_t, T, GetCastMethod< wchar_t, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } -#endif - -#ifdef SIZE_T_CAST_NEEDED - // We also need an explicit cast to size_t, or the compiler will complain - // Apparently, only SOME compilers complain, and cl 14.00.50727.42 isn't one of them - // Leave here in case we decide to backport this to an earlier compiler - operator size_t() const SAFEINT_CPP_THROW - { - size_t val; - SafeCastHelper< size_t, T, GetCastMethod< size_t, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } -#endif - - // Also provide a cast operator for floating point types - operator float() const SAFEINT_CPP_THROW - { - float val; - SafeCastHelper< float, T, GetCastMethod< float, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - operator double() const SAFEINT_CPP_THROW - { - double val; - SafeCastHelper< double, T, GetCastMethod< double, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - operator long double() const SAFEINT_CPP_THROW - { - long double val; - SafeCastHelper< long double, T, GetCastMethod< long double, T >::method >::template CastThrow< E >( m_int, val ); - return val; - } - - // If you need a pointer to the data - // this could be dangerous, but allows you to correctly pass - // instances of this class to APIs that take a pointer to an integer - // also see overloaded address-of operator below - T* Ptr() SAFEINT_NOTHROW { return &m_int; } - const T* Ptr() const SAFEINT_NOTHROW { return &m_int; } - const T& Ref() const SAFEINT_NOTHROW { return m_int; } - - // Or if SafeInt< T, E >::Ptr() is inconvenient, use the overload - // operator & - // This allows you to do unsafe things! - // It is meant to allow you to more easily - // pass a SafeInt into things like ReadFile - T* operator &() SAFEINT_NOTHROW { return &m_int; } - const T* operator &() const SAFEINT_NOTHROW { return &m_int; } - - // Unary operators - bool operator !() const SAFEINT_NOTHROW { return (!m_int) ? true : false; } - - // operator + (unary) - // note - normally, the '+' and '-' operators will upcast to a signed int - // for T < 32 bits. This class changes behavior to preserve type - const SafeInt< T, E >& operator +() const SAFEINT_NOTHROW { return *this; } - - //unary - - - SafeInt< T, E > operator -() const SAFEINT_CPP_THROW - { - // Note - unsigned still performs the bitwise manipulation - // will warn at level 2 or higher if the value is 32-bit or larger - return SafeInt(NegationHelper::isSigned>::template NegativeThrow(m_int)); - } - - // prefix increment operator - SafeInt< T, E >& operator ++() SAFEINT_CPP_THROW - { - if( m_int != IntTraits< T >::maxInt ) - { - ++m_int; - return *this; - } - E::SafeIntOnOverflow(); - } - - // prefix decrement operator - SafeInt< T, E >& operator --() SAFEINT_CPP_THROW - { - if( m_int != IntTraits< T >::minInt ) - { - --m_int; - return *this; - } - E::SafeIntOnOverflow(); - } - - // note that postfix operators have inherently worse perf - // characteristics - - // postfix increment operator - SafeInt< T, E > operator ++( int ) SAFEINT_CPP_THROW // dummy arg to comply with spec - { - if( m_int != IntTraits< T >::maxInt ) - { - SafeInt< T, E > tmp( m_int ); - - m_int++; - return tmp; - } - E::SafeIntOnOverflow(); - } - - // postfix decrement operator - SafeInt< T, E > operator --( int ) SAFEINT_CPP_THROW // dummy arg to comply with spec - { - if( m_int != IntTraits< T >::minInt ) - { - SafeInt< T, E > tmp( m_int ); - m_int--; - return tmp; - } - E::SafeIntOnOverflow(); - } - - // One's complement - // Note - this operator will normally change size to an int - // cast in return improves perf and maintains type - SafeInt< T, E > operator ~() const SAFEINT_NOTHROW { return SafeInt< T, E >( (T)~m_int ); } - - // Binary operators - // - // arithmetic binary operators - // % modulus - // * multiplication - // / division - // + addition - // - subtraction - // - // For each of the arithmetic operators, you will need to - // use them as follows: - // - // SafeInt c = 2; - // SafeInt i = 3; - // - // SafeInt i2 = i op (char)c; - // OR - // SafeInt i2 = (int)i op c; - // - // The base problem is that if the lhs and rhs inputs are different SafeInt types - // it is not possible in this implementation to determine what type of SafeInt - // should be returned. You have to let the class know which of the two inputs - // need to be the return type by forcing the other value to the base integer type. - // - // Note - as per feedback from Scott Meyers, I'm exploring how to get around this. - // 3.0 update - I'm still thinking about this. It can be done with template metaprogramming, - // but it is tricky, and there's a perf vs. correctness tradeoff where the right answer - // is situational. - // - // The case of: - // - // SafeInt< T, E > i, j, k; - // i = j op k; - // - // works just fine and no unboxing is needed because the return type is not ambiguous. - - // Modulus - // Modulus has some convenient properties - - // first, the magnitude of the return can never be - // larger than the lhs operand, and it must be the same sign - // as well. It does, however, suffer from the same promotion - // problems as comparisons, division and other operations - template < typename U > - SafeInt< T, E > operator %( U rhs ) const SAFEINT_CPP_THROW - { - T result; - ModulusHelper< T, U, ValidComparison< T, U >::method >::template ModulusThrow< E >( m_int, rhs, result ); - return SafeInt< T, E >( result ); - } - - SafeInt< T, E > operator %( SafeInt< T, E > rhs ) const SAFEINT_CPP_THROW - { - T result; - ModulusHelper< T, T, ValidComparison< T, T >::method >::template ModulusThrow< E >( m_int, rhs, result ); - return SafeInt< T, E >( result ); - } - - // Modulus assignment - template < typename U > - SafeInt< T, E >& operator %=( U rhs ) SAFEINT_CPP_THROW - { - ModulusHelper< T, U, ValidComparison< T, U >::method >::template ModulusThrow< E >( m_int, rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator %=( SafeInt< U, E > rhs ) SAFEINT_CPP_THROW - { - ModulusHelper< T, U, ValidComparison< T, U >::method >::template ModulusThrow< E >( m_int, (U)rhs, m_int ); - return *this; - } - - // Multiplication - template < typename U > - SafeInt< T, E > operator *( U rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::template MultiplyThrow< E >( m_int, rhs, ret ); - return SafeInt< T, E >( ret ); - } - - SafeInt< T, E > operator *( SafeInt< T, E > rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - MultiplicationHelper< T, T, MultiplicationMethod< T, T >::method >::template MultiplyThrow< E >( m_int, (T)rhs, ret ); - return SafeInt< T, E >( ret ); - } - - // Multiplication assignment - SafeInt< T, E >& operator *=( SafeInt< T, E > rhs ) SAFEINT_CPP_THROW - { - MultiplicationHelper< T, T, MultiplicationMethod< T, T >::method >::template MultiplyThrow< E >( m_int, (T)rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator *=( U rhs ) SAFEINT_CPP_THROW - { - MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::template MultiplyThrow< E >( m_int, rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator *=( SafeInt< U, E > rhs ) SAFEINT_CPP_THROW - { - MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::template MultiplyThrow< E >( m_int, rhs.Ref(), m_int ); - return *this; - } - - // Division - template < typename U > - SafeInt< T, E > operator /( U rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - DivisionHelper< T, U, DivisionMethod< T, U >::method >::template DivideThrow< E >( m_int, rhs, ret ); - return SafeInt< T, E >( ret ); - } - - SafeInt< T, E > operator /( SafeInt< T, E > rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - DivisionHelper< T, T, DivisionMethod< T, T >::method >::template DivideThrow< E >( m_int, (T)rhs, ret ); - return SafeInt< T, E >( ret ); - } - - // Division assignment - SafeInt< T, E >& operator /=( SafeInt< T, E > i ) SAFEINT_CPP_THROW - { - DivisionHelper< T, T, DivisionMethod< T, T >::method >::template DivideThrow< E >( m_int, (T)i, m_int ); - return *this; - } - - template < typename U > SafeInt< T, E >& operator /=( U i ) SAFEINT_CPP_THROW - { - DivisionHelper< T, U, DivisionMethod< T, U >::method >::template DivideThrow< E >( m_int, i, m_int ); - return *this; - } - - template < typename U > SafeInt< T, E >& operator /=( SafeInt< U, E > i ) - { - DivisionHelper< T, U, DivisionMethod< T, U >::method >::template DivideThrow< E >( m_int, (U)i, m_int ); - return *this; - } - - // For addition and subtraction - - // Addition - SafeInt< T, E > operator +( SafeInt< T, E > rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - AdditionHelper< T, T, AdditionMethod< T, T >::method >::template AdditionThrow< E >( m_int, (T)rhs, ret ); - return SafeInt< T, E >( ret ); - } - - template < typename U > - SafeInt< T, E > operator +( U rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - AdditionHelper< T, U, AdditionMethod< T, U >::method >::template AdditionThrow< E >( m_int, rhs, ret ); - return SafeInt< T, E >( ret ); - } - - //addition assignment - SafeInt< T, E >& operator +=( SafeInt< T, E > rhs ) SAFEINT_CPP_THROW - { - AdditionHelper< T, T, AdditionMethod< T, T >::method >::template AdditionThrow< E >( m_int, (T)rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator +=( U rhs ) SAFEINT_CPP_THROW - { - AdditionHelper< T, U, AdditionMethod< T, U >::method >::template AdditionThrow< E >( m_int, rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator +=( SafeInt< U, E > rhs ) SAFEINT_CPP_THROW - { - AdditionHelper< T, U, AdditionMethod< T, U >::method >::template AdditionThrow< E >( m_int, (U)rhs, m_int ); - return *this; - } - - // Subtraction - template < typename U > - SafeInt< T, E > operator -( U rhs ) const SAFEINT_CPP_THROW - { - T ret( 0 ); - SubtractionHelper< T, U, SubtractionMethod< T, U >::method >::template SubtractThrow< E >( m_int, rhs, ret ); - return SafeInt< T, E >( ret ); - } - - SafeInt< T, E > operator -(SafeInt< T, E > rhs) const SAFEINT_CPP_THROW - { - T ret( 0 ); - SubtractionHelper< T, T, SubtractionMethod< T, T >::method >::template SubtractThrow< E >( m_int, (T)rhs, ret ); - return SafeInt< T, E >( ret ); - } - - // Subtraction assignment - SafeInt< T, E >& operator -=( SafeInt< T, E > rhs ) SAFEINT_CPP_THROW - { - SubtractionHelper< T, T, SubtractionMethod< T, T >::method >::template SubtractThrow< E >( m_int, (T)rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator -=( U rhs ) SAFEINT_CPP_THROW - { - SubtractionHelper< T, U, SubtractionMethod< T, U >::method >::template SubtractThrow< E >( m_int, rhs, m_int ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator -=( SafeInt< U, E > rhs ) SAFEINT_CPP_THROW - { - SubtractionHelper< T, U, SubtractionMethod< T, U >::method >::template SubtractThrow< E >( m_int, (U)rhs, m_int ); - return *this; - } - - // Shift operators - // Note - shift operators ALWAYS return the same type as the lhs - // specific version for SafeInt< T, E > not needed - - // code path is exactly the same as for SafeInt< U, E > as rhs - - // Left shift - // Also, shifting > bitcount is undefined - trap in debug -#ifdef SAFEINT_DISABLE_SHIFT_ASSERT - #define ShiftAssert(x) -#else - #define ShiftAssert(x) SAFEINT_ASSERT(x) -#endif - - template < typename U > - SafeInt< T, E > operator <<( U bits ) const SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || bits >= 0 ); - ShiftAssert( bits < (int)IntTraits< T >::bitCount ); - - return SafeInt< T, E >( (T)( m_int << bits ) ); - } - - template < typename U > - SafeInt< T, E > operator <<( SafeInt< U, E > bits ) const SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || (U)bits >= 0 ); - ShiftAssert( (U)bits < (int)IntTraits< T >::bitCount ); - - return SafeInt< T, E >( (T)( m_int << (U)bits ) ); - } - - // Left shift assignment - - template < typename U > - SafeInt< T, E >& operator <<=( U bits ) SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || bits >= 0 ); - ShiftAssert( bits < (int)IntTraits< T >::bitCount ); - - m_int <<= bits; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator <<=( SafeInt< U, E > bits ) SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || (U)bits >= 0 ); - ShiftAssert( (U)bits < (int)IntTraits< T >::bitCount ); - - m_int <<= (U)bits; - return *this; - } - - // Right shift - template < typename U > - SafeInt< T, E > operator >>( U bits ) const SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || bits >= 0 ); - ShiftAssert( bits < (int)IntTraits< T >::bitCount ); - - return SafeInt< T, E >( (T)( m_int >> bits ) ); - } - - template < typename U > - SafeInt< T, E > operator >>( SafeInt< U, E > bits ) const SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || (U)bits >= 0 ); - ShiftAssert( bits < (int)IntTraits< T >::bitCount ); - - return SafeInt< T, E >( (T)(m_int >> (U)bits) ); - } - - // Right shift assignment - template < typename U > - SafeInt< T, E >& operator >>=( U bits ) SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || bits >= 0 ); - ShiftAssert( bits < (int)IntTraits< T >::bitCount ); - - m_int >>= bits; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator >>=( SafeInt< U, E > bits ) SAFEINT_NOTHROW - { - ShiftAssert( !IntTraits< U >::isSigned || (U)bits >= 0 ); - ShiftAssert( (U)bits < (int)IntTraits< T >::bitCount ); - - m_int >>= (U)bits; - return *this; - } - - // Bitwise operators - // This only makes sense if we're dealing with the same type and size - // demand a type T, or something that fits into a type T - - // Bitwise & - SafeInt< T, E > operator &( SafeInt< T, E > rhs ) const SAFEINT_NOTHROW - { - return SafeInt< T, E >( m_int & (T)rhs ); - } - - template < typename U > - SafeInt< T, E > operator &( U rhs ) const SAFEINT_NOTHROW - { - // we want to avoid setting bits by surprise - // consider the case of lhs = int, value = 0xffffffff - // rhs = char, value = 0xff - // - // programmer intent is to get only the lower 8 bits - // normal behavior is to upcast both sides to an int - // which then sign extends rhs, setting all the bits - - // If you land in the assert, this is because the bitwise operator - // was causing unexpected behavior. Fix is to properly cast your inputs - // so that it works like you meant, not unexpectedly - - return SafeInt< T, E >( BinaryAndHelper< T, U, BinaryMethod< T, U >::method >::And( m_int, rhs ) ); - } - - // Bitwise & assignment - SafeInt< T, E >& operator &=( SafeInt< T, E > rhs ) SAFEINT_NOTHROW - { - m_int &= (T)rhs; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator &=( U rhs ) SAFEINT_NOTHROW - { - m_int = BinaryAndHelper< T, U, BinaryMethod< T, U >::method >::And( m_int, rhs ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator &=( SafeInt< U, E > rhs ) SAFEINT_NOTHROW - { - m_int = BinaryAndHelper< T, U, BinaryMethod< T, U >::method >::And( m_int, (U)rhs ); - return *this; - } - - // XOR - SafeInt< T, E > operator ^( SafeInt< T, E > rhs ) const SAFEINT_NOTHROW - { - return SafeInt< T, E >( (T)( m_int ^ (T)rhs ) ); - } - - template < typename U > - SafeInt< T, E > operator ^( U rhs ) const SAFEINT_NOTHROW - { - // If you land in the assert, this is because the bitwise operator - // was causing unexpected behavior. Fix is to properly cast your inputs - // so that it works like you meant, not unexpectedly - - return SafeInt< T, E >( BinaryXorHelper< T, U, BinaryMethod< T, U >::method >::Xor( m_int, rhs ) ); - } - - // XOR assignment - SafeInt< T, E >& operator ^=( SafeInt< T, E > rhs ) SAFEINT_NOTHROW - { - m_int ^= (T)rhs; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator ^=( U rhs ) SAFEINT_NOTHROW - { - m_int = BinaryXorHelper< T, U, BinaryMethod< T, U >::method >::Xor( m_int, rhs ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator ^=( SafeInt< U, E > rhs ) SAFEINT_NOTHROW - { - m_int = BinaryXorHelper< T, U, BinaryMethod< T, U >::method >::Xor( m_int, (U)rhs ); - return *this; - } - - // bitwise OR - SafeInt< T, E > operator |( SafeInt< T, E > rhs ) const SAFEINT_NOTHROW - { - return SafeInt< T, E >( (T)( m_int | (T)rhs ) ); - } - - template < typename U > - SafeInt< T, E > operator |( U rhs ) const SAFEINT_NOTHROW - { - return SafeInt< T, E >( BinaryOrHelper< T, U, BinaryMethod< T, U >::method >::Or( m_int, rhs ) ); - } - - // bitwise OR assignment - SafeInt< T, E >& operator |=( SafeInt< T, E > rhs ) SAFEINT_NOTHROW - { - m_int |= (T)rhs; - return *this; - } - - template < typename U > - SafeInt< T, E >& operator |=( U rhs ) SAFEINT_NOTHROW - { - m_int = BinaryOrHelper< T, U, BinaryMethod< T, U >::method >::Or( m_int, rhs ); - return *this; - } - - template < typename U > - SafeInt< T, E >& operator |=( SafeInt< U, E > rhs ) SAFEINT_NOTHROW - { - m_int = BinaryOrHelper< T, U, BinaryMethod< T, U >::method >::Or( m_int, (U)rhs ); - return *this; - } - - // Miscellaneous helper functions - SafeInt< T, E > Min( SafeInt< T, E > test, const T floor = IntTraits< T >::minInt ) const SAFEINT_NOTHROW - { - T tmp = test < m_int ? (T)test : m_int; - return tmp < floor ? floor : tmp; - } - - SafeInt< T, E > Max( SafeInt< T, E > test, const T upper = IntTraits< T >::maxInt ) const SAFEINT_NOTHROW - { - T tmp = test > m_int ? (T)test : m_int; - return tmp > upper ? upper : tmp; - } - - void Swap( SafeInt< T, E >& with ) SAFEINT_NOTHROW - { - T temp( m_int ); - m_int = with.m_int; - with.m_int = temp; - } - - static SafeInt< T, E > SafeAtoI( const char* input ) SAFEINT_CPP_THROW - { - return SafeTtoI( input ); - } - - static SafeInt< T, E > SafeWtoI( const wchar_t* input ) - { - return SafeTtoI( input ); - } - - enum alignBits - { - align2 = 1, - align4 = 2, - align8 = 3, - align16 = 4, - align32 = 5, - align64 = 6, - align128 = 7, - align256 = 8 - }; - - template < alignBits bits > - const SafeInt< T, E >& Align() SAFEINT_CPP_THROW - { - // Zero is always aligned - if( m_int == 0 ) - return *this; - - // We don't support aligning negative numbers at this time - // Can't align unsigned numbers on bitCount (e.g., 8 bits = 256, unsigned char max = 255) - // or signed numbers on bitCount-1 (e.g., 7 bits = 128, signed char max = 127). - // Also makes no sense to try to align on negative or no bits. - - ShiftAssert( ( ( IntTraits::isSigned && bits < (int)IntTraits< T >::bitCount - 1 ) - || ( !IntTraits::isSigned && bits < (int)IntTraits< T >::bitCount ) ) && - bits >= 0 && ( !IntTraits::isSigned || m_int > 0 ) ); - - const T AlignValue = ( (T)1 << bits ) - 1; - - m_int = (T)( ( m_int + AlignValue ) & ~AlignValue ); - - if( m_int <= 0 ) - E::SafeIntOnOverflow(); - - return *this; - } - - // Commonly needed alignments: - const SafeInt< T, E >& Align2() { return Align< align2 >(); } - const SafeInt< T, E >& Align4() { return Align< align4 >(); } - const SafeInt< T, E >& Align8() { return Align< align8 >(); } - const SafeInt< T, E >& Align16() { return Align< align16 >(); } - const SafeInt< T, E >& Align32() { return Align< align32 >(); } - const SafeInt< T, E >& Align64() { return Align< align64 >(); } -private: - - // This is almost certainly not the best optimized version of atoi, - // but it does not display a typical bug where it isn't possible to set MinInt - // and it won't allow you to overflow your integer. - // This is here because it is useful, and it is an example of what - // can be done easily with SafeInt. - template < typename U > - static SafeInt< T, E > SafeTtoI( U* input ) SAFEINT_CPP_THROW - { - U* tmp = input; - SafeInt< T, E > s; - bool negative = false; - - // Bad input, or empty string - if( input == nullptr || input[0] == 0 ) - E::SafeIntOnOverflow(); - - switch( *tmp ) - { - case '-': - tmp++; - negative = true; - break; - case '+': - tmp++; - break; - } - - while( *tmp != 0 ) - { - if( *tmp < '0' || *tmp > '9' ) - break; - - if( (T)s != 0 ) - s *= (T)10; - - if( !negative ) - s += (T)( *tmp - '0' ); - else - s -= (T)( *tmp - '0' ); - - tmp++; - } - - return s; - } - - T m_int; -}; - -// Helper function used to subtract pointers. -// Used to squelch warnings -template -SafeInt SafePtrDiff(const P* p1, const P* p2) SAFEINT_CPP_THROW -{ - return SafeInt( p1 - p2 ); -} - -// Comparison operators - -//Less than -template < typename T, typename U, typename E > -bool operator <( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)rhs, lhs ); -} - -template < typename T, typename U, typename E > -bool operator <( SafeInt lhs, U rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( rhs, (T)lhs ); -} - -template < typename T, typename U, typename E > -bool operator <( SafeInt< U, E > lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)rhs, (U)lhs ); -} - -// Greater than -template < typename T, typename U, typename E > -bool operator >( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( lhs, (T)rhs ); -} - -template < typename T, typename U, typename E > -bool operator >( SafeInt lhs, U rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)lhs, rhs ); -} - -template < typename T, typename U, typename E > -bool operator >( SafeInt< T, E > lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - return GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)lhs, (U)rhs ); -} - -// Greater than or equal -template < typename T, typename U, typename E > -bool operator >=( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)rhs, lhs ); -} - -template < typename T, typename U, typename E > -bool operator >=( SafeInt lhs, U rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( rhs, (T)lhs ); -} - -template < typename T, typename U, typename E > -bool operator >=( SafeInt< T, E > lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( (U)rhs, (T)lhs ); -} - -// Less than or equal -template < typename T, typename U, typename E > -bool operator <=( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< U, T, ValidComparison< U, T >::method >::GreaterThan( lhs, (T)rhs ); -} - -template < typename T, typename U, typename E > -bool operator <=( SafeInt< T, E > lhs, U rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)lhs, rhs ); -} - -template < typename T, typename U, typename E > -bool operator <=( SafeInt< T, E > lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - return !GreaterThanTest< T, U, ValidComparison< T, U >::method >::GreaterThan( (T)lhs, (U)rhs ); -} - -// equality -// explicit overload for bool -template < typename T, typename E > -bool operator ==( bool lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return lhs == ( (T)rhs == 0 ? false : true ); -} - -template < typename T, typename E > -bool operator ==( SafeInt< T, E > lhs, bool rhs ) SAFEINT_NOTHROW -{ - return rhs == ( (T)lhs == 0 ? false : true ); -} - -template < typename T, typename U, typename E > -bool operator ==( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals((T)rhs, lhs); -} - -template < typename T, typename U, typename E > -bool operator ==( SafeInt< T, E > lhs, U rhs ) SAFEINT_NOTHROW -{ - return EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( (T)lhs, rhs ); -} - -template < typename T, typename U, typename E > -bool operator ==( SafeInt< T, E > lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - return EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( (T)lhs, (U)rhs ); -} - -//not equals -template < typename T, typename U, typename E > -bool operator !=( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return !EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( (T)rhs, lhs ); -} - -template < typename T, typename U, typename E > -bool operator !=( SafeInt< T, E > lhs, U rhs ) SAFEINT_NOTHROW -{ - return !EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( (T)lhs, rhs ); -} - -template < typename T, typename U, typename E > -bool operator !=( SafeInt< T, E > lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - return !EqualityTest< T, U, ValidComparison< T, U >::method >::IsEquals( lhs, rhs ); -} - - -template < typename T, typename E > -bool operator !=( bool lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return ( (T)rhs == 0 ? false : true ) != lhs; -} - -template < typename T, typename E > -bool operator !=( SafeInt< T, E > lhs, bool rhs ) SAFEINT_NOTHROW -{ - return ( (T)lhs == 0 ? false : true ) != rhs; -} - - -template < typename T, typename U, typename E, int method > class ModulusSimpleCaseHelper; - -template < typename T, typename E, int method > class ModulusSignedCaseHelper; - -template < typename T, typename E > class ModulusSignedCaseHelper < T, E, true > -{ -public: - static bool SignedCase( SafeInt< T, E > rhs, SafeInt< T, E >& result ) SAFEINT_NOTHROW - { - if( (T)rhs == (T)-1 ) - { - result = 0; - return true; - } - return false; - } -}; - -template < typename T, typename E > class ModulusSignedCaseHelper < T, E, false > -{ -public: - static bool SignedCase( SafeInt< T, E > /*rhs*/, SafeInt< T, E >& /*result*/ ) SAFEINT_NOTHROW - { - return false; - } -}; - -template < typename T, typename U, typename E > -class ModulusSimpleCaseHelper < T, U, E, true > -{ -public: - static bool ModulusSimpleCase( U lhs, SafeInt< T, E > rhs, SafeInt< T, E >& result ) SAFEINT_CPP_THROW - { - if( rhs != 0 ) - { - if( ModulusSignedCaseHelper< T, E, IntTraits< T >::isSigned >::SignedCase( rhs, result ) ) - return true; - - result = SafeInt< T, E >( (T)( lhs % (T)rhs ) ); - return true; - } - - E::SafeIntOnDivZero(); - } -}; - -template< typename T, typename U, typename E > -class ModulusSimpleCaseHelper < T, U, E, false > -{ -public: - static bool ModulusSimpleCase( U /*lhs*/, SafeInt< T, E > /*rhs*/, SafeInt< T, E >& /*result*/ ) SAFEINT_NOTHROW - { - return false; - } -}; - -// Modulus -template < typename T, typename U, typename E > -SafeInt< T, E > operator %( U lhs, SafeInt< T, E > rhs ) SAFEINT_CPP_THROW -{ - // Value of return depends on sign of lhs - // This one may not be safe - bounds check in constructor - // if lhs is negative and rhs is unsigned, this will throw an exception. - - // Fast-track the simple case - // same size and same sign - SafeInt< T, E > result; - - if( ModulusSimpleCaseHelper< T, U, E, - sizeof(T) == sizeof(U) && (bool)IntTraits< T >::isSigned == (bool)IntTraits< U >::isSigned >::ModulusSimpleCase( lhs, rhs, result ) ) - return result; - - return SafeInt< T, E >( ( SafeInt< U, E >( lhs ) % (T)rhs ) ); -} - -// Multiplication -template < typename T, typename U, typename E > -SafeInt< T, E > operator *( U lhs, SafeInt< T, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::template MultiplyThrow< E >( (T)rhs, lhs, ret ); - return SafeInt< T, E >(ret); -} - -template < typename T, typename U, typename E, int method > class DivisionNegativeCornerCaseHelper; - -template < typename T, typename U, typename E > class DivisionNegativeCornerCaseHelper< T, U, E, true > -{ -public: - static bool NegativeCornerCase( U lhs, SafeInt< T, E > rhs, SafeInt& result ) SAFEINT_CPP_THROW - { - // Problem case - normal casting behavior changes meaning - // flip rhs to positive - // any operator casts now do the right thing - U tmp; - - if( CompileConst< sizeof(T) == 4 >::Value() ) - tmp = lhs/(U)( ~(unsigned __int32)(T)rhs + 1 ); - else - tmp = lhs/(U)( ~(unsigned __int64)(T)rhs + 1 ); - - if( tmp <= (U)IntTraits< T >::maxInt ) - { - result = SafeInt< T, E >( (T)(~(unsigned __int64)tmp + 1) ); - return true; - } - - // Corner case - T maxT = IntTraits< T >::maxInt; - if( tmp == (U)maxT + 1 ) - { - T minT = IntTraits< T >::minInt; - result = SafeInt< T, E >( minT ); - return true; - } - - E::SafeIntOnOverflow(); - } -}; - -template < typename T, typename U, typename E > class DivisionNegativeCornerCaseHelper< T, U, E, false > -{ -public: - static bool NegativeCornerCase( U /*lhs*/, SafeInt< T, E > /*rhs*/, SafeInt& /*result*/ ) SAFEINT_NOTHROW - { - return false; - } -}; - -template < typename T, typename U, typename E, int method > class DivisionCornerCaseHelper; - -template < typename T, typename U, typename E > class DivisionCornerCaseHelper < T, U, E, true > -{ -public: - static bool DivisionCornerCase1( U lhs, SafeInt< T, E > rhs, SafeInt& result ) SAFEINT_CPP_THROW - { - if( (T)rhs > 0 ) - { - result = SafeInt< T, E >( lhs/(T)rhs ); - return true; - } - - // Now rhs is either negative, or zero - if( (T)rhs != 0 ) - { - if( DivisionNegativeCornerCaseHelper< T, U, E, sizeof( U ) >= 4 && sizeof( T ) <= sizeof( U ) >::NegativeCornerCase( lhs, rhs, result ) ) - return true; - - result = SafeInt< T, E >(lhs/(T)rhs); - return true; - } - - E::SafeIntOnDivZero(); - } -}; - -template < typename T, typename U, typename E > class DivisionCornerCaseHelper < T, U, E, false > -{ -public: - static bool DivisionCornerCase1( U /*lhs*/, SafeInt< T, E > /*rhs*/, SafeInt& /*result*/ ) SAFEINT_NOTHROW - { - return false; - } -}; - -template < typename T, typename U, typename E, int method > class DivisionCornerCaseHelper2; - -template < typename T, typename U, typename E > class DivisionCornerCaseHelper2 < T, U, E, true > -{ -public: - static bool DivisionCornerCase2( U lhs, SafeInt< T, E > rhs, SafeInt& result ) SAFEINT_CPP_THROW - { - if( lhs == IntTraits< U >::minInt && (T)rhs == -1 ) - { - // corner case of a corner case - lhs = min int, rhs = -1, - // but rhs is the return type, so in essence, we can return -lhs - // if rhs is a larger type than lhs - // If types are wrong, throws - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning(push) -//cast truncates constant value -#pragma warning(disable:4310) -#endif - - if( CompileConst::Value() ) - result = SafeInt< T, E >( (T)( -(T)IntTraits< U >::minInt ) ); - else - E::SafeIntOnOverflow(); - -#if SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER -#pragma warning(pop) -#endif - - return true; - } - - return false; - } -}; - -template < typename T, typename U, typename E > class DivisionCornerCaseHelper2 < T, U, E, false > -{ -public: - static bool DivisionCornerCase2( U /*lhs*/, SafeInt< T, E > /*rhs*/, SafeInt& /*result*/ ) SAFEINT_NOTHROW - { - return false; - } -}; - -// Division -template < typename T, typename U, typename E > SafeInt< T, E > operator /( U lhs, SafeInt< T, E > rhs ) SAFEINT_CPP_THROW -{ - // Corner case - has to be handled seperately - SafeInt< T, E > result; - if( DivisionCornerCaseHelper< T, U, E, (int)DivisionMethod< U, T >::method == (int)DivisionState_UnsignedSigned >::DivisionCornerCase1( lhs, rhs, result ) ) - return result; - - if( DivisionCornerCaseHelper2< T, U, E, SafeIntCompare< T, U >::isBothSigned >::DivisionCornerCase2( lhs, rhs, result ) ) - return result; - - // Otherwise normal logic works with addition of bounds check when casting from U->T - U ret; - DivisionHelper< U, T, DivisionMethod< U, T >::method >::template DivideThrow< E >( lhs, (T)rhs, ret ); - return SafeInt< T, E >( ret ); -} - -// Addition -template < typename T, typename U, typename E > -SafeInt< T, E > operator +( U lhs, SafeInt< T, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - AdditionHelper< T, U, AdditionMethod< T, U >::method >::template AdditionThrow< E >( (T)rhs, lhs, ret ); - return SafeInt< T, E >( ret ); -} - -// Subtraction -template < typename T, typename U, typename E > -SafeInt< T, E > operator -( U lhs, SafeInt< T, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - SubtractionHelper< U, T, SubtractionMethod2< U, T >::method >::template SubtractThrow< E >( lhs, rhs.Ref(), ret ); - - return SafeInt< T, E >( ret ); -} - -// Overrides designed to deal with cases where a SafeInt is assigned out -// to a normal int - this at least makes the last operation safe -// += -template < typename T, typename U, typename E > -T& operator +=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - AdditionHelper< T, U, AdditionMethod< T, U >::method >::template AdditionThrow< E >( lhs, (U)rhs, ret ); - lhs = ret; - return lhs; -} - -template < typename T, typename U, typename E > -T& operator -=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - SubtractionHelper< T, U, SubtractionMethod< T, U >::method >::template SubtractThrow< E >( lhs, (U)rhs, ret ); - lhs = ret; - return lhs; -} - -template < typename T, typename U, typename E > -T& operator *=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - MultiplicationHelper< T, U, MultiplicationMethod< T, U >::method >::template MultiplyThrow< E >( lhs, (U)rhs, ret ); - lhs = ret; - return lhs; -} - -template < typename T, typename U, typename E > -T& operator /=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - DivisionHelper< T, U, DivisionMethod< T, U >::method >::template DivideThrow< E >( lhs, (U)rhs, ret ); - lhs = ret; - return lhs; -} - -template < typename T, typename U, typename E > -T& operator %=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - T ret( 0 ); - ModulusHelper< T, U, ValidComparison< T, U >::method >::template ModulusThrow< E >( lhs, (U)rhs, ret ); - lhs = ret; - return lhs; -} - -template < typename T, typename U, typename E > -T& operator &=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - lhs = BinaryAndHelper< T, U, BinaryMethod< T, U >::method >::And( lhs, (U)rhs ); - return lhs; -} - -template < typename T, typename U, typename E > -T& operator ^=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - lhs = BinaryXorHelper< T, U, BinaryMethod< T, U >::method >::Xor( lhs, (U)rhs ); - return lhs; -} - -template < typename T, typename U, typename E > -T& operator |=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - lhs = BinaryOrHelper< T, U, BinaryMethod< T, U >::method >::Or( lhs, (U)rhs ); - return lhs; -} - -template < typename T, typename U, typename E > -T& operator <<=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - lhs = (T)( SafeInt< T, E >( lhs ) << (U)rhs ); - return lhs; -} - -template < typename T, typename U, typename E > -T& operator >>=( T& lhs, SafeInt< U, E > rhs ) SAFEINT_NOTHROW -{ - lhs = (T)( SafeInt< T, E >( lhs ) >> (U)rhs ); - return lhs; -} - -// Specific pointer overrides -// Note - this function makes no attempt to ensure -// that the resulting pointer is still in the buffer, only -// that no int overflows happened on the way to getting the new pointer -template < typename T, typename U, typename E > -T*& operator +=( T*& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - // Cast the pointer to a number so we can do arithmetic - SafeInt< size_t, E > ptr_val = reinterpret_cast< size_t >( lhs ); - // Check first that rhs is valid for the type of ptrdiff_t - // and that multiplying by sizeof( T ) doesn't overflow a ptrdiff_t - // Next, we need to add 2 SafeInts of different types, so unbox the ptr_diff - // Finally, cast the number back to a pointer of the correct type - lhs = reinterpret_cast< T* >( (size_t)( ptr_val + (ptrdiff_t)( SafeInt< ptrdiff_t, E >( rhs ) * sizeof( T ) ) ) ); - return lhs; -} - -template < typename T, typename U, typename E > -T*& operator -=( T*& lhs, SafeInt< U, E > rhs ) SAFEINT_CPP_THROW -{ - // Cast the pointer to a number so we can do arithmetic - SafeInt< size_t, E > ptr_val = reinterpret_cast< size_t >( lhs ); - // See above for comments - lhs = reinterpret_cast< T* >( (size_t)( ptr_val - (ptrdiff_t)( SafeInt< ptrdiff_t, E >( rhs ) * sizeof( T ) ) ) ); - return lhs; -} - -template < typename T, typename U, typename E > -T*& operator *=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator /=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator %=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator &=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator ^=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator |=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator <<=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -template < typename T, typename U, typename E > -T*& operator >>=( T*& lhs, SafeInt< U, E > ) SAFEINT_NOTHROW -{ - // This operator explicitly not supported - C_ASSERT( sizeof(T) == 0 ); - return (lhs = NULL); -} - -// Shift operators -// NOTE - shift operators always return the type of the lhs argument - -// Left shift -template < typename T, typename U, typename E > -SafeInt< U, E > operator <<( U lhs, SafeInt< T, E > bits ) SAFEINT_NOTHROW -{ - ShiftAssert( !IntTraits< T >::isSigned || (T)bits >= 0 ); - ShiftAssert( (T)bits < (int)IntTraits< U >::bitCount ); - - return SafeInt< U, E >( (U)( lhs << (T)bits ) ); -} - -// Right shift -template < typename T, typename U, typename E > -SafeInt< U, E > operator >>( U lhs, SafeInt< T, E > bits ) SAFEINT_NOTHROW -{ - ShiftAssert( !IntTraits< T >::isSigned || (T)bits >= 0 ); - ShiftAssert( (T)bits < (int)IntTraits< U >::bitCount ); - - return SafeInt< U, E >( (U)( lhs >> (T)bits ) ); -} - -// Bitwise operators -// This only makes sense if we're dealing with the same type and size -// demand a type T, or something that fits into a type T. - -// Bitwise & -template < typename T, typename U, typename E > -SafeInt< T, E > operator &( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return SafeInt< T, E >( BinaryAndHelper< T, U, BinaryMethod< T, U >::method >::And( (T)rhs, lhs ) ); -} - -// Bitwise XOR -template < typename T, typename U, typename E > -SafeInt< T, E > operator ^( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return SafeInt< T, E >(BinaryXorHelper< T, U, BinaryMethod< T, U >::method >::Xor( (T)rhs, lhs ) ); -} - -// Bitwise OR -template < typename T, typename U, typename E > -SafeInt< T, E > operator |( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW -{ - return SafeInt< T, E >( BinaryOrHelper< T, U, BinaryMethod< T, U >::method >::Or( (T)rhs, lhs ) ); -} - -#if SAFEINT_COMPILER == GCC_COMPILER -#pragma GCC diagnostic pop -#endif - -#if SAFEINT_COMPILER == CLANG_COMPILER -#pragma clang diagnostic pop -#endif - -} // utilities -} // safeint3 - diff --git a/src/corehost/cli/json/casablanca/include/cpprest/details/basic_types.h b/src/corehost/cli/json/casablanca/include/cpprest/details/basic_types.h deleted file mode 100755 index ea28f8260..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/details/basic_types.h +++ /dev/null @@ -1,140 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* Platform-dependent type definitions -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#pragma once - -#include -#include -#include -#include -#include "cpprest/details/cpprest_compat.h" - -#ifndef _WIN32 -# define __STDC_LIMIT_MACROS -# include -#else -#include -#endif - -#include "cpprest/details/SafeInt3.hpp" - -namespace utility -{ - -#ifdef _WIN32 -#define _UTF16_STRINGS -#endif - -// We should be using a 64-bit size type for most situations that do -// not involve specifying the size of a memory allocation or buffer. -typedef uint64_t size64_t; - -#ifndef _WIN32 -typedef uint32_t HRESULT; // Needed for PPLX -#endif - -#ifdef _UTF16_STRINGS -// -// On Windows, all strings are wide -// -typedef wchar_t char_t ; -typedef std::wstring string_t; -#define _XPLATSTR(x) L ## x -typedef std::wostringstream ostringstream_t; -typedef std::wofstream ofstream_t; -typedef std::wostream ostream_t; -typedef std::wistream istream_t; -typedef std::wifstream ifstream_t; -typedef std::wistringstream istringstream_t; -typedef std::wstringstream stringstream_t; -#define ucout std::wcout -#define ucin std::wcin -#define ucerr std::wcerr -#else -// -// On POSIX platforms, all strings are narrow -// -typedef char char_t; -typedef std::string string_t; -#define _XPLATSTR(x) x -typedef std::ostringstream ostringstream_t; -typedef std::ofstream ofstream_t; -typedef std::ostream ostream_t; -typedef std::istream istream_t; -typedef std::ifstream ifstream_t; -typedef std::istringstream istringstream_t; -typedef std::stringstream stringstream_t; -#define ucout std::cout -#define ucin std::cin -#define ucerr std::cerr -#endif // endif _UTF16_STRINGS - -#ifndef _TURN_OFF_PLATFORM_STRING -#define U(x) _XPLATSTR(x) -#endif // !_TURN_OFF_PLATFORM_STRING - -}// namespace utility - -typedef char utf8char; -typedef std::string utf8string; -typedef std::stringstream utf8stringstream; -typedef std::ostringstream utf8ostringstream; -typedef std::ostream utf8ostream; -typedef std::istream utf8istream; -typedef std::istringstream utf8istringstream; - -#ifdef _UTF16_STRINGS -typedef wchar_t utf16char; -typedef std::wstring utf16string; -typedef std::wstringstream utf16stringstream; -typedef std::wostringstream utf16ostringstream; -typedef std::wostream utf16ostream; -typedef std::wistream utf16istream; -typedef std::wistringstream utf16istringstream; -#else -typedef char16_t utf16char; -typedef std::u16string utf16string; -typedef std::basic_stringstream utf16stringstream; -typedef std::basic_ostringstream utf16ostringstream; -typedef std::basic_ostream utf16ostream; -typedef std::basic_istream utf16istream; -typedef std::basic_istringstream utf16istringstream; -#endif - - -#if defined(_WIN32) -// Include on everything except Windows Desktop ARM, unless explicitly excluded. -#if !defined(CPPREST_EXCLUDE_WEBSOCKETS) -#if defined(WINAPI_FAMILY) -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && defined(_M_ARM) -#define CPPREST_EXCLUDE_WEBSOCKETS -#endif -#else -#if defined(_M_ARM) -#define CPPREST_EXCLUDE_WEBSOCKETS -#endif -#endif -#endif -#endif diff --git a/src/corehost/cli/json/casablanca/include/cpprest/details/cpprest_compat.h b/src/corehost/cli/json/casablanca/include/cpprest/details/cpprest_compat.h deleted file mode 100755 index 240a33899..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/details/cpprest_compat.h +++ /dev/null @@ -1,97 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* Standard macros and definitions. -* This header has minimal dependency on windows headers and is safe for use in the public API -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#pragma once - -#if defined(_WIN32) // Settings specific to Windows - -#if _MSC_VER >= 1900 -#define CPPREST_NOEXCEPT noexcept -#else -#define CPPREST_NOEXCEPT -#endif - -#define CASABLANCA_UNREFERENCED_PARAMETER(x) (x) - -#include - -#else // End settings specific to Windows - -// Settings common to all but Windows - -#define __declspec(x) __attribute__ ((x)) -#define dllimport -#define novtable /* no novtable equivalent */ -#define __assume(x) do { if (!(x)) __builtin_unreachable(); } while (false) -#define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x -#define CPPREST_NOEXCEPT noexcept - -#include -#define _ASSERTE(x) assert(x) - -// No SAL on non Windows platforms -#include "cpprest/details/nosal.h" - -#if not defined __cdecl -#if defined cdecl -#define __cdecl __attribute__ ((cdecl)) -#else -#define __cdecl -#endif - -#if defined(__ANDROID__) -// This is needed to disable the use of __thread inside the boost library. -// Android does not support thread local storage -- if boost is included -// without this macro defined, it will create references to __tls_get_addr -// which (while able to link) will not be available at runtime and prevent -// the .so from loading. -#define BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -#endif - -#ifdef __clang__ -#include -#endif - -#endif // defined(__APPLE__) - -#endif - - -#ifdef _NO_ASYNCRTIMP -#define _ASYNCRTIMP -#else -#ifdef _ASYNCRT_EXPORT -#define _ASYNCRTIMP __declspec(dllexport) -#else -#define _ASYNCRTIMP __declspec(dllimport) -#endif -#endif - -#ifdef CASABLANCA_DEPRECATION_NO_WARNINGS -#define CASABLANCA_DEPRECATED(x) -#else -#define CASABLANCA_DEPRECATED(x) __declspec(deprecated(x)) -#endif diff --git a/src/corehost/cli/json/casablanca/include/cpprest/details/nosal.h b/src/corehost/cli/json/casablanca/include/cpprest/details/nosal.h deleted file mode 100755 index 4d7e583a7..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/details/nosal.h +++ /dev/null @@ -1,89 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -***/ - -#pragma once -// selected MS SAL annotations - -#ifdef _In_ -#undef _In_ -#endif -#define _In_ - -#ifdef _Inout_ -#undef _Inout_ -#endif -#define _Inout_ - -#ifdef _Out_ -#undef _Out_ -#endif -#define _Out_ - -#ifdef _In_z_ -#undef _In_z_ -#endif -#define _In_z_ - -#ifdef _Out_z_ -#undef _Out_z_ -#endif -#define _Out_z_ - -#ifdef _Inout_z_ -#undef _Inout_z_ -#endif -#define _Inout_z_ - -#ifdef _In_opt_ -#undef _In_opt_ -#endif -#define _In_opt_ - -#ifdef _Out_opt_ -#undef _Out_opt_ -#endif -#define _Out_opt_ - -#ifdef _Inout_opt_ -#undef _Inout_opt_ -#endif -#define _Inout_opt_ - -#ifdef _Out_writes_ -#undef _Out_writes_ -#endif -#define _Out_writes_(x) - -#ifdef _Out_writes_opt_ -#undef _Out_writes_opt_ -#endif -#define _Out_writes_opt_(x) - -#ifdef _In_reads_ -#undef _In_reads_ -#endif -#define _In_reads_(x) - -#ifdef _Inout_updates_bytes_ -#undef _Inout_updates_bytes_ -#endif -#define _Inout_updates_bytes_(x) \ No newline at end of file diff --git a/src/corehost/cli/json/casablanca/include/cpprest/json.h b/src/corehost/cli/json/casablanca/include/cpprest/json.h deleted file mode 100755 index 7490c866e..000000000 --- a/src/corehost/cli/json/casablanca/include/cpprest/json.h +++ /dev/null @@ -1,1936 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* HTTP Library: JSON parser and writer -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ -#pragma once - -#ifndef _CASA_JSON_H -#define _CASA_JSON_H - -#include -#include -#include -#include -#include -#include -#include "cpprest/details/basic_types.h" -#include "cpprest/asyncrt_utils.h" - -namespace web -{ -/// Library for parsing and serializing JSON values to and from C++ types. -namespace json -{ - // Various forward declarations. - namespace details - { - class _Value; - class _Number; - class _Null; - class _Boolean; - class _String; - class _Object; - class _Array; - template class JSON_Parser; - } - - namespace details - { - extern bool g_keep_json_object_unsorted; - } - - /// - /// Preserve the order of the name/value pairs when parsing a JSON object. - /// The default is false, which can yield better performance. - /// - /// true if ordering should be preserved when parsing, false otherwise. - /// Note this is a global setting and affects all JSON parsing done. - void _ASYNCRTIMP __cdecl keep_object_element_order(bool keep_order); - -#ifdef _WIN32 -#ifdef _DEBUG -#define ENABLE_JSON_VALUE_VISUALIZER -#endif -#endif - - class number; - class array; - class object; - - /// - /// A JSON value represented as a C++ class. - /// - class value - { - public: - /// - /// This enumeration represents the various kinds of JSON values. - /// - enum value_type - { - /// Number value - Number, - /// Boolean value - Boolean, - /// String value - String, - /// Object value - Object, - /// Array value - Array, - /// Null value - Null - }; - - /// - /// Constructor creating a null value - /// - _ASYNCRTIMP value(); - - /// - /// Constructor creating a JSON number value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP value(int32_t value); - - /// - /// Constructor creating a JSON number value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP value(uint32_t value); - - /// - /// Constructor creating a JSON number value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP value(int64_t value); - - /// - /// Constructor creating a JSON number value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP value(uint64_t value); - - /// - /// Constructor creating a JSON number value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP value(double value); - - /// - /// Constructor creating a JSON Boolean value - /// - /// The C++ value to create a JSON value from - _ASYNCRTIMP explicit value(bool value); - - /// - /// Constructor creating a JSON string value - /// - /// The C++ value to create a JSON value from, a C++ STL string of the platform-native character width - /// - /// This constructor has O(n) performance because it tries to determine if - /// specified string has characters that should be properly escaped in JSON. - /// - _ASYNCRTIMP explicit value(utility::string_t value); - - /// - /// Constructor creating a JSON string value specifying if the string contains characters to escape - /// - /// The C++ value to create a JSON value from, a C++ STL string of the platform-native character width - /// Whether contains characters - /// that should be escaped in JSON value - /// - /// This constructor has O(1) performance. - /// - _ASYNCRTIMP explicit value(utility::string_t value, bool has_escape_chars); - - /// - /// Constructor creating a JSON string value - /// - /// The C++ value to create a JSON value from, a C++ STL string of the platform-native character width - /// - /// - /// This constructor has O(n) performance because it tries to determine if - /// specified string has characters that should be properly escaped in JSON. - /// - /// - /// This constructor exists in order to avoid string literals matching another constructor, - /// as is very likely. For example, conversion to bool does not require a user-defined conversion, - /// and will therefore match first, which means that the JSON value turns up as a boolean. - /// - /// - _ASYNCRTIMP explicit value(const utility::char_t* value); - - /// - /// Constructor creating a JSON string value - /// - /// The C++ value to create a JSON value from, a C++ STL string of the platform-native character width - /// Whether contains characters - /// - /// - /// This overload has O(1) performance. - /// - /// - /// This constructor exists in order to avoid string literals matching another constructor, - /// as is very likely. For example, conversion to bool does not require a user-defined conversion, - /// and will therefore match first, which means that the JSON value turns up as a boolean. - /// - /// - _ASYNCRTIMP explicit value(const utility::char_t* value, bool has_escape_chars); - - /// - /// Copy constructor - /// - _ASYNCRTIMP value(const value &); - - /// - /// Move constructor - /// - _ASYNCRTIMP value(value &&) CPPREST_NOEXCEPT ; - - /// - /// Assignment operator. - /// - /// The JSON value object that contains the result of the assignment. - _ASYNCRTIMP value &operator=(const value &); - - /// - /// Move assignment operator. - /// - /// The JSON value object that contains the result of the assignment. - _ASYNCRTIMP value &operator=(value &&) CPPREST_NOEXCEPT ; - - // Static factories - - /// - /// Creates a null value - /// - /// A JSON null value - static _ASYNCRTIMP value __cdecl null(); - - /// - /// Creates a number value - /// - /// The C++ value to create a JSON value from - /// A JSON number value - static _ASYNCRTIMP value __cdecl number(double value); - - /// - /// Creates a number value - /// - /// The C++ value to create a JSON value from - /// A JSON number value - static _ASYNCRTIMP value __cdecl number(int32_t value); - - /// - /// Creates a number value - /// - /// The C++ value to create a JSON value from - /// A JSON number value - static _ASYNCRTIMP value __cdecl number(uint32_t value); - - /// - /// Creates a number value - /// - /// The C++ value to create a JSON value from - /// A JSON number value - static _ASYNCRTIMP value __cdecl number(int64_t value); - - /// - /// Creates a number value - /// - /// The C++ value to create a JSON value from - /// A JSON number value - static _ASYNCRTIMP value __cdecl number(uint64_t value); - - /// - /// Creates a Boolean value - /// - /// The C++ value to create a JSON value from - /// A JSON Boolean value - static _ASYNCRTIMP value __cdecl boolean(bool value); - - /// - /// Creates a string value - /// - /// The C++ value to create a JSON value from - /// A JSON string value - /// - /// This overload has O(n) performance because it tries to determine if - /// specified string has characters that should be properly escaped in JSON. - /// - static _ASYNCRTIMP value __cdecl string(utility::string_t value); - - /// - /// Creates a string value specifying if the string contains characters to escape - /// - /// The C++ value to create a JSON value from - /// Whether contains characters - /// that should be escaped in JSON value - /// A JSON string value - /// - /// This overload has O(1) performance. - /// - static _ASYNCRTIMP value __cdecl string(utility::string_t value, bool has_escape_chars); - -#ifdef _WIN32 -private: - // Only used internally by JSON parser. - static _ASYNCRTIMP value __cdecl string(const std::string &value); -public: -#endif - - /// - /// Creates an object value - /// - /// Whether to preserve the original order of the fields - /// An empty JSON object value - static _ASYNCRTIMP json::value __cdecl object(bool keep_order = false); - - /// - /// Creates an object value from a collection of field/values - /// - /// Field names associated with JSON values - /// Whether to preserve the original order of the fields - /// A non-empty JSON object value - static _ASYNCRTIMP json::value __cdecl object(std::vector> fields, bool keep_order = false); - - /// - /// Creates an empty JSON array - /// - /// An empty JSON array value - static _ASYNCRTIMP json::value __cdecl array(); - - /// - /// Creates a JSON array - /// - /// The initial number of elements of the JSON value - /// A JSON array value - static _ASYNCRTIMP json::value __cdecl array(size_t size); - - /// - /// Creates a JSON array - /// - /// A vector of JSON values - /// A JSON array value - static _ASYNCRTIMP json::value __cdecl array(std::vector elements); - - /// - /// Accesses the type of JSON value the current value instance is - /// - /// The value's type - _ASYNCRTIMP json::value::value_type type() const; - - /// - /// Is the current value a null value? - /// - /// true if the value is a null value, false otherwise - bool is_null() const { return type() == Null; }; - - /// - /// Is the current value a number value? - /// - /// true if the value is a number value, false otherwise - bool is_number() const { return type() == Number; } - - /// - /// Is the current value represented as an integer number value? - /// - /// - /// Note that if a json value is a number but represented as a double it can still - /// be retrieved as a integer using as_integer(), however the value will be truncated. - /// - /// true if the value is an integer value, false otherwise. - _ASYNCRTIMP bool is_integer() const; - - /// - /// Is the current value represented as an double number value? - /// - /// - /// Note that if a json value is a number but represented as a int it can still - /// be retrieved as a double using as_double(). - /// - /// true if the value is an double value, false otherwise. - _ASYNCRTIMP bool is_double() const; - - /// - /// Is the current value a Boolean value? - /// - /// true if the value is a Boolean value, false otherwise - bool is_boolean() const { return type() == Boolean; } - - /// - /// Is the current value a string value? - /// - /// true if the value is a string value, false otherwise - bool is_string() const { return type() == String; } - - /// - /// Is the current value an array? - /// - /// true if the value is an array, false otherwise - bool is_array() const { return type() == Array; } - - /// - /// Is the current value an object? - /// - /// true if the value is an object, false otherwise - bool is_object() const { return type() == Object; } - - /// - /// Gets the number of children of the value. - /// - /// The number of children. 0 for all non-composites. - size_t size() const; - - /// - /// Parses a string and construct a JSON value. - /// - /// The C++ value to create a JSON value from, a C++ STL double-byte string - _ASYNCRTIMP static value __cdecl parse(const utility::string_t &value); - - /// - /// Attempts to parse a string and construct a JSON value. - /// - /// The C++ value to create a JSON value from, a C++ STL double-byte string - /// If parsing fails, the error code is greater than 0 - /// The parsed object. Returns web::json::value::null if failed - _ASYNCRTIMP static value __cdecl parse(const utility::string_t &value, std::error_code &errorCode); - - /// - /// Serializes the current JSON value to a C++ string. - /// - /// A string representation of the value - _ASYNCRTIMP utility::string_t serialize() const; - - /// - /// Serializes the current JSON value to a C++ string. - /// - /// A string representation of the value - CASABLANCA_DEPRECATED("This API is deprecated and has been renamed to avoid confusion with as_string(), use ::web::json::value::serialize() instead.") - _ASYNCRTIMP utility::string_t to_string() const; - - /// - /// Parses a JSON value from the contents of an input stream using the native platform character width. - /// - /// The stream to read the JSON value from - /// The JSON value object created from the input stream. - _ASYNCRTIMP static value __cdecl parse(utility::istream_t &input); - - /// - /// Parses a JSON value from the contents of an input stream using the native platform character width. - /// - /// The stream to read the JSON value from - /// If parsing fails, the error code is greater than 0 - /// The parsed object. Returns web::json::value::null if failed - _ASYNCRTIMP static value __cdecl parse(utility::istream_t &input, std::error_code &errorCode); - - /// - /// Writes the current JSON value to a stream with the native platform character width. - /// - /// The stream that the JSON string representation should be written to. - _ASYNCRTIMP void serialize(utility::ostream_t &stream) const; - -#ifdef _WIN32 - /// - /// Parses a JSON value from the contents of a single-byte (UTF8) stream. - /// - /// The stream to read the JSON value from - _ASYNCRTIMP static value __cdecl parse(std::istream& stream); - - /// - /// Parses a JSON value from the contents of a single-byte (UTF8) stream. - /// - /// The stream to read the JSON value from - /// If parsing fails, the error code is greater than 0 - /// The parsed object. Returns web::json::value::null if failed - _ASYNCRTIMP static value __cdecl parse(std::istream& stream, std::error_code& error); - - /// - /// Serializes the content of the value into a single-byte (UTF8) stream. - /// - /// The stream that the JSON string representation should be written to. - _ASYNCRTIMP void serialize(std::ostream& stream) const; -#endif - - /// - /// Converts the JSON value to a C++ double, if and only if it is a number value. - /// Throws if the value is not a number - /// - /// A double representation of the value - _ASYNCRTIMP double as_double() const; - - /// - /// Converts the JSON value to a C++ integer, if and only if it is a number value. - /// Throws if the value is not a number - /// - /// An integer representation of the value - _ASYNCRTIMP int as_integer() const; - - /// - /// Converts the JSON value to a number class, if and only if it is a number value. - /// Throws if the value is not a number - /// - /// An instance of number class - _ASYNCRTIMP const json::number& as_number() const; - - /// - /// Converts the JSON value to a C++ bool, if and only if it is a Boolean value. - /// - /// A C++ bool representation of the value - _ASYNCRTIMP bool as_bool() const; - - /// - /// Converts the JSON value to a json array, if and only if it is an array value. - /// - /// The returned json::array should have the same or shorter lifetime as this - /// An array representation of the value - _ASYNCRTIMP json::array& as_array(); - - /// - /// Converts the JSON value to a json array, if and only if it is an array value. - /// - /// The returned json::array should have the same or shorter lifetime as this - /// An array representation of the value - _ASYNCRTIMP const json::array& as_array() const; - - /// - /// Converts the JSON value to a json object, if and only if it is an object value. - /// - /// An object representation of the value - _ASYNCRTIMP json::object& as_object(); - - /// - /// Converts the JSON value to a json object, if and only if it is an object value. - /// - /// An object representation of the value - _ASYNCRTIMP const json::object& as_object() const; - - /// - /// Converts the JSON value to a C++ STL string, if and only if it is a string value. - /// - /// A C++ STL string representation of the value - _ASYNCRTIMP const utility::string_t& as_string() const; - - /// - /// Compares two JSON values for equality. - /// - /// The JSON value to compare with. - /// True iff the values are equal. - _ASYNCRTIMP bool operator==(const value& other) const; - - /// - /// Compares two JSON values for inequality. - /// - /// The JSON value to compare with. - /// True iff the values are unequal. - bool operator!=(const value& other) const - { - return !((*this) == other); - } - - /// - /// Tests for the presence of a field. - /// - /// The name of the field - /// True if the field exists, false otherwise. - bool has_field(const utility::string_t &key) const; - - /// - /// Accesses a field of a JSON object. - /// - /// The name of the field - /// The value kept in the field; null if the field does not exist - CASABLANCA_DEPRECATED("This API is deprecated and will be removed in a future release, use json::value::at() instead.") - value get(const utility::string_t &key) const; - - /// - /// Erases an element of a JSON array. Throws if index is out of bounds. - /// - /// The index of the element to erase in the JSON array. - _ASYNCRTIMP void erase(size_t index); - - /// - /// Erases an element of a JSON object. Throws if the key doesn't exist. - /// - /// The key of the element to erase in the JSON object. - _ASYNCRTIMP void erase(const utility::string_t &key); - - /// - /// Accesses an element of a JSON array. Throws when index out of bounds. - /// - /// The index of an element in the JSON array. - /// A reference to the value. - _ASYNCRTIMP json::value& at(size_t index); - - /// - /// Accesses an element of a JSON array. Throws when index out of bounds. - /// - /// The index of an element in the JSON array. - /// A reference to the value. - _ASYNCRTIMP const json::value& at(size_t index) const; - - /// - /// Accesses an element of a JSON object. If the key doesn't exist, this method throws. - /// - /// The key of an element in the JSON object. - /// If the key exists, a reference to the value. - _ASYNCRTIMP json::value& at(const utility::string_t& key); - - /// - /// Accesses an element of a JSON object. If the key doesn't exist, this method throws. - /// - /// The key of an element in the JSON object. - /// If the key exists, a reference to the value. - _ASYNCRTIMP const json::value& at(const utility::string_t& key) const; - - /// - /// Accesses a field of a JSON object. - /// - /// The name of the field - /// A reference to the value kept in the field. - _ASYNCRTIMP value & operator [] (const utility::string_t &key); - -#ifdef _WIN32 -private: - // Only used internally by JSON parser - _ASYNCRTIMP value & operator [] (const std::string &key) - { - // JSON object stores its field map as a unordered_map of string_t, so this conversion is hard to avoid - return operator[](utility::conversions::to_string_t(key)); - } -public: -#endif - - /// - /// Accesses an element of a JSON array. - /// - /// The index of an element in the JSON array - /// The value kept at the array index; null if outside the boundaries of the array - CASABLANCA_DEPRECATED("This API is deprecated and will be removed in a future release, use json::value::at() instead.") - value get(size_t index) const; - - /// - /// Accesses an element of a JSON array. - /// - /// The index of an element in the JSON array. - /// A reference to the value kept in the field. - _ASYNCRTIMP value & operator [] (size_t index); - - private: - friend class web::json::details::_Object; - friend class web::json::details::_Array; - template friend class web::json::details::JSON_Parser; - -#ifdef _WIN32 - /// - /// Writes the current JSON value as a double-byte string to a string instance. - /// - /// The string that the JSON representation should be written to. - _ASYNCRTIMP void format(std::basic_string &string) const; -#endif - /// - /// Serializes the content of the value into a string instance in UTF8 format - /// - /// The string that the JSON representation should be written to - _ASYNCRTIMP void format(std::basic_string& string) const; - -#ifdef ENABLE_JSON_VALUE_VISUALIZER - explicit value(std::unique_ptr v, value_type kind) : m_value(std::move(v)), m_kind(kind) -#else - explicit value(std::unique_ptr v) : m_value(std::move(v)) -#endif - {} - - std::unique_ptr m_value; -#ifdef ENABLE_JSON_VALUE_VISUALIZER - value_type m_kind; -#endif - }; - - /// - /// A single exception type to represent errors in parsing, converting, and accessing - /// elements of JSON values. - /// - class json_exception : public std::exception - { - private: - std::string _message; - public: - json_exception(const utility::char_t * const &message) : _message(utility::conversions::to_utf8string(message)) { } - - // Must be narrow string because it derives from std::exception - const char* what() const CPPREST_NOEXCEPT - { - return _message.c_str(); - } - }; - - namespace details - { - enum json_error - { - left_over_character_in_stream = 1, - malformed_array_literal, - malformed_comment, - malformed_literal, - malformed_object_literal, - malformed_numeric_literal, - malformed_string_literal, - malformed_token, - mismatched_brances, - nesting, - unexpected_token - }; - - class json_error_category_impl : public std::error_category - { - public: - virtual const char* name() const CPPREST_NOEXCEPT override - { - return "json"; - } - - virtual std::string message(int ev) const override - { - switch (ev) - { - case json_error::left_over_character_in_stream: - return "Left-over characters in stream after parsing a JSON value"; - case json_error::malformed_array_literal: - return "Malformed array literal"; - case json_error::malformed_comment: - return "Malformed comment"; - case json_error::malformed_literal: - return "Malformed literal"; - case json_error::malformed_object_literal: - return "Malformed object literal"; - case json_error::malformed_numeric_literal: - return "Malformed numeric literal"; - case json_error::malformed_string_literal: - return "Malformed string literal"; - case json_error::malformed_token: - return "Malformed token"; - case json_error::mismatched_brances: - return "Mismatched braces"; - case json_error::nesting: - return "Nesting too deep"; - case json_error::unexpected_token: - return "Unexpected token"; - default: - return "Unknown json error"; - } - } - }; - - const json_error_category_impl& json_error_category(); - } - - /// - /// A JSON array represented as a C++ class. - /// - class array - { - typedef std::vector storage_type; - - public: - typedef storage_type::iterator iterator; - typedef storage_type::const_iterator const_iterator; - typedef storage_type::reverse_iterator reverse_iterator; - typedef storage_type::const_reverse_iterator const_reverse_iterator; - typedef storage_type::size_type size_type; - - private: - array() : m_elements() { } - array(size_type size) : m_elements(size) { } - array(storage_type elements) : m_elements(std::move(elements)) { } - - public: - /// - /// Gets the beginning iterator element of the array - /// - /// An iterator to the beginning of the JSON array. - iterator begin() - { - return m_elements.begin(); - } - - /// - /// Gets the beginning const iterator element of the array. - /// - /// A const_iterator to the beginning of the JSON array. - const_iterator begin() const - { - return m_elements.cbegin(); - } - - /// - /// Gets the end iterator element of the array - /// - /// An iterator to the end of the JSON array. - iterator end() - { - return m_elements.end(); - } - - /// - /// Gets the end const iterator element of the array. - /// - /// A const_iterator to the end of the JSON array. - const_iterator end() const - { - return m_elements.cend(); - } - - /// - /// Gets the beginning reverse iterator element of the array - /// - /// An reverse_iterator to the beginning of the JSON array. - reverse_iterator rbegin() - { - return m_elements.rbegin(); - } - - /// - /// Gets the beginning const reverse iterator element of the array - /// - /// An const_reverse_iterator to the beginning of the JSON array. - const_reverse_iterator rbegin() const - { - return m_elements.rbegin(); - } - - /// - /// Gets the end reverse iterator element of the array - /// - /// An reverse_iterator to the end of the JSON array. - reverse_iterator rend() - { - return m_elements.rend(); - } - - /// - /// Gets the end const reverse iterator element of the array - /// - /// An const_reverse_iterator to the end of the JSON array. - const_reverse_iterator rend() const - { - return m_elements.crend(); - } - - /// - /// Gets the beginning const iterator element of the array. - /// - /// A const_iterator to the beginning of the JSON array. - const_iterator cbegin() const - { - return m_elements.cbegin(); - } - - /// - /// Gets the end const iterator element of the array. - /// - /// A const_iterator to the end of the JSON array. - const_iterator cend() const - { - return m_elements.cend(); - } - - /// - /// Gets the beginning const reverse iterator element of the array. - /// - /// A const_reverse_iterator to the beginning of the JSON array. - const_reverse_iterator crbegin() const - { - return m_elements.crbegin(); - } - - /// - /// Gets the end const reverse iterator element of the array. - /// - /// A const_reverse_iterator to the end of the JSON array. - const_reverse_iterator crend() const - { - return m_elements.crend(); - } - - /// - /// Deletes an element of the JSON array. - /// - /// A const_iterator to the element to delete. - /// Iterator to the new location of the element following the erased element. - /// GCC doesn't support erase with const_iterator on vector yet. In the future this should be changed. - iterator erase(iterator position) - { - return m_elements.erase(position); - } - - /// - /// Deletes the element at an index of the JSON array. - /// - /// The index of the element to delete. - void erase(size_type index) - { - if (index >= m_elements.size()) - { - throw json_exception(_XPLATSTR("index out of bounds")); - } - m_elements.erase(m_elements.begin() + index); - } - - /// - /// Accesses an element of a JSON array. Throws when index out of bounds. - /// - /// The index of an element in the JSON array. - /// A reference to the value kept in the field. - json::value& at(size_type index) - { - if (index >= m_elements.size()) - throw json_exception(_XPLATSTR("index out of bounds")); - - return m_elements[index]; - } - - /// - /// Accesses an element of a JSON array. Throws when index out of bounds. - /// - /// The index of an element in the JSON array. - /// A reference to the value kept in the field. - const json::value& at(size_type index) const - { - if (index >= m_elements.size()) - throw json_exception(_XPLATSTR("index out of bounds")); - - return m_elements[index]; - } - - /// - /// Accesses an element of a JSON array. - /// - /// The index of an element in the JSON array. - /// A reference to the value kept in the field. - json::value& operator[](size_type index) - { - msl::safeint3::SafeInt nMinSize(index); - nMinSize += 1; - msl::safeint3::SafeInt nlastSize(m_elements.size()); - if (nlastSize < nMinSize) - m_elements.resize(nMinSize); - - return m_elements[index]; - } - - /// - /// Gets the number of elements of the array. - /// - /// The number of elements. - size_type size() const - { - return m_elements.size(); - } - - private: - storage_type m_elements; - - friend class details::_Array; - template friend class json::details::JSON_Parser; - }; - - /// - /// A JSON object represented as a C++ class. - /// - class object - { - typedef std::vector> storage_type; - - public: - typedef storage_type::iterator iterator; - typedef storage_type::const_iterator const_iterator; - typedef storage_type::reverse_iterator reverse_iterator; - typedef storage_type::const_reverse_iterator const_reverse_iterator; - typedef storage_type::size_type size_type; - - private: - object(bool keep_order = false) : m_elements(), m_keep_order(keep_order) { } - object(storage_type elements, bool keep_order = false) : m_elements(std::move(elements)), m_keep_order(keep_order) - { - if (!keep_order) { - sort(m_elements.begin(), m_elements.end(), compare_pairs); - } - } - - public: - /// - /// Gets the beginning iterator element of the object - /// - /// An iterator to the beginning of the JSON object. - iterator begin() - { - return m_elements.begin(); - } - - /// - /// Gets the beginning const iterator element of the object. - /// - /// A const_iterator to the beginning of the JSON object. - const_iterator begin() const - { - return m_elements.cbegin(); - } - - /// - /// Gets the end iterator element of the object - /// - /// An iterator to the end of the JSON object. - iterator end() - { - return m_elements.end(); - } - - /// - /// Gets the end const iterator element of the object. - /// - /// A const_iterator to the end of the JSON object. - const_iterator end() const - { - return m_elements.cend(); - } - - /// - /// Gets the beginning reverse iterator element of the object - /// - /// An reverse_iterator to the beginning of the JSON object. - reverse_iterator rbegin() - { - return m_elements.rbegin(); - } - - /// - /// Gets the beginning const reverse iterator element of the object - /// - /// An const_reverse_iterator to the beginning of the JSON object. - const_reverse_iterator rbegin() const - { - return m_elements.rbegin(); - } - - /// - /// Gets the end reverse iterator element of the object - /// - /// An reverse_iterator to the end of the JSON object. - reverse_iterator rend() - { - return m_elements.rend(); - } - - /// - /// Gets the end const reverse iterator element of the object - /// - /// An const_reverse_iterator to the end of the JSON object. - const_reverse_iterator rend() const - { - return m_elements.crend(); - } - - /// - /// Gets the beginning const iterator element of the object. - /// - /// A const_iterator to the beginning of the JSON object. - const_iterator cbegin() const - { - return m_elements.cbegin(); - } - - /// - /// Gets the end const iterator element of the object. - /// - /// A const_iterator to the end of the JSON object. - const_iterator cend() const - { - return m_elements.cend(); - } - - /// - /// Gets the beginning const reverse iterator element of the object. - /// - /// A const_reverse_iterator to the beginning of the JSON object. - const_reverse_iterator crbegin() const - { - return m_elements.crbegin(); - } - - /// - /// Gets the end const reverse iterator element of the object. - /// - /// A const_reverse_iterator to the end of the JSON object. - const_reverse_iterator crend() const - { - return m_elements.crend(); - } - - /// - /// Deletes an element of the JSON object. - /// - /// A const_iterator to the element to delete. - /// Iterator to the new location of the element following the erased element. - /// GCC doesn't support erase with const_iterator on vector yet. In the future this should be changed. - iterator erase(iterator position) - { - return m_elements.erase(position); - } - - /// - /// Deletes an element of the JSON object. If the key doesn't exist, this method throws. - /// - /// The key of an element in the JSON object. - void erase(const utility::string_t &key) - { - auto iter = find_by_key(key); - if (iter == m_elements.end()) - { - throw web::json::json_exception(_XPLATSTR("Key not found")); - } - - m_elements.erase(iter); - } - - /// - /// Accesses an element of a JSON object. If the key doesn't exist, this method throws. - /// - /// The key of an element in the JSON object. - /// If the key exists, a reference to the value kept in the field. - json::value& at(const utility::string_t& key) - { - auto iter = find_by_key(key); - if (iter == m_elements.end()) - { - throw web::json::json_exception(_XPLATSTR("Key not found")); - } - - return iter->second; - } - - /// - /// Accesses an element of a JSON object. If the key doesn't exist, this method throws. - /// - /// The key of an element in the JSON object. - /// If the key exists, a reference to the value kept in the field. - const json::value& at(const utility::string_t& key) const - { - auto iter = find_by_key(key); - if (iter == m_elements.end()) - { - throw web::json::json_exception(_XPLATSTR("Key not found")); - } - - return iter->second; - } - - /// - /// Accesses an element of a JSON object. - /// - /// The key of an element in the JSON object. - /// If the key exists, a reference to the value kept in the field, otherwise a newly created null value that will be stored for the given key. - json::value& operator[](const utility::string_t& key) - { - auto iter = find_insert_location(key); - - if (iter == m_elements.end() || key != iter->first) - { - return m_elements.insert(iter, std::pair(key, value()))->second; - } - - return iter->second; - } - - /// - /// Gets an iterator to an element of a JSON object. - /// - /// The key of an element in the JSON object. - /// A const iterator to the value kept in the field. - const_iterator find(const utility::string_t& key) const - { - return find_by_key(key); - } - - /// - /// Gets the number of elements of the object. - /// - /// The number of elements. - size_type size() const - { - return m_elements.size(); - } - - /// - /// Checks if there are any elements in the JSON object. - /// - /// True iff empty. - bool empty() const - { - return m_elements.empty(); - } - private: - - static bool compare_pairs(const std::pair& p1, const std::pair& p2) - { - return p1.first < p2.first; - } - static bool compare_with_key(const std::pair& p1, const utility::string_t& key) - { - return p1.first < key; - } - - storage_type::iterator find_insert_location(const utility::string_t &key) - { - if (m_keep_order) - { - return std::find_if(m_elements.begin(), m_elements.end(), - [&key](const std::pair& p) { - return p.first == key; - }); - } - else - { - return std::lower_bound(m_elements.begin(), m_elements.end(), key, compare_with_key); - } - } - - storage_type::const_iterator find_by_key(const utility::string_t& key) const - { - if (m_keep_order) - { - return std::find_if(m_elements.begin(), m_elements.end(), - [&key](const std::pair& p) { - return p.first == key; - }); - } - else - { - auto iter = std::lower_bound(m_elements.begin(), m_elements.end(), key, compare_with_key); - if (iter != m_elements.end() && key != iter->first) - { - return m_elements.end(); - } - return iter; - } - } - - storage_type::iterator find_by_key(const utility::string_t& key) - { - auto iter = find_insert_location(key); - if (iter != m_elements.end() && key != iter->first) - { - return m_elements.end(); - } - return iter; - } - - storage_type m_elements; - bool m_keep_order; - friend class details::_Object; - - template friend class json::details::JSON_Parser; - }; - - /// - /// A JSON number represented as a C++ class. - /// - class number - { - // Note that these constructors make sure that only negative integers are stored as signed int64 (while others convert to unsigned int64). - // This helps handling number objects e.g. comparing two numbers. - - number(double value) : m_value(value), m_type(double_type) { } - number(int32_t value) : m_intval(value), m_type(value < 0 ? signed_type : unsigned_type) { } - number(uint32_t value) : m_intval(value), m_type(unsigned_type) { } - number(int64_t value) : m_intval(value), m_type(value < 0 ? signed_type : unsigned_type) { } - number(uint64_t value) : m_uintval(value), m_type(unsigned_type) { } - - public: - - /// - /// Does the number fit into int32? - /// - /// true if the number fits into int32, false otherwise - _ASYNCRTIMP bool is_int32() const; - - /// - /// Does the number fit into unsigned int32? - /// - /// true if the number fits into unsigned int32, false otherwise - _ASYNCRTIMP bool is_uint32() const; - - /// - /// Does the number fit into int64? - /// - /// true if the number fits into int64, false otherwise - _ASYNCRTIMP bool is_int64() const; - - /// - /// Does the number fit into unsigned int64? - /// - /// true if the number fits into unsigned int64, false otherwise - bool is_uint64() const - { - switch (m_type) - { - case signed_type : return m_intval >= 0; - case unsigned_type : return true; - case double_type : - default : - return false; - } - } - - /// - /// Converts the JSON number to a C++ double. - /// - /// A double representation of the number - double to_double() const - { - switch (m_type) - { - case double_type : return m_value; - case signed_type : return static_cast(m_intval); - case unsigned_type : return static_cast(m_uintval); - default : return false; - } - } - - /// - /// Converts the JSON number to int32. - /// - /// An int32 representation of the number - int32_t to_int32() const - { - if (m_type == double_type) - return static_cast(m_value); - else - return static_cast(m_intval); - } - - /// - /// Converts the JSON number to unsigned int32. - /// - /// An usigned int32 representation of the number - uint32_t to_uint32() const - { - if (m_type == double_type) - return static_cast(m_value); - else - return static_cast(m_intval); - } - - /// - /// Converts the JSON number to int64. - /// - /// An int64 representation of the number - int64_t to_int64() const - { - if (m_type == double_type) - return static_cast(m_value); - else - return static_cast(m_intval); - } - - /// - /// Converts the JSON number to unsigned int64. - /// - /// An unsigned int64 representation of the number - uint64_t to_uint64() const - { - if (m_type == double_type) - return static_cast(m_value); - else - return static_cast(m_intval); - } - - /// - /// Is the number represented internally as an integral type? - /// - /// true if the number is represented as an integral type, false otherwise - bool is_integral() const - { - return m_type != double_type; - } - - /// - /// Compares two JSON numbers for equality. - /// - /// The JSON number to compare with. - /// True iff the numbers are equal. - bool operator==(const number &other) const - { - if (m_type != other.m_type) - return false; - - switch (m_type) - { - case json::number::type::signed_type : - return m_intval == other.m_intval; - case json::number::type::unsigned_type : - return m_uintval == other.m_uintval; - case json::number::type::double_type : - return m_value == other.m_value; - } - __assume(0); - } - - private: - union - { - int64_t m_intval; - uint64_t m_uintval; - double m_value; - }; - - enum type - { - signed_type=0, unsigned_type, double_type - } m_type; - - friend class details::_Number; - }; - - namespace details - { - class _Value - { - public: - virtual std::unique_ptr<_Value> _copy_value() = 0; - - virtual bool has_field(const utility::string_t &) const { return false; } - virtual value get_field(const utility::string_t &) const { throw json_exception(_XPLATSTR("not an object")); } - virtual value get_element(array::size_type) const { throw json_exception(_XPLATSTR("not an array")); } - - virtual value &index(const utility::string_t &) { throw json_exception(_XPLATSTR("not an object")); } - virtual value &index(array::size_type) { throw json_exception(_XPLATSTR("not an array")); } - - virtual const value &cnst_index(const utility::string_t &) const { throw json_exception(_XPLATSTR("not an object")); } - virtual const value &cnst_index(array::size_type) const { throw json_exception(_XPLATSTR("not an array")); } - - // Common function used for serialization to strings and streams. - virtual void serialize_impl(std::string& str) const - { - format(str); - } -#ifdef _WIN32 - virtual void serialize_impl(std::wstring& str) const - { - format(str); - } -#endif - - virtual utility::string_t to_string() const - { - utility::string_t str; - serialize_impl(str); - return str; - } - - virtual json::value::value_type type() const { return json::value::Null; } - - virtual bool is_integer() const { throw json_exception(_XPLATSTR("not a number")); } - virtual bool is_double() const { throw json_exception(_XPLATSTR("not a number")); } - - virtual const json::number& as_number() { throw json_exception(_XPLATSTR("not a number")); } - virtual double as_double() const { throw json_exception(_XPLATSTR("not a number")); } - virtual int as_integer() const { throw json_exception(_XPLATSTR("not a number")); } - virtual bool as_bool() const { throw json_exception(_XPLATSTR("not a boolean")); } - virtual json::array& as_array() { throw json_exception(_XPLATSTR("not an array")); } - virtual const json::array& as_array() const { throw json_exception(_XPLATSTR("not an array")); } - virtual json::object& as_object() { throw json_exception(_XPLATSTR("not an object")); } - virtual const json::object& as_object() const { throw json_exception(_XPLATSTR("not an object")); } - virtual const utility::string_t& as_string() const { throw json_exception(_XPLATSTR("not a string")); } - - virtual size_t size() const { return 0; } - - virtual ~_Value() {} - - protected: - _Value() {} - - virtual void format(std::basic_string& stream) const - { - stream.append("null"); - } -#ifdef _WIN32 - virtual void format(std::basic_string& stream) const - { - stream.append(L"null"); - } -#endif - private: - - friend class web::json::value; - }; - - class _Null : public _Value - { - public: - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_Null>(); - } - virtual json::value::value_type type() const { return json::value::Null; } - }; - - class _Number : public _Value - { - public: - _Number(double value) : m_number(value) { } - _Number(int32_t value) : m_number(value) { } - _Number(uint32_t value) : m_number(value) { } - _Number(int64_t value) : m_number(value) { } - _Number(uint64_t value) : m_number(value) { } - - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_Number>(*this); - } - - virtual json::value::value_type type() const { return json::value::Number; } - - virtual bool is_integer() const { return m_number.is_integral(); } - virtual bool is_double() const { return !m_number.is_integral(); } - - virtual double as_double() const - { - return m_number.to_double(); - } - - virtual int as_integer() const - { - return m_number.to_int32(); - } - - virtual const number& as_number() { return m_number; } - - protected: - virtual void format(std::basic_string& stream) const ; -#ifdef _WIN32 - virtual void format(std::basic_string& stream) const; -#endif - private: - template friend class json::details::JSON_Parser; - - json::number m_number; - }; - - class _Boolean : public _Value - { - public: - _Boolean(bool value) : m_value(value) { } - - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_Boolean>(*this); - } - - virtual json::value::value_type type() const { return json::value::Boolean; } - - virtual bool as_bool() const { return m_value; } - - protected: - virtual void format(std::basic_string& stream) const - { - stream.append(m_value ? "true" : "false"); - } - -#ifdef _WIN32 - virtual void format(std::basic_string& stream) const - { - stream.append(m_value ? L"true" : L"false"); - } -#endif - private: - template friend class json::details::JSON_Parser; - bool m_value; - }; - - class _String : public _Value - { - public: - - _String(utility::string_t value) : m_string(std::move(value)) - { - m_has_escape_char = has_escape_chars(*this); - } - _String(utility::string_t value, bool escaped_chars) - : m_string(std::move(value)), - m_has_escape_char(escaped_chars) - { } - -#ifdef _WIN32 - _String(std::string &&value) : m_string(utility::conversions::to_utf16string(std::move(value))) - { - m_has_escape_char = has_escape_chars(*this); - } - _String(std::string &&value, bool escape_chars) - : m_string(utility::conversions::to_utf16string(std::move(value))), - m_has_escape_char(escape_chars) - { } -#endif - - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_String>(*this); - } - - virtual json::value::value_type type() const { return json::value::String; } - - virtual const utility::string_t & as_string() const; - - virtual void serialize_impl(std::string& str) const - { - serialize_impl_char_type(str); - } -#ifdef _WIN32 - virtual void serialize_impl(std::wstring& str) const - { - serialize_impl_char_type(str); - } -#endif - - protected: - virtual void format(std::basic_string& str) const; -#ifdef _WIN32 - virtual void format(std::basic_string& str) const; -#endif - - private: - friend class _Object; - friend class _Array; - - size_t get_reserve_size() const - { - return m_string.size() + 2; - } - - template - void serialize_impl_char_type(std::basic_string& str) const - { - // To avoid repeated allocations reserve some space all up front. - // size of string + 2 for quotes - str.reserve(get_reserve_size()); - format(str); - } - - std::string as_utf8_string() const; - utf16string as_utf16_string() const; - - utility::string_t m_string; - - // There are significant performance gains that can be made by knowning whether - // or not a character that requires escaping is present. - bool m_has_escape_char; - static bool has_escape_chars(const _String &str); - }; - - template - _ASYNCRTIMP void append_escape_string(std::basic_string& str, const std::basic_string& escaped); - - void format_string(const utility::string_t& key, utility::string_t& str); - -#ifdef _WIN32 - void format_string(const utility::string_t& key, std::string& str); -#endif - - class _Object : public _Value - { - public: - - _Object(bool keep_order) : m_object(keep_order) { } - _Object(object::storage_type fields, bool keep_order) : m_object(std::move(fields), keep_order) { } - - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_Object>(*this); - } - - virtual json::object& as_object() { return m_object; } - - virtual const json::object& as_object() const { return m_object; } - - virtual json::value::value_type type() const { return json::value::Object; } - - virtual bool has_field(const utility::string_t &) const; - - virtual json::value &index(const utility::string_t &key); - - bool is_equal(const _Object* other) const - { - if (m_object.size() != other->m_object.size()) - return false; - - return std::equal(std::begin(m_object), std::end(m_object), std::begin(other->m_object)); - } - - virtual void serialize_impl(std::string& str) const - { - // To avoid repeated allocations reserve some space all up front. - str.reserve(get_reserve_size()); - format(str); - } -#ifdef _WIN32 - virtual void serialize_impl(std::wstring& str) const - { - // To avoid repeated allocations reserve some space all up front. - str.reserve(get_reserve_size()); - format(str); - } -#endif - size_t size() const { return m_object.size(); } - - protected: - virtual void format(std::basic_string& str) const - { - format_impl(str); - } -#ifdef _WIN32 - virtual void format(std::basic_string& str) const - { - format_impl(str); - } -#endif - - private: - json::object m_object; - - template friend class json::details::JSON_Parser; - - template - void format_impl(std::basic_string& str) const - { - str.push_back('{'); - if(!m_object.empty()) - { - auto lastElement = m_object.end() - 1; - for (auto iter = m_object.begin(); iter != lastElement; ++iter) - { - format_string(iter->first, str); - str.push_back(':'); - iter->second.format(str); - str.push_back(','); - } - format_string(lastElement->first, str); - str.push_back(':'); - lastElement->second.format(str); - } - str.push_back('}'); - } - - size_t get_reserve_size() const - { - // This is a heuristic we can tune more in the future: - // Basically size of string plus - // sum size of value if an object, array, or string. - size_t reserveSize = 2; // For brackets {} - for(auto iter = m_object.begin(); iter != m_object.end(); ++iter) - { - reserveSize += iter->first.length() + 2; // 2 for quotes - size_t valueSize = iter->second.size() * 20; // Multipler by each object/array element - if(valueSize == 0) - { - if(iter->second.type() == json::value::String) - { - valueSize = static_cast<_String *>(iter->second.m_value.get())->get_reserve_size(); - } - else - { - valueSize = 5; // true, false, or null - } - } - reserveSize += valueSize; - } - return reserveSize; - } - }; - - class _Array : public _Value - { - public: - _Array() {} - _Array(array::size_type size) : m_array(size) {} - _Array(array::storage_type elements) : m_array(std::move(elements)) { } - - virtual std::unique_ptr<_Value> _copy_value() - { - return utility::details::make_unique<_Array>(*this); - } - - virtual json::value::value_type type() const { return json::value::Array; } - - virtual json::array& as_array() { return m_array; } - virtual const json::array& as_array() const { return m_array; } - - virtual json::value &index(json::array::size_type index) - { - return m_array[index]; - } - - bool is_equal(const _Array* other) const - { - if ( m_array.size() != other->m_array.size()) - return false; - - auto iterT = m_array.cbegin(); - auto iterO = other->m_array.cbegin(); - auto iterTe = m_array.cend(); - auto iterOe = other->m_array.cend(); - - for (; iterT != iterTe && iterO != iterOe; ++iterT, ++iterO) - { - if ( *iterT != *iterO ) - return false; - } - - return true; - } - - virtual void serialize_impl(std::string& str) const - { - // To avoid repeated allocations reserve some space all up front. - str.reserve(get_reserve_size()); - format(str); - } -#ifdef _WIN32 - virtual void serialize_impl(std::wstring& str) const - { - // To avoid repeated allocations reserve some space all up front. - str.reserve(get_reserve_size()); - format(str); - } -#endif - size_t size() const { return m_array.size(); } - - protected: - virtual void format(std::basic_string& str) const - { - format_impl(str); - } -#ifdef _WIN32 - virtual void format(std::basic_string& str) const - { - format_impl(str); - } -#endif - private: - json::array m_array; - - template friend class json::details::JSON_Parser; - - template - void format_impl(std::basic_string& str) const - { - str.push_back('['); - if(!m_array.m_elements.empty()) - { - auto lastElement = m_array.m_elements.end() - 1; - for (auto iter = m_array.m_elements.begin(); iter != lastElement; ++iter) - { - iter->format(str); - str.push_back(','); - } - lastElement->format(str); - } - str.push_back(']'); - } - - size_t get_reserve_size() const - { - // This is a heuristic we can tune more in the future: - // Basically sum size of each value if an object, array, or string by a multiplier. - size_t reserveSize = 2; // For brackets [] - for(auto iter = m_array.cbegin(); iter != m_array.cend(); ++iter) - { - size_t valueSize = iter->size() * 20; // Per each nested array/object - - if(valueSize == 0) - valueSize = 5; // true, false, or null - - reserveSize += valueSize; - } - return reserveSize; - } - }; - } // namespace details - - /// - /// Gets the number of children of the value. - /// - /// The number of children. 0 for all non-composites. - inline size_t json::value::size() const - { - return m_value->size(); - } - - /// - /// Test for the presence of a field. - /// - /// The name of the field - /// True if the field exists, false otherwise. - inline bool json::value::has_field(const utility::string_t& key) const - { - return m_value->has_field(key); - } - - /// - /// Access a field of a JSON object. - /// - /// The name of the field - /// The value kept in the field; null if the field does not exist - inline json::value json::value::get(const utility::string_t& key) const - { - return m_value->get_field(key); - } - - /// - /// Access an element of a JSON array. - /// - /// The index of an element in the JSON array - /// The value kept at the array index; null if outside the boundaries of the array - inline json::value json::value::get(size_t index) const - { - return m_value->get_element(index); - } - - /// - /// A standard std::ostream operator to facilitate writing JSON values to streams. - /// - /// The output stream to write the JSON value to. - /// The JSON value to be written to the stream. - /// The output stream object - _ASYNCRTIMP utility::ostream_t& __cdecl operator << (utility::ostream_t &os, const json::value &val); - - /// - /// A standard std::istream operator to facilitate reading JSON values from streams. - /// - /// The input stream to read the JSON value from. - /// The JSON value object read from the stream. - /// The input stream object. - _ASYNCRTIMP utility::istream_t& __cdecl operator >> (utility::istream_t &is, json::value &val); -}} - -#endif diff --git a/src/corehost/cli/json/casablanca/include/stdafx.h b/src/corehost/cli/json/casablanca/include/stdafx.h deleted file mode 100644 index 553d828a6..000000000 --- a/src/corehost/cli/json/casablanca/include/stdafx.h +++ /dev/null @@ -1,109 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* Pre-compiled headers -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#pragma once - -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-local-typedef" -#endif - -#include -#include -#ifdef _WIN32 -#ifdef CPPREST_TARGET_XP -#include -#ifndef _WIN32_WINNT -#define _WIN32_WINNT _WIN32_WINNT_WS03 //Windows XP with SP2 -#endif -#endif -#include -// use the debug version of the CRT if _DEBUG is defined -#ifdef _DEBUG - #define _CRTDBG_MAP_ALLOC - #include - #include -#endif - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#define NOMINMAX -#endif - -#include -#include - -// Windows Header Files: -#if !defined(__cplusplus_winrt) -#include - -#endif // #if !defined(__cplusplus_winrt) -#else // LINUX or APPLE -#define __STDC_LIMIT_MACROS -#include -#include -#include -#include -#include -#include -#include -#include "pthread.h" -#include -#include -#include -#include -#endif // _WIN32 - -// Macro indicating the C++ Rest SDK product itself is being built. -// This is to help track how many developers are directly building from source themselves. -#define _CASA_BUILD_FROM_SRC - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// json -#include "cpprest/json.h" - -#if defined(max) -#error: max macro defined -- make sure to #define NOMINMAX before including windows.h -#endif -#if defined(min) -#error: min macro defined -- make sure to #define NOMINMAX before including windows.h -#endif - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - diff --git a/src/corehost/cli/json/casablanca/src/json/json.cpp b/src/corehost/cli/json/casablanca/src/json/json.cpp deleted file mode 100644 index c5d45544d..000000000 --- a/src/corehost/cli/json/casablanca/src/json/json.cpp +++ /dev/null @@ -1,495 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* HTTP Library: JSON parser and writer -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#include "stdafx.h" - -using namespace web; - -bool json::details::g_keep_json_object_unsorted = false; -void json::keep_object_element_order(bool keep_order) -{ - json::details::g_keep_json_object_unsorted = keep_order; -} - -utility::ostream_t& web::json::operator << (utility::ostream_t &os, const web::json::value &val) -{ - val.serialize(os); - return os; -} - -utility::istream_t& web::json::operator >> (utility::istream_t &is, json::value &val) -{ - val = json::value::parse(is); - return is; -} - -web::json::value::value() : - m_value(utility::details::make_unique()) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Null) -#endif - { } - -web::json::value::value(int32_t value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Number) -#endif - { } - -web::json::value::value(uint32_t value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Number) -#endif - { } - -web::json::value::value(int64_t value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Number) -#endif - { } - -web::json::value::value(uint64_t value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Number) -#endif - { } - -web::json::value::value(double value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Number) -#endif - { } - -web::json::value::value(bool value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::Boolean) -#endif - { } - -web::json::value::value(utility::string_t value) : - m_value(utility::details::make_unique(std::move(value))) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::String) -#endif - { } - -web::json::value::value(utility::string_t value, bool has_escape_chars) : -m_value(utility::details::make_unique(std::move(value), has_escape_chars)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER -, m_kind(value::String) -#endif -{ } - -web::json::value::value(const utility::char_t* value) : - m_value(utility::details::make_unique(value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(value::String) -#endif - { } - -web::json::value::value(const utility::char_t* value, bool has_escape_chars) : -m_value(utility::details::make_unique(utility::string_t(value), has_escape_chars)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER -, m_kind(value::String) -#endif -{ } - -web::json::value::value(const value &other) : - m_value(other.m_value->_copy_value()) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(other.m_kind) -#endif - { } - -web::json::value &web::json::value::operator=(const value &other) -{ - if(this != &other) - { - m_value = std::unique_ptr(other.m_value->_copy_value()); -#ifdef ENABLE_JSON_VALUE_VISUALIZER - m_kind = other.m_kind; -#endif - } - return *this; -} - -web::json::value::value(value &&other) CPPREST_NOEXCEPT : - m_value(std::move(other.m_value)) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,m_kind(other.m_kind) -#endif -{} - -web::json::value &web::json::value::operator=(web::json::value &&other) CPPREST_NOEXCEPT -{ - if(this != &other) - { - m_value.swap(other.m_value); -#ifdef ENABLE_JSON_VALUE_VISUALIZER - m_kind = other.m_kind; -#endif - } - return *this; -} - -web::json::value web::json::value::null() -{ - return web::json::value(); -} - -web::json::value web::json::value::number(double value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::number(int32_t value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::number(uint32_t value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::number(int64_t value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::number(uint64_t value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::boolean(bool value) -{ - return web::json::value(value); -} - -web::json::value web::json::value::string(utility::string_t value) -{ - std::unique_ptr ptr = utility::details::make_unique(std::move(value)); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::String -#endif - ); -} - -web::json::value web::json::value::string(utility::string_t value, bool has_escape_chars) -{ - std::unique_ptr ptr = utility::details::make_unique(std::move(value), has_escape_chars); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::String -#endif - ); -} - -#ifdef _WIN32 -web::json::value web::json::value::string(const std::string &value) -{ - std::unique_ptr ptr = utility::details::make_unique(utility::conversions::to_utf16string(value)); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::String -#endif - ); -} -#endif - -web::json::value web::json::value::object(bool keep_order) -{ - std::unique_ptr ptr = utility::details::make_unique(keep_order); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::Object -#endif - ); -} - -web::json::value web::json::value::object(std::vector> fields, bool keep_order) -{ - std::unique_ptr ptr = utility::details::make_unique(std::move(fields), keep_order); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::Object -#endif - ); -} - -web::json::value web::json::value::array() -{ - std::unique_ptr ptr = utility::details::make_unique(); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::Array -#endif - ); -} - -web::json::value web::json::value::array(size_t size) -{ - std::unique_ptr ptr = utility::details::make_unique(size); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::Array -#endif - ); -} - -web::json::value web::json::value::array(std::vector elements) -{ - std::unique_ptr ptr = utility::details::make_unique(std::move(elements)); - return web::json::value(std::move(ptr) -#ifdef ENABLE_JSON_VALUE_VISUALIZER - ,value::Array -#endif - ); -} - -const web::json::number& web::json::value::as_number() const -{ - return m_value->as_number(); -} - -double web::json::value::as_double() const -{ - return m_value->as_double(); -} - -int web::json::value::as_integer() const -{ - return m_value->as_integer(); -} - -bool web::json::value::as_bool() const -{ - return m_value->as_bool(); -} - -json::array& web::json::value::as_array() -{ - return m_value->as_array(); -} - -const json::array& web::json::value::as_array() const -{ - return m_value->as_array(); -} - -json::object& web::json::value::as_object() -{ - return m_value->as_object(); -} - -const json::object& web::json::value::as_object() const -{ - return m_value->as_object(); -} - -bool web::json::number::is_int32() const -{ - switch (m_type) - { - case signed_type : return m_intval >= std::numeric_limits::min() && m_intval <= std::numeric_limits::max(); - case unsigned_type : return m_uintval <= std::numeric_limits::max(); - case double_type : - default : - return false; - } -} - -bool web::json::number::is_uint32() const -{ - switch (m_type) - { - case signed_type : return m_intval >= 0 && m_intval <= std::numeric_limits::max(); - case unsigned_type : return m_uintval <= std::numeric_limits::max(); - case double_type : - default : - return false; - } -} - -bool web::json::number::is_int64() const -{ - switch (m_type) - { - case signed_type : return true; - case unsigned_type : return m_uintval <= static_cast(std::numeric_limits::max()); - case double_type : - default : - return false; - } -} - -bool web::json::details::_String::has_escape_chars(const _String &str) -{ - return std::any_of(std::begin(str.m_string), std::end(str.m_string), [](utility::string_t::value_type const x) - { - if (x <= 31) { return true; } - if (x == '"') { return true; } - if (x == '\\') { return true; } - return false; - }); -} - -web::json::value::value_type json::value::type() const { return m_value->type(); } - -bool json::value::is_integer() const -{ - if(!is_number()) - { - return false; - } - return m_value->is_integer(); -} - -bool json::value::is_double() const -{ - if(!is_number()) - { - return false; - } - return m_value->is_double(); -} - -json::value& web::json::details::_Object::index(const utility::string_t &key) -{ - return m_object[key]; -} - -bool web::json::details::_Object::has_field(const utility::string_t &key) const -{ - return m_object.find(key) != m_object.end(); -} - -utility::string_t json::value::to_string() const -{ -#ifndef _WIN32 - utility::details::scoped_c_thread_locale locale; -#endif - return m_value->to_string(); -} - -bool json::value::operator==(const json::value &other) const -{ - if (this->m_value.get() == other.m_value.get()) - return true; - if (this->type() != other.type()) - return false; - - switch(this->type()) - { - case Null: - return true; - case Number: - return this->as_number() == other.as_number(); - case Boolean: - return this->as_bool() == other.as_bool(); - case String: - return this->as_string() == other.as_string(); - case Object: - return static_cast(this->m_value.get())->is_equal(static_cast(other.m_value.get())); - case Array: - return static_cast(this->m_value.get())->is_equal(static_cast(other.m_value.get())); - } - __assume(0); -} - -void web::json::value::erase(size_t index) -{ - return this->as_array().erase(index); -} - -void web::json::value::erase(const utility::string_t &key) -{ - return this->as_object().erase(key); -} - -// at() overloads -web::json::value& web::json::value::at(size_t index) -{ - return this->as_array().at(index); -} - -const web::json::value& web::json::value::at(size_t index) const -{ - return this->as_array().at(index); -} - -web::json::value& web::json::value::at(const utility::string_t& key) -{ - return this->as_object().at(key); -} - -const web::json::value& web::json::value::at(const utility::string_t& key) const -{ - return this->as_object().at(key); -} - -web::json::value& web::json::value::operator [] (const utility::string_t &key) -{ - if ( this->is_null() ) - { - m_value.reset(new web::json::details::_Object(details::g_keep_json_object_unsorted)); -#ifdef ENABLE_JSON_VALUE_VISUALIZER - m_kind = value::Object; -#endif - } - return m_value->index(key); -} - -web::json::value& web::json::value::operator[](size_t index) -{ - if ( this->is_null() ) - { - m_value.reset(new web::json::details::_Array()); -#ifdef ENABLE_JSON_VALUE_VISUALIZER - m_kind = value::Array; -#endif - } - return m_value->index(index); -} - -// Remove once VS 2013 is no longer supported. -#if defined(_WIN32) && _MSC_VER < 1900 -static web::json::details::json_error_category_impl instance; -#endif -const web::json::details::json_error_category_impl& web::json::details::json_error_category() -{ -#if !defined(_WIN32) || _MSC_VER >= 1900 - static web::json::details::json_error_category_impl instance; -#endif - return instance; -} diff --git a/src/corehost/cli/json/casablanca/src/json/json_parsing.cpp b/src/corehost/cli/json/casablanca/src/json/json_parsing.cpp deleted file mode 100644 index 1cf40dc67..000000000 --- a/src/corehost/cli/json/casablanca/src/json/json_parsing.cpp +++ /dev/null @@ -1,1312 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* HTTP Library: JSON parser -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#include "stdafx.h" -#include - -#if defined(_MSC_VER) -#pragma warning(disable : 4127) // allow expressions like while(true) pass -#endif -using namespace web; -using namespace web::json; -using namespace utility; -using namespace utility::conversions; - -std::array _hexval = {{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }}; - -namespace web { -namespace json -{ -namespace details -{ - -// -// JSON Parsing -// - -template -#if defined(_WIN32) - __declspec(noreturn) -#else - __attribute__((noreturn)) -#endif -void CreateException(const Token &tk, const utility::string_t &message) -{ - utility::ostringstream_t os; - os << _XPLATSTR("* Line ") << tk.start.m_line << _XPLATSTR(", Column ") << tk.start.m_column << _XPLATSTR(" Syntax error: ") << message; - utility::string_t osStr = os.str(); - throw web::json::json_exception(osStr.c_str()); -} - -template -void SetErrorCode(Token &tk, json_error jsonErrorCode) -{ - tk.m_error = std::error_code(jsonErrorCode, json_error_category()); -} - -template -class JSON_Parser -{ -public: - JSON_Parser() - : m_currentLine(1), - m_currentColumn(1), - m_currentParsingDepth(0) - { } - - struct Location - { - size_t m_line; - size_t m_column; - }; - - struct Token - { - enum Kind - { - TKN_EOF, - - TKN_OpenBrace, - TKN_CloseBrace, - TKN_OpenBracket, - TKN_CloseBracket, - TKN_Comma, - TKN_Colon, - TKN_StringLiteral, - TKN_NumberLiteral, - TKN_IntegerLiteral, - TKN_BooleanLiteral, - TKN_NullLiteral, - TKN_Comment - }; - - Token() : kind(TKN_EOF) {} - - Kind kind; - std::basic_string string_val; - - typename JSON_Parser::Location start; - - union - { - double double_val; - int64_t int64_val; - uint64_t uint64_val; - bool boolean_val; - bool has_unescape_symbol; - }; - - bool signed_number; - - std::error_code m_error; - }; - - void GetNextToken(Token &); - - web::json::value ParseValue(typename JSON_Parser::Token &first) - { -#ifndef _WIN32 - utility::details::scoped_c_thread_locale locale; -#endif - -#ifdef ENABLE_JSON_VALUE_VISUALIZER - auto _value = _ParseValue(first); - auto type = _value->type(); - return web::json::value(std::move(_value), type); -#else - return web::json::value(_ParseValue(first)); -#endif - } - -protected: - typedef typename std::char_traits::int_type int_type; - virtual int_type NextCharacter() = 0; - virtual int_type PeekCharacter() = 0; - - virtual bool CompleteComment(Token &token); - virtual bool CompleteStringLiteral(Token &token); - bool handle_unescape_char(Token &token); - -private: - - bool CompleteNumberLiteral(CharType first, Token &token); - bool ParseInt64(CharType first, uint64_t& value); - bool CompleteKeywordTrue(Token &token); - bool CompleteKeywordFalse(Token &token); - bool CompleteKeywordNull(Token &token); - std::unique_ptr _ParseValue(typename JSON_Parser::Token &first); - std::unique_ptr _ParseObject(typename JSON_Parser::Token &tkn); - std::unique_ptr _ParseArray(typename JSON_Parser::Token &tkn); - - JSON_Parser& operator=(const JSON_Parser&); - - int_type EatWhitespace(); - - void CreateToken(typename JSON_Parser::Token& tk, typename Token::Kind kind, Location &start) - { - tk.kind = kind; - tk.start = start; - tk.string_val.clear(); - } - - void CreateToken(typename JSON_Parser::Token& tk, typename Token::Kind kind) - { - tk.kind = kind; - tk.start.m_line = m_currentLine; - tk.start.m_column = m_currentColumn; - tk.string_val.clear(); - } - -protected: - - size_t m_currentLine; - size_t m_currentColumn; - size_t m_currentParsingDepth; - -// The DEBUG macro is defined in XCode but we don't in our CMakeList -// so for now we will keep the same on debug and release. In the future -// this can be increase on release if necessary. -#if defined(__APPLE__) - static const size_t maxParsingDepth = 32; -#else - static const size_t maxParsingDepth = 128; -#endif -}; - -// Replace with template alias once VS 2012 support is removed. -template -typename std::char_traits::int_type eof() -{ - return std::char_traits::eof(); -} - -template -class JSON_StreamParser : public JSON_Parser - { -public: - JSON_StreamParser(std::basic_istream &stream) - : m_streambuf(stream.rdbuf()) - { - } - -protected: - - virtual typename JSON_Parser::int_type NextCharacter(); - virtual typename JSON_Parser::int_type PeekCharacter(); - -private: - typename std::basic_streambuf>* m_streambuf; -}; - -template -class JSON_StringParser : public JSON_Parser -{ -public: - JSON_StringParser(const std::basic_string& string) - : m_position(&string[0]) - { - m_startpos = m_position; - m_endpos = m_position+string.size(); - } - -protected: - - virtual typename JSON_Parser::int_type NextCharacter(); - virtual typename JSON_Parser::int_type PeekCharacter(); - - virtual bool CompleteComment(typename JSON_Parser::Token &token); - virtual bool CompleteStringLiteral(typename JSON_Parser::Token &token); - -private: - bool finish_parsing_string_with_unescape_char(typename JSON_Parser::Token &token); - const CharType* m_position; - const CharType* m_startpos; - const CharType* m_endpos; -}; - - -template -typename JSON_Parser::int_type JSON_StreamParser::NextCharacter() -{ - auto ch = m_streambuf->sbumpc(); - - if (ch == '\n') - { - this->m_currentLine += 1; - this->m_currentColumn = 0; - } - else - { - this->m_currentColumn += 1; - } - - return ch; -} - -template -typename JSON_Parser::int_type JSON_StreamParser::PeekCharacter() -{ - return m_streambuf->sgetc(); -} - -template -typename JSON_Parser::int_type JSON_StringParser::NextCharacter() -{ - if (m_position == m_endpos) - return eof(); - - CharType ch = *m_position; - m_position += 1; - - if ( ch == '\n' ) - { - this->m_currentLine += 1; - this->m_currentColumn = 0; - } - else - { - this->m_currentColumn += 1; - } - - return ch; -} - -template -typename JSON_Parser::int_type JSON_StringParser::PeekCharacter() -{ - if ( m_position == m_endpos ) return eof(); - - return *m_position; -} - -// -// Consume whitespace characters and return the first non-space character or EOF -// -template -typename JSON_Parser::int_type JSON_Parser::EatWhitespace() -{ - auto ch = NextCharacter(); - - while ( ch != eof() && iswspace(static_cast(ch))) - { - ch = NextCharacter(); - } - - return ch; -} - -template -bool JSON_Parser::CompleteKeywordTrue(Token &token) -{ - if (NextCharacter() != 'r') - return false; - if (NextCharacter() != 'u') - return false; - if (NextCharacter() != 'e') - return false; - token.kind = Token::TKN_BooleanLiteral; - token.boolean_val = true; - return true; -} - -template -bool JSON_Parser::CompleteKeywordFalse(Token &token) -{ - if (NextCharacter() != 'a') - return false; - if (NextCharacter() != 'l') - return false; - if (NextCharacter() != 's') - return false; - if (NextCharacter() != 'e') - return false; - token.kind = Token::TKN_BooleanLiteral; - token.boolean_val = false; - return true; -} - -template -bool JSON_Parser::CompleteKeywordNull(Token &token) -{ - if (NextCharacter() != 'u') - return false; - if (NextCharacter() != 'l') - return false; - if (NextCharacter() != 'l') - return false; - token.kind = Token::TKN_NullLiteral; - return true; -} - -// Returns false only on overflow -template -inline bool JSON_Parser::ParseInt64(CharType first, uint64_t& value) -{ - value = first - '0'; - auto ch = PeekCharacter(); - while (ch >= '0' && ch <= '9') - { - unsigned int next_digit = (unsigned int)(ch - '0'); - if (value > (ULLONG_MAX / 10) || (value == ULLONG_MAX/10 && next_digit > ULLONG_MAX%10)) - return false; - - NextCharacter(); - - value *= 10; - value += next_digit; - ch = PeekCharacter(); - } - return true; -} - -// This namespace hides the x-plat helper functions -namespace -{ -#if defined(_WIN32) - static int print_llu(char* ptr, size_t n, uint64_t val64) - { - return _snprintf_s_l(ptr, n, _TRUNCATE, "%I64u", utility::details::scoped_c_thread_locale::c_locale(), val64); - } - - static int print_llu(wchar_t* ptr, size_t n, uint64_t val64) - { - return _snwprintf_s_l(ptr, n, _TRUNCATE, L"%I64u", utility::details::scoped_c_thread_locale::c_locale(), val64); - } - static double anystod(const char* str) - { - return _strtod_l(str, nullptr, utility::details::scoped_c_thread_locale::c_locale()); - } - static double anystod(const wchar_t* str) - { - return _wcstod_l(str, nullptr, utility::details::scoped_c_thread_locale::c_locale()); - } -#else - static int __attribute__((__unused__)) print_llu(char* ptr, size_t n, unsigned long long val64) - { - return snprintf(ptr, n, "%llu", val64); - } - static int __attribute__((__unused__)) print_llu(char* ptr, size_t n, unsigned long val64) - { - return snprintf(ptr, n, "%lu", val64); - } - static double __attribute__((__unused__)) anystod(const char* str) - { - return strtod(str, nullptr); - } - static double __attribute__((__unused__)) anystod(const wchar_t* str) - { - return wcstod(str, nullptr); - } -#endif -} - -template -bool JSON_Parser::CompleteNumberLiteral(CharType first, Token &token) -{ - bool minus_sign; - - if (first == '-') - { - minus_sign = true; - - // Safe to cast because the check after this if/else statement will cover EOF. - first = static_cast(NextCharacter()); - } - else - { - minus_sign = false; - } - - if (first < '0' || first > '9') - return false; - - auto ch = PeekCharacter(); - - //Check for two (or more) zeros at the beginning - if (first == '0' && ch == '0') - return false; - - // Parse the number assuming its integer - uint64_t val64; - bool complete = ParseInt64(first, val64); - - ch = PeekCharacter(); - if (complete && ch!='.' && ch!='E' && ch!='e') - { - if (minus_sign) - { - if (val64 > static_cast(1) << 63 ) - { - // It is negative and cannot be represented in int64, so we resort to double - token.double_val = 0 - static_cast(val64); - token.signed_number = true; - token.kind = JSON_Parser::Token::TKN_NumberLiteral; - return true; - } - - // It is negative, but fits into int64 - token.int64_val = 0 - static_cast(val64); - token.kind = JSON_Parser::Token::TKN_IntegerLiteral; - token.signed_number = true; - return true; - } - - // It is positive so we use unsigned int64 - token.uint64_val = val64; - token.kind = JSON_Parser::Token::TKN_IntegerLiteral; - token.signed_number = false; - return true; - } - - // Magic number 5 leaves room for decimal point, null terminator, etc (in most cases) - ::std::vector buf(::std::numeric_limits::digits10 + 5); - int count = print_llu(buf.data(), buf.size(), val64); - _ASSERTE(count >= 0); - _ASSERTE((size_t)count < buf.size()); - // Resize to cut off the null terminator - buf.resize(count); - - bool decimal = false; - - while (ch != eof()) - { - // Digit encountered? - if (ch >= '0' && ch <= '9') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - - // Decimal dot? - else if (ch == '.') - { - if (decimal) - return false; - - decimal = true; - buf.push_back(static_cast(ch)); - - NextCharacter(); - ch = PeekCharacter(); - - // Check that the following char is a digit - if (ch < '0' || ch > '9') - return false; - - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - - // Exponent? - else if (ch == 'E' || ch == 'e') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - - // Check for the exponent sign - if (ch == '+') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - else if (ch == '-') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - - // First number of the exponent - if (ch >= '0' && ch <= '9') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - else return false; - - // The rest of the exponent - while (ch >= '0' && ch <= '9') - { - buf.push_back(static_cast(ch)); - NextCharacter(); - ch = PeekCharacter(); - } - - // The peeked character is not a number, so we can break from the loop and construct the number - break; - } - else - { - // Not expected number character? - break; - } - }; - - buf.push_back('\0'); - token.double_val = anystod(buf.data()); - if (minus_sign) - { - token.double_val = -token.double_val; - } - token.kind = (JSON_Parser::Token::TKN_NumberLiteral); - - return true; -} - -template -bool JSON_Parser::CompleteComment(Token &token) -{ - // We already found a '/' character as the first of a token -- what kind of comment is it? - - auto ch = NextCharacter(); - - if ( ch == eof() || (ch != '/' && ch != '*') ) - return false; - - if ( ch == '/' ) - { - // Line comment -- look for a newline or EOF to terminate. - - ch = NextCharacter(); - - while ( ch != eof() && ch != '\n') - { - ch = NextCharacter(); - } - } - else - { - // Block comment -- look for a terminating "*/" sequence. - - ch = NextCharacter(); - - while ( true ) - { - if ( ch == eof()) - return false; - - if ( ch == '*' ) - { - auto ch1 = PeekCharacter(); - - if ( ch1 == eof()) - return false; - - if ( ch1 == '/' ) - { - // Consume the character - NextCharacter(); - break; - } - - ch = ch1; - } - - ch = NextCharacter(); - } - } - - token.kind = Token::TKN_Comment; - - return true; -} - -template -bool JSON_StringParser::CompleteComment(typename JSON_Parser::Token &token) -{ - // This function is specialized for the string parser, since we can be slightly more - // efficient in copying data from the input to the token: do a memcpy() rather than - // one character at a time. - - auto ch = JSON_StringParser::NextCharacter(); - - if ( ch == eof() || (ch != '/' && ch != '*') ) - return false; - - if ( ch == '/' ) - { - // Line comment -- look for a newline or EOF to terminate. - - ch = JSON_StringParser::NextCharacter(); - - while ( ch != eof() && ch != '\n') - { - ch = JSON_StringParser::NextCharacter(); - } - } - else - { - // Block comment -- look for a terminating "*/" sequence. - - ch = JSON_StringParser::NextCharacter(); - - while ( true ) - { - if ( ch == eof()) - return false; - - if ( ch == '*' ) - { - ch = JSON_StringParser::PeekCharacter(); - - if ( ch == eof()) - return false; - - if ( ch == '/' ) - { - // Consume the character - JSON_StringParser::NextCharacter(); - break; - } - - } - - ch = JSON_StringParser::NextCharacter(); - } - } - - token.kind = JSON_Parser::Token::TKN_Comment; - - return true; -} - -void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16char value) -{ - token.string_val.push_back(value); -} -void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16char value) -{ - utf16string utf16(reinterpret_cast(&value), 1); - token.string_val.append(::utility::conversions::utf16_to_utf8(utf16)); -} - -template -inline bool JSON_Parser::handle_unescape_char(Token &token) -{ - token.has_unescape_symbol = true; - - // This function converts unescaped character pairs (e.g. "\t") into their ASCII or Unicode representations (e.g. tab sign) - // Also it handles \u + 4 hexadecimal digits - auto ch = NextCharacter(); - switch (ch) - { - case '\"': - token.string_val.push_back('\"'); - return true; - case '\\': - token.string_val.push_back('\\'); - return true; - case '/': - token.string_val.push_back('/'); - return true; - case 'b': - token.string_val.push_back('\b'); - return true; - case 'f': - token.string_val.push_back('\f'); - return true; - case 'r': - token.string_val.push_back('\r'); - return true; - case 'n': - token.string_val.push_back('\n'); - return true; - case 't': - token.string_val.push_back('\t'); - return true; - case 'u': - { - // A four-hexdigit Unicode character. - // Transform into a 16 bit code point. - int decoded = 0; - for (int i = 0; i < 4; ++i) - { - ch = NextCharacter(); - int ch_int = static_cast(ch); - if (ch_int < 0 || ch_int > 127) - return false; -#ifdef _WIN32 - const int isxdigitResult = _isxdigit_l(ch_int, utility::details::scoped_c_thread_locale::c_locale()); -#else - const int isxdigitResult = isxdigit(ch_int); -#endif - if (!isxdigitResult) - return false; - - int val = _hexval[static_cast(ch_int)]; - _ASSERTE(val != -1); - - // Add the input char to the decoded number - decoded |= (val << (4 * (3 - i))); - } - - // Construct the character based on the decoded number - convert_append_unicode_code_unit(token, static_cast(decoded)); - - return true; - } - default: - return false; - } -} - -template -bool JSON_Parser::CompleteStringLiteral(Token &token) -{ - token.has_unescape_symbol = false; - auto ch = NextCharacter(); - while ( ch != '"' ) - { - if ( ch == '\\' ) - { - handle_unescape_char(token); - } - else if (ch >= CharType(0x0) && ch < CharType(0x20)) - { - return false; - } - else - { - if (ch == eof()) - return false; - - token.string_val.push_back(static_cast(ch)); - } - ch = NextCharacter(); - } - - if ( ch == '"' ) - { - token.kind = Token::TKN_StringLiteral; - } - else - { - return false; - } - - return true; -} - -template -bool JSON_StringParser::CompleteStringLiteral(typename JSON_Parser::Token &token) -{ - // This function is specialized for the string parser, since we can be slightly more - // efficient in copying data from the input to the token: do a memcpy() rather than - // one character at a time. - - auto start = m_position; - token.has_unescape_symbol = false; - - auto ch = JSON_StringParser::NextCharacter(); - - while (ch != '"') - { - if (ch == eof()) - return false; - - if (ch == '\\') - { - const size_t numChars = m_position - start - 1; - const size_t prevSize = token.string_val.size(); - token.string_val.resize(prevSize + numChars); - memcpy(const_cast(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); - - if (!JSON_StringParser::handle_unescape_char(token)) - { - return false; - } - - // Reset start position and continue. - start = m_position; - } - else if (ch >= CharType(0x0) && ch < CharType(0x20)) - { - return false; - } - - ch = JSON_StringParser::NextCharacter(); - } - - const size_t numChars = m_position - start - 1; - const size_t prevSize = token.string_val.size(); - token.string_val.resize(prevSize + numChars); - memcpy(const_cast(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); - - token.kind = JSON_Parser::Token::TKN_StringLiteral; - - return true; -} - -template -void JSON_Parser::GetNextToken(typename JSON_Parser::Token& result) -{ -try_again: - auto ch = EatWhitespace(); - - CreateToken(result, Token::TKN_EOF); - - if (ch == eof()) return; - - switch (ch) - { - case '{': - case '[': - { - if(++m_currentParsingDepth > JSON_Parser::maxParsingDepth) - { - SetErrorCode(result, json_error::nesting); - break; - } - - typename JSON_Parser::Token::Kind tk = ch == '{' ? Token::TKN_OpenBrace : Token::TKN_OpenBracket; - CreateToken(result, tk, result.start); - break; - } - case '}': - case ']': - { - if((signed int)(--m_currentParsingDepth) < 0) - { - SetErrorCode(result, json_error::mismatched_brances); - break; - } - - typename JSON_Parser::Token::Kind tk = ch == '}' ? Token::TKN_CloseBrace : Token::TKN_CloseBracket; - CreateToken(result, tk, result.start); - break; - } - case ',': - CreateToken(result, Token::TKN_Comma, result.start); - break; - - case ':': - CreateToken(result, Token::TKN_Colon, result.start); - break; - - case 't': - if (!CompleteKeywordTrue(result)) - { - SetErrorCode(result, json_error::malformed_literal); - } - break; - case 'f': - if (!CompleteKeywordFalse(result)) - { - SetErrorCode(result, json_error::malformed_literal); - } - break; - case 'n': - if (!CompleteKeywordNull(result)) - { - SetErrorCode(result, json_error::malformed_literal); - } - break; - case '/': - if (!CompleteComment(result)) - { - SetErrorCode(result, json_error::malformed_comment); - break; - } - // For now, we're ignoring comments. - goto try_again; - case '"': - if (!CompleteStringLiteral(result)) - { - SetErrorCode(result, json_error::malformed_string_literal); - } - break; - - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (!CompleteNumberLiteral(static_cast(ch), result)) - { - SetErrorCode(result, json_error::malformed_numeric_literal); - } - break; - default: - SetErrorCode(result, json_error::malformed_token); - break; - } -} - -template -std::unique_ptr JSON_Parser::_ParseObject(typename JSON_Parser::Token &tkn) -{ - auto obj = utility::details::make_unique(g_keep_json_object_unsorted); - auto& elems = obj->m_object.m_elements; - - GetNextToken(tkn); - if (tkn.m_error) goto error; - - if (tkn.kind != JSON_Parser::Token::TKN_CloseBrace) - { - while (true) - { - // State 1: New field or end of object, looking for field name or closing brace - std::basic_string fieldName; - switch (tkn.kind) - { - case JSON_Parser::Token::TKN_StringLiteral: - fieldName = std::move(tkn.string_val); - break; - default: - goto error; - } - - GetNextToken(tkn); - if (tkn.m_error) goto error; - - // State 2: Looking for a colon. - if (tkn.kind != JSON_Parser::Token::TKN_Colon) goto done; - - GetNextToken(tkn); - if (tkn.m_error) goto error; - - // State 3: Looking for an expression. -#ifdef ENABLE_JSON_VALUE_VISUALIZER - auto fieldValue = _ParseValue(tkn); - auto type = fieldValue->type(); - elems.emplace_back(utility::conversions::to_string_t(std::move(fieldName)), json::value(std::move(fieldValue), type)); -#else - elems.emplace_back(utility::conversions::to_string_t(std::move(fieldName)), json::value(_ParseValue(tkn))); -#endif - if (tkn.m_error) goto error; - - // State 4: Looking for a comma or a closing brace - switch (tkn.kind) - { - case JSON_Parser::Token::TKN_Comma: - GetNextToken(tkn); - if (tkn.m_error) goto error; - break; - case JSON_Parser::Token::TKN_CloseBrace: - goto done; - default: - goto error; - } - } - } - -done: - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - - if (!g_keep_json_object_unsorted) { - ::std::sort(elems.begin(), elems.end(), json::object::compare_pairs); - } - - return std::move(obj); - -error: - if (!tkn.m_error) - { - SetErrorCode(tkn, json_error::malformed_object_literal); - } - return utility::details::make_unique(); -} - -template -std::unique_ptr JSON_Parser::_ParseArray(typename JSON_Parser::Token &tkn) -{ - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - - auto result = utility::details::make_unique(); - - if (tkn.kind != JSON_Parser::Token::TKN_CloseBracket) - { - while (true) - { - // State 1: Looking for an expression. - result->m_array.m_elements.emplace_back(ParseValue(tkn)); - if (tkn.m_error) return utility::details::make_unique(); - - // State 4: Looking for a comma or a closing bracket - switch (tkn.kind) - { - case JSON_Parser::Token::TKN_Comma: - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - break; - case JSON_Parser::Token::TKN_CloseBracket: - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - return std::move(result); - default: - SetErrorCode(tkn, json_error::malformed_array_literal); - return utility::details::make_unique(); - } - } - } - - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - - return std::move(result); -} - -template -std::unique_ptr JSON_Parser::_ParseValue(typename JSON_Parser::Token &tkn) -{ - switch (tkn.kind) - { - case JSON_Parser::Token::TKN_OpenBrace: - { - return _ParseObject(tkn); - } - case JSON_Parser::Token::TKN_OpenBracket: - { - return _ParseArray(tkn); - } - case JSON_Parser::Token::TKN_StringLiteral: - { - auto value = utility::details::make_unique(std::move(tkn.string_val), tkn.has_unescape_symbol); - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - return std::move(value); - } - case JSON_Parser::Token::TKN_IntegerLiteral: - { - std::unique_ptr value; - if (tkn.signed_number) - value = utility::details::make_unique(tkn.int64_val); - else - value = utility::details::make_unique(tkn.uint64_val); - - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - return std::move(value); - } - case JSON_Parser::Token::TKN_NumberLiteral: - { - auto value = utility::details::make_unique(tkn.double_val); - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - return std::move(value); - } - case JSON_Parser::Token::TKN_BooleanLiteral: - { - auto value = utility::details::make_unique(tkn.boolean_val); - GetNextToken(tkn); - if (tkn.m_error) return utility::details::make_unique(); - return std::move(value); - } - case JSON_Parser::Token::TKN_NullLiteral: - { - GetNextToken(tkn); - // Returning a null value whether or not an error occurred. - return utility::details::make_unique(); - } - default: - { - SetErrorCode(tkn, json_error::malformed_token); - return utility::details::make_unique(); - } - } -} - -}}} - -static web::json::value _parse_stream(utility::istream_t &stream) -{ - web::json::details::JSON_StreamParser parser(stream); - web::json::details::JSON_Parser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - - auto value = parser.ParseValue(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - else if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - web::json::details::CreateException(tkn, _XPLATSTR("Left-over characters in stream after parsing a JSON value")); - } - return value; -} - -static web::json::value _parse_stream(utility::istream_t &stream, std::error_code& error) -{ - web::json::details::JSON_StreamParser parser(stream); - web::json::details::JSON_Parser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - error = std::move(tkn.m_error); - return web::json::value(); - } - - auto returnObject = parser.ParseValue(tkn); - if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - web::json::details::SetErrorCode(tkn, web::json::details::json_error::left_over_character_in_stream); - } - - error = std::move(tkn.m_error); - return returnObject; -} - -#ifdef _WIN32 -static web::json::value _parse_narrow_stream(std::istream &stream) -{ - web::json::details::JSON_StreamParser parser(stream); - web::json::details::JSON_StreamParser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - - auto value = parser.ParseValue(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - else if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - web::json::details::CreateException(tkn, _XPLATSTR("Left-over characters in stream after parsing a JSON value")); - } - return value; -} - -static web::json::value _parse_narrow_stream(std::istream &stream, std::error_code& error) -{ - web::json::details::JSON_StreamParser parser(stream); - web::json::details::JSON_StreamParser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - error = std::move(tkn.m_error); - return web::json::value(); - } - - auto returnObject = parser.ParseValue(tkn); - if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - returnObject = web::json::value(); - web::json::details::SetErrorCode(tkn, web::json::details::json_error::left_over_character_in_stream); - } - - error = std::move(tkn.m_error); - return returnObject; -} -#endif - -web::json::value web::json::value::parse(const utility::string_t& str) -{ - web::json::details::JSON_StringParser parser(str); - web::json::details::JSON_Parser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - - auto value = parser.ParseValue(tkn); - if (tkn.m_error) - { - web::json::details::CreateException(tkn, utility::conversions::to_string_t(tkn.m_error.message())); - } - else if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - web::json::details::CreateException(tkn, _XPLATSTR("Left-over characters in stream after parsing a JSON value")); - } - return value; -} - -web::json::value web::json::value::parse(const utility::string_t& str, std::error_code& error) -{ - web::json::details::JSON_StringParser parser(str); - web::json::details::JSON_Parser::Token tkn; - - parser.GetNextToken(tkn); - if (tkn.m_error) - { - error = std::move(tkn.m_error); - return web::json::value(); - } - - auto returnObject = parser.ParseValue(tkn); - if (tkn.kind != web::json::details::JSON_Parser::Token::TKN_EOF) - { - returnObject = web::json::value(); - web::json::details::SetErrorCode(tkn, web::json::details::json_error::left_over_character_in_stream); - } - - error = std::move(tkn.m_error); - return returnObject; -} - -web::json::value web::json::value::parse(utility::istream_t &stream) -{ - return _parse_stream(stream); -} - -web::json::value web::json::value::parse(utility::istream_t &stream, std::error_code& error) -{ - return _parse_stream(stream, error); -} - -#ifdef _WIN32 -web::json::value web::json::value::parse(std::istream& stream) -{ - return _parse_narrow_stream(stream); -} - -web::json::value web::json::value::parse(std::istream& stream, std::error_code& error) -{ - return _parse_narrow_stream(stream, error); -} -#endif diff --git a/src/corehost/cli/json/casablanca/src/json/json_serialization.cpp b/src/corehost/cli/json/casablanca/src/json/json_serialization.cpp deleted file mode 100644 index e99e0bc5a..000000000 --- a/src/corehost/cli/json/casablanca/src/json/json_serialization.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* HTTP Library: JSON parser and writer -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#include "stdafx.h" -#include - -#ifndef _WIN32 -#define __STDC_FORMAT_MACROS -#include -#endif - -using namespace web; -using namespace web::json; -using namespace utility; -using namespace utility::conversions; - -// -// JSON Serialization -// - -#ifdef _WIN32 -void web::json::value::serialize(std::ostream& stream) const -{ - // This has better performance than writing directly to stream. - std::string str; - m_value->serialize_impl(str); - stream << str; -} -void web::json::value::format(std::basic_string &string) const -{ - m_value->format(string); -} -#endif - -void web::json::value::serialize(utility::ostream_t &stream) const -{ -#ifndef _WIN32 - utility::details::scoped_c_thread_locale locale; -#endif - - // This has better performance than writing directly to stream. - utility::string_t str; - m_value->serialize_impl(str); - stream << str; -} - -void web::json::value::format(std::basic_string& string) const -{ - m_value->format(string); -} - -template -void web::json::details::append_escape_string(std::basic_string& str, const std::basic_string& escaped) -{ - for (const auto &ch : escaped) - { - switch (ch) - { - case '\"': - str += '\\'; - str += '\"'; - break; - case '\\': - str += '\\'; - str += '\\'; - break; - case '\b': - str += '\\'; - str += 'b'; - break; - case '\f': - str += '\\'; - str += 'f'; - break; - case '\r': - str += '\\'; - str += 'r'; - break; - case '\n': - str += '\\'; - str += 'n'; - break; - case '\t': - str += '\\'; - str += 't'; - break; - default: - - // If a control character then must unicode escaped. - if (ch >= 0 && ch <= 0x1F) - { - static const std::array intToHex = { { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' } }; - str += '\\'; - str += 'u'; - str += '0'; - str += '0'; - str += intToHex[(ch & 0xF0) >> 4]; - str += intToHex[ch & 0x0F]; - } - else - { - str += ch; - } - } - } -} - -void web::json::details::format_string(const utility::string_t& key, utility::string_t& str) -{ - str.push_back('"'); - append_escape_string(str, key); - str.push_back('"'); -} - -#ifdef _WIN32 -void web::json::details::format_string(const utility::string_t& key, std::string& str) -{ - str.push_back('"'); - append_escape_string(str, utility::conversions::to_utf8string(key)); - str.push_back('"'); -} -#endif - -void web::json::details::_String::format(std::basic_string& str) const -{ - str.push_back('"'); - - if(m_has_escape_char) - { - append_escape_string(str, utility::conversions::to_utf8string(m_string)); - } - else - { - str.append(utility::conversions::to_utf8string(m_string)); - } - - str.push_back('"'); -} - -void web::json::details::_Number::format(std::basic_string& stream) const -{ - if(m_number.m_type != number::type::double_type) - { - // #digits + 1 to avoid loss + 1 for the sign + 1 for null terminator. - const size_t tempSize = std::numeric_limits::digits10 + 3; - char tempBuffer[tempSize]; - -#ifdef _WIN32 - // This can be improved performance-wise if we implement our own routine - if (m_number.m_type == number::type::signed_type) - _i64toa_s(m_number.m_intval, tempBuffer, tempSize, 10); - else - _ui64toa_s(m_number.m_uintval, tempBuffer, tempSize, 10); - - const auto numChars = strnlen_s(tempBuffer, tempSize); -#else - int numChars; - if (m_number.m_type == number::type::signed_type) - numChars = snprintf(tempBuffer, tempSize, "%" PRId64, m_number.m_intval); - else - numChars = snprintf(tempBuffer, tempSize, "%" PRIu64, m_number.m_uintval); -#endif - stream.append(tempBuffer, numChars); - } - else - { - // #digits + 2 to avoid loss + 1 for the sign + 1 for decimal point + 5 for exponent (e+xxx) + 1 for null terminator - const size_t tempSize = std::numeric_limits::digits10 + 10; - char tempBuffer[tempSize]; -#ifdef _WIN32 - const auto numChars = _sprintf_s_l( - tempBuffer, - tempSize, - "%.*g", - utility::details::scoped_c_thread_locale::c_locale(), - std::numeric_limits::digits10 + 2, - m_number.m_value); -#else - const auto numChars = snprintf(tempBuffer, tempSize, "%.*g", std::numeric_limits::digits10 + 2, m_number.m_value); -#endif - stream.append(tempBuffer, numChars); - } -} - -#ifdef _WIN32 - -void web::json::details::_String::format(std::basic_string& str) const -{ - str.push_back(L'"'); - - if(m_has_escape_char) - { - append_escape_string(str, m_string); - } - else - { - str.append(m_string); - } - - str.push_back(L'"'); -} - -void web::json::details::_Number::format(std::basic_string& stream) const -{ - if(m_number.m_type != number::type::double_type) - { - // #digits + 1 to avoid loss + 1 for the sign + 1 for null terminator. - const size_t tempSize = std::numeric_limits::digits10 + 3; - wchar_t tempBuffer[tempSize]; - - if (m_number.m_type == number::type::signed_type) - _i64tow_s(m_number.m_intval, tempBuffer, tempSize, 10); - else - _ui64tow_s(m_number.m_uintval, tempBuffer, tempSize, 10); - - stream.append(tempBuffer, wcsnlen_s(tempBuffer, tempSize)); - } - else - { - // #digits + 2 to avoid loss + 1 for the sign + 1 for decimal point + 5 for exponent (e+xxx) + 1 for null terminator - const size_t tempSize = std::numeric_limits::digits10 + 10; - wchar_t tempBuffer[tempSize]; - const int numChars = _swprintf_s_l( - tempBuffer, - tempSize, - L"%.*g", - utility::details::scoped_c_thread_locale::c_locale(), - std::numeric_limits::digits10 + 2, - m_number.m_value); - stream.append(tempBuffer, numChars); - } -} - -#endif - -const utility::string_t & web::json::details::_String::as_string() const -{ - return m_string; -} - -const utility::string_t & web::json::value::as_string() const -{ - return m_value->as_string(); -} - -utility::string_t json::value::serialize() const -{ -#ifndef _WIN32 - utility::details::scoped_c_thread_locale locale; -#endif - return m_value->to_string(); -} diff --git a/src/corehost/cli/json/casablanca/src/utilities/asyncrt_utils.cpp b/src/corehost/cli/json/casablanca/src/utilities/asyncrt_utils.cpp deleted file mode 100644 index 87a0d8957..000000000 --- a/src/corehost/cli/json/casablanca/src/utilities/asyncrt_utils.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/*** -* ==++== -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* ==--== -* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -* -* Utilities -* -* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk -* -* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -****/ - -#include "stdafx.h" - -#ifndef _WIN32 -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-local-typedef" -#endif -#if defined(__clang__) -#pragma clang diagnostic pop -#endif -#endif - -// Could use C++ standard library if not __GLIBCXX__, -// For testing purposes we just the handwritten on all platforms. -#if defined(CPPREST_STDLIB_UNICODE_CONVERSIONS) -#include -#endif - -using namespace web; -using namespace utility; -using namespace utility::conversions; - -namespace utility -{ -namespace details -{ - -#if !defined(ANDROID) && !defined(__ANDROID__) -std::once_flag g_c_localeFlag; -std::unique_ptr g_c_locale(nullptr, [](scoped_c_thread_locale::xplat_locale *){}); -scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale() -{ - std::call_once(g_c_localeFlag, [&]() - { - scoped_c_thread_locale::xplat_locale *clocale = new scoped_c_thread_locale::xplat_locale(); -#ifdef _WIN32 - *clocale = _create_locale(LC_ALL, "C"); - if (*clocale == nullptr) - { - throw std::runtime_error("Unable to create 'C' locale."); - } - auto deleter = [](scoped_c_thread_locale::xplat_locale *clocale) - { - _free_locale(*clocale); - delete clocale; - }; -#else - *clocale = newlocale(LC_ALL, "C", nullptr); - if (*clocale == nullptr) - { - throw std::runtime_error("Unable to create 'C' locale."); - } - auto deleter = [](scoped_c_thread_locale::xplat_locale *clocale) - { - freelocale(*clocale); - delete clocale; - }; -#endif - g_c_locale = std::unique_ptr(clocale, deleter); - }); - return *g_c_locale; -} -#endif - -#ifdef _WIN32 -scoped_c_thread_locale::scoped_c_thread_locale() - : m_prevLocale(), m_prevThreadSetting(-1) -{ - char *prevLocale = setlocale(LC_ALL, nullptr); - if (prevLocale == nullptr) - { - throw std::runtime_error("Unable to retrieve current locale."); - } - - if (std::strcmp(prevLocale, "C") != 0) - { - m_prevLocale = prevLocale; - m_prevThreadSetting = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); - if (m_prevThreadSetting == -1) - { - throw std::runtime_error("Unable to enable per thread locale."); - } - if (setlocale(LC_ALL, "C") == nullptr) - { - _configthreadlocale(m_prevThreadSetting); - throw std::runtime_error("Unable to set locale"); - } - } -} - -scoped_c_thread_locale::~scoped_c_thread_locale() -{ - if (m_prevThreadSetting != -1) - { - setlocale(LC_ALL, m_prevLocale.c_str()); - _configthreadlocale(m_prevThreadSetting); - } -} -#elif (defined(ANDROID) || defined(__ANDROID__)) -scoped_c_thread_locale::scoped_c_thread_locale() {} -scoped_c_thread_locale::~scoped_c_thread_locale() {} -#else -scoped_c_thread_locale::scoped_c_thread_locale() - : m_prevLocale(nullptr) -{ - char *prevLocale = setlocale(LC_ALL, nullptr); - if (prevLocale == nullptr) - { - throw std::runtime_error("Unable to retrieve current locale."); - } - - if (std::strcmp(prevLocale, "C") != 0) - { - m_prevLocale = uselocale(c_locale()); - if (m_prevLocale == nullptr) - { - throw std::runtime_error("Unable to set locale"); - } - } -} - -scoped_c_thread_locale::~scoped_c_thread_locale() -{ - if (m_prevLocale != nullptr) - { - uselocale(m_prevLocale); - } -} -#endif -} - -namespace details -{ - -const std::error_category & __cdecl platform_category() -{ -#ifdef _WIN32 - return windows_category(); -#else - return linux_category(); -#endif -} - -#ifdef _WIN32 - -// Remove once VS 2013 is no longer supported. -#if _MSC_VER < 1900 -static details::windows_category_impl instance; -#endif -const std::error_category & __cdecl windows_category() -{ -#if _MSC_VER >= 1900 - static details::windows_category_impl instance; -#endif - return instance; -} - -std::string windows_category_impl::message(int errorCode) const CPPREST_NOEXCEPT -{ - const size_t buffer_size = 4096; - DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM; - LPCVOID lpSource = NULL; - -#if !defined(__cplusplus_winrt) - if (errorCode >= 12000) - { - dwFlags = FORMAT_MESSAGE_FROM_HMODULE; - lpSource = GetModuleHandleA("winhttp.dll"); // this handle DOES NOT need to be freed - } -#endif - - std::wstring buffer; - buffer.resize(buffer_size); - - const auto result = ::FormatMessageW( - dwFlags, - lpSource, - errorCode, - 0, - &buffer[0], - buffer_size, - NULL); - if (result == 0) - { - std::ostringstream os; - os << "Unable to get an error message for error code: " << errorCode << "."; - return os.str(); - } - - return utility::conversions::to_utf8string(buffer); -} - -std::error_condition windows_category_impl::default_error_condition(int errorCode) const CPPREST_NOEXCEPT -{ - // First see if the STL implementation can handle the mapping for common cases. - const std::error_condition errCondition = std::system_category().default_error_condition(errorCode); - const std::string errConditionMsg = errCondition.message(); - if(_stricmp(errConditionMsg.c_str(), "unknown error") != 0) - { - return errCondition; - } - - switch(errorCode) - { -#ifndef __cplusplus_winrt - case ERROR_WINHTTP_TIMEOUT: - return std::errc::timed_out; - case ERROR_WINHTTP_CANNOT_CONNECT: - return std::errc::host_unreachable; - case ERROR_WINHTTP_CONNECTION_ERROR: - return std::errc::connection_aborted; -#endif - case INET_E_RESOURCE_NOT_FOUND: - case INET_E_CANNOT_CONNECT: - return std::errc::host_unreachable; - case INET_E_CONNECTION_TIMEOUT: - return std::errc::timed_out; - case INET_E_DOWNLOAD_FAILURE: - return std::errc::connection_aborted; - default: - break; - } - - return std::error_condition(errorCode, *this); -} - -#else - -const std::error_category & __cdecl linux_category() -{ - // On Linux we are using boost error codes which have the exact same - // mapping and are equivalent with std::generic_category error codes. - return std::generic_category(); -} - -#endif - -} - -#define LOW_3BITS 0x7 -#define LOW_4BITS 0xF -#define LOW_5BITS 0x1F -#define LOW_6BITS 0x3F -#define BIT4 0x8 -#define BIT5 0x10 -#define BIT6 0x20 -#define BIT7 0x40 -#define BIT8 0x80 -#define L_SURROGATE_START 0xDC00 -#define L_SURROGATE_END 0xDFFF -#define H_SURROGATE_START 0xD800 -#define H_SURROGATE_END 0xDBFF -#define SURROGATE_PAIR_START 0x10000 - -utf16string __cdecl conversions::utf8_to_utf16(const std::string &s) -{ -#if defined(CPPREST_STDLIB_UNICODE_CONVERSIONS) - std::wstring_convert, utf16char> conversion; - return conversion.from_bytes(src); -#else - utf16string dest; - // Save repeated heap allocations, use less than source string size assuming some - // of the characters are not just ASCII and collapse. - dest.reserve(static_cast(static_cast(s.size()) * .70)); - - for (auto src = s.begin(); src != s.end(); ++src) - { - if ((*src & BIT8) == 0) // single byte character, 0x0 to 0x7F - { - dest.push_back(utf16string::value_type(*src)); - } - else - { - unsigned char numContBytes = 0; - uint32_t codePoint; - if ((*src & BIT7) == 0) - { - throw std::range_error("UTF-8 string character can never start with 10xxxxxx"); - } - else if ((*src & BIT6) == 0) // 2 byte character, 0x80 to 0x7FF - { - codePoint = *src & LOW_5BITS; - numContBytes = 1; - } - else if ((*src & BIT5) == 0) // 3 byte character, 0x800 to 0xFFFF - { - codePoint = *src & LOW_4BITS; - numContBytes = 2; - } - else if ((*src & BIT4) == 0) // 4 byte character, 0x10000 to 0x10FFFF - { - codePoint = *src & LOW_3BITS; - numContBytes = 3; - } - else - { - throw std::range_error("UTF-8 string has invalid Unicode code point"); - } - - for (unsigned char i = 0; i < numContBytes; ++i) - { - if (++src == s.end()) - { - throw std::range_error("UTF-8 string is missing bytes in character"); - } - if ((*src & BIT8) == 0 || (*src & BIT7) != 0) - { - throw std::range_error("UTF-8 continuation byte is missing leading byte"); - } - codePoint <<= 6; - codePoint |= *src & LOW_6BITS; - } - - if (codePoint >= SURROGATE_PAIR_START) - { - // In UTF-16 U+10000 to U+10FFFF are represented as two 16-bit code units, surrogate pairs. - // - 0x10000 is subtracted from the code point - // - high surrogate is 0xD800 added to the top ten bits - // - low surrogate is 0xDC00 added to the low ten bits - codePoint -= SURROGATE_PAIR_START; - dest.push_back(utf16string::value_type((codePoint >> 10) | H_SURROGATE_START)); - dest.push_back(utf16string::value_type((codePoint & 0x3FF) | L_SURROGATE_START)); - } - else - { - // In UTF-16 U+0000 to U+D7FF and U+E000 to U+FFFF are represented exactly as the Unicode code point value. - // U+D800 to U+DFFF are not valid characters, for simplicity we assume they are not present but will encode - // them if encountered. - dest.push_back(utf16string::value_type(codePoint)); - } - } - } - return dest; -#endif -} - -std::string __cdecl conversions::utf16_to_utf8(const utf16string &w) -{ - #if defined(CPPREST_STDLIB_UNICODE_CONVERSIONS) - std::wstring_convert, utf16char> conversion; - return conversion.to_bytes(w); - #else - std::string dest; - dest.reserve(w.size()); - for (auto src = w.begin(); src != w.end(); ++src) - { - // Check for high surrogate. - if (*src >= H_SURROGATE_START && *src <= H_SURROGATE_END) - { - const auto highSurrogate = *src++; - if (src == w.end()) - { - throw std::range_error("UTF-16 string is missing low surrogate"); - } - const auto lowSurrogate = *src; - if (lowSurrogate < L_SURROGATE_START || lowSurrogate > L_SURROGATE_END) - { - throw std::range_error("UTF-16 string has invalid low surrogate"); - } - - // To get from surrogate pair to Unicode code point: - // - subract 0xD800 from high surrogate, this forms top ten bits - // - subract 0xDC00 from low surrogate, this forms low ten bits - // - add 0x10000 - // Leaves a code point in U+10000 to U+10FFFF range. - uint32_t codePoint = highSurrogate - H_SURROGATE_START; - codePoint <<= 10; - codePoint |= lowSurrogate - L_SURROGATE_START; - codePoint += SURROGATE_PAIR_START; - - // 4 bytes need using 21 bits - dest.push_back(char((codePoint >> 18) | 0xF0)); // leading 3 bits - dest.push_back(char(((codePoint >> 12) & LOW_6BITS) | BIT8)); // next 6 bits - dest.push_back(char(((codePoint >> 6) & LOW_6BITS) | BIT8)); // next 6 bits - dest.push_back(char((codePoint & LOW_6BITS) | BIT8)); // trailing 6 bits - } - else - { - if (*src <= 0x7F) // single byte character - { - dest.push_back(static_cast(*src)); - } - else if (*src <= 0x7FF) // 2 bytes needed (11 bits used) - { - dest.push_back(char((*src >> 6) | 0xC0)); // leading 5 bits - dest.push_back(char((*src & LOW_6BITS) | BIT8)); // trailing 6 bits - } - else // 3 bytes needed (16 bits used) - { - dest.push_back(char((*src >> 12) | 0xE0)); // leading 4 bits - dest.push_back(char(((*src >> 6) & LOW_6BITS) | BIT8)); // middle 6 bits - dest.push_back(char((*src & LOW_6BITS) | BIT8)); // trailing 6 bits - } - } - } - - return dest; - #endif -} - -utf16string __cdecl conversions::usascii_to_utf16(const std::string &s) -{ - // Ascii is a subset of UTF-8 so just convert to UTF-16 - return utf8_to_utf16(s); -} - -utf16string __cdecl conversions::latin1_to_utf16(const std::string &s) -{ - // Latin1 is the first 256 code points in Unicode. - // In UTF-16 encoding each of these is represented as exactly the numeric code point. - utf16string dest; - dest.resize(s.size()); - for (size_t i = 0; i < s.size(); ++i) - { - dest[i] = utf16char(s[i]); - } - return dest; -} - -utf8string __cdecl conversions::latin1_to_utf8(const std::string &s) -{ - return utf16_to_utf8(latin1_to_utf16(s)); -} - -utility::string_t __cdecl conversions::to_string_t(utf16string &&s) -{ -#ifdef _UTF16_STRINGS - return std::move(s); -#else - return utf16_to_utf8(std::move(s)); -#endif -} - -utility::string_t __cdecl conversions::to_string_t(std::string &&s) -{ -#ifdef _UTF16_STRINGS - return utf8_to_utf16(std::move(s)); -#else - return std::move(s); -#endif -} - -utility::string_t __cdecl conversions::to_string_t(const utf16string &s) -{ -#ifdef _UTF16_STRINGS - return s; -#else - return utf16_to_utf8(s); -#endif -} - -utility::string_t __cdecl conversions::to_string_t(const std::string &s) -{ -#ifdef _UTF16_STRINGS - return utf8_to_utf16(s); -#else - return s; -#endif -} - -std::string __cdecl conversions::to_utf8string(std::string value) { return std::move(value); } - -std::string __cdecl conversions::to_utf8string(const utf16string &value) { return utf16_to_utf8(value); } - -utf16string __cdecl conversions::to_utf16string(const std::string &value) { return utf8_to_utf16(value); } - -utf16string __cdecl conversions::to_utf16string(utf16string value) { return std::move(value); } - -static bool is_digit(utility::char_t c) { return c >= _XPLATSTR('0') && c <= _XPLATSTR('9'); } - -} diff --git a/src/corehost/cli/libhost.cpp b/src/corehost/cli/libhost.cpp deleted file mode 100644 index 87e270490..000000000 --- a/src/corehost/cli/libhost.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "utils.h" -#include "trace.h" -#include "libhost.h" - -void get_runtime_config_paths_from_app(const pal::string_t& app, pal::string_t* cfg, pal::string_t* dev_cfg) -{ - auto name = get_filename_without_ext(app); - - auto json_name = name + _X(".runtimeconfig.json"); - auto dev_json_name = name + _X(".runtimeconfig.dev.json"); - - auto json_path = get_directory(app); - auto dev_json_path = json_path; - - append_path(&json_path, json_name.c_str()); - append_path(&dev_json_path, dev_json_name.c_str()); - - trace::verbose(_X("Runtime config is cfg=%s dev=%s"), json_path.c_str(), dev_json_path.c_str()); - - dev_cfg->assign(dev_json_path); - cfg->assign(json_path); -} - -void get_runtime_config_paths_from_arg(const pal::string_t& arg, pal::string_t* cfg, pal::string_t* dev_cfg) -{ - auto name = get_filename_without_ext(arg); - - auto json_name = name + _X(".json"); - auto dev_json_name = name + _X(".dev.json"); - - auto json_path = get_directory(arg); - auto dev_json_path = json_path; - - append_path(&json_path, json_name.c_str()); - append_path(&dev_json_path, dev_json_name.c_str()); - - trace::verbose(_X("Runtime config is cfg=%s dev=%s"), json_path.c_str(), dev_json_path.c_str()); - - dev_cfg->assign(dev_json_path); - cfg->assign(json_path); -} - -host_mode_t detect_operating_mode(const pal::string_t& own_dir, const pal::string_t& own_dll, const pal::string_t& own_name) -{ - if (coreclr_exists_in_dir(own_dir) || pal::file_exists(own_dll)) - { - pal::string_t own_deps_json = own_dir; - pal::string_t own_deps_filename = strip_file_ext(own_name) + _X(".deps.json"); - pal::string_t own_config_filename = strip_file_ext(own_name) + _X(".runtimeconfig.json"); - append_path(&own_deps_json, own_deps_filename.c_str()); - if (trace::is_enabled()) - { - trace::info(_X("Detecting mode... CoreCLR present in own dir [%s] and checking if [%s] file present=[%d]"), - own_dir.c_str(), own_deps_filename.c_str(), pal::file_exists(own_deps_json)); - } - return ((pal::file_exists(own_deps_json) || !pal::file_exists(own_config_filename)) && pal::file_exists(own_dll)) ? host_mode_t::standalone : host_mode_t::split_fx; - } - else - { - return host_mode_t::muxer; - } -} - -void try_patch_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str) -{ - pal::string_t path = cur_dir; - - if (trace::is_enabled()) - { - pal::string_t start_str = start_ver.as_str(); - trace::verbose(_X("Reading patch roll forward candidates in dir [%s] for version [%s]"), path.c_str(), start_str.c_str()); - } - - pal::string_t maj_min_star = start_ver.patch_glob(); - - std::vector list; - pal::readdir(path, maj_min_star, &list); - - fx_ver_t max_ver = start_ver; - fx_ver_t ver(-1, -1, -1); - for (const auto& str : list) - { - trace::verbose(_X("Considering patch roll forward candidate version [%s]"), str.c_str()); - if (fx_ver_t::parse(str, &ver, true)) - { - max_ver = std::max(ver, max_ver); - } - } - max_str->assign(max_ver.as_str()); - - if (trace::is_enabled()) - { - pal::string_t start_str = start_ver.as_str(); - trace::verbose(_X("Patch roll forwarded [%s] -> [%s] in [%s]"), start_str.c_str(), max_str->c_str(), path.c_str()); - } -} - -void try_prerelease_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str) -{ - pal::string_t path = cur_dir; - - if (trace::is_enabled()) - { - pal::string_t start_str = start_ver.as_str(); - trace::verbose(_X("Reading prerelease roll forward candidates in dir [%s] for version [%s]"), path.c_str(), start_str.c_str()); - } - - pal::string_t maj_min_pat_star = start_ver.prerelease_glob(); - - std::vector list; - pal::readdir(path, maj_min_pat_star, &list); - - fx_ver_t max_ver = start_ver; - fx_ver_t ver(-1, -1, -1); - for (const auto& str : list) - { - trace::verbose(_X("Considering prerelease roll forward candidate version [%s]"), str.c_str()); - if (fx_ver_t::parse(str, &ver, false) - && ver.is_prerelease()) // Pre-release can roll forward to only pre-release - { - max_ver = std::max(ver, max_ver); - } - } - max_str->assign(max_ver.as_str()); - - if (trace::is_enabled()) - { - pal::string_t start_str = start_ver.as_str(); - trace::verbose(_X("Prerelease roll forwarded [%s] -> [%s] in [%s]"), start_str.c_str(), max_str->c_str(), path.c_str()); - } -} diff --git a/src/corehost/cli/libhost.h b/src/corehost/cli/libhost.h deleted file mode 100644 index e6f0cc8c6..000000000 --- a/src/corehost/cli/libhost.h +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __LIBHOST_H__ -#define __LIBHOST_H__ -#include -#include "trace.h" -#include "runtime_config.h" -#include "fx_ver.h" - -enum host_mode_t -{ - invalid = 0, - muxer, - standalone, - split_fx -}; - -class fx_ver_t; -class runtime_config_t; - -#define _HOST_INTERFACE_PACK 1 -#pragma pack(push, _HOST_INTERFACE_PACK) -struct strarr_t -{ - // DO NOT modify this struct. It is used in a layout - // dependent manner. Create another for your use. - size_t len; - const pal::char_t** arr; -}; - -struct host_interface_t -{ - size_t version_lo; // Just assign sizeof() to this field. - size_t version_hi; // Breaking changes to the layout -- increment HOST_INTERFACE_LAYOUT_VERSION - strarr_t config_keys; - strarr_t config_values; - const pal::char_t* fx_dir; - const pal::char_t* fx_name; - const pal::char_t* deps_file; - size_t is_portable; - strarr_t probe_paths; - size_t patch_roll_forward; - size_t prerelease_roll_forward; - size_t host_mode; - // !! WARNING / WARNING / WARNING / WARNING / WARNING / WARNING / WARNING / WARNING / WARNING - // !! 1. Only append to this structure to maintain compat. - // !! 2. Any nested structs should not use compiler specific padding (pack with _HOST_INTERFACE_PACK) - // !! 3. Do not take address of the fields of this struct or be prepared to deal with unaligned accesses. - // !! 4. Must be POD types; only use non-const size_t and pointer types; no access modifiers. - // !! 5. Do not reorder fields or change any existing field types. - // !! 6. Add static asserts for fields you add. -}; -#pragma pack(pop) -static_assert(_HOST_INTERFACE_PACK == 1, "Packing size should not be modified for back compat"); -static_assert(offsetof(host_interface_t, version_lo) == 0 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, version_hi) == 1 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, config_keys) == 2 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, config_values) == 4 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, fx_dir) == 6 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, fx_name) == 7 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, deps_file) == 8 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, is_portable) == 9 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, probe_paths) == 10 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, patch_roll_forward) == 12 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, prerelease_roll_forward) == 13 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(offsetof(host_interface_t, host_mode) == 14 * sizeof(size_t), "Struct offset breaks backwards compatibility"); -static_assert(sizeof(host_interface_t) == 15 * sizeof(size_t), "Did you add static asserts for the newly added fields?"); - -#define HOST_INTERFACE_LAYOUT_VERSION_HI 0x16041101 // YYMMDD:nn always increases when layout breaks compat. -#define HOST_INTERFACE_LAYOUT_VERSION_LO sizeof(host_interface_t) - -class corehost_init_t -{ -private: - std::vector m_clr_keys; - std::vector m_clr_values; - std::vector m_clr_keys_cstr; - std::vector m_clr_values_cstr; - const pal::string_t m_fx_dir; - const pal::string_t m_fx_name; - const pal::string_t m_deps_file; - bool m_portable; - std::vector m_probe_paths; - std::vector m_probe_paths_cstr; - bool m_patch_roll_forward; - bool m_prerelease_roll_forward; - host_mode_t m_host_mode; - host_interface_t m_host_interface; - const pal::string_t m_fx_ver; -public: - corehost_init_t( - const pal::string_t& deps_file, - const std::vector& probe_paths, - const pal::string_t& fx_dir, - const host_mode_t mode, - const runtime_config_t& runtime_config) - : m_fx_dir(fx_dir) - , m_fx_name(runtime_config.get_fx_name()) - , m_deps_file(deps_file) - , m_portable(runtime_config.get_portable()) - , m_probe_paths(probe_paths) - , m_patch_roll_forward(runtime_config.get_patch_roll_fwd()) - , m_prerelease_roll_forward(runtime_config.get_prerelease_roll_fwd()) - , m_host_mode(mode) - , m_host_interface() - , m_fx_ver(runtime_config.get_fx_version()) - { - runtime_config.config_kv(&m_clr_keys, &m_clr_values); - make_cstr_arr(m_clr_keys, &m_clr_keys_cstr); - make_cstr_arr(m_clr_values, &m_clr_values_cstr); - make_cstr_arr(m_probe_paths, &m_probe_paths_cstr); - } - - const pal::string_t& fx_dir() const - { - return m_fx_dir; - } - - const pal::string_t& fx_name() const - { - return m_fx_name; - } - - const pal::string_t& fx_version() const - { - return m_fx_ver; - } - - const host_interface_t& get_host_init_data() - { - host_interface_t& hi = m_host_interface; - - hi.version_lo = HOST_INTERFACE_LAYOUT_VERSION_LO; - hi.version_hi = HOST_INTERFACE_LAYOUT_VERSION_HI; - - hi.config_keys.len = m_clr_keys_cstr.size(); - hi.config_keys.arr = m_clr_keys_cstr.data(); - - hi.config_values.len = m_clr_values_cstr.size(); - hi.config_values.arr = m_clr_values_cstr.data(); - - hi.fx_dir = m_fx_dir.c_str(); - hi.fx_name = m_fx_name.c_str(); - hi.deps_file = m_deps_file.c_str(); - hi.is_portable = m_portable; - - hi.probe_paths.len = m_probe_paths_cstr.size(); - hi.probe_paths.arr = m_probe_paths_cstr.data(); - - hi.patch_roll_forward = m_patch_roll_forward; - hi.prerelease_roll_forward = m_prerelease_roll_forward; - hi.host_mode = m_host_mode; - - return hi; - } - -private: - - static void make_cstr_arr(const std::vector& arr, std::vector* out) - { - out->reserve(arr.size()); - for (const auto& str : arr) - { - out->push_back(str.c_str()); - } - } -}; - - -struct hostpolicy_init_t -{ - std::vector> cfg_keys; - std::vector> cfg_values; - pal::string_t deps_file; - std::vector probe_paths; - pal::string_t fx_dir; - pal::string_t fx_name; - host_mode_t host_mode; - bool patch_roll_forward; - bool prerelease_roll_forward; - bool is_portable; - - static bool init(host_interface_t* input, hostpolicy_init_t* init) - { - // Check if there are any breaking changes. - if (input->version_hi != HOST_INTERFACE_LAYOUT_VERSION_HI) - { - trace::error(_X("The version of the data layout used to initialize %s is [0x%04x]; expected version [0x%04x]"), LIBHOSTPOLICY_NAME, input->version_hi, HOST_INTERFACE_LAYOUT_VERSION_HI); - return false; - } - // Check if the size is at least what we expect to contain. - if (input->version_lo < HOST_INTERFACE_LAYOUT_VERSION_LO) - { - trace::error(_X("The size of the data layout used to initialize %s is %d; expected at least %d"), LIBHOSTPOLICY_NAME, input->version_lo, HOST_INTERFACE_LAYOUT_VERSION_LO); - return false; - } - trace::verbose(_X("Reading from host interface version: [0x%04x:%d] to initialize policy version: [0x%04x:%d]"), input->version_hi, input->version_lo, HOST_INTERFACE_LAYOUT_VERSION_HI, HOST_INTERFACE_LAYOUT_VERSION_LO); - - make_clrstr_arr(input->config_keys.len, input->config_keys.arr, &init->cfg_keys); - make_clrstr_arr(input->config_values.len, input->config_values.arr, &init->cfg_values); - - init->fx_dir = input->fx_dir; - init->fx_name = input->fx_name; - init->deps_file = input->deps_file; - init->is_portable = input->is_portable; - - make_palstr_arr(input->probe_paths.len, input->probe_paths.arr, &init->probe_paths); - - init->patch_roll_forward = input->patch_roll_forward; - init->prerelease_roll_forward = input->prerelease_roll_forward; - init->host_mode = (host_mode_t) input->host_mode; - - return true; - } - -private: - static void make_palstr_arr(int argc, const pal::char_t** argv, std::vector* out) - { - out->reserve(argc); - for (int i = 0; i < argc; ++i) - { - out->push_back(argv[i]); - } - } - - static void make_clrstr_arr(int argc, const pal::char_t** argv, std::vector>* out) - { - out->resize(argc); - for (int i = 0; i < argc; ++i) - { - pal::pal_clrstring(pal::string_t(argv[i]), &(*out)[i]); - } - } -}; - -void get_runtime_config_paths_from_app(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); -void get_runtime_config_paths_from_arg(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file); - -host_mode_t detect_operating_mode(const pal::string_t& own_dir, const pal::string_t& own_dll, const pal::string_t& own_name); -bool hostpolicy_exists_in_svc(pal::string_t* resolved_dir); - -void try_patch_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str); -void try_prerelease_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str); - -#endif // __LIBHOST_H__ diff --git a/src/corehost/cli/runtime_config.cpp b/src/corehost/cli/runtime_config.cpp deleted file mode 100644 index 748f33572..000000000 --- a/src/corehost/cli/runtime_config.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "trace.h" -#include "utils.h" -#include "cpprest/json.h" -#include "runtime_config.h" -#include - -runtime_config_t::runtime_config_t(const pal::string_t& path, const pal::string_t& dev_path) - : m_patch_roll_fwd(true) - , m_prerelease_roll_fwd(false) - , m_path(path) - , m_dev_path(dev_path) - , m_portable(false) -{ - m_valid = ensure_parsed(); - trace::verbose(_X("Runtime config [%s] is valid=[%d]"), path.c_str(), m_valid); -} - -bool runtime_config_t::parse_opts(const json_value& opts) -{ - // Note: both runtime_config and dev_runtime_config call into the function. - // runtime_config will override whatever dev_runtime_config populated. - if (opts.is_null()) - { - return true; - } - - const auto& opts_obj = opts.as_object(); - - auto properties = opts_obj.find(_X("configProperties")); - if (properties != opts_obj.end()) - { - const auto& prop_obj = properties->second.as_object(); - for (const auto& property : prop_obj) - { - m_properties[property.first] = property.second.is_string() - ? property.second.as_string() - : property.second.to_string(); - } - } - - auto probe_paths = opts_obj.find(_X("additionalProbingPaths")); - if (probe_paths != opts_obj.end()) - { - if (probe_paths->second.is_string()) - { - m_probe_paths.insert(m_probe_paths.begin(), probe_paths->second.as_string()); - } - else - { - const auto& arr = probe_paths->second.as_array(); - for (auto iter = arr.rbegin(); iter != arr.rend(); iter++) - { - m_probe_paths.push_front(iter->as_string()); - } - } - } - - auto patch_roll_fwd = opts_obj.find(_X("applyPatches")); - if (patch_roll_fwd != opts_obj.end()) - { - m_patch_roll_fwd = patch_roll_fwd->second.as_bool(); - } - - auto prerelease_roll_fwd = opts_obj.find(_X("preReleaseRollForward")); - if (prerelease_roll_fwd != opts_obj.end()) - { - m_prerelease_roll_fwd = prerelease_roll_fwd->second.as_bool(); - } - - auto framework = opts_obj.find(_X("framework")); - if (framework == opts_obj.end()) - { - return true; - } - - m_portable = true; - - const auto& fx_obj = framework->second.as_object(); - m_fx_name = fx_obj.at(_X("name")).as_string(); - m_fx_ver = fx_obj.at(_X("version")).as_string(); - return true; -} - -bool runtime_config_t::ensure_dev_config_parsed() -{ - trace::verbose(_X("Attempting to read dev runtime config: %s"), m_dev_path.c_str()); - - pal::string_t retval; - if (!pal::file_exists(m_dev_path)) - { - // Not existing is not an error. - return true; - } - - pal::ifstream_t file(m_dev_path); - if (!file.good()) - { - trace::verbose(_X("File stream not good %s"), m_dev_path.c_str()); - return false; - } - - if (skip_utf8_bom(&file)) - { - trace::verbose(_X("UTF-8 BOM skipped while reading [%s]"), m_dev_path.c_str()); - } - - try - { - const auto root = json_value::parse(file); - const auto& json = root.as_object(); - const auto iter = json.find(_X("runtimeOptions")); - if (iter != json.end()) - { - parse_opts(iter->second); - } - } - catch (const std::exception& je) - { - pal::string_t jes; - (void) pal::utf8_palstring(je.what(), &jes); - trace::error(_X("A JSON parsing exception occurred in [%s]: %s"), m_dev_path.c_str(), jes.c_str()); - return false; - } - - return true; -} - -bool runtime_config_t::ensure_parsed() -{ - trace::verbose(_X("Attempting to read runtime config: %s"), m_path.c_str()); - if (!ensure_dev_config_parsed()) - { - trace::verbose(_X("Did not successfully parse the runtimeconfig.dev.json")); - } - - pal::string_t retval; - if (!pal::file_exists(m_path)) - { - // Not existing is not an error. - return true; - } - - pal::ifstream_t file(m_path); - if (!file.good()) - { - trace::verbose(_X("File stream not good %s"), m_path.c_str()); - return false; - } - - if (skip_utf8_bom(&file)) - { - trace::verbose(_X("UTF-8 BOM skipped while reading [%s]"), m_path.c_str()); - } - - try - { - const auto root = json_value::parse(file); - const auto& json = root.as_object(); - const auto iter = json.find(_X("runtimeOptions")); - if (iter != json.end()) - { - parse_opts(iter->second); - } - } - catch (const std::exception& je) - { - pal::string_t jes; - (void) pal::utf8_palstring(je.what(), &jes); - trace::error(_X("A JSON parsing exception occurred in [%s]: %s"), m_path.c_str(), jes.c_str()); - return false; - } - return true; -} - -const pal::string_t& runtime_config_t::get_fx_name() const -{ - assert(m_valid); - return m_fx_name; -} - -const pal::string_t& runtime_config_t::get_fx_version() const -{ - assert(m_valid); - return m_fx_ver; -} - -bool runtime_config_t::get_patch_roll_fwd() const -{ - assert(m_valid); - return m_patch_roll_fwd; -} - -bool runtime_config_t::get_prerelease_roll_fwd() const -{ - assert(m_valid); - return m_prerelease_roll_fwd; -} - -bool runtime_config_t::get_portable() const -{ - return m_portable; -} - -const std::list& runtime_config_t::get_probe_paths() const -{ - return m_probe_paths; -} - -void runtime_config_t::config_kv(std::vector* keys, std::vector* values) const -{ - for (const auto& kv : m_properties) - { - keys->push_back(kv.first); - values->push_back(kv.second); - } -} diff --git a/src/corehost/cli/runtime_config.h b/src/corehost/cli/runtime_config.h deleted file mode 100644 index f51e0324f..000000000 --- a/src/corehost/cli/runtime_config.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __RUNTIME_CONFIG_H__ -#define __RUNTIME_CONFIG_H__ - -#include - -#include "pal.h" -#include "cpprest/json.h" - -typedef web::json::value json_value; - -class runtime_config_t -{ -public: - runtime_config_t(const pal::string_t& path, const pal::string_t& dev_path); - bool is_valid() { return m_valid; } - const pal::string_t& get_path() { return m_path; } - const pal::string_t& get_dev_path() { return m_dev_path; } - const pal::string_t& get_gc_server() const; - const pal::string_t& get_fx_version() const; - const pal::string_t& get_fx_name() const; - const std::list& get_probe_paths() const; - bool get_patch_roll_fwd() const; - bool get_prerelease_roll_fwd() const; - bool get_portable() const; - bool parse_opts(const json_value& opts); - void config_kv(std::vector*, std::vector*) const; - -private: - bool ensure_parsed(); - bool ensure_dev_config_parsed(); - - std::unordered_map m_properties; - std::vector m_prop_keys; - std::vector m_prop_values; - std::list m_probe_paths; - pal::string_t m_fx_name; - pal::string_t m_fx_ver; - bool m_patch_roll_fwd; - bool m_prerelease_roll_fwd; - - pal::string_t m_dev_path; - pal::string_t m_path; - bool m_portable; - bool m_valid; -}; -#endif // __RUNTIME_CONFIG_H__ \ No newline at end of file diff --git a/src/corehost/cli/setup.cmake b/src/corehost/cli/setup.cmake deleted file mode 100644 index 19b8abead..000000000 --- a/src/corehost/cli/setup.cmake +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -if(WIN32) - add_definitions(-DWIN32) - add_definitions(-D_WIN32=1) - if(IS_64BIT_BUILD) - add_definitions(-D_WIN64=1) - endif() - add_compile_options($<$:-DDEBUG>) - add_compile_options($<$:-DNDEBUG>) - add_compile_options($<$:-DNDEBUG>) - add_compile_options($<$:/Od>) - add_compile_options(/guard:cf) - add_compile_options(/d2Zi+) # make optimized builds debugging easier - add_compile_options(/Oi) # enable intrinsics - add_compile_options(/Oy-) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls - add_compile_options(/GF) # enable read-only string pooling - add_compile_options(/FC) # use full pathnames in diagnostics - add_compile_options(/DEBUG) - add_compile_options(/GS) - add_compile_options(/W1) - add_compile_options(/Zc:inline) - add_compile_options(/fp:precise) - add_compile_options(/EHsc) - - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") - - # Debug build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NOVCFEATURE") - - # Release build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - - # RelWithDebInfo specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") -else() - add_compile_options(-Wno-unused-local-typedef) -endif() - -# This is required to map a symbol reference to a matching definition local to the module (.so) -# containing the reference instead of using definitions from other modules. -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions") - add_compile_options(-fstack-protector-strong) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - add_compile_options(-fstack-protector) -endif() - -if(CLI_CMAKE_PLATFORM_ARCH_I386) - add_definitions(-D_TARGET_X86_=1) -elseif(CLI_CMAKE_PLATFORM_ARCH_AMD64) - add_definitions(-D_TARGET_AMD64_=1) -elseif(CLI_CMAKE_PLATFORM_ARCH_ARM) - add_definitions(-D_TARGET_ARM_=1) -else() - message(FATAL_ERROR "Unknown target architecture") -endif() - -if("${CLI_CMAKE_RUNTIME_ID}" STREQUAL "") - message(FATAL_ERROR "Runtime ID not specified") -else() - add_definitions(-DTARGET_RUNTIME_ID="${CLI_CMAKE_RUNTIME_ID}") -endif() - -if("${CLI_CMAKE_HOST_POLICY_VER}" STREQUAL "") - message(FATAL_ERROR "Host policy version is not specified") -else() - add_definitions(-DHOST_POLICY_PKG_VER="${CLI_CMAKE_HOST_POLICY_VER}") -endif() - -if("${CLI_CMAKE_HOST_FXR_VER}" STREQUAL "") - message(FATAL_ERROR "Host FXR version is not specified") -else() - add_definitions(-DHOST_FXR_PKG_VER="${CLI_CMAKE_HOST_FXR_VER}") -endif() - -if("${CLI_CMAKE_HOST_VER}" STREQUAL "") - message(FATAL_ERROR "Dotnet host version is not specified") -else() - add_definitions(-DHOST_PKG_VER="${CLI_CMAKE_HOST_VER}") -endif() - -if("${CLI_CMAKE_PKG_RID}" STREQUAL "") - message(FATAL_ERROR "A minimum supported package rid is not specified (ex: win7-x86 or ubuntu.14.04-x64, osx.10.10-x64, rhel.7-x64)") -else() - add_definitions(-DHOST_POLICY_PKG_NAME="runtime.${CLI_CMAKE_PKG_RID}.Microsoft.NETCore.DotNetHostPolicy") - add_definitions(-DHOST_POLICY_PKG_REL_DIR="runtimes/${CLI_CMAKE_PKG_RID}/native") -endif() - -if("${CLI_CMAKE_COMMIT_HASH}" STREQUAL "") - message(FATAL_ERROR "Commit hash needs to be specified to build the host") -else() - add_definitions(-DREPO_COMMIT_HASH="${CLI_CMAKE_COMMIT_HASH}") -endif() - diff --git a/src/corehost/common/pal.h b/src/corehost/common/pal.h deleted file mode 100644 index 740d6283d..000000000 --- a/src/corehost/common/pal.h +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef PAL_H -#define PAL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) - -#define NOMINMAX -#include - -#define xerr std::wcerr -#define xout std::wcout -#define DIR_SEPARATOR L'\\' -#define PATH_SEPARATOR L';' -#define PATH_MAX MAX_PATH -#define _X(s) L ## s - -#else - -#include -#include - -#define HOST_EXE_NAME "corehost" -#define xerr std::cerr -#define xout std::cout -#define DIR_SEPARATOR '/' -#define PATH_SEPARATOR ':' -#define _X(s) s - -#define S_OK 0x00000000 -#define E_NOTIMPL 0x80004001 -#define E_FAIL 0x80004005 - -#define SUCCEEDED(Status) ((Status) >= 0) - -#endif - - -#if defined(_WIN32) -#define LIB_PREFIX -#define MAKE_LIBNAME(NAME) (_X(NAME) _X(".dll")) -#elif defined(__APPLE__) -#define LIB_PREFIX _X("lib") -#define MAKE_LIBNAME(NAME) (LIB_PREFIX _X(NAME) _X(".dylib")) -#else -#define LIB_PREFIX _X("lib") -#define MAKE_LIBNAME(NAME) (LIB_PREFIX _X(NAME) _X(".so")) -#endif - -#define LIBCORECLR_FILENAME (LIB_PREFIX _X("coreclr")) -#define LIBCORECLR_NAME MAKE_LIBNAME("coreclr") - - -#define LIBHOSTPOLICY_FILENAME (LIB_PREFIX _X("hostpolicy")) -#define LIBHOSTPOLICY_NAME MAKE_LIBNAME("hostpolicy") - -#if !defined(PATH_MAX) && !defined(_WIN32) -#define PATH_MAX 4096 -#endif - - -namespace pal -{ -#if defined(_WIN32) - #ifdef COREHOST_MAKE_DLL - #define SHARED_API extern "C" __declspec(dllexport) - #else - #define SHARED_API - #endif - - #define STDMETHODCALLTYPE __stdcall - - typedef wchar_t char_t; - typedef std::wstring string_t; - typedef std::wstringstream stringstream_t; - // TODO: Agree on the correct encoding of the files: The PoR for now is to - // temporarily wchar for Windows and char for Unix. Current implementation - // implicitly expects the contents on both Windows and Unix as char and - // converts them to wchar in code for Windows. This line should become: - // typedef std::basic_ifstream ifstream_t. - typedef std::basic_ifstream ifstream_t; - typedef std::istreambuf_iterator istreambuf_iterator_t; - typedef HRESULT hresult_t; - typedef HMODULE dll_t; - typedef FARPROC proc_t; - - inline string_t exe_suffix() { return _X(".exe"); } - inline bool need_api_sets() { return true; } - void setup_api_sets(const std::unordered_set& api_sets); - - pal::string_t to_string(int value); - - bool getcwd(pal::string_t* recv); - - inline int strcmp(const char_t* str1, const char_t* str2) { return ::wcscmp(str1, str2); } - inline int strcasecmp(const char_t* str1, const char_t* str2) { return ::_wcsicmp(str1, str2); } - inline int strncmp(const char_t* str1, const char_t* str2, int len) { return ::wcsncmp(str1, str2, len); } - inline int strncasecmp(const char_t* str1, const char_t* str2, int len) { return ::_wcsnicmp(str1, str2, len); } - - pal::string_t to_lower(const pal::string_t& in); - - inline size_t strlen(const char_t* str) { return ::wcslen(str); } - inline void err_vprintf(const char_t* format, va_list vl) { ::vfwprintf(stderr, format, vl); ::fputws(_X("\r\n"), stderr); } - inline void out_vprintf(const char_t* format, va_list vl) { ::vfwprintf(stdout, format, vl); ::fputws(_X("\r\n"), stdout); } - - bool utf8_palstring(const std::string& str, pal::string_t* out); - bool pal_clrstring(const pal::string_t& str, std::vector* out); - bool clr_palstring(const char* cstr, pal::string_t* out); -#else - #ifdef COREHOST_MAKE_DLL - #define SHARED_API extern "C" - #else - #define SHARED_API - #endif - - #define __cdecl /* nothing */ - #define __stdcall /* nothing */ - #define __fastcall /* nothing */ - #define STDMETHODCALLTYPE __stdcall - - typedef char char_t; - typedef std::string string_t; - typedef std::stringstream stringstream_t; - typedef std::basic_ifstream ifstream_t; - typedef std::istreambuf_iterator istreambuf_iterator_t; - typedef int hresult_t; - typedef void* dll_t; - typedef void* proc_t; - - inline string_t exe_suffix() { return _X(""); } - inline bool need_api_sets() { return false; } - inline void setup_api_sets(const std::unordered_set& api_sets) { } - - pal::string_t to_string(int value); - - bool getcwd(pal::string_t* recv); - - inline int strcmp(const char_t* str1, const char_t* str2) { return ::strcmp(str1, str2); } - inline int strcasecmp(const char_t* str1, const char_t* str2) { return ::strcasecmp(str1, str2); } - inline int strncmp(const char_t* str1, const char_t* str2, int len) { return ::strncmp(str1, str2, len); } - inline int strncasecmp(const char_t* str1, const char_t* str2, int len) { return ::strncasecmp(str1, str2, len); } - - pal::string_t to_lower(const pal::string_t& in); - - inline size_t strlen(const char_t* str) { return ::strlen(str); } - inline void err_vprintf(const char_t* format, va_list vl) { ::vfprintf(stderr, format, vl); ::fputc('\n', stderr); } - inline void out_vprintf(const char_t* format, va_list vl) { ::vfprintf(stdout, format, vl); ::fputc('\n', stdout); } - inline bool utf8_palstring(const std::string& str, pal::string_t* out) { out->assign(str); return true; } - inline bool pal_clrstring(const pal::string_t& str, std::vector* out) { out->assign(str.begin(), str.end()); out->push_back('\0'); return true; } - inline bool clr_palstring(const char* cstr, pal::string_t* out) { out->assign(cstr); return true; } -#endif - - bool touch_file(const pal::string_t& path); - bool realpath(string_t* path); - bool file_exists(const string_t& path); - inline bool directory_exists(const string_t& path) { return file_exists(path); } - void readdir(const string_t& path, const string_t& pattern, std::vector* list); - void readdir(const string_t& path, std::vector* list); - - bool get_own_executable_path(string_t* recv); - bool getenv(const char_t* name, string_t* recv); - bool get_default_servicing_directory(string_t* recv); - bool get_default_breadcrumb_store(string_t* recv); - bool is_path_rooted(const string_t& path); - - int xtoi(const char_t* input); - - bool load_library(const char_t* path, dll_t* dll); - proc_t get_symbol(dll_t library, const char* name); - void unload_library(dll_t library); - - bool find_coreclr(pal::string_t* recv); -} - -#endif // PAL_H diff --git a/src/corehost/common/pal.unix.cpp b/src/corehost/common/pal.unix.cpp deleted file mode 100644 index f53ce4726..000000000 --- a/src/corehost/common/pal.unix.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "utils.h" -#include "trace.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__APPLE__) -#include -#endif - -#if defined(__LINUX__) -#define symlinkEntrypointExecutable "/proc/self/exe" -#elif !defined(__APPLE__) -#define symlinkEntrypointExecutable "/proc/curproc/exe" -#endif - -pal::string_t pal::to_string(int value) { return std::to_string(value); } - -pal::string_t pal::to_lower(const pal::string_t& in) -{ - pal::string_t ret = in; - std::transform(ret.begin(), ret.end(), ret.begin(), ::tolower); - return ret; -} - -bool pal::touch_file(const pal::string_t& path) -{ - int fd = open(path.c_str(), (O_CREAT | O_EXCL), (S_IRUSR | S_IRGRP | S_IROTH)); - if (fd == -1) - { - trace::warning(_X("open(%s) failed in %s"), path.c_str(), _STRINGIFY(__FUNCTION__)); - return false; - } - (void) close(fd); - return true; -} - -bool pal::getcwd(pal::string_t* recv) -{ - recv->clear(); - pal::char_t* buf = ::getcwd(nullptr, PATH_MAX + 1); - if (buf == nullptr) - { - if (errno == ENOENT) - { - return false; - } - perror("getcwd()"); - return false; - } - recv->assign(buf); - ::free(buf); - return true; -} - -bool pal::find_coreclr(pal::string_t* recv) -{ - pal::string_t candidate; - pal::string_t test; - - // Try /usr/share/dotnet and /usr/local/share/dotnet/cli - // TODO: These paths should be consistent - candidate.assign("/usr/share/dotnet/runtime/coreclr"); - if (coreclr_exists_in_dir(candidate)) { - recv->assign(candidate); - return true; - } - - candidate.assign("/usr/local/share/dotnet/runtime/coreclr"); - if (coreclr_exists_in_dir(candidate)) { - recv->assign(candidate); - return true; - } - return false; -} - -bool pal::load_library(const char_t* path, dll_t* dll) -{ - *dll = dlopen(path, RTLD_LAZY); - if (*dll == nullptr) - { - trace::error(_X("Failed to load %s, error: %s"), path, dlerror()); - return false; - } - return true; -} - -pal::proc_t pal::get_symbol(dll_t library, const char* name) -{ - auto result = dlsym(library, name); - if (result == nullptr) - { - trace::error(_X("Failed to resolve library symbol %s, error: %s"), name, dlerror()); - } - return result; -} - -void pal::unload_library(dll_t library) -{ - if (dlclose(library) != 0) - { - trace::warning(_X("Failed to unload library, error: %s"), dlerror()); - } -} - -int pal::xtoi(const char_t* input) -{ - return atoi(input); -} - -bool pal::is_path_rooted(const pal::string_t& path) -{ - return path.front() == '/'; -} - -bool pal::get_default_breadcrumb_store(string_t* recv) -{ - recv->clear(); - pal::string_t ext; - if (pal::getenv(_X("CORE_BREADCRUMBS"), &ext) && pal::realpath(&ext)) - { - // We should have the path in ext. - trace::info(_X("Realpath CORE_BREADCRUMBS [%s]"), ext.c_str()); - } - - if (!pal::directory_exists(ext)) - { - trace::info(_X("Directory core breadcrumbs [%s] was not specified or found"), ext.c_str()); - ext.clear(); - append_path(&ext, _X("opt")); - append_path(&ext, _X("corebreadcrumbs")); - if (!pal::directory_exists(ext)) - { - trace::info(_X("Fallback directory core breadcrumbs at [%s] was not found"), ext.c_str()); - return false; - } - } - - if (access(ext.c_str(), (R_OK | W_OK)) != 0) - { - trace::info(_X("Breadcrumb store [%s] is not ACL-ed with rw-"), ext.c_str()); - } - - recv->assign(ext); - return true; -} - -bool pal::get_default_servicing_directory(string_t* recv) -{ - recv->clear(); - pal::string_t ext; - if (pal::getenv(_X("CORE_SERVICING"), &ext) && pal::realpath(&ext)) - { - // We should have the path in ext. - trace::info(_X("Realpath CORE_SERVICING [%s]"), ext.c_str()); - } - - if (!pal::directory_exists(ext)) - { - trace::info(_X("Directory core servicing at [%s] was not specified or found"), ext.c_str()); - ext.clear(); - append_path(&ext, _X("opt")); - append_path(&ext, _X("coreservicing")); - if (!pal::directory_exists(ext)) - { - trace::info(_X("Fallback directory core servicing at [%s] was not found"), ext.c_str()); - return false; - } - } - - if (access(ext.c_str(), R_OK) != 0) - { - trace::info(_X("Directory core servicing at [%s] was not ACL-ed properly"), ext.c_str()); - } - - recv->assign(ext); - trace::info(_X("Using core servicing at [%s]"), ext.c_str()); - return true; -} - -#if defined(__APPLE__) -bool pal::get_own_executable_path(pal::string_t* recv) -{ - uint32_t path_length = 0; - if (_NSGetExecutablePath(nullptr, &path_length) == -1) - { - char path_buf[path_length]; - if (_NSGetExecutablePath(path_buf, &path_length) == 0) - { - recv->assign(path_buf); - return true; - } - } - return false; -} -#else -bool pal::get_own_executable_path(pal::string_t* recv) -{ - // Just return the symlink to the exe from /proc - // We'll call realpath on it later - recv->assign(symlinkEntrypointExecutable); - return true; -} -#endif - -// Returns true only if an env variable can be read successfully to be non-empty. -bool pal::getenv(const pal::char_t* name, pal::string_t* recv) -{ - recv->clear(); - - auto result = ::getenv(name); - if (result != nullptr) - { - recv->assign(result); - } - - return (recv->length() > 0); -} - -bool pal::realpath(pal::string_t* path) -{ - auto resolved = ::realpath(path->c_str(), nullptr); - if (resolved == nullptr) - { - if (errno == ENOENT) - { - return false; - } - perror("realpath()"); - return false; - } - path->assign(resolved); - ::free(resolved); - return true; -} - -bool pal::file_exists(const pal::string_t& path) -{ - if (path.empty()) - { - return false; - } - struct stat buffer; - return (::stat(path.c_str(), &buffer) == 0); -} - -void pal::readdir(const string_t& path, const string_t& pattern, std::vector* list) -{ - assert(list != nullptr); - - std::vector& files = *list; - - auto dir = opendir(path.c_str()); - if (dir != nullptr) - { - struct dirent* entry = nullptr; - while ((entry = readdir(dir)) != nullptr) - { - if (fnmatch(pattern.c_str(), entry->d_name, FNM_PATHNAME) != 0) - { - continue; - } - - // We are interested in files only - switch (entry->d_type) - { - case DT_DIR: - case DT_REG: - break; - - // Handle symlinks and file systems that do not support d_type - case DT_LNK: - case DT_UNKNOWN: - { - std::string fullFilename; - - fullFilename.append(path); - fullFilename.push_back(DIR_SEPARATOR); - fullFilename.append(entry->d_name); - - struct stat sb; - if (stat(fullFilename.c_str(), &sb) == -1) - { - continue; - } - - if (!S_ISREG(sb.st_mode) && !S_ISDIR(sb.st_mode)) - { - continue; - } - } - break; - - default: - continue; - } - - files.push_back(pal::string_t(entry->d_name)); - } - } -} - -void pal::readdir(const pal::string_t& path, std::vector* list) -{ - readdir(path, _X("*"), list); -} diff --git a/src/corehost/common/pal.windows.cpp b/src/corehost/common/pal.windows.cpp deleted file mode 100644 index ab792483d..000000000 --- a/src/corehost/common/pal.windows.cpp +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "pal.h" -#include "trace.h" -#include "utils.h" - -#include -#include -#include -#include - -pal::string_t pal::to_lower(const pal::string_t& in) -{ - pal::string_t ret = in; - std::transform(ret.begin(), ret.end(), ret.begin(), ::towlower); - return ret; -} - -pal::string_t pal::to_string(int value) -{ - return std::to_wstring(value); -} - -bool pal::find_coreclr(pal::string_t* recv) -{ - pal::string_t candidate; - - // Try %LocalAppData%\dotnet - if (pal::getenv(_X("LocalAppData"), &candidate)) { - append_path(&candidate, _X("dotnet")); - append_path(&candidate, _X("runtime")); - append_path(&candidate, _X("coreclr")); - if (coreclr_exists_in_dir(candidate)) { - recv->assign(candidate); - return true; - } - } - - - // Try %ProgramFiles%. Note this works for both x86 and x64/wow64 as per: - // https://msdn.microsoft.com/en-us/library/windows/desktop/aa384274(v=vs.85).aspx - - // candidate.clear(); getenv clears it. - if (pal::getenv(_X("ProgramFiles"), &candidate)) { - append_path(&candidate, _X("dotnet")); - append_path(&candidate, _X("bin")); - if (coreclr_exists_in_dir(candidate)) { - recv->assign(candidate); - return true; - } - } - return false; -} - -bool pal::touch_file(const pal::string_t& path) -{ - HANDLE hnd = ::CreateFileW(path.c_str(), 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (hnd == INVALID_HANDLE_VALUE) - { - trace::verbose(_X("Failed to leave breadcrumb"), HRESULT_FROM_WIN32(GetLastError())); - return false; - } - ::CloseHandle(hnd); - return true; -} - -void pal::setup_api_sets(const std::unordered_set& api_sets) -{ - if (api_sets.empty()) - { - return; - } - - pal::string_t path; - - (void) getenv(_X("PATH"), &path); - - // We need this ugly hack, as the PInvoked DLL's static dependencies can come from - // some other NATIVE_DLL_SEARCH_DIRECTORIES and not necessarily side by side. However, - // CoreCLR.dll loads PInvoke DLLs with LOAD_WITH_ALTERED_SEARCH_PATH. Note that this - // option cannot be combined with LOAD_LIBRARY_SEARCH_USER_DIRS, so the AddDllDirectory - // doesn't help much in telling CoreCLR where to load the PInvoke DLLs from. - // So we resort to modifying the PATH variable on our own hoping Windows loader will do the right thing. - for (const auto& as : api_sets) - { - // AddDllDirectory is still needed for Standalone App's CoreCLR load. - ::AddDllDirectory(as.c_str()); - - // Path patch is needed for static dependencies of a PInvoked DLL load out of the nuget cache. - path.push_back(PATH_SEPARATOR); - path.append(as); - } - - trace::verbose(_X("Setting PATH=%s"), path.c_str()); - - ::SetEnvironmentVariableW(_X("PATH"), path.c_str()); -} - -bool pal::getcwd(pal::string_t* recv) -{ - recv->clear(); - - pal::char_t buf[MAX_PATH]; - DWORD result = GetCurrentDirectoryW(MAX_PATH, buf); - if (result < MAX_PATH) - { - recv->assign(buf); - return true; - } - else if (result != 0) - { - std::vector str; - str.resize(result); - result = GetCurrentDirectoryW(str.size(), str.data()); - assert(result <= str.size()); - if (result != 0) - { - recv->assign(str.data()); - return true; - } - } - assert(result == 0); - trace::error(_X("Failed to obtain working directory, HRESULT: 0x%X"), HRESULT_FROM_WIN32(GetLastError())); - return false; -} - -bool pal::load_library(const char_t* path, dll_t* dll) -{ - // LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: - // In portable apps, coreclr would come from another directory than the host, - // so make sure coreclr dependencies can be resolved from coreclr.dll load dir. - *dll = ::LoadLibraryExW(path, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); - if (*dll == nullptr) - { - trace::error(_X("Failed to load the dll from [%s], HRESULT: 0x%X"), path, HRESULT_FROM_WIN32(GetLastError())); - return false; - } - - // Pin the module - HMODULE dummy_module; - if (!::GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN, path, &dummy_module)) - { - trace::error(_X("Failed to pin library [%s] in [%s]"), path, _STRINGIFY(__FUNCTION__)); - return false; - } - - if (trace::is_enabled()) - { - pal::char_t buf[PATH_MAX]; - ::GetModuleFileNameW(*dll, buf, PATH_MAX); - trace::info(_X("Loaded library from %s"), buf); - } - - return true; -} - -pal::proc_t pal::get_symbol(dll_t library, const char* name) -{ - return ::GetProcAddress(library, name); -} - -void pal::unload_library(dll_t library) -{ - // No-op. On windows, we pin the library, so it can't be unloaded. -} - -bool pal::get_default_breadcrumb_store(string_t* recv) -{ - recv->clear(); - - pal::char_t* prog_dat; - HRESULT hr = ::SHGetKnownFolderPath(FOLDERID_ProgramData, 0, NULL, &prog_dat); - if (hr != S_OK) - { - trace::verbose(_X("Failed to read default breadcrumb store 0x%X"), hr); - return false; - } - recv->assign(prog_dat); - append_path(recv, _X("Microsoft")); - append_path(recv, _X("NetFramework")); - append_path(recv, _X("BreadcrumbStore")); - return true; -} - -bool pal::get_default_servicing_directory(string_t* recv) -{ - recv->clear(); - - // See https://github.com/dotnet/cli/issues/2179 -#ifdef _TARGET_X86_ - // In WOW64 mode, PF maps to PFx86. - if (!pal::getenv(_X("ProgramFiles"), recv)) -#elif defined(_TARGET_AMD64_) - if (!pal::getenv(_X("ProgramFiles(x86)"), recv)) -#endif - { - return false; - } - - append_path(recv, _X("coreservicing")); - return true; -} - -bool pal::is_path_rooted(const string_t& path) -{ - return path.length() >= 2 && path[1] == L':'; -} - -// Returns true only if an env variable can be read successfully to be non-empty. -bool pal::getenv(const char_t* name, string_t* recv) -{ - recv->clear(); - - auto length = ::GetEnvironmentVariableW(name, nullptr, 0); - if (length == 0) - { - auto err = GetLastError(); - if (err != ERROR_ENVVAR_NOT_FOUND) - { - trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError())); - } - return false; - } - auto buf = new char_t[length]; - if (::GetEnvironmentVariableW(name, buf, length) == 0) - { - trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError())); - return false; - } - - recv->assign(buf); - delete[] buf; - - return true; -} - -int pal::xtoi(const char_t* input) -{ - return ::_wtoi(input); -} - -bool pal::get_own_executable_path(string_t* recv) -{ - char_t program_path[MAX_PATH]; - DWORD dwModuleFileName = ::GetModuleFileNameW(NULL, program_path, MAX_PATH); - if (dwModuleFileName == 0 || dwModuleFileName >= MAX_PATH) { - return false; - } - recv->assign(program_path); - return true; -} - -static bool wchar_convert_helper(DWORD code_page, const char* cstr, int len, pal::string_t* out) -{ - out->clear(); - - // No need of explicit null termination, so pass in the actual length. - size_t size = ::MultiByteToWideChar(code_page, 0, cstr, len, nullptr, 0); - if (size == 0) - { - return false; - } - out->resize(size, '\0'); - return ::MultiByteToWideChar(code_page, 0, cstr, len, &(*out)[0], out->size()) != 0; -} - -bool pal::utf8_palstring(const std::string& str, pal::string_t* out) -{ - return wchar_convert_helper(CP_UTF8, &str[0], str.size(), out); -} - -bool pal::pal_clrstring(const pal::string_t& str, std::vector* out) -{ - out->clear(); - - // Pass -1 as we want explicit null termination in the char buffer. - size_t size = ::WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, nullptr, 0, nullptr, nullptr); - if (size == 0) - { - return false; - } - out->resize(size, '\0'); - return ::WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, out->data(), out->size(), nullptr, nullptr) != 0; -} - -bool pal::clr_palstring(const char* cstr, pal::string_t* out) -{ - return wchar_convert_helper(CP_UTF8, cstr, ::strlen(cstr), out); -} - -bool pal::realpath(string_t* path) -{ - char_t buf[MAX_PATH]; - auto res = ::GetFullPathNameW(path->c_str(), MAX_PATH, buf, nullptr); - if (res == 0 || res > MAX_PATH) - { - trace::error(_X("Error resolving full path [%s]"), path->c_str()); - return false; - } - path->assign(buf); - return true; -} - -bool pal::file_exists(const string_t& path) -{ - if (path.empty()) - { - return false; - } - - WIN32_FIND_DATAW data; - auto find_handle = ::FindFirstFileW(path.c_str(), &data); - bool found = find_handle != INVALID_HANDLE_VALUE; - ::FindClose(find_handle); - return found; -} - -void pal::readdir(const string_t& path, const string_t& pattern, std::vector* list) -{ - assert(list != nullptr); - - std::vector& files = *list; - - string_t search_string(path); - append_path(&search_string, pattern.c_str()); - - WIN32_FIND_DATAW data = { 0 }; - auto handle = ::FindFirstFileExW(search_string.c_str(), FindExInfoStandard, &data, FindExSearchNameMatch, NULL, 0); - if (handle == INVALID_HANDLE_VALUE) - { - return; - } - do - { - string_t filepath(data.cFileName); - files.push_back(filepath); - } while (::FindNextFileW(handle, &data)); - ::FindClose(handle); -} - -void pal::readdir(const string_t& path, std::vector* list) -{ - pal::readdir(path, _X("*"), list); -} diff --git a/src/corehost/common/trace.cpp b/src/corehost/common/trace.cpp deleted file mode 100644 index b04c9d3e1..000000000 --- a/src/corehost/common/trace.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "trace.h" - -static bool g_enabled = false; - -// -// Turn on tracing for the corehost based on "COREHOST_TRACE" env. -// -void trace::setup() -{ - // Read trace environment variable - pal::string_t trace_str; - if (!pal::getenv(_X("COREHOST_TRACE"), &trace_str)) - { - return; - } - - auto trace_val = pal::xtoi(trace_str.c_str()); - if (trace_val > 0) - { - trace::enable(); - trace::info(_X("Tracing enabled")); - } -} - -void trace::enable() -{ - g_enabled = true; -} - -bool trace::is_enabled() -{ - return g_enabled; -} - -void trace::verbose(const pal::char_t* format, ...) -{ - if (g_enabled) - { - va_list args; - va_start(args, format); - pal::err_vprintf(format, args); - va_end(args); - } -} - -void trace::info(const pal::char_t* format, ...) -{ - if (g_enabled) - { - va_list args; - va_start(args, format); - pal::err_vprintf(format, args); - va_end(args); - } -} - -void trace::error(const pal::char_t* format, ...) -{ - // Always print errors - va_list args; - va_start(args, format); - pal::err_vprintf(format, args); - va_end(args); -} - -void trace::println(const pal::char_t* format, ...) -{ - va_list args; - va_start(args, format); - pal::out_vprintf(format, args); - va_end(args); -} - -void trace::println() -{ - println(_X("")); -} - -void trace::warning(const pal::char_t* format, ...) -{ - if (g_enabled) - { - va_list args; - va_start(args, format); - pal::err_vprintf(format, args); - va_end(args); - } -} diff --git a/src/corehost/common/trace.h b/src/corehost/common/trace.h deleted file mode 100644 index d462ef12c..000000000 --- a/src/corehost/common/trace.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef TRACE_H -#define TRACE_H - -#include "pal.h" - -namespace trace -{ - void setup(); - void enable(); - bool is_enabled(); - void verbose(const pal::char_t* format, ...); - void info(const pal::char_t* format, ...); - void warning(const pal::char_t* format, ...); - void error(const pal::char_t* format, ...); - void println(const pal::char_t* format, ...); - void println(); -}; - -#endif // TRACE_H diff --git a/src/corehost/common/utils.cpp b/src/corehost/common/utils.cpp deleted file mode 100644 index 60488607e..000000000 --- a/src/corehost/common/utils.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "utils.h" -#include "trace.h" - -bool library_exists_in_dir(const pal::string_t& lib_dir, const pal::string_t& lib_name, pal::string_t* p_lib_path) -{ - pal::string_t lib_path = lib_dir; - append_path(&lib_path, lib_name.c_str()); - - if (!pal::file_exists(lib_path)) - { - return false; - } - if (p_lib_path) - { - *p_lib_path = lib_path; - } - return true; -} - -bool coreclr_exists_in_dir(const pal::string_t& candidate) -{ - pal::string_t test(candidate); - append_path(&test, LIBCORECLR_NAME); - trace::verbose(_X("Checking if CoreCLR path exists=[%s]"), test.c_str()); - return pal::file_exists(test); -} - -bool ends_with(const pal::string_t& value, const pal::string_t& suffix, bool match_case) -{ - auto cmp = match_case ? pal::strcmp : pal::strcasecmp; - return (value.size() >= suffix.size()) && - cmp(value.c_str() + value.size() - suffix.size(), suffix.c_str()) == 0; -} - -bool starts_with(const pal::string_t& value, const pal::string_t& prefix, bool match_case) -{ - if (prefix.empty()) - { - // Cannot start with an empty string. - return false; - } - auto cmp = match_case ? pal::strncmp : pal::strncasecmp; - return (value.size() >= prefix.size()) && - cmp(value.c_str(), prefix.c_str(), prefix.size()) == 0; -} - -void append_path(pal::string_t* path1, const pal::char_t* path2) -{ - if (pal::is_path_rooted(path2)) - { - path1->assign(path2); - } - else - { - if (path1->empty() || path1->back() != DIR_SEPARATOR) - { - path1->push_back(DIR_SEPARATOR); - } - path1->append(path2); - } -} - -pal::string_t get_executable(const pal::string_t& filename) -{ - pal::string_t exe_suffix = pal::exe_suffix(); - if (exe_suffix.empty()) - { - return filename; - } - - if (ends_with(filename, exe_suffix, false)) - { - // We need to strip off the old extension - pal::string_t result(filename); - result.erase(result.size() - exe_suffix.size()); - return result; - } - - return filename; -} - -pal::string_t strip_file_ext(const pal::string_t& path) -{ - if (path.empty()) - { - return path; - } - size_t sep_pos = path.rfind(_X("/\\")); - size_t dot_pos = path.rfind(_X('.')); - if (sep_pos != pal::string_t::npos && sep_pos > dot_pos) - { - return path; - } - return path.substr(0, dot_pos); -} - -pal::string_t get_filename_without_ext(const pal::string_t& path) -{ - if (path.empty()) - { - return path; - } - - size_t name_pos = path.find_last_of(_X("/\\")); - size_t dot_pos = path.rfind(_X('.')); - size_t start_pos = (name_pos == pal::string_t::npos) ? 0 : (name_pos + 1); - size_t count = (dot_pos == pal::string_t::npos || dot_pos < start_pos) ? pal::string_t::npos : (dot_pos - start_pos); - return path.substr(start_pos, count); -} - -pal::string_t get_filename(const pal::string_t& path) -{ - if (path.empty()) - { - return path; - } - - auto name_pos = path.find_last_of(DIR_SEPARATOR); - if (name_pos == pal::string_t::npos) - { - return path; - } - - return path.substr(name_pos + 1); -} - -pal::string_t get_directory(const pal::string_t& path) -{ - // Find the last dir separator - auto path_sep = path.find_last_of(DIR_SEPARATOR); - if (path_sep == pal::string_t::npos) - { - return pal::string_t(path); - } - - return path.substr(0, path_sep); -} - -void replace_char(pal::string_t* path, pal::char_t match, pal::char_t repl) -{ - int pos = 0; - while ((pos = path->find(match, pos)) != pal::string_t::npos) - { - (*path)[pos] = repl; - } -} - -const pal::char_t* get_arch() -{ -#if _TARGET_AMD64_ - return _X("x64"); -#elif _TARGET_X86_ - return _X("x86"); -#elif _TARGET_ARM_ - return _X("arm"); -#else -#error "Unknown target" -#endif -} - -pal::string_t get_last_known_arg( - const std::unordered_map>& opts, - const pal::string_t& opt_key, - const pal::string_t& de_fault) -{ - if (opts.count(opt_key)) - { - const auto& val = opts.find(opt_key)->second; - return val[val.size() - 1]; - } - return de_fault; -} - -bool parse_known_args( - const int argc, - const pal::char_t* argv[], - const std::vector& known_opts, - // Although multimap would provide this functionality the order of kv, values are - // not preserved in C++ < C++0x - std::unordered_map>* opts, - int* num_args) -{ - int arg_i = *num_args; - while (arg_i < argc) - { - pal::string_t arg = argv[arg_i]; - pal::string_t arg_lower = pal::to_lower(arg); - if (std::find(known_opts.begin(), known_opts.end(), arg_lower) == known_opts.end()) - { - // Unknown argument. - break; - } - - // Known argument, so expect one more arg (value) to be present. - if (arg_i + 1 >= argc) - { - return false; - } - - trace::verbose(_X("Parsed known arg %s = %s"), arg.c_str(), argv[arg_i + 1]); - (*opts)[arg_lower].push_back(argv[arg_i + 1]); - - // Increment for both the option and its value. - arg_i += 2; - } - - *num_args = arg_i; - - return true; -} - -// Try to match 0xEF 0xBB 0xBF byte sequence (no endianness here.) -bool skip_utf8_bom(pal::ifstream_t* stream) -{ - if (stream->eof() || !stream->good()) - { - return false; - } - - int peeked = stream->peek(); - if (peeked == EOF || ((peeked & 0xFF) != 0xEF)) - { - return false; - } - - unsigned char bytes[3]; - stream->read((char*) bytes, 3); - if ((stream->gcount() < 3) || - (bytes[1] != 0xBB) || - (bytes[2] != 0xBF)) - { - // Reset to 0 if returning false. - stream->seekg(0, stream->beg); - return false; - } - - return true; -} diff --git a/src/corehost/common/utils.h b/src/corehost/common/utils.h deleted file mode 100644 index 7f8e5cef7..000000000 --- a/src/corehost/common/utils.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef UTILS_H -#define UTILS_H - -#include "pal.h" - -#define _STRINGIFY(s) _X(s) - -bool ends_with(const pal::string_t& value, const pal::string_t& suffix, bool match_case); -bool starts_with(const pal::string_t& value, const pal::string_t& prefix, bool match_case); -pal::string_t get_executable(const pal::string_t& filename); -pal::string_t get_directory(const pal::string_t& path); -pal::string_t strip_file_ext(const pal::string_t& path); -pal::string_t get_filename(const pal::string_t& path); -pal::string_t get_filename_without_ext(const pal::string_t& path); -void append_path(pal::string_t* path1, const pal::char_t* path2); -bool library_exists_in_dir(const pal::string_t& lib_dir, const pal::string_t& lib_name, pal::string_t* p_lib_path); -bool coreclr_exists_in_dir(const pal::string_t& candidate); -void replace_char(pal::string_t* path, pal::char_t match, pal::char_t repl); -const pal::char_t* get_arch(); -pal::string_t get_last_known_arg( - const std::unordered_map>& opts, - const pal::string_t& opt_key, - const pal::string_t& de_fault); -bool parse_known_args( - const int argc, - const pal::char_t* argv[], - const std::vector& known_opts, - std::unordered_map>* opts, - int* num_args); -bool skip_utf8_bom(pal::ifstream_t* stream); -#endif diff --git a/src/corehost/corehost.cpp b/src/corehost/corehost.cpp deleted file mode 100644 index 6201d1172..000000000 --- a/src/corehost/corehost.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "trace.h" -#include "utils.h" -#include "pal.h" -#include "fx_ver.h" -#include "error_codes.h" - -#define LIBFXR_NAME MAKE_LIBNAME("hostfxr") - -typedef int(*hostfxr_main_fn) (const int argc, const pal::char_t* argv[]); - -pal::string_t resolve_fxr_path(const pal::string_t& own_dir) -{ - pal::string_t fxr_dir = own_dir; - append_path(&fxr_dir, _X("host")); - append_path(&fxr_dir, _X("fxr")); - if (pal::directory_exists(fxr_dir)) - { - trace::info(_X("Reading fx resolver directory=[%s]"), fxr_dir.c_str()); - - std::vector list; - pal::readdir(fxr_dir, &list); - - fx_ver_t max_ver(-1, -1, -1); - for (const auto& dir : list) - { - trace::info(_X("Considering fxr version=[%s]..."), dir.c_str()); - - pal::string_t ver = get_filename(dir); - - fx_ver_t fx_ver(-1, -1, -1); - if (fx_ver_t::parse(ver, &fx_ver, false)) - { - max_ver = std::max(max_ver, fx_ver); - } - } - - pal::string_t max_ver_str = max_ver.as_str(); - append_path(&fxr_dir, max_ver_str.c_str()); - trace::info(_X("Detected latest fxr version=[%s]..."), fxr_dir.c_str()); - - pal::string_t ret_path; - if (library_exists_in_dir(fxr_dir, LIBFXR_NAME, &ret_path)) - { - trace::info(_X("Resolved fxr [%s]..."), ret_path.c_str()); - return ret_path; - } - } - - pal::string_t fxr_path; - if (library_exists_in_dir(own_dir, LIBFXR_NAME, &fxr_path)) - { - trace::info(_X("Resolved fxr [%s]..."), fxr_path.c_str()); - return fxr_path; - } - return pal::string_t(); -} - -int run(const int argc, const pal::char_t* argv[]) -{ - pal::string_t own_path; - if (!pal::get_own_executable_path(&own_path) || !pal::realpath(&own_path)) - { - trace::error(_X("Failed to resolve full path of the current executable [%s]"), own_path.c_str()); - return StatusCode::CoreHostCurExeFindFailure; - } - - pal::dll_t fxr; - - pal::string_t own_dir = get_directory(own_path); - - // Load library - pal::string_t fxr_path = resolve_fxr_path(own_dir); - if (!pal::load_library(fxr_path.c_str(), &fxr)) - { - trace::info(_X("Load library of %s failed"), fxr_path.c_str()); - return StatusCode::CoreHostLibLoadFailure; - } - - // Obtain entrypoint symbols - hostfxr_main_fn main_fn = (hostfxr_main_fn) pal::get_symbol(fxr, "hostfxr_main"); - int code = main_fn(argc, argv); - pal::unload_library(fxr); - return code; -} - -static char sccsid[] = "@(#)" \ - "version: " \ - HOST_PKG_VER \ - "; commit: " \ - REPO_COMMIT_HASH \ - "; built: " \ - __DATE__ \ - " " \ - __TIME__ \ - ; - -#if defined(_WIN32) -int __cdecl wmain(const int argc, const pal::char_t* argv[]) -#else -int main(const int argc, const pal::char_t* argv[]) -#endif -{ - trace::setup(); - - if (trace::is_enabled()) - { - trace::info(_X("--- Invoked dotnet [version: %s, commit hash: %s] main = {"), _STRINGIFY(HOST_PKG_VER), _STRINGIFY(REPO_COMMIT_HASH)); - for (int i = 0; i < argc; ++i) - { - trace::info(_X("%s"), argv[i]); - } - trace::info(_X("}")); - } - - return run(argc, argv); -} - diff --git a/src/corehost/error_codes.h b/src/corehost/error_codes.h deleted file mode 100644 index 3b06f6f9e..000000000 --- a/src/corehost/error_codes.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef __ERROR_CODES_H__ -#define __ERROR_CODES_H__ -enum StatusCode -{ - Success = 0, - InvalidArgFailure = 0x80008081, - CoreHostLibLoadFailure = 0x80008082, - CoreHostLibMissingFailure = 0x80008083, - CoreHostEntryPointFailure = 0x80008084, - CoreHostCurExeFindFailure = 0x80008085, - CoreHostResolveModeFailure = 0x80008086, - CoreClrResolveFailure = 0x80008087, - CoreClrBindFailure = 0x80008088, - CoreClrInitFailure = 0x80008089, - CoreClrExeFailure = 0x8000808a, - ResolverInitFailure = 0x8000808b, - ResolverResolveFailure = 0x8000808c, - LibHostCurExeFindFailure = 0x8000808d, - LibHostInitFailure = 0x8000808e, - LibHostMuxFailure = 0x8000808f, - LibHostExecModeFailure = 0x80008090, - LibHostSdkFindFailure = 0x80008091, - LibHostInvalidArgs = 0x80008092, - InvalidConfigFile = 0x80008093, - AppArgNotRunnable = 0x80008094 -}; -#endif // __ERROR_CODES_H__ diff --git a/src/dotnet-compile-fsc/project.json b/src/dotnet-compile-fsc/project.json index 56354b2f0..acf9d140a 100644 --- a/src/dotnet-compile-fsc/project.json +++ b/src/dotnet-compile-fsc/project.json @@ -24,7 +24,7 @@ }, "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } }, "frameworks": { diff --git a/src/dotnet/project.json b/src/dotnet/project.json index da02c2c89..e08abd2fd 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -43,7 +43,7 @@ }, "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Diagnostics.TraceSource": "4.0.0-rc3-24123-01", "System.Diagnostics.TextWriterTraceListener": "4.0.0-rc3-24123-01", diff --git a/src/sharedframework/framework/Program.cs b/src/sharedframework/framework/Program.cs deleted file mode 100644 index 4aa370b90..000000000 --- a/src/sharedframework/framework/Program.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace ConsoleApplication -{ - public class Program - { - public static void Main(string[] args) - { - } - } -} \ No newline at end of file diff --git a/src/sharedframework/framework/project.json.template b/src/sharedframework/framework/project.json.template deleted file mode 100644 index d458d4322..000000000 --- a/src/sharedframework/framework/project.json.template +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Microsoft.NETCore.App": "$(NetCoreAppVersion)" - }, - "runtimes": { - "$(RID)": {} - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "portable-net45+win8" - ] - } - } -} diff --git a/test/ArgumentForwardingTests/project.json b/test/ArgumentForwardingTests/project.json index bde06268b..42354c478 100644 --- a/test/ArgumentForwardingTests/project.json +++ b/test/ArgumentForwardingTests/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.ProjectModel": { diff --git a/test/ArgumentsReflector/project.json b/test/ArgumentsReflector/project.json index 1683272d0..997a61c79 100644 --- a/test/ArgumentsReflector/project.json +++ b/test/ArgumentsReflector/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" } }, "frameworks": { diff --git a/test/EndToEnd/project.json b/test/EndToEnd/project.json index 542b632bf..05cb6e309 100644 --- a/test/EndToEnd/project.json +++ b/test/EndToEnd/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.ProjectModel": { diff --git a/test/Kestrel.Tests/project.json b/test/Kestrel.Tests/project.json index bb76cc537..88d342c3c 100644 --- a/test/Kestrel.Tests/project.json +++ b/test/Kestrel.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 09108e693..80557d732 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -16,7 +16,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Diagnostics.TraceSource": "4.0.0-rc3-24123-01", "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", diff --git a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json index 883fbf2f8..2ccb1c7f7 100644 --- a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json +++ b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/project.json b/test/Microsoft.DotNet.ProjectModel.Tests/project.json index ea84cc7e8..301856970 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/project.json +++ b/test/Microsoft.DotNet.ProjectModel.Tests/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.ProjectModel": { diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json index 42aa43c5c..ff9139a36 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json @@ -23,7 +23,7 @@ ], "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24022", "System.Collections.Immutable": "1.2.0-rc2-24022", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index f1a61b85b..498726ad4 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Diagnostics.TraceSource": "4.0.0-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/Performance/project.json b/test/Performance/project.json index 5a6e1e08f..56c5a0162 100644 --- a/test/Performance/project.json +++ b/test/Performance/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.ProjectModel": { diff --git a/test/ScriptExecutorTests/project.json b/test/ScriptExecutorTests/project.json index bc93009e1..15fc8323c 100644 --- a/test/ScriptExecutorTests/project.json +++ b/test/ScriptExecutorTests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json index d2f2a6dad..2ae352956 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.Extensions.Testing.Abstractions": { "target": "project" diff --git a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json index f21396034..6b033c5dc 100644 --- a/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json +++ b/test/TestingAbstractions/Microsoft.Extensions.Testing.Abstractions.UnitTests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.Extensions.Testing.Abstractions": { "target": "project" diff --git a/test/crossgen.Tests/project.json b/test/crossgen.Tests/project.json index e2d6c2500..8c5bfca85 100644 --- a/test/crossgen.Tests/project.json +++ b/test/crossgen.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-build.Tests/project.json b/test/dotnet-build.Tests/project.json index b0965e79c..1f567b976 100644 --- a/test/dotnet-build.Tests/project.json +++ b/test/dotnet-build.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-compile-fsc.Tests/project.json b/test/dotnet-compile-fsc.Tests/project.json index 1219474e6..b32a8bac4 100644 --- a/test/dotnet-compile-fsc.Tests/project.json +++ b/test/dotnet-compile-fsc.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-compile.Tests/project.json b/test/dotnet-compile.Tests/project.json index 8f8399efb..83d5fadf7 100644 --- a/test/dotnet-compile.Tests/project.json +++ b/test/dotnet-compile.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-compile.UnitTests/project.json b/test/dotnet-compile.UnitTests/project.json index 9b4818851..802a89c00 100644 --- a/test/dotnet-compile.UnitTests/project.json +++ b/test/dotnet-compile.UnitTests/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.Cli.Utils": { "target": "project" diff --git a/test/dotnet-new.Tests/project.json b/test/dotnet-new.Tests/project.json index 321da3f99..6b8a8432e 100644 --- a/test/dotnet-new.Tests/project.json +++ b/test/dotnet-new.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-pack.Tests/project.json b/test/dotnet-pack.Tests/project.json index b88ad5e6a..504f3485f 100644 --- a/test/dotnet-pack.Tests/project.json +++ b/test/dotnet-pack.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "System.IO.Compression.ZipFile": "4.0.1-rc3-24123-01", diff --git a/test/dotnet-projectmodel-server.Tests/project.json b/test/dotnet-projectmodel-server.Tests/project.json index da467385f..505e57743 100644 --- a/test/dotnet-projectmodel-server.Tests/project.json +++ b/test/dotnet-projectmodel-server.Tests/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "dotnet": { "target": "project" diff --git a/test/dotnet-publish.Tests/project.json b/test/dotnet-publish.Tests/project.json index 05b046582..7de6bf691 100644 --- a/test/dotnet-publish.Tests/project.json +++ b/test/dotnet-publish.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.TestFramework": { diff --git a/test/dotnet-resgen.Tests/project.json b/test/dotnet-resgen.Tests/project.json index df6357341..be59bf61e 100644 --- a/test/dotnet-resgen.Tests/project.json +++ b/test/dotnet-resgen.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-run.Tests/project.json b/test/dotnet-run.Tests/project.json index bb76cc537..88d342c3c 100644 --- a/test/dotnet-run.Tests/project.json +++ b/test/dotnet-run.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-run.UnitTests/project.json b/test/dotnet-run.UnitTests/project.json index 29eab7175..e7d226ebf 100644 --- a/test/dotnet-run.UnitTests/project.json +++ b/test/dotnet-run.UnitTests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "dotnet": { diff --git a/test/dotnet-test.Tests/project.json b/test/dotnet-test.Tests/project.json index 73c8a4fa5..bd274e559 100644 --- a/test/dotnet-test.Tests/project.json +++ b/test/dotnet-test.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Newtonsoft.Json": "7.0.1", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 4224c93fc..ab29cece1 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "Newtonsoft.Json": "7.0.1", "dotnet": { diff --git a/test/dotnet.Tests/project.json b/test/dotnet.Tests/project.json index 1ff812e74..c64cb4f85 100644 --- a/test/dotnet.Tests/project.json +++ b/test/dotnet.Tests/project.json @@ -3,7 +3,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc3-*" + "version": "1.0.0-rc3-004306" }, "System.Runtime.Serialization.Primitives": "4.1.1-rc3-24123-01", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/tools/MultiProjectValidator/project.json b/tools/MultiProjectValidator/project.json index dfda07290..4d539ce49 100644 --- a/tools/MultiProjectValidator/project.json +++ b/tools/MultiProjectValidator/project.json @@ -5,7 +5,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc3-*", + "Microsoft.NETCore.App": "1.0.0-rc3-004306", "Microsoft.DotNet.ProjectModel": { "target": "project" }, diff --git a/tools/RuntimeGraphGenerator/Program.cs b/tools/RuntimeGraphGenerator/Program.cs deleted file mode 100644 index cbaddbe9f..000000000 --- a/tools/RuntimeGraphGenerator/Program.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Collections.Generic; -using System.CommandLine; -using System.IO; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.ProjectModel; -using Microsoft.DotNet.ProjectModel.Graph; -using Microsoft.Extensions.DependencyModel; -using NuGet.Frameworks; - -namespace RuntimeGraphGenerator -{ - public class Program - { - public static int Main(string[] args) - { - DebugHelper.HandleDebugSwitch(ref args); - - string projectDirectory = null; - string depsFile = null; - IReadOnlyList runtimes = null; - try - { - ArgumentSyntax.Parse(args, syntax => - { - syntax.ApplicationName = "Runtime GraphGenerator"; - - syntax.HandleHelp = false; - syntax.HandleErrors = false; - - syntax.DefineOption("p|project", ref projectDirectory, "Project location"); - syntax.DefineOption("d|deps", ref depsFile, "Deps file path"); - - syntax.DefineParameterList("runtimes", ref runtimes, "Runtimes"); - }); - } - catch (ArgumentSyntaxException exception) - { - Console.Error.WriteLine(exception.Message); - return 1; - } - - if (runtimes == null || runtimes.Count == 0) - { - Reporter.Error.WriteLine("No runtimes specified"); - return 1; - } - if (!File.Exists(depsFile)) - { - Reporter.Error.WriteLine($"Deps file not found: {depsFile}"); - return 1; - } - if (!Directory.Exists(projectDirectory)) - { - Reporter.Error.WriteLine($"Project directory not found: {projectDirectory}"); - return 1; - } - - try - { - DependencyContext context; - using (var depsStream = File.OpenRead(depsFile)) - { - context = new DependencyContextJsonReader().Read(depsStream); - } - var framework = NuGetFramework.Parse(context.Target.Framework); - var projectContext = ProjectContext.Create(projectDirectory, framework); - - // Configuration is used only for P2P dependencies so were don't care - var exporter = projectContext.CreateExporter("Debug"); - var manager = new RuntimeGraphManager(); - var graph = manager.Collect(exporter.GetDependencies(LibraryType.Package)); - var expandedGraph = manager.Expand(graph, runtimes); - - context = new DependencyContext( - context.Target, - context.CompilationOptions, - context.CompileLibraries, - context.RuntimeLibraries, - expandedGraph - ); - - using (var depsStream = File.Create(depsFile)) - { - new DependencyContextWriter().Write(context, depsStream); - } - - return 0; - } - catch (Exception ex) - { -#if DEBUG - Reporter.Error.WriteLine(ex.ToString()); -#else - Reporter.Error.WriteLine(ex.Message); -#endif - return 1; - } - } - - } -} diff --git a/tools/RuntimeGraphGenerator/RuntimeGraphGenerator.xproj b/tools/RuntimeGraphGenerator/RuntimeGraphGenerator.xproj deleted file mode 100644 index e88aee95c..000000000 --- a/tools/RuntimeGraphGenerator/RuntimeGraphGenerator.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25029 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - efc4fe68-83eb-40e4-bfa8-61d0b4626f25 - RuntimeGraphGenerator - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin - - - - 2.0 - - - \ No newline at end of file diff --git a/tools/RuntimeGraphGenerator/RuntimeGraphManager.cs b/tools/RuntimeGraphGenerator/RuntimeGraphManager.cs deleted file mode 100644 index 88e290307..000000000 --- a/tools/RuntimeGraphGenerator/RuntimeGraphManager.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.DotNet.ProjectModel.Compilation; -using Microsoft.DotNet.ProjectModel.Graph; -using Microsoft.Extensions.DependencyModel; -using NuGet.RuntimeModel; - -namespace Microsoft.DotNet.ProjectModel -{ - public class RuntimeGraphManager - { - private const string RuntimeJsonFileName = "runtime.json"; - - public NuGet.RuntimeModel.RuntimeGraph Collect(IEnumerable exports) - { - var graph = RuntimeGraph.Empty; - foreach (var export in exports) - { - if (export.Library.Identity.Type == LibraryType.Package) - { - var runtimeJson = ((PackageDescription) export.Library).PackageLibrary.Files.FirstOrDefault(f => f == RuntimeJsonFileName); - if (runtimeJson != null) - { - var runtimeJsonFullName = Path.Combine(export.Library.Path, runtimeJson); - graph = RuntimeGraph.Merge(graph, JsonRuntimeFormat.ReadRuntimeGraph(runtimeJsonFullName)); - } - } - } - return graph; - } - - public IEnumerable Expand(RuntimeGraph runtimeGraph, IEnumerable runtimes) - { - foreach (var runtime in runtimes) - { - var importers = FindImporters(runtimeGraph, runtime); - foreach (var importer in importers) - { - // ExpandRuntime return runtime itself as first item so we are skiping it - yield return new RuntimeFallbacks(importer, runtimeGraph.ExpandRuntime(importer).Skip(1)); - } - } - } - - private IEnumerable FindImporters(RuntimeGraph runtimeGraph, string runtime) - { - foreach (var runtimePair in runtimeGraph.Runtimes) - { - var expanded = runtimeGraph.ExpandRuntime(runtimePair.Key); - if (expanded.Contains(runtime)) - { - yield return runtimePair.Key; - } - } - } - } -} diff --git a/tools/RuntimeGraphGenerator/project.json b/tools/RuntimeGraphGenerator/project.json deleted file mode 100644 index b892b589c..000000000 --- a/tools/RuntimeGraphGenerator/project.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "NuGet.RuntimeModel": "3.5.0-rc-1285", - "NuGet.Versioning": "3.5.0-rc-1285", - "System.CommandLine": "0.1.0-e160119-1", - "System.Runtime.Serialization.Json": "4.0.2-rc3-24123-01", - "Microsoft.DotNet.ProjectModel": { - "target": "project" - }, - "Microsoft.DotNet.Cli.Utils": { - "target": "project" - }, - "Microsoft.NETCore.ConsoleHost": "1.0.0-rc3-24123-01", - "Microsoft.NETCore.Runtime": "1.0.2-rc3-24123-01", - "NETStandard.Library": "1.5.0-rc3-24123-01" - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "dnxcore50", - "portable-net45+wp80+win8+wpa81+dnxcore50" - ] - } - } -}