Skip to content

Commit

Permalink
Merge pull request #66 from neon-bindings/allow-mixing-presets-and-pl…
Browse files Browse the repository at this point in the history
…atforms

Allow mixing platforms and presets
  • Loading branch information
dherman authored Aug 25, 2024
2 parents df5cf61 + 3172835 commit 13cfb94
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 128 deletions.
30 changes: 25 additions & 5 deletions dist/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42113,7 +42113,7 @@ const add_OPTIONS = [
];
class Add {
static summary() { return 'Add a platform or platform preset to a Neon project.'; }
static syntax() { return 'neon add [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>] [-b <f>]'; }
static syntax() { return 'neon add [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>]'; }
static options() {
return [
{ name: '<p>', summary: 'A Node platform or platform preset.' },
Expand Down Expand Up @@ -46093,6 +46093,14 @@ module.exports = eval("require")("@cargo-messages/linux-arm-gnueabihf");
module.exports = eval("require")("@cargo-messages/linux-arm64-gnu");


/***/ }),

/***/ 4134:
/***/ ((module) => {

module.exports = eval("require")("@cargo-messages/linux-arm64-musl");


/***/ }),

/***/ 1316:
Expand All @@ -46101,6 +46109,14 @@ module.exports = eval("require")("@cargo-messages/linux-arm64-gnu");
module.exports = eval("require")("@cargo-messages/linux-x64-gnu");


/***/ }),

/***/ 6469:
/***/ ((module) => {

module.exports = eval("require")("@cargo-messages/linux-x64-musl");


/***/ }),

/***/ 7894:
Expand Down Expand Up @@ -60877,7 +60893,9 @@ module.exports = (__nccwpck_require__(8372)/* .proxy */ .sj)({
'linux-x64-gnu': () => __nccwpck_require__(1316),
'linux-arm-gnueabihf': () => __nccwpck_require__(5379),
'android-arm-eabi': () => __nccwpck_require__(1738),
'linux-arm64-gnu': () => __nccwpck_require__(1713)
'linux-arm64-gnu': () => __nccwpck_require__(1713),
'linux-arm64-musl': () => __nccwpck_require__(4134),
'linux-x64-musl': () => __nccwpck_require__(6469)
});


