Skip to content

Commit

Permalink
Fixed running Bash commands on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
glektarssza committed Oct 23, 2024
1 parent 6020ac6 commit f6c60ed
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ vars:
buildDir: build
distDir: dist
#-- Shell Settings
shell: '{{if eq OS "windows"}}wsl -- {{end}}'
shell: '{{if eq OS "windows"}}bash -c ''{{end}}'
postShell: '{{if eq OS "windows"}}''{{end}}'
#-- Output Settings
outputBaseName: odincraft
outputNameDebug: '{{.outputBaseName}}-debug'
Expand Down Expand Up @@ -42,27 +43,27 @@ tasks:
create-build-dir:
desc: Create the `build` directory.
status:
- '{{.shell}} test -d "{{.buildDir}}"'
cmd: '{{.shell}} mkdir -p {{.buildDir}}'
- '{{.shell}} test -d "{{.buildDir}}"{{.postShell}}'
cmd: '{{.shell}} mkdir -p {{.buildDir}}{{.postShell}}'
create-dist-dir:
desc: Create the `dist` directory.
status:
- '{{.shell}} test -d "{{.distDir}}"'
cmd: '{{.shell}} mkdir -p {{.distDir}}'
- '{{.shell}} test -d "{{.distDir}}"{{.postShell}}'
cmd: '{{.shell}} mkdir -p {{.distDir}}{{.postShell}}'
create-release-dist-dir:
desc: Create the `dist/release` directory.
deps:
- create-dist-dir
status:
- '{{.shell}} test -d "{{.distDir}}/release"'
cmd: '{{.shell}} mkdir -p {{.distDir}}/release'
- '{{.shell}} test -d "{{.distDir}}/release"{{.postShell}}'
cmd: '{{.shell}} mkdir -p {{.distDir}}/release{{.postShell}}'
create-debug-dist-dir:
desc: Create the `dist/debug` directory.
deps:
- create-dist-dir
status:
- '{{.shell}} test -d "{{.distDir}}/debug"'
cmd: '{{.shell}} mkdir -p {{.distDir}}/debug'
- '{{.shell}} test -d "{{.distDir}}/debug"{{.postShell}}'
cmd: '{{.shell}} mkdir -p {{.distDir}}/debug{{.postShell}}'
build-release:
desc: Build the project in release mode.
aliases:
Expand Down Expand Up @@ -96,27 +97,27 @@ tasks:
aliases:
- clean
status:
- '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}"'
cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameRelease}}{{exeExt}}'
- '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}"{{.postShell}}'
cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameRelease}}{{exeExt}}{{.postShell}}'
clean-debug:
desc: Clean the project in debug mode.
status:
- '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}"'
- '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}"{{.postShell}}'
cmds:
- '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}{{exeExt}}'
- cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}.pdb'
- '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}{{exeExt}}{{.postShell}}'
- cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}.pdb{{.postShell}}'
platforms:
- windows
clean-dist-release:
desc: Clean the release distribution.
status:
- '{{.shell}} test ! -d "{{.distDir}}/release/"'
cmd: '{{.shell}} rm -rf {{.distDir}}/release/'
- '{{.shell}} test ! -d "{{.distDir}}/release/"{{.postShell}}'
cmd: '{{.shell}} rm -rf {{.distDir}}/release/{{.postShell}}'
clean-dist-debug:
desc: Clean the debug distribution.
status:
- '{{.shell}} test ! -d "{{.distDir}}/debug/"'
cmd: '{{.shell}} rm -rf {{.distDir}}/debug/'
- '{{.shell}} test ! -d "{{.distDir}}/debug/"{{.postShell}}'
cmd: '{{.shell}} rm -rf {{.distDir}}/debug/{{.postShell}}'
clean-dist-all:
desc: Clean both release and debug distributions.
deps:
Expand All @@ -125,13 +126,13 @@ tasks:
clean-archive-release:
desc: Clean the release archive.
status:
- '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameRelease}}"'
cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameRelease}}'
- '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameRelease}}"{{.postShell}}'
cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameRelease}}{{.postShell}}'
clean-archive-debug:
desc: Clean the debug archive.
status:
- '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameDebug}}"'
cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameDebug}}'
- '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameDebug}}"{{.postShell}}'
cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameDebug}}{{.postShell}}'
clean-archive-all:
desc: Clean both release and debug archives.
deps:
Expand All @@ -147,11 +148,11 @@ tasks:
- clean-archive-release
- clean-archive-debug
status:
- '{{.shell}} test ! -d "{{.buildDir}}"'
- '{{.shell}} test ! -d "{{.distDir}}"'
- '{{.shell}} test ! -d "{{.buildDir}}"{{.postShell}}'
- '{{.shell}} test ! -d "{{.distDir}}"{{.postShell}}'
cmds:
- '{{.shell}} rm -rf {{.buildDir}}'
- '{{.shell}} rm -rf {{.distDir}}'
- '{{.shell}} rm -rf {{.buildDir}}{{.postShell}}'
- '{{.shell}} rm -rf {{.distDir}}{{.postShell}}'
rebuild-release:
desc: Rebuild the project in release mode.
aliases:
Expand Down Expand Up @@ -184,7 +185,7 @@ tasks:
- '{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}'
generates:
- '{{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}'
cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameRelease}}{{exeExt}} {{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}'
cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameRelease}}{{exeExt}} {{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}{{.postShell}}'
dist-debug:
desc: Generate a debug distribution.
deps:
Expand All @@ -195,8 +196,8 @@ tasks:
generates:
- '{{.distDir}}/debug/{{.outputNameDebug}}.*'
cmds:
- '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}{{exeExt}} {{.distDir}}/debug/{{.outputNameDebug}}{{exeExt}}'
- cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}.pdb {{.distDir}}/debug/{{.outputNameDebug}}.pdb'
- '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}{{exeExt}} {{.distDir}}/debug/{{.outputNameDebug}}{{exeExt}}{{.postShell}}'
- cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}.pdb {{.distDir}}/debug/{{.outputNameDebug}}.pdb{{.postShell}}'
platforms:
- windows
dist-all:
Expand Down

0 comments on commit f6c60ed

Please sign in to comment.