Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet@8 8.0.11 (new formula) #197537

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Aliases/dotnet@8

This file was deleted.

157 changes: 157 additions & 0 deletions Formula/d/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
class DotnetAT8 < 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/archive/refs/tags/v8.0.11.tar.gz"
sha256 "d7cb383bbfa20f86e085615ab3dcb769e5c9af7330d90834ce34889857bd92e5"
license "MIT"

livecheck do
url :stable
regex(/^v?(8(?:\.\d+)+)$/i)
end

keg_only :versioned_formula

# https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core#lifecycle
deprecate! date: "2026-11-10", because: :unsupported

depends_on "cmake" => :build
depends_on "pkgconf" => :build
depends_on "icu4c@76"
depends_on "openssl@3"

uses_from_macos "python" => :build, since: :catalina
uses_from_macos "krb5"
uses_from_macos "zlib"

on_macos do
depends_on "grep" => :build # grep: invalid option -- P
end

on_linux do
depends_on "libunwind"
depends_on "lttng-ust"
end

resource "release.json" do
url "https://github.com/dotnet/dotnet/releases/download/v8.0.11/release.json"
sha256 "585e6094fa25acc8b8907220b6c8a167ba3611fc082c1b220486df1cebce4caf"
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

def install
odie "Update release.json resource!" if resource("release.json").version != version
buildpath.install resource("release.json")

if OS.mac?
# Need GNU grep (Perl regexp support) to use release manifest rather than git repo
ENV.prepend_path "PATH", Formula["grep"].libexec/"gnubin"

# Avoid mixing CLT and Xcode.app when building CoreCLR component which can
# cause undefined symbols, e.g. __swift_FORCE_LOAD_$_swift_Builtin_float
ENV["SDKROOT"] = MacOS.sdk_path

# 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
inreplace "src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj",
"<CrossgenOutput Condition=\" '$(TargetArchitecture)' == 's390x'",
"<CrossgenOutput Condition=\" '$(TargetOsName)' == 'osx'"
else
icu4c_dep = deps.find { |dep| dep.name.match?(/^icu4c(@\d+)?$/) }
ENV.append_path "LD_LIBRARY_PATH", icu4c_dep.to_formula.opt_lib

# Use our libunwind rather than the bundled one.
inreplace "src/runtime/eng/SourceBuild.props",
"--outputrid $(TargetRid)",
"\\0 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=ON"

# Work around build script getting stuck when running shutdown command on Linux
# Ref: https://github.com/dotnet/source-build/discussions/3105#discussioncomment-4373142
inreplace "build.sh", '"$CLI_ROOT/dotnet" build-server shutdown', ""
inreplace "repo-projects/Directory.Build.targets",
'<Exec Command="$(DotnetToolCommand) build-server shutdown" />',
""
end

system "./prep.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", "--release-manifest", "release.json"
end

libexec.mkpath
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 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
<<~TEXT
For other software to find dotnet you may need to set:
export DOTNET_ROOT="#{opt_libexec}"
TEXT
end

test do
target_framework = "net#{version.major_minor}"

(testpath/"test.cs").write <<~CSHARP
using System;

namespace Homebrew
{
public class Dotnet
{
public static void Main(string[] args)
{
var joined = String.Join(",", args);
Console.WriteLine(joined);
}
}
}
CSHARP

(testpath/"test.csproj").write <<~XML
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>#{target_framework}</TargetFrameworks>
<PlatformTarget>AnyCPU</PlatformTarget>
<RootNamespace>Homebrew</RootNamespace>
<PackageId>Homebrew.Dotnet</PackageId>
<Title>Homebrew.Dotnet</Title>
<Product>$(AssemblyName)</Product>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="test.cs" />
</ItemGroup>
</Project>
XML

system bin/"dotnet", "build", "--framework", target_framework, "--output", testpath, testpath/"test.csproj"
output = shell_output("#{bin}/dotnet run --framework #{target_framework} #{testpath}/test.dll a b c")
assert_equal "#{testpath}/test.dll,a,b,c\n", output
end
end
7 changes: 3 additions & 4 deletions Formula/s/sbom-tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
url "https://github.com/microsoft/sbom-tool/archive/refs/tags/v3.0.1.tar.gz"
sha256 "90085ab1f134f83d43767e46d6952be42a62dbb0f5368e293437620a96458867"
license "MIT"
revision 1
head "https://github.com/microsoft/sbom-tool.git", branch: "main"

# There can be a notable gap between when a version is tagged and a
Expand All @@ -23,16 +24,14 @@
sha256 cellar: :any_skip_relocation, x86_64_linux: "f7350a825d6b0e31ff02f6145487765ed899d95d1243f9d91d914b63b3102c59"
end

depends_on "dotnet"
depends_on "dotnet@8"

uses_from_macos "zlib"

def install

Check failure on line 31 in Formula/s/sbom-tool.rb

View workflow job for this annotation

GitHub Actions / macOS 14-x86_64

`brew install --verbose --formula --build-bottle sbom-tool` failed on macOS Sonoma (14)!

::error::sbom-tool 3.0.1 did not build
bin.mkdir

ENV["DOTNET_CLI_TELEMETRY_OPTOUT"] = "true"

dotnet = Formula["dotnet"]
dotnet = Formula["dotnet@8"]
os = OS.mac? ? "osx" : OS.kernel_name.downcase
arch = Hardware::CPU.intel? ? "x64" : Hardware::CPU.arch.to_s

Expand Down
Loading