Jens Geyer created THRIFT-6313:
----------------------------------

             Summary: Publish the Windows Thrift compiler as a .NET tool
                 Key: THRIFT-6313
                 URL: https://issues.apache.org/jira/browse/THRIFT-6313
             Project: Thrift
          Issue Type: New Feature
          Components: Build Process
            Reporter: Jens Geyer
             Fix For: 0.26.0


h2. Proposal

Publish the Windows Thrift compiler as a [.NET 
tool|https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create],
 so that a .NET developer on Windows can get it with

{noformat}
dotnet tool install --global Apache.Thrift.Compiler
thrift --version
{noformat}

and pin it per repository with a {{dotnet-tools.json}} manifest, which is how 
.NET projects normally pin build-time tools.

h2. Package id

{{Apache.Thrift.Compiler}}. Checked against nuget.org:

* {{ApacheThrift}} is the existing netstd runtime library and stays what it is.
* {{Apache.Thrift}} is *not* available. It is taken by a third party and 
delisted, and NuGet ids are permanent, so a delisted id cannot be reused.
* {{Apache.Thrift.Compiler}} is free, and it follows the {{Apache.Avro}} and 
{{Apache.Arrow}} naming that sibling ASF projects use.
* The {{Apache.*}} prefix is not reserved on nuget.org, so a push under this id 
will be accepted.

h2. Shape of the package

A .NET tool package needs a managed entry point. The payload here is a native 
executable, so the package carries a small managed launcher that finds 
{{thrift.exe}} next to itself and runs it, passing arguments, the standard 
streams and the exit code straight through.

.NET 10 added a way to declare a native executable as the entry point directly, 
with no managed code at all. It is not used here: a package built that way 
cannot be installed by the .NET 8 or .NET 9 SDK at all, which fails for the 
majority of current users, and the two MSBuild properties involved are 
undocumented.

The package targets {{net8.0}} so that it installs on every supported SDK.

h2. Platforms

The package carries the Windows compiler only. NuGet will install it anywhere, 
so the launcher checks the platform and exits with a message pointing at the 
other ways to get Thrift rather than failing obscurely.

Should builds of the compiler for other platforms be added later, .NET 10's 
runtime identifier specific tool packages can turn that into an install time 
refusal instead, without changing the install command.

h2. Publishing

A new workflow builds the compiler on a Windows runner, packs the tool, 
verifies the package contents, and publishes on {{release: published}} for a 
release that is not a pre-release - the same gate {{pypi.yml}}, 
{{release_rust.yml}} and {{release_ruby.yml}} use.

_Drafted with AI assistance (Claude Opus 5); reviewed and posted by Jens Geyer._




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to