From f28bdda839fc6e1debda9907e6b29ce9e1da1609 Mon Sep 17 00:00:00 2001 From: G'lek Tarssza Date: Wed, 23 Oct 2024 09:04:12 -0600 Subject: [PATCH 1/3] Update tasks a bit. --- taskfile.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/taskfile.yaml b/taskfile.yaml index b03737b..1d93c93 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -68,6 +68,7 @@ tasks: deps: - create-build-dir sources: + - '{{.srcDir}}/*.odin' - '{{.srcDir}}/**/*.odin' generates: - '{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}' @@ -77,6 +78,7 @@ tasks: deps: - create-build-dir sources: + - '{{.srcDir}}/*.odin' - '{{.srcDir}}/**/*.odin' generates: - '{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}' @@ -241,7 +243,11 @@ tasks: deps: - create-build-dir sources: + - '{{.srcDir}}/*.odin' - '{{.srcDir}}/**/*.odin' + - '{{.libDir}}/*.odin' + - '{{.libDir}}/**/*.odin' + - '{{.testsDir}}/*.odin' - '{{.testsDir}}/**/*.odin' generates: - '{{.buildDir}}/{{.outputNameTests}}{{exeExt}}' @@ -249,6 +255,7 @@ tasks: lint-src: desc: Lint the project `{{.srcDir}}` directory. sources: + - '{{.srcDir}}/*.odin' - '{{.srcDir}}/**/*.odin' cmd: '{{.compiler}} check {{.srcDir}} {{.compilerCheckFlags}} {{.compilerDefines}} {{.compilerCollections}}' lint-lib: @@ -259,6 +266,7 @@ tasks: lint-tests: desc: Lint the project `{{.testsDir}}` directory. sources: + - '{{.testsDir}}/*.odin' - '{{.testsDir}}/**/*.odin' cmd: '{{.compiler}} check {{.testsDir}} {{.compilerTestsCheckFlags}} {{.compilerDefines}} {{.compilerCollections}}' lint-all: From 6020ac682f093b7af4ff2158180ab88506e7fee4 Mon Sep 17 00:00:00 2001 From: G'lek Tarssza Date: Wed, 23 Oct 2024 09:39:55 -0600 Subject: [PATCH 2/3] Fixed up tasks on Windows. --- taskfile.yaml | 76 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/taskfile.yaml b/taskfile.yaml index 1d93c93..29a1006 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -12,6 +12,8 @@ vars: testsDir: tests buildDir: build distDir: dist + #-- Shell Settings + shell: '{{if eq OS "windows"}}wsl -- {{end}}' #-- Output Settings outputBaseName: odincraft outputNameDebug: '{{.outputBaseName}}-debug' @@ -27,7 +29,8 @@ vars: compilerDefines: -define:PROJECT_NAME="{{.projectName}}" -define:PROJECT_VERSION="{{.projectVersion}}" -define:PROJECT_DESCRIPTION="{{.projectDescription}}" compilerTestDefines: '{{.compilerDefines}}' compilerCollections: '' - compilerTestCollections: '{{.compilerCollections}} -collection:src={{.srcDir}} -collection:test_utils={{.testsDir}}/utils' + compilerTestCollections: '{{.compilerCollections}} -collection:src={{.srcDir}} -collection:lib={{.libDir}} -collection:test_utils={{.testsDir}}/utils' + compilerTestCollectionsNoLib: '{{.compilerCollections}} -collection:src={{.srcDir}} -collection:test_utils={{.testsDir}}/utils' compilerBaseFlags: '-build-mode:exe' compilerDebugFlags: '{{.compilerBaseFlags}} -o:none -debug' compilerReleaseFlags: '{{.compilerBaseFlags}} -o:minimal' @@ -39,27 +42,27 @@ tasks: create-build-dir: desc: Create the `build` directory. status: - - bash -c 'test -d "{{.buildDir}}"' - cmd: bash -c 'mkdir -p {{.buildDir}}' + - '{{.shell}} test -d "{{.buildDir}}"' + cmd: '{{.shell}} mkdir -p {{.buildDir}}' create-dist-dir: desc: Create the `dist` directory. status: - - bash -c 'test -d "{{.distDir}}"' - cmd: bash -c 'mkdir -p {{.distDir}}' + - '{{.shell}} test -d "{{.distDir}}"' + cmd: '{{.shell}} mkdir -p {{.distDir}}' create-release-dist-dir: desc: Create the `dist/release` directory. deps: - create-dist-dir status: - - bash -c 'test -d "{{.distDir}}/release"' - cmd: bash -c 'mkdir -p {{.distDir}}/release' + - '{{.shell}} test -d "{{.distDir}}/release"' + cmd: '{{.shell}} mkdir -p {{.distDir}}/release' create-debug-dist-dir: desc: Create the `dist/debug` directory. deps: - create-dist-dir status: - - bash -c 'test -d "{{.distDir}}/debug"' - cmd: bash -c 'mkdir -p {{.distDir}}/debug' + - '{{.shell}} test -d "{{.distDir}}/debug"' + cmd: '{{.shell}} mkdir -p {{.distDir}}/debug' build-release: desc: Build the project in release mode. aliases: @@ -93,27 +96,27 @@ tasks: aliases: - clean status: - - bash -c 'test ! -f "{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}"' - cmd: bash -c 'rm -f {{.buildDir}}/{{.outputNameRelease}}{{exeExt}}' + - '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}"' + cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameRelease}}{{exeExt}}' clean-debug: desc: Clean the project in debug mode. status: - - bash -c 'test ! -f "{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}"' + - '{{.shell}} test ! -f "{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}"' cmds: - - bash -c 'rm -f {{.buildDir}}/{{.outputNameDebug}}{{exeExt}}' - - cmd: bash -c 'rm -f {{.buildDir}}/{{.outputNameDebug}}.pdb' + - '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}{{exeExt}}' + - cmd: '{{.shell}} rm -f {{.buildDir}}/{{.outputNameDebug}}.pdb' platforms: - windows clean-dist-release: desc: Clean the release distribution. status: - - bash -c 'test ! -d "{{.distDir}}/release/"' - cmd: bash -c 'rm -rf {{.distDir}}/release/' + - '{{.shell}} test ! -d "{{.distDir}}/release/"' + cmd: '{{.shell}} rm -rf {{.distDir}}/release/' clean-dist-debug: desc: Clean the debug distribution. status: - - bash -c 'test ! -d "{{.distDir}}/debug/"' - cmd: bash -c 'rm -rf {{.distDir}}/debug/' + - '{{.shell}} test ! -d "{{.distDir}}/debug/"' + cmd: '{{.shell}} rm -rf {{.distDir}}/debug/' clean-dist-all: desc: Clean both release and debug distributions. deps: @@ -122,13 +125,13 @@ tasks: clean-archive-release: desc: Clean the release archive. status: - - bash -c 'test ! -f "{{.distDir}}/{{.archiveNameRelease}}"' - cmd: bash -c 'rm -f {{.distDir}}/{{.archiveNameRelease}}' + - '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameRelease}}"' + cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameRelease}}' clean-archive-debug: desc: Clean the debug archive. status: - - bash -c 'test ! -f "{{.distDir}}/{{.archiveNameDebug}}"' - cmd: bash -c 'rm -f {{.distDir}}/{{.archiveNameDebug}}' + - '{{.shell}} test ! -f "{{.distDir}}/{{.archiveNameDebug}}"' + cmd: '{{.shell}} rm -f {{.distDir}}/{{.archiveNameDebug}}' clean-archive-all: desc: Clean both release and debug archives. deps: @@ -144,11 +147,11 @@ tasks: - clean-archive-release - clean-archive-debug status: - - bash -c 'test ! -d "{{.buildDir}}"' - - bash -c 'test ! -d "{{.distDir}}"' + - '{{.shell}} test ! -d "{{.buildDir}}"' + - '{{.shell}} test ! -d "{{.distDir}}"' cmds: - - bash -c 'rm -rf {{.buildDir}}' - - bash -c 'rm -rf {{.distDir}}' + - '{{.shell}} rm -rf {{.buildDir}}' + - '{{.shell}} rm -rf {{.distDir}}' rebuild-release: desc: Rebuild the project in release mode. aliases: @@ -181,7 +184,7 @@ tasks: - '{{.buildDir}}/{{.outputNameRelease}}{{exeExt}}' generates: - '{{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}' - cmd: bash -c 'cp {{.buildDir}}/{{.outputNameRelease}}{{exeExt}} {{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}' + cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameRelease}}{{exeExt}} {{.distDir}}/release/{{.outputNameRelease}}{{exeExt}}' dist-debug: desc: Generate a debug distribution. deps: @@ -192,8 +195,8 @@ tasks: generates: - '{{.distDir}}/debug/{{.outputNameDebug}}.*' cmds: - - bash -c 'cp {{.buildDir}}/{{.outputNameDebug}}{{exeExt}} {{.distDir}}/debug/{{.outputNameDebug}}{{exeExt}}' - - cmd: bash -c 'cp {{.buildDir}}/{{.outputNameDebug}}.pdb {{.distDir}}/debug/{{.outputNameDebug}}.pdb' + - '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}{{exeExt}} {{.distDir}}/debug/{{.outputNameDebug}}{{exeExt}}' + - cmd: '{{.shell}} cp {{.buildDir}}/{{.outputNameDebug}}.pdb {{.distDir}}/debug/{{.outputNameDebug}}.pdb' platforms: - windows dist-all: @@ -240,6 +243,7 @@ tasks: cmd: '{{.buildDir}}/{{.outputNameDebug}}{{exeExt}}' test: desc: Run the project unit tests. + method: none deps: - create-build-dir sources: @@ -251,7 +255,12 @@ tasks: - '{{.testsDir}}/**/*.odin' generates: - '{{.buildDir}}/{{.outputNameTests}}{{exeExt}}' - cmd: '{{.compiler}} test {{.testsDir}} -out:{{.buildDir}}/{{.outputNameTests}}{{exeExt}} {{.compilerTestFlags}} {{.compilerTestDefines}} {{.compilerTestCollections}}' + cmd: | + if [[ -d {{.libDir}} ]]; then + {{.compiler}} test {{.testsDir}} -out:{{.buildDir}}/{{.outputNameTests}}{{exeExt}} {{.compilerTestFlags}} {{.compilerTestDefines}} {{.compilerTestCollections}} + else + {{.compiler}} test {{.testsDir}} -out:{{.buildDir}}/{{.outputNameTests}}{{exeExt}} {{.compilerTestFlags}} {{.compilerTestDefines}} {{.compilerTestCollectionsNoLib}} + fi lint-src: desc: Lint the project `{{.srcDir}}` directory. sources: @@ -261,8 +270,12 @@ tasks: lint-lib: desc: Lint the project `{{.libDir}}` directory. sources: + - '{{.libDir}}/*.odin' - '{{.libDir}}/**/*.odin' - cmd: '{{.compiler}} check {{.libDir}}/* {{.compilerLibCheckFlags}} {{.compilerDefines}} {{.compilerCollections}}' + cmd: | + if [[ -d {{.libDir}} ]]; then + {{.compiler}} check {{.libDir}}/* {{.compilerLibCheckFlags}} {{.compilerDefines}} {{.compilerCollections}} + fi lint-tests: desc: Lint the project `{{.testsDir}}` directory. sources: @@ -275,4 +288,5 @@ tasks: - lint deps: - lint-src + - lint-lib - lint-tests From f6c60ed7436a612a848a49469fa99b2429e6d314 Mon Sep 17 00:00:00 2001 From: G'lek Tarssza Date: Wed, 23 Oct 2024 09:47:54 -0600 Subject: [PATCH 3/3] Fixed running Bash commands on Windows. --- taskfile.yaml | 59 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/taskfile.yaml b/taskfile.yaml index 29a1006..c7614bd 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -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' @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: