Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add target OS which define INCLUDE variable setup #88

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
57 changes: 54 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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") {
Expand Down