-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add dnx scripts #49461
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
Add dnx scripts #49461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds dnx scripts to the redistributable layout and installer targets, facilitating cross-platform support for executing dnx commands.
- Removed deletion of certain runtime configuration files in the GenerateLayout.targets file
- Introduced a new LayoutDnxScript target and copy actions in GenerateInstallerLayout.targets, including marking the dnx script as executable
- Added new script files (dnx.cmd and dnx) to support Windows and non-Windows environments
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Layout/redist/targets/GenerateLayout.targets | Removed deletion of runtime configuration files |
src/Layout/redist/targets/GenerateInstallerLayout.targets | Added LayoutDnxScript target to copy and fix permissions for dnx scripts |
src/Layout/redist/dnx.cmd | Added Windows-specific batch script to run dnx commands |
src/Layout/redist/dnx | Added Unix shell script to run dnx commands |
Comments suppressed due to low confidence (1)
src/Layout/redist/targets/GenerateInstallerLayout.targets:75
- The chmod command (chmod 644) does not set the executable bit on Unix systems; please change this to chmod +x or chmod 755 to ensure the dnx script is executable.
<Exec Command="chmod 644 "$(RedistInstallerLayoutPath)/dnx"" Condition="!$([MSBuild]::IsOSPlatform('Windows'))" />
<Target Name="LayoutDnxScript"> | ||
<PropertyGroup> | ||
<DnxScriptSource Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">dnx.cmd</DnxScriptSource> | ||
<DnxScriptSource Condition="!$([MSBuild]::IsOSPlatform('WINDOWS'))">dnx</DnxScriptSource> | ||
</PropertyGroup> | ||
<Copy SourceFiles="$(DnxScriptSource)" DestinationFolder="$(RedistInstallerLayoutPath)" /> | ||
|
||
<!-- Mark script as executable --> | ||
<Exec Command="chmod 644 "$(RedistInstallerLayoutPath)/dnx"" Condition="!$([MSBuild]::IsOSPlatform('Windows'))" /> | ||
</Target> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a cross-compilation mechanism for generating the installer layouts? Feels like these conditions should be something more like '$(TargetOS)' != 'Windows'
or something along those lines (properties may not exist and are illustrative only).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that's not at all possible currently. I looked a bit and didn't find anything really, and I did find a few similar cases that used the current OS. I know there is some target RID logic so you can choose whether you are targeting linux-x64 or something more specific for example, but I think there's no way to compile across Windows and non-Windows.
I found two problems when testing on linux:
>dnx fsautocomplete
Restore complete (4.8s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
dnx failed with 7 error(s) (1.7s)
/home/chethusk/dotnet-dev/dnx(2,13): error CS1002: ; expected
/home/chethusk/dotnet-dev/dnx(2,13): error CS1056: Unexpected character '$'
/home/chethusk/dotnet-dev/dnx(2,15): error CS1002: ; expected
/home/chethusk/dotnet-dev/dnx(2,26): error CS1002: ; expected
/home/chethusk/dotnet-dev/dnx(2,30): error CS1001: Identifier expected
/home/chethusk/dotnet-dev/dnx(2,30): error CS1003: Syntax error, ',' expected
/home/chethusk/dotnet-dev/dnx(2,34): error CS1002: ; expected
The build failed. Fix the build errors and run again. |
Pushed up a commit that sets the executable bit on the |
Ok I'm slightly wrong on the run-file conflict. What had happened was, I ran As soon as I moved out of that directory and set up my PATH as one would normally do, chethusk@Chet-Desktop:~$ ~/dotnet-dev/dnx fsautocomplete@0.78.1 -- --help
Tool package fsautocomplete@0.78.1 will be downloaded from source https://api.nuget.org/v3/index.json.
Proceed? [y/n] (y): y
Description:
An F# LSP server implementation
Usage:
fsautocomplete [options] [[--] <additional arguments>...]]
Options:
-v, --debug, --verbose Enable verbose logging. This is equivalent to --log-level debug.
--attach-debugger Launch the system debugger and break immediately
-l, --log-file, --logfile <log-file> Send log output to specified file.
--filter, --log-filter <log-filter> Filter logs by category. The category can be seen in the logs inside []. For example: [Compiler].
--attachdebugger, --wait-for-debugger Stop execution on startup until an external debugger to attach to this process
--project-graph-enabled Enable MSBuild Graph workspace loading. Should be faster than the default, but is experimental.
--adaptive-lsp-server-enabled Enable LSP Server based on FSharp.Data.Adaptive. Should be more stable, but is experimental.
--log-level <Debug|Error|Fatal|Information|Verbose|Warning> Set the log verbosity to a specific level.
--state-directory <state-directory> Set the directory to store the state of the server. This should be a per-workspace location, not a
shared-workspace location. [default: /home/chethusk]
--otel-exporter-enabled Enabled OpenTelemetry exporter. See https://opentelemetry.io/docs/reference/specification/protocol/exporter/ for
environment variables to configure for the exporter.
--use-fcs-transparent-compiler Use Transparent Compiler in FSharp.Compiler.Services. Should have better performance characteristics, but is
experimental. See https://github.com/dotnet/fsharp/pull/15179 for more details.
--version Show version information
-?, -h, --help Show help and usage information
Additional Arguments:
Arguments passed to the application that is being run. |
/backport to release/10.0.1xx-preview6 |
Started backporting to release/10.0.1xx-preview6: https://github.com/dotnet/sdk/actions/runs/15748884118 |
No description provided.