cmake-action/src/context.ts
dependabot[bot] c40a5ff9d3
Some checks failed
Build / Build Action (push) Has been cancelled
Test / Test Action With Custom Generator (push) Has been cancelled
Test / Test Action (macos-14) (push) Has been cancelled
Test / Test Action (ubuntu-24.04) (push) Has been cancelled
Test / Test Action (windows-2022) (push) Has been cancelled
Test / Test Action With Specified Directories (push) Has been cancelled
Test / Test Action Without Run Build (push) Has been cancelled
Test / Test Action With Additional Options (push) Has been cancelled
chore: bump typescript-eslint from 8.34.1 to 8.39.1 (#790)
* chore: bump typescript-eslint from 8.34.1 to 8.39.1

Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.34.1 to 8.39.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.39.1/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-version: 8.39.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* test: fix lint

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfi Maulana <alfi.maulana.f@gmail.com>
2025-08-18 15:08:06 +08:00

60 lines
1.4 KiB
TypeScript

import { getInput } from "gha-utils";
import path from "node:path";
import { parse } from "./utils.js";
export interface Context {
sourceDir: string;
buildDir: string;
configure: {
generator: string;
options: string[];
args: string[];
};
build: {
enabled: boolean;
args: string[];
};
}
export function getContext(): Context {
const sourceDir = getInput("source-dir");
const options: string[] = [];
let input = getInput("c-compiler");
if (input) options.push(`CMAKE_C_COMPILER=${input}`);
input = getInput("cxx-compiler");
if (input) options.push(`CMAKE_CXX_COMPILER=${input}`);
input = getInput("c-flags");
if (input) {
const flags = input.replaceAll(/\s+/g, " ");
options.push(`CMAKE_C_FLAGS=${flags}`);
}
input = getInput("cxx-flags");
if (input) {
const flags = input.replaceAll(/\s+/g, " ");
options.push(`CMAKE_CXX_FLAGS=${flags}`);
}
input = getInput("options");
if (input) {
options.push(...parse(input).map((opt) => opt));
}
return {
sourceDir,
buildDir: getInput("build-dir") || path.join(sourceDir, "build"),
configure: {
generator: getInput("generator"),
options,
args: parse(getInput("args")).map((arg) => arg),
},
build: {
enabled: getInput("run-build") == "true",
args: parse(getInput("build-args")).map((arg) => arg),
},
};
}