diff --git a/README.md b/README.md index aa2cc6d..cecb4e5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ For legacy DDKBuild projects: ```yaml - name: build driver shell: cmd - run: call "${{ steps.wdk7.outputs.ddkbuild-cmd }}" -WIN7A64 free src + run: call ddkbuild.cmd -WIN7A64 free src ``` Use `root` to point at a preinstalled WDK7 tree, or `download-url` to provide diff --git a/dist/index.js b/dist/index.js index 543b4d6..84bfcde 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29172,6 +29172,7 @@ function publishWdk7(root, source, cacheHit, sdk) { exportVariable("WDK7_DDKBUILD_CMD", ddkbuildCmd()); exportVariable("WDK7_CMAKE_GENERATOR", cmakeGenerator); addPath(host); + addPath(actionRoot()); setOutput("found", "true"); setOutput("root", resolvedRoot); setOutput("source", source); diff --git a/scripts/test-e2e.ps1 b/scripts/test-e2e.ps1 index 7dd24b5..e3c004a 100644 --- a/scripts/test-e2e.ps1 +++ b/scripts/test-e2e.ps1 @@ -32,6 +32,27 @@ function Assert-ExistingPath { } } +<# +.SYNOPSIS +Ensures a command is available through PATH before the e2e script uses it. + +.DESCRIPTION +The action adds bundled helper commands to PATH for downstream steps. Checking +command resolution directly protects the user-facing contract that legacy +projects can call ddkbuild.cmd without referencing an action output. +#> +function Assert-CommandAvailable { + param( + [string]$CommandName + ) + + # Get-Command tests the same PATH-based resolution that a later cmd.exe call + # relies on when it invokes the bundled batch wrapper. + if ($null -eq (Get-Command $CommandName -ErrorAction SilentlyContinue)) { + throw "$CommandName is not available on PATH." + } +} + <# .SYNOPSIS Runs a command and exits with the command's status when it fails. @@ -198,7 +219,7 @@ function Build-DdkbuildTarget { # expects normal cmd call semantics. The source path stays relative # because legacy ddkbuild path handling is more reliable with repo-local # target directories than with absolute workflow paths. - Invoke-Checked "cmd" @("/s", "/c", "call ""$env:WDK7_DDKBUILD_CMD"" $target free ""$source""") + Invoke-Checked "cmd" @("/s", "/c", "call ddkbuild.cmd $target free ""$source""") } $sysFiles = @(Get-ChildItem -Path $sourcePath -Recurse -Filter e2e_ddkbuild.sys) @@ -214,7 +235,7 @@ function Build-DdkbuildTarget { Assert-ExistingPath $env:WDK7_ROOT "WDK7_ROOT is not set or does not exist." Assert-ExistingPath $env:WDK7_CMAKE_TOOLCHAIN_FILE "WDK7_CMAKE_TOOLCHAIN_FILE is not set or does not exist." -Assert-ExistingPath $env:WDK7_DDKBUILD_CMD "WDK7_DDKBUILD_CMD is not set or does not exist." +Assert-CommandAvailable "ddkbuild.cmd" if ([string]::IsNullOrWhiteSpace($env:WDK7_CMAKE_GENERATOR)) { throw "WDK7_CMAKE_GENERATOR is not set." diff --git a/src/action.ts b/src/action.ts index 3ce7b55..a17d6ee 100644 --- a/src/action.ts +++ b/src/action.ts @@ -222,6 +222,10 @@ export function publishWdk7(root: string, source: string, cacheHit: boolean, sdk // invoke NMake and rc.exe after the action step completes. core.addPath(host); + // The action root is added so legacy projects can run ddkbuild.cmd directly + // without reaching through a step output for the bundled wrapper path. + core.addPath(actionRoot()); + core.setOutput("found", "true"); core.setOutput("root", resolvedRoot); core.setOutput("source", source);