diff --git a/action.yml b/action.yml index ab731d8..12d5235 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,10 @@ inputs: description: 'Set default Open Watcom environment variables (WATCOM + INCLUDE + PATH)' required: false default: true + target: + description: 'Set target OS specific Open Watcom header search path (INCLUDE)' + required: false + default: '' runs: using: 'node20' main: 'index.js' diff --git a/src/main.ts b/src/main.ts index 5ce39a5..4e8e978 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,8 @@ import * as exec from "@actions/exec"; function getInputs(): ISetupWatcomSettings { const p_version = core.getInput("version"); const version_allowed = ["1.8", "1.9", "2.0", "2.0-64"]; + const p_target = core.getInput("target"); + const target_allowed = ["", "dos", "win", "nt", "os2", "os2-16", "linux"]; if (!version_allowed.includes(p_version.toLowerCase())) { throw new Error( @@ -18,6 +20,14 @@ function getInputs(): ISetupWatcomSettings { ); } + if (!target_allowed.includes(p_target.toLowerCase())) { + throw new Error( + `"target" needs to be one of ${target_allowed.join( + ", ", + )}, got ${p_target}`, + ); + } + let p_url: string; let p_needs_chmod = false; let p_archive_type: ArchiveType; @@ -58,7 +68,6 @@ function getInputs(): ISetupWatcomSettings { } else { p_path_subdir = "BINNT"; } - p_inc_subdirs = ["H", "H\\NT", "H\\NT\\DIRECTX", "H\\NT\\DDK"]; } else if (process.platform === "darwin") { if (p_version !== "2.0-64") { throw new Error("Unsupported platform"); @@ -70,15 +79,57 @@ function getInputs(): ISetupWatcomSettings { } else { throw new Error("Unsupported platform"); } - p_inc_subdirs = ["lh"]; } else { if (p_version == "2.0-64") { p_path_subdir = "binl64"; } else { p_path_subdir = "binl"; } - p_inc_subdirs = ["lh"]; } + if (process.platform === "win32") { + switch (p_target) { + case "dos": + p_inc_subdirs = ["H"]; + break; + case "win": + p_inc_subdirs = ["H", "H\\WIN"]; + break; + case "os2": + p_inc_subdirs = ["H", "H\\OS2"]; + break; + case "os2-16": + p_inc_subdirs = ["H", "H\\OS21X"]; + break; + case "linux": + p_inc_subdirs = ["LH"]; + break; + case "nt": + default: + p_inc_subdirs = ["H", "H\\NT", "H\\NT\\DIRECTX", "H\\NT\\DDK"]; + } + } else { + switch (p_target) { + case "dos": + p_inc_subdirs = ["h"]; + break; + case "win": + p_inc_subdirs = ["h", "h/win"]; + break; + case "nt": + p_inc_subdirs = ["h", "h/nt", "h/nt/directx", "h/nt/ddk"]; + break; + case "os2": + p_inc_subdirs = ["h", "h/os2"]; + break; + case "os2-16": + p_inc_subdirs = ["h", "h/os21x"]; + break; + case "linux": + default: + p_inc_subdirs = ["lh"]; + } + } + let p_location = core.getInput("location"); if (!p_location) { if (process.platform === "win32") {