[PATCH] D133483: Update Windows packaging script.
Carlos Alberto Enciso via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 03:45:16 PDT 2022
CarlosAlbertoEnciso created this revision.
CarlosAlbertoEnciso added reviewers: hans, thieta.
CarlosAlbertoEnciso added projects: All, LLVM.
CarlosAlbertoEnciso requested review of this revision.
Herald added a subscriber: llvm-commits.
Update the Windows packaging script.
As discussed here:
https://discourse.llvm.org/t/build-llvm-release-bat-script-options
These are the changes in this patch:
Add a function to parse command line arguments: `parse_args`.
The format for the arguments is:
Boolean: `--option`
Value: `--option=value`
Command line usage example:
`my-batch-file.bat --build --type=release`
It will create 2 variables:
`build` with the value `true`
`type` with the value `release`
Usage:
set "build="
set "type="
REM Parse arguments.
call :parse_args %*
if defined build (
...
)
if %type%=='release' (
...
)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133483
Files:
llvm/utils/release/build_llvm_release.bat
Index: llvm/utils/release/build_llvm_release.bat
===================================================================
--- llvm/utils/release/build_llvm_release.bat
+++ llvm/utils/release/build_llvm_release.bat
@@ -251,3 +251,55 @@
exit /b 0
::==============================================================================
+
+::=============================================================================
+:: Parse command line arguments.
+:: The format for the arguments is:
+:: Boolean: --option
+:: Value: --option=value
+::
+:: Command line usage example:
+:: my-batch-file.bat --build --type=release
+:: It will create 2 variables:
+:: 'build' with the value 'true'
+:: 'type' with the value 'release'
+::
+:: Usage:
+:: set "build="
+:: set "type="
+:: REM Parse arguments.
+:: call :parse_args %*
+:: if defined build (
+:: ...
+:: )
+:: if %type%=='release' (
+:: ...
+:: )
+::=============================================================================
+:parse_args
+ set "arg_name="
+ :parse_args_start
+ if "%1" == "" (
+ :: Set a seen boolean argument.
+ if "%arg_name%" neq "" (
+ set "%arg_name%=true"
+ )
+ goto :parse_args_done
+ )
+ set aux=%1
+ if "%aux:~0,2%" == "--" (
+ :: Set a seen boolean argument.
+ if "%arg_name%" neq "" (
+ set "%arg_name%=true"
+ )
+ set "arg_name=%aux:~2,250%"
+ ) else (
+ set "%arg_name%=%1"
+ set "arg_name="
+ )
+ shift
+ goto :parse_args_start
+
+:parse_args_done
+exit /b 0
+::==============================================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133483.458697.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/fe9156a6/attachment.bin>
More information about the llvm-commits
mailing list