Expand Down Expand Up @@ -61829,9 +61847,11 @@ exports.expandPlatformPreset = expandPlatformPreset;
function expandPlatformFamily(family) {
return isPlatformPreset(family)
? expandPlatformPreset(family)
: Array.isArray(family)
? merge(family.map(expandPlatformFamily))
: family;
: isNodePlatform(family)
? { [family]: node2Rust(family)[0] }
: Array.isArray(family)
? merge(family.map(expandPlatformFamily))
: family;
}
exports.expandPlatformFamily = expandPlatformFamily;
function describeTarget(target) {
Expand Down
20 changes: 10 additions & 10 deletions dist/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
},
"homepage": "https://github.com/dherman/neon-rs#readme",
"optionalDependencies": {
"@cargo-messages/android-arm-eabi": "0.1.78",
"@cargo-messages/darwin-arm64": "0.1.78",
"@cargo-messages/darwin-x64": "0.1.78",
"@cargo-messages/linux-arm-gnueabihf": "0.1.78",
"@cargo-messages/linux-arm64-gnu": "0.1.78",
"@cargo-messages/linux-arm64-musl": "0.1.78",
"@cargo-messages/linux-x64-gnu": "0.1.78",
"@cargo-messages/linux-x64-musl": "0.1.78",
"@cargo-messages/win32-arm64-msvc": "0.1.78",
"@cargo-messages/win32-x64-msvc": "0.1.78"
"@cargo-messages/android-arm-eabi": "0.1.79",
"@cargo-messages/darwin-arm64": "0.1.79",
"@cargo-messages/darwin-x64": "0.1.79",
"@cargo-messages/linux-arm-gnueabihf": "0.1.79",
"@cargo-messages/linux-arm64-gnu": "0.1.79",
"@cargo-messages/linux-arm64-musl": "0.1.79",
"@cargo-messages/linux-x64-gnu": "0.1.79",
"@cargo-messages/linux-x64-musl": "0.1.79",
"@cargo-messages/win32-arm64-msvc": "0.1.79",
"@cargo-messages/win32-x64-msvc": "0.1.79"
}
}
92 changes: 58 additions & 34 deletions dist/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions src/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"dependencies": {
"@neon-rs/artifact": "^0.1.0",
"@neon-rs/load": "^0.0.181",
"@neon-rs/manifest": "^0.1.1",
"cargo-messages": "^0.1.78",
"@neon-rs/manifest": "^0.1.2",
"cargo-messages": "^0.1.79",
"chalk": "^5.2.0",
"command-line-args": "^5.2.1",
"command-line-commands": "^3.0.2",
Expand All @@ -70,15 +70,15 @@
"temp": "^0.9.4"
},
"optionalDependencies": {
"@cargo-messages/android-arm-eabi": "0.1.78",
"@cargo-messages/darwin-arm64": "0.1.78",
"@cargo-messages/darwin-x64": "0.1.78",
"@cargo-messages/linux-arm-gnueabihf": "0.1.78",
"@cargo-messages/linux-arm64-gnu": "0.1.78",
"@cargo-messages/linux-arm64-musl": "0.1.78",
"@cargo-messages/linux-x64-gnu": "0.1.78",
"@cargo-messages/linux-x64-musl": "0.1.78",
"@cargo-messages/win32-arm64-msvc": "0.1.78",
"@cargo-messages/win32-x64-msvc": "0.1.78"
"@cargo-messages/android-arm-eabi": "0.1.79",
"@cargo-messages/darwin-arm64": "0.1.79",
"@cargo-messages/darwin-x64": "0.1.79",
"@cargo-messages/linux-arm-gnueabihf": "0.1.79",
"@cargo-messages/linux-arm64-gnu": "0.1.79",
"@cargo-messages/linux-arm64-musl": "0.1.79",
"@cargo-messages/linux-x64-gnu": "0.1.79",
"@cargo-messages/linux-x64-musl": "0.1.79",
"@cargo-messages/win32-arm64-msvc": "0.1.79",
"@cargo-messages/win32-x64-msvc": "0.1.79"
}
}
2 changes: 1 addition & 1 deletion src/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const OPTIONS = [

export default class Add implements Command {
static summary(): string { return 'Add a platform or platform preset to a Neon project.'; }
static syntax(): string { return 'neon add [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>] [-b <f>]'; }
static syntax(): string { return 'neon add [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>]'; }
static options(): CommandDetail[] {
return [
{ name: '<p>', summary: 'A Node platform or platform preset.' },
Expand Down
2 changes: 1 addition & 1 deletion src/manifest/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@neon-rs/manifest",
"private": false,
"version": "0.1.1",
"version": "0.1.2",
"description": "Library for working with Neon package configuration.",
"exports": {
".": {
Expand Down
7 changes: 5 additions & 2 deletions src/manifest/src/platform.cts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ export function assertIsPlatformFamily(json: unknown, path: string): asserts jso

export type TargetPair = { node: NodePlatform, rust: RustTarget };
export type PlatformMap = { [key in NodePlatform]?: RustTarget };
export type PlatformName = NodePlatform | PlatformPreset;

export type PlatformFamily =
PlatformPreset
| PlatformPreset[]
PlatformName
| PlatformName[]
| PlatformMap;

function lookupPlatformPreset(key: PlatformPreset): PlatformFamily {
Expand All @@ -96,6 +97,8 @@ export function expandPlatformPreset(preset: PlatformPreset): PlatformMap {
export function expandPlatformFamily(family: PlatformFamily): PlatformMap {
return isPlatformPreset(family)
? expandPlatformPreset(family)
: isNodePlatform(family)
? { [family]: node2Rust(family)[0] }
: Array.isArray(family)
? merge(family.map(expandPlatformFamily))
: family;
Expand Down
Loading

0 comments on commit 13cfb94

Please sign in to comment.