Skip to content

Commit dc61fb1

Browse files
authored
Reorganize tools/cmdline sub scripts (#3247)
Reorganize tools/cmdline: move scripts to plugins/, register as axmol subcommands - Move 13 utility files from tools/cmdline/ to tools/cmdline/plugins/ - Keep only entry points (axmol, axmol.bat, axmol.ps1) and README.md - Update paths for AX_ROOT calculation (+1 level deep) - Register 5 new subcommands: source-lint, clang-format, genbindings, build-docs, publish - Update CI workflow and doc references to use plugins/ paths - Remove stale make-pkg.ps1 references from CI paths-ignore
1 parent ec9b47a commit dc61fb1

19 files changed

Lines changed: 77 additions & 17 deletions

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
- '.github/workflows/publish.yml'
1313
- '.github/workflows/debian.yml'
1414
- '.github/workflows/source-tidy.yml'
15-
- 'tools/cmdline/make-pkg.ps1'
1615
pull_request:
1716
types: [opened, synchronize, reopened]
1817
paths-ignore:

.github/workflows/genbindings.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- '**/*.md.in'
1111
- 'docs/**'
1212
- '.github/workflows/publish.yml'
13-
- 'tools/cmdline/make-pkg.ps1'
1413
- '.github/workflows/debian.yml'
1514

1615
workflow_dispatch:
@@ -27,7 +26,7 @@ jobs:
2726
python-version: '3.12.10' # python-3.12 is last release that support axmol traditional binding generator
2827

2928
- name: Genbindings
30-
run: tools\cmdline\genbindings.ps1
29+
run: tools\cmdline\plugins\genbindings.ps1
3130

3231
- name: Create pull request
3332
if: ${{ env.BINDING_NO_CHANGES != 'true' }}

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
axmol -xc '-DAX_WITH_LZ4=ON,-DAX_WITH_CARES=ON,-DAX_WITH_YAML_CPP=ON,-DAX_WITH_KCP=ON' -c
5555
$input_commitish = "${{ github.event.inputs.commitish }}"
5656
if (!$input_commitish) { $input_commitish = $(git -C $AX_ROOT branch --show-current) }
57-
./tools/cmdline/publish.ps1 -version "${{ steps.check_ver.outputs.release_ver }}" -commitish $input_commitish
57+
./tools/cmdline/plugins/publish.ps1 -version "${{ steps.check_ver.outputs.release_ver }}" -commitish $input_commitish
5858
echo "commitish=$input_commitish" >> ${env:GITHUB_OUTPUT}
5959
6060
- name: Publish to github release page

.github/workflows/source-tidy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
- name: Lint Axmol source files (UTF-8 BOM & cstd headers)
147147
if: ${{ steps.pp.outputs.should_run == 'true' }}
148148
shell: pwsh
149-
run: ./tools/cmdline/source-lint.ps1
149+
run: ./tools/cmdline/plugins/source-lint.ps1
150150

151151
- name: Install llvm clang-format
152152
if: ${{ steps.pp.outputs.should_run == 'true' }}
@@ -159,7 +159,7 @@ jobs:
159159
if: ${{ steps.pp.outputs.should_run == 'true' }}
160160
shell: pwsh
161161
run: |
162-
./tools/cmdline/clang-format.ps1 -ver $env:LLVM_VER
162+
./tools/cmdline/plugins/clang-format.ps1 -ver $env:LLVM_VER
163163
164164
# check_only mode
165165
- name: Check for uncommitted changes

tools/cmdline/axmol.ps1

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ Available commands:
5050
build Compile projects to binary.
5151
deploy Compile and deploy a project to a device/simulator.
5252
run Compiles, deploy and run project on the target.
53+
source-lint Lint axmol source files (UTF-8 BOM & cstd headers).
54+
clang-format Format source files using clang-format.
55+
genbindings Generate Lua bindings for axmol engine.
56+
build-docs Build axmol documentation.
57+
publish Publish axmol release.
5358
5459
Available arguments:
5560
-h Show this help information.
@@ -83,7 +88,7 @@ if ($IsMacOS) {
8388
function axmol_build() {
8489
$sub_args = $args
8590
println $sub_args
86-
$build_script = Join-Path $PSScriptRoot 'build.ps1'
91+
$build_script = Join-Path $PSScriptRoot 'plugins/build.ps1'
8792
if ("$args".Contains('-d')) {
8893
# have proj dir
8994
. $build_script @sub_args
@@ -250,7 +255,7 @@ function axmol_run() {
250255

251256
$builtinPlugins = @{
252257
new = @{
253-
proc = (Join-Path $PSScriptRoot 'axmol_new.ps1');
258+
proc = (Join-Path $PSScriptRoot 'plugins/axmol_new.ps1');
254259
usage = @"
255260
usage: axmol new -p dev.axmol.hellocpp -d path/to/project -l cpp --portrait <ProjectName>
256261
Creates a new project.
@@ -352,6 +357,63 @@ options:
352357
-c: no build, only generate native project files (vs .sln, xcodeproj)
353358
-d: specify project dir to compile, i.e. -d /path/your/project/
354359
-f: force generate native project files. Useful if no changes are detected, such as with resource updates.
360+
"@
361+
};
362+
'source-lint' = @{
363+
proc = (Join-Path $PSScriptRoot 'plugins/source-lint.ps1');
364+
usage = @"
365+
usage: axmol source-lint
366+
367+
Lint axmol source files (UTF-8 BOM & cstd headers).
368+
369+
options:
370+
-h Show this help message.
371+
"@
372+
};
373+
'clang-format' = @{
374+
proc = (Join-Path $PSScriptRoot 'plugins/clang-format.ps1');
375+
usage = @"
376+
usage: axmol clang-format -ver <llvm-version>
377+
378+
Format source files using clang-format.
379+
380+
options:
381+
-h Show this help message.
382+
-ver LLVM/clang-format version to use.
383+
"@
384+
};
385+
genbindings = @{
386+
proc = (Join-Path $PSScriptRoot 'plugins/genbindings.ps1');
387+
usage = @"
388+
usage: axmol genbindings
389+
390+
Generate Lua bindings for axmol engine.
391+
392+
options:
393+
-h Show this help message.
394+
"@
395+
};
396+
'build-docs' = @{
397+
proc = (Join-Path $PSScriptRoot 'plugins/build-docs.ps1');
398+
usage = @"
399+
usage: axmol build-docs
400+
401+
Build axmol documentation.
402+
403+
options:
404+
-h Show this help message.
405+
"@
406+
};
407+
publish = @{
408+
proc = (Join-Path $PSScriptRoot 'plugins/publish.ps1');
409+
usage = @"
410+
usage: axmol publish -version <ver>
411+
412+
Publish axmol release.
413+
414+
options:
415+
-h Show this help message.
416+
-version Release version to publish.
355417
"@
356418
}
357419
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $isWin = $IsWindows -or ("$env:OS" -eq 'Windows_NT')
1111

1212
$pwsh_ver = $PSVersionTable.PSVersion.ToString()
1313

14-
$AX_ROOT = (Resolve-Path $PSScriptRoot/../..)
14+
$AX_ROOT = (Resolve-Path $PSScriptRoot/../../..)
1515

1616
$git_prog = (Get-Command 'git' -ErrorAction SilentlyContinue).Source
1717
if (!$git_prog) {

0 commit comments

Comments
 (0)