Skip to content

build(windows): Port generate.sh script to Windows - #109

Open
indyteo wants to merge 1 commit into
mainfrom
indy/generate-bat
Open

build(windows): Port generate.sh script to Windows#109
indyteo wants to merge 1 commit into
mainfrom
indy/generate-bat

Conversation

@indyteo

@indyteo indyteo commented May 26, 2025

Copy link
Copy Markdown
Member

Type of modification

  • Documentation:
    • Markdown Files
  • Other: generate helper script

Changes

This PR adds Windows version of the helper script.

Feature description

I rewrote the generate.sh shell script in batch (generate.bat) and PowerShell (generate.ps1) to allow Windows users to use it.

I also updated the messages of the original script because I noticed some minor issues.

Finally, I updated the docs to reflect those changes.

Showcase

Batch help example
D:\Programmation\Java\Minalac\Generator>generate.bat /h
generate.bat [options] <format> <process> <place> [<outputdir>]
available options:
/h Displays this help message only
/g Stops before generation
/s Stops before saving
/y Displays Yaml configuration only
/l (formats|processes|places) Lists available formats/processes/places only
formats:
  minecraft
  minetest
processes:
  full
places:
  bagnolet
  boulouris
  ign
  lakeSaintMande
  martrou
  millau
  serreponcon
  stlazare
  villeneuve
outputdir is required if no option given (if directory exists, it will be emptied)
PowerShell help example Note: Since the help message is partially auto-generated, some parts are in my computer's language (French)
PS D:\Programmation\Java\Minalac\Generator> .\generate.ps1 -h

NOM
    D:\Programmation\Java\Minalac\Generator\generate.ps1

RÉSUMÉ
    Helper script for Minalac Generator.


SYNTAXE
    D:\Programmation\Java\Minalac\Generator\generate.ps1 -Help [<CommonParameters>]

    D:\Programmation\Java\Minalac\Generator\generate.ps1 [-DisableGeneration] [-DisableSaving] [-YamlOnly] [-Format] <String> [-Process] <String> [-Place] <String> [<CommonParameters>]

    D:\Programmation\Java\Minalac\Generator\generate.ps1 -ListYaml <String> [<CommonParameters>]

    D:\Programmation\Java\Minalac\Generator\generate.ps1 [-Format] <String> [-Process] <String> [-Place] <String> [-OutputDir] <String> [<CommonParameters>]


DESCRIPTION
    This script can combine Yaml parameters from multiple files and
    launch the Generator.jar program with that parameters. Multiple
    options are available to control the process.


PARAMÈTRES
    -Help [<SwitchParameter>]
        Displays this help message only.

    -DisableGeneration [<SwitchParameter>]
        Stops before generation.

    -DisableSaving [<SwitchParameter>]
        Stops before saving.

    -YamlOnly [<SwitchParameter>]
        Displays Yaml configuration only.

    -ListYaml <String>
        Lists available formats/processes/places only.

    -Format <String>
        Name of the format to use.
        Use '-ListYaml formats' option to get the list of allowed values.

    -Process <String>
        Name of the process to use.
        Use '-ListYaml processes' option to get the list of allowed values.

    -Place <String>
        Name of the place to use.
        Use '-ListYaml places' option to get the list of allowed values.

    -OutputDir <String>
        Output directory where the result will be generated.

    <CommonParameters>
        Cette applet de commande prend en charge les paramètres courants : Verbose, Debug,
     ErrorAction, ErrorVariable, WarningAction, WarningVariable,
     OutBuffer, PipelineVariable et OutVariable. Pour plus d’informations, voir
     about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

REMARQUES
    Pour consulter les exemples, tapez : "get-help D:\Programmation\Java\Minalac\Generator\generate.ps1 -examples".
    Pour plus d'informations, tapez : "get-help D:\Programmation\Java\Minalac\Generator\generate.ps1 -detailed".
    Pour obtenir des informations techniques, tapez : "get-help D:\Programmation\Java\Minalac\Generator\generate.ps1 -full".

Formats: 
        minecraft
        minetest
Processes:
        full
Places:
        bagnolet
        boulouris
        ign
        lakeSaintMande
        martrou
        millau
        serreponcon
        stlazare
        villeneuve

Reason

Since commit 63e5169, Windows users cannot really use the bundled example files to start the generator anymore. The solution I came up with was just to rewrite the shell script in batch, then I realized how terrible batch was, thus I did it in PowerShell as well.

Another solution would be to rewrite that helper script in a platform-independent language, such as Java (using Maven modules could allow us to keep the main generator apart from that helper tool, for example). This would require a little bit more work initially, but maybe a bit less later.

Self-checks

  • The code has unit tests associated
  • The code has Javadoc Comments associated
  • Complex / Unexpected code is explained / justified with a small comment
  • Relevant documentation inside the /docs folder has been updated
  • All examples in docs/usage/Examples.md work the same (or have been adapted if subject to changes in this PR)
  • Git history is clean (each commit accomplish a single task and describe it accordingly)
  • The texts have been proofread (documentation, error messages, logs, comments...)

@indyteo indyteo self-assigned this May 26, 2025
@indyteo indyteo added the size: tiny Really small change, can be reviewed very quickly label May 26, 2025
@indyteo
indyteo requested a review from a team May 26, 2025 14:59
@pyrollo

pyrollo commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

Je vois cette PR prendre la poussière... faut qu'on s'installe un Windows pour tester :'(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: tiny Really small change, can be reviewed very quickly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants