mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-22 03:21:21 +00:00
feat: parse quotation in build-args
input
Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
parent
a2e5d22b54
commit
bc6eb9d372
4
dist/action.mjs
generated
vendored
4
dist/action.mjs
generated
vendored
@ -386,9 +386,7 @@ function getContext() {
|
|||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
enabled: getInput("run-build") == "true",
|
enabled: getInput("run-build") == "true",
|
||||||
args: getInput("build-args")
|
args: shellQuoteExports.parse(getInput("build-args")).map((arg) => arg.toString()),
|
||||||
.split(/\s+/)
|
|
||||||
.filter((arg) => arg != ""),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -132,11 +132,11 @@ describe("get action context", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with additional build arguments specified",
|
name: "with additional build arguments specified",
|
||||||
inputs: { "build-args": "--target foo\n--parallel 8" },
|
inputs: { "build-args": `--target foo\n--parallel 8 --foo "bar baz"` },
|
||||||
expectedContext: {
|
expectedContext: {
|
||||||
build: {
|
build: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
args: ["--target", "foo", "--parallel", "8"],
|
args: ["--target", "foo", "--parallel", "8", "--foo", "bar baz"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -153,7 +153,7 @@ describe("get action context", () => {
|
|||||||
options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`,
|
options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`,
|
||||||
args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"`,
|
args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"`,
|
||||||
"run-build": "true",
|
"run-build": "true",
|
||||||
"build-args": "--target foo\n--parallel 8",
|
"build-args": `--target foo\n--parallel 8 --foo "bar baz"`,
|
||||||
},
|
},
|
||||||
expectedContext: {
|
expectedContext: {
|
||||||
sourceDir: "project",
|
sourceDir: "project",
|
||||||
@ -174,7 +174,7 @@ describe("get action context", () => {
|
|||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
args: ["--target", "foo", "--parallel", "8"],
|
args: ["--target", "foo", "--parallel", "8", "--foo", "bar baz"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -53,9 +53,7 @@ export function getContext(): Context {
|
|||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
enabled: getInput("run-build") == "true",
|
enabled: getInput("run-build") == "true",
|
||||||
args: getInput("build-args")
|
args: parse(getInput("build-args")).map((arg) => arg.toString()),
|
||||||
.split(/\s+/)
|
|
||||||
.filter((arg) => arg != ""),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user