xamarin-macios/scripts
Rolf Bjarne Kvinge 0daefa2212
Remove a lot of legacy logic. (#21576)
2024-11-06 11:34:39 +01:00
..
generate-defines [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
generate-errors [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
generate-frameworks [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
generate-sourcelink-json [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
generate-target-platforms [csharp] Port csharp scripts in dotnet/ to .NET projects. (#21554) 2024-10-31 18:37:18 +01:00
generate-vs-workload [csharp] Port csharp scripts in dotnet/ to .NET projects. (#21554) 2024-10-31 18:37:18 +01:00
generate-workloadmanifest-json [csharp] Port csharp scripts in dotnet/ to .NET projects. (#21554) 2024-10-31 18:37:18 +01:00
generate-workloadmanifest-targets [csharp] Port csharp scripts in dotnet/ to .NET projects. (#21554) 2024-10-31 18:37:18 +01:00
run-with-timeout [csharp] Port the run-with-timeout script in tests/ to a .NET project. (#21563) 2024-11-01 08:56:38 +01:00
versions-check Remove a lot of legacy logic. (#21576) 2024-11-06 11:34:39 +01:00
Directory.Build.props [csharp] Port the versions-check.csharp script to a .NET project. (#21474) 2024-10-22 16:35:09 +02:00
README.md [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
new-script.sh [csharp] Port csharp scripts in src/ to .NET projects. (#21498) 2024-10-29 13:00:35 +01:00
template.mk [csharp] Port the versions-check.csharp script to a .NET project. (#21474) 2024-10-22 16:35:09 +02:00

README.md

Scripts

This directory contains numerous short C# scripts, each in their own directory with its own project file.

To create a new script, the easy way is to run the new-script.sh script.

The harder way is to copy an existing script directory, and:

  • Rename the csproj file to match the directory name.

  • Add your C# code, and document what it's supposed to do in a README.md file.

  • Edit the arguments to the TemplateScript template in the fragment.mk file according to how you named your script (directory). The first argument will be used in other makefiles that use the script, the second is the name of the script (directory). Say your script is my-script, then that would be:

    $(eval $(call TemplateScript,MY_SCRIPT,my-script))
    
    

To use the new script:

  1. In the consuming Makefile, import the fragment.mk file from the script directory:

    include $(TOP)/scripts/my-script/fragment.mk
    
  2. In the target where you want to execute the script, depend on the script executable, which is named MY_SCRIPT (from the call to the TemplateScript template):

    dostuff: $(MY_SCRIPT)
        echo "Doing stuff"
    

    This makes sure the script is actually built before you want to execute it.

  3. The actual invocation to call the script, is the same variable, but with _EXEC appended:

    dostuff: $(MY_SCRIPT)
        $(MY_SCRIPT_EXEC) --arguments to/my/script
    

Sidenote: if https://github.com/dotnet/designs/pull/296 were ever implemented, we could dispense with the project file, making these C# files actual scripts.