From 33d18d989280c7ace0585cc94968952ee38f22ac Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Sat, 2 Nov 2024 19:13:49 -0400 Subject: [PATCH 1/4] dotnet 9.0.0 --- Aliases/dotnet@9 | 1 + Formula/d/dotnet.rb | 168 +++++++++++++++++--------------------------- 2 files changed, 65 insertions(+), 104 deletions(-) create mode 120000 Aliases/dotnet@9 diff --git a/Aliases/dotnet@9 b/Aliases/dotnet@9 new file mode 120000 index 0000000000000..03c38d233fd77 --- /dev/null +++ b/Aliases/dotnet@9 @@ -0,0 +1 @@ +../Formula/d/dotnet.rb \ No newline at end of file diff --git a/Formula/d/dotnet.rb b/Formula/d/dotnet.rb index 7cc454ca3177e..0f4344eeb2571 100644 --- a/Formula/d/dotnet.rb +++ b/Formula/d/dotnet.rb @@ -1,11 +1,19 @@ class Dotnet < Formula desc ".NET Core" homepage "https://dotnet.microsoft.com/" - # Source-build tag announced at https://github.com/dotnet/source-build/discussions - url "https://github.com/dotnet/dotnet.git", - tag: "v8.0.10", - revision: "8922fe64a1903ed4e35e24568efb056b3e0fad43" license "MIT" + head "https://github.com/dotnet/dotnet.git", branch: "main" + + stable do + # Source-build tag announced at https://github.com/dotnet/source-build/discussions + url "https://github.com/dotnet/dotnet/archive/refs/tags/v9.0.0.tar.gz" + sha256 "ade10f909a684c2a056b8b0ec3a30e1570ce2b83c46c5f621a4464d02729af9f" + + resource "release.json" do + url "https://github.com/dotnet/dotnet/releases/download/v9.0.0/release.json" + sha256 "2a08862e4cd0095c743deccd8e34f3188261772cc775a7c6cdbfc9237727edda" + end + end bottle do sha256 cellar: :any, arm64_sequoia: "197cb068d41882513946c97853080a27b7c314ffd8f42296b663d2a6a19277c4" @@ -17,17 +25,18 @@ class Dotnet < Formula end depends_on "cmake" => :build - depends_on "pkg-config" => :build - depends_on "python@3.13" => :build + depends_on "pkgconf" => :build + depends_on "rapidjson" => :build + depends_on "brotli" depends_on "icu4c@76" depends_on "openssl@3" - uses_from_macos "llvm" => :build + uses_from_macos "python" => :build, since: :catalina uses_from_macos "krb5" uses_from_macos "zlib" - on_sonoma do - depends_on xcode: :build if DevelopmentTools.clang_build_version == 1600 + on_macos do + depends_on "grep" => :build # grep: invalid option -- P end on_linux do @@ -35,91 +44,65 @@ class Dotnet < Formula depends_on "lttng-ust" end - # Upstream only directly supports and tests llvm/clang builds. - # GCC builds have limited support via community. - fails_with :gcc - - # Backport fix for error loading BuildXL service index - patch do - url "https://github.com/dotnet/dotnet/commit/18b5c7e1b125468f483a697ba8809c0a2412a762.patch?full_index=1" - sha256 "76ede810166cf718fe430a8b155da07ca245ec9174b73b3471baf413bbd42460" - end - - # Backport fix to build with Xcode 16 - patch do - url "https://github.com/dotnet/runtime/commit/562efd6824762dd0c1826cc99e006ad34a7e9e85.patch?full_index=1" - sha256 "435002246227064be19db8065b945e94565b59362e75a72ee6d6322a25baa832" - directory "src/runtime" - end - - # Backport fix to build with Clang 19 - # Ref: https://github.com/dotnet/runtime/commit/043ae8c50dbe1c7377cf5ad436c5ac1c226aef79 - patch :DATA - def install if OS.mac? - # Deparallelize to reduce chances of missing PDBs - ENV.deparallelize - # Avoid failing on missing PDBs as unable to build bottle on all runners in current state - # Issue ref: https://github.com/dotnet/source-build/issues/4150 - inreplace "build.proj", /\bFailOnMissingPDBs="true"/, 'FailOnMissingPDBs="false"' - - # Disable crossgen2 optimization in ASP.NET Core to work around build failure trying to find tool. - # Microsoft.AspNetCore.App.Runtime.csproj(445,5): error : Could not find crossgen2 tools/crossgen2 - # TODO: Try to remove in future .NET 8 release or when macOS is officially supported in .NET 9 - inreplace "src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj", - "', - "" + '"$(DotnetTool) build-server shutdown --vbcscompiler"', + '"true"' end - system "./prep.sh" + args = ["--clean-while-building", "--source-build", "--with-system-libs", "brotli+libunwind+rapidjson+zlib"] + if build.stable? + args += ["--release-manifest", "release.json"] + odie "Update release.json resource!" if resource("release.json").version != version + buildpath.install resource("release.json") + end + + system "./prep-source-build.sh" # We unset "CI" environment variable to work around aspire build failure # error MSB4057: The target "GitInfo" does not exist in the project. # Ref: https://github.com/Homebrew/homebrew-core/pull/154584#issuecomment-1815575483 with_env(CI: nil) do - system "./build.sh", "--clean-while-building", "--online" + system "./build.sh", *args end libexec.mkpath - tarball = Dir["artifacts/*/Release/dotnet-sdk-*.tar.gz"].first - system "tar", "-xzf", tarball, "--directory", libexec - doc.install Dir[libexec/"*.txt"] + tarball = buildpath.glob("artifacts/*/Release/dotnet-sdk-*.tar.gz").first + system "tar", "--extract", "--file", tarball, "--directory", libexec + doc.install libexec.glob("*.txt") (bin/"dotnet").write_env_script libexec/"dotnet", DOTNET_ROOT: libexec bash_completion.install "src/sdk/scripts/register-completions.bash" => "dotnet" zsh_completion.install "src/sdk/scripts/register-completions.zsh" => "_dotnet" - man1.install Dir["src/sdk/documentation/manpages/sdk/*.1"] - man7.install Dir["src/sdk/documentation/manpages/sdk/*.7"] + man1.install Utils::Gzip.compress(*buildpath.glob("src/sdk/documentation/manpages/sdk/*.1")) + man7.install Utils::Gzip.compress(*buildpath.glob("src/sdk/documentation/manpages/sdk/*.7")) end def caveats - <<~EOS + <<~TEXT For other software to find dotnet you may need to set: export DOTNET_ROOT="#{opt_libexec}" - EOS + TEXT end test do target_framework = "net#{version.major_minor}" - (testpath/"test.cs").write <<~EOS + + (testpath/"test.cs").write <<~CSHARP using System; namespace Homebrew @@ -133,8 +116,9 @@ def caveats } } } - EOS - (testpath/"test.csproj").write <<~EOS + CSHARP + + (testpath/"test.csproj").write <<~XML Exe @@ -150,47 +134,23 @@ def caveats - EOS + XML + system bin/"dotnet", "build", "--framework", target_framework, "--output", testpath, testpath/"test.csproj" - assert_equal "#{testpath}/test.dll,a,b,c\n", - shell_output("#{bin}/dotnet run --framework #{target_framework} #{testpath}/test.dll a b c") + output = shell_output("#{bin}/dotnet run --framework #{target_framework} #{testpath}/test.dll a b c") + # We switched to `assert_match` due to progress status ANSI codes in output. + # TODO: Switch back to `assert_equal` once fixed in release. + # Issue ref: https://github.com/dotnet/sdk/issues/44610 + assert_match "#{testpath}/test.dll,a,b,c\n", output + + # Test to avoid uploading broken Intel Sonoma bottle which has stack overflow on restore. + # See https://github.com/Homebrew/homebrew-core/issues/197546 + resource "docfx" do + url "https://github.com/dotnet/docfx/archive/refs/tags/v2.77.0.tar.gz" + sha256 "03c13ca2cdb4a476365ef8f5b7f408a6cf6e35f0193c959d7765c03dd4884bfb" + end + resource("docfx").stage do + system bin/"dotnet", "restore", "src/docfx", "--disable-build-servers", "--no-cache" + end end end - -__END__ -diff --git a/src/runtime/src/coreclr/vm/comreflectioncache.hpp b/src/runtime/src/coreclr/vm/comreflectioncache.hpp -index 08d173e61648c6ebb98a4d7323b30d40ec351d94..12db55251d80d24e3765a8fbe6e3b2d24a12f767 100644 ---- a/src/runtime/src/coreclr/vm/comreflectioncache.hpp -+++ b/src/runtime/src/coreclr/vm/comreflectioncache.hpp -@@ -26,6 +26,7 @@ template class ReflectionCache - - void Init(); - -+#ifndef DACCESS_COMPILE - BOOL GetFromCache(Element *pElement, CacheType& rv) - { - CONTRACTL -@@ -102,6 +103,7 @@ template class ReflectionCache - AdjustStamp(TRUE); - this->LeaveWrite(); - } -+#endif // !DACCESS_COMPILE - - private: - // Lock must have been taken before calling this. -@@ -141,6 +143,7 @@ template class ReflectionCache - return CacheSize; - } - -+#ifndef DACCESS_COMPILE - void AdjustStamp(BOOL hasWriterLock) - { - CONTRACTL -@@ -170,6 +173,7 @@ template class ReflectionCache - if (!hasWriterLock) - this->LeaveWrite(); - } -+#endif // !DACCESS_COMPILE - - void UpdateHashTable(SIZE_T hash, int slot) - { From 2e51c8fb2373b5ddc54dfd72c554cef202a22f40 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Sat, 16 Nov 2024 09:16:46 -0500 Subject: [PATCH 2/4] dug: revision bump (dotnet 9.0.0) --- Formula/d/dug.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Formula/d/dug.rb b/Formula/d/dug.rb index 9e4db98dc4b72..00ffa6595f1c8 100644 --- a/Formula/d/dug.rb +++ b/Formula/d/dug.rb @@ -4,6 +4,7 @@ class Dug < Formula url "https://github.com/unfrl/dug/archive/refs/tags/0.0.94.tar.gz" sha256 "f97952be49d93ed66f1cc7e40bf7004928e6573077839a18f5be371c80e2c16b" license "MIT" + revision 1 livecheck do url :stable @@ -24,25 +25,23 @@ class Dug < Formula def install ENV["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "1" - dotnet = Formula["dotnet"] - os = OS.mac? ? "osx" : OS.kernel_name.downcase - arch = Hardware::CPU.intel? ? "x64" : Hardware::CPU.arch.to_s + dotnet = Formula["dotnet"] args = %W[ --configuration Release --framework net#{dotnet.version.major_minor} - --output #{libexec} - --runtime #{os}-#{arch} --no-self-contained + --output #{bin} + --use-current-runtime + -p:AppHostRelativeDotNet=#{dotnet.opt_libexec.relative_path_from(bin)} -p:TargetFrameworks=net#{dotnet.version.major_minor} -p:Version=#{version} -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true + -p:DebugType=None ] system "dotnet", "publish", "cli/dug.csproj", *args - env = { DOTNET_ROOT: "${DOTNET_ROOT:-#{dotnet.opt_libexec}}" } - (bin/"dug").write_env_script libexec/"dug", env end test do From 0214bf88ed14bd26d62044fbb112a6e6c3fcd0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0tefan=20Baebler?= <319826+stefanb@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:51:40 +0000 Subject: [PATCH 3/4] dotnet: update 9.0.0 bottle. --- Formula/d/dotnet.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Formula/d/dotnet.rb b/Formula/d/dotnet.rb index 0f4344eeb2571..7e0cab56301fb 100644 --- a/Formula/d/dotnet.rb +++ b/Formula/d/dotnet.rb @@ -16,12 +16,11 @@ class Dotnet < Formula end bottle do - sha256 cellar: :any, arm64_sequoia: "197cb068d41882513946c97853080a27b7c314ffd8f42296b663d2a6a19277c4" - sha256 cellar: :any, arm64_sonoma: "ee8e38b1f895f854eb38256ce40ae985613b2c005881a64d58de86a7e0b9e24d" - sha256 cellar: :any, arm64_ventura: "474fd3ad1582cf4f406654ec9b015e975569705c451e7f55d1a609a35b2da9ad" - sha256 cellar: :any, sonoma: "ef18da376e2734a3b327840e99aac667dd43b5c797e6b651aa875ed56644e2c4" - sha256 cellar: :any, ventura: "75c23fb3c05ac68ec3a3c22203e6829a8f80f5a2f22a3453bce1a4eff83338ad" - sha256 cellar: :any_skip_relocation, x86_64_linux: "e8bc8e2a21f664c9e49fba79e66c6e0fe53d8ad2eba046703ad536e47e5bb675" + sha256 cellar: :any, arm64_sequoia: "846716ea37ae27f2be05098226bef127d27c650798f07085417ba8a610b1cf6f" + sha256 cellar: :any, arm64_sonoma: "f12bdbf90b2a57fc29349cb78123cd7f8eab584b27cf859c4413ae07a3f4a6bc" + sha256 cellar: :any, arm64_ventura: "9a4970542023cb1cf76566978f7f6ee9d5e5b3890e47edc64d507468fc382558" + sha256 cellar: :any, ventura: "7e315138a9da1bb22c057f063d89d08297609a2196c2f6a5d25ccd405a6e2cef" + sha256 cellar: :any_skip_relocation, x86_64_linux: "23cad8699a8133d024cea4cb20f31d829911bffc9acd2586c9ea3811fd51df29" end depends_on "cmake" => :build From efa14713c14c25e075f01cbaa2efbfbbf94d614a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0tefan=20Baebler?= <319826+stefanb@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:51:41 +0000 Subject: [PATCH 4/4] dug: update 0.0.94_1 bottle. --- Formula/d/dug.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Formula/d/dug.rb b/Formula/d/dug.rb index 00ffa6595f1c8..f1d11f6d16d2f 100644 --- a/Formula/d/dug.rb +++ b/Formula/d/dug.rb @@ -12,12 +12,12 @@ class Dug < Formula end bottle do - sha256 cellar: :any_skip_relocation, arm64_sequoia: "5fc22af9ae66c539b84fd9202cc15442c5cb9ccc2da736c25073c01cd7cb7d1c" - sha256 cellar: :any_skip_relocation, arm64_sonoma: "b218fc33ff689d05ad7637d3a90516eff22c12721dce9c45a6bc0b9d7d8005b8" - sha256 cellar: :any_skip_relocation, arm64_ventura: "a2b486b453398832444fe293c2114ae52415e32450a307efd4f8d794e612978b" - sha256 cellar: :any_skip_relocation, sonoma: "bafbcd64d21759be827798be5e716d58f4c5b25272884d6efc517d0c56a88885" - sha256 cellar: :any_skip_relocation, ventura: "c5fca1866650201da0bf750a980bb99c02635b45c10d12f07de0dd004ea65b5d" - sha256 cellar: :any_skip_relocation, x86_64_linux: "373a0464e15b4ceb0af958ceaf67c701946f521bec7654477f0036b585aff48c" + sha256 cellar: :any_skip_relocation, arm64_sequoia: "b2056f58b7a98102e267466ac4b78cb0c20f6d718edadec02e99711e73c63f1d" + sha256 cellar: :any_skip_relocation, arm64_sonoma: "2a0694076a8ca9f24aa8105df5400385905f0346365c0d9ff663180126657aff" + sha256 cellar: :any_skip_relocation, arm64_ventura: "e7caf9fe29373fefb13ca554c3e58d0ac96cc4fb5f4a210d2ff28162a0a2d96d" + sha256 cellar: :any_skip_relocation, sonoma: "6fcc35f470be76307cf14e8ced656a65749c49f65e63df5e267494596199eeb4" + sha256 cellar: :any_skip_relocation, ventura: "4fd87cddb2e79d2fa8f92f0534b386767e8670c481091ada9574e5944813bfcc" + sha256 cellar: :any_skip_relocation, x86_64_linux: "6ce1254977a436fccb15cd219228dbb012ec7722d91e883b4a47bbd277e19803" end depends_on "dotnet"