This commit is contained in:
병준 박 2025-05-06 17:29:25 +00:00
parent ba73cc8752
commit 780e5d5002
11 changed files with 22 additions and 21 deletions

View File

@ -16,16 +16,15 @@
"profile": {
"type": "string"
},
"cwd": {
"type": "string"
},
"target-dir": {
"type": "string"
},
"toolchain": {
"type": "string",
"enum": [
"stable",
"beta",
"nightly"
],
"enum": ["stable", "beta", "nightly"],
"default": "stable"
},
"features": {

View File

@ -77,7 +77,7 @@ describe('add-napi generator', () => {
"release": true,
},
},
"executor": "@monodon/rust:napi",
"executor": "@unbox-x/nx-rust:napi",
"options": Object {
"dist": "test",
"jsFile": "index.js",

View File

@ -60,7 +60,7 @@ export default async function (tree: Tree, options: AddNapiGeneratorSchema) {
build: {
cache: true,
outputs: [`{workspaceRoot}/${normalizedOptions.projectRoot}`],
executor: '@monodon/rust:napi',
executor: '@unbox-x/nx-rust:napi',
options: {
dist: normalizedOptions.projectRoot,
jsFile: 'index.js',

View File

@ -66,7 +66,7 @@ export default async function (
sourceRoot: `${normalizedOptions.projectRoot}/src`,
targets: {
build: {
executor: '@monodon/rust:build',
executor: '@unbox-x/nx-rust:build',
},
},
tags: normalizedOptions.parsedTags,

View File

@ -40,7 +40,7 @@ describe('init generator', () => {
const nxJson = readNxJson(appTree);
expect(nxJson?.plugins).toMatchInlineSnapshot(`
Array [
"@monodon/rust",
"@unbox-x/nx-rust",
]
`);
});
@ -55,7 +55,7 @@ describe('init generator', () => {
expect(nxJson?.plugins).toMatchInlineSnapshot(`
Array [
"@nrwl/graph/plugin",
"@monodon/rust",
"@unbox-x/nx-rust",
]
`);
});

View File

@ -45,7 +45,7 @@ function includeProjectGraphPlugin(tree: Tree) {
if (!config) {
return;
}
(config.plugins ??= []).push('@monodon/rust');
(config.plugins ??= []).push('@unbox-x/nx-rust');
updateNxJson(tree, config);
}

View File

@ -90,7 +90,7 @@ function processCargoMetadata(ctx: CreateNodesContext | CreateNodesContextV2): {
if (!isPrivate) {
targets['nx-release-publish'] = {
dependsOn: ['^nx-release-publish'],
executor: '@monodon/rust:release-publish',
executor: '@unbox-x/nx-rust:release-publish',
options: {},
};
}
@ -101,7 +101,7 @@ function processCargoMetadata(ctx: CreateNodesContext | CreateNodesContextV2): {
targets,
release: {
version: {
generator: '@monodon/rust:release-version',
generator: '@unbox-x/nx-rust:release-version',
},
},
};

View File

@ -2,7 +2,7 @@ import { NxPlugin } from '@nx/devkit';
import { createDependencies, createNodes, createNodesV2 } from './graph';
const nxPlugin: NxPlugin = {
name: '@monodon/rust',
name: '@unbox-x/nx-rust',
createDependencies,
createNodes,
createNodesV2,

View File

@ -7,6 +7,7 @@ export interface CargoMetadata {
packages: Package[];
workspace_members: string[];
resolve: Resolve;
cwd: string;
target_directory: string;
version: number;
workspace_root: string;

View File

@ -10,7 +10,7 @@ export function addBuildExecutor(
): TargetConfiguration {
return {
cache: true,
executor: '@monodon/rust:build',
executor: '@unbox-x/nx-rust:build',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,
@ -27,7 +27,7 @@ export function addCheckExecutor(
additionalOptions?: BuildExecutorSchema
): TargetConfiguration {
return {
executor: '@monodon/rust:check',
executor: '@unbox-x/nx-rust:check',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,
@ -40,7 +40,7 @@ export function addTestExecutor(
): TargetConfiguration {
return {
cache: true,
executor: '@monodon/rust:test',
executor: '@unbox-x/nx-rust:test',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,
@ -57,7 +57,7 @@ export function addRunExecutor(
additionalOptions?: RunExecutorSchema
): TargetConfiguration {
return {
executor: '@monodon/rust:run',
executor: '@unbox-x/nx-rust:run',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,
@ -75,7 +75,7 @@ export function addLintExecutor(
): TargetConfiguration {
return {
cache: true,
executor: '@monodon/rust:lint',
executor: '@unbox-x/nx-rust:lint',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,
@ -88,7 +88,7 @@ export function addWasmPackExecutor(
): TargetConfiguration {
return {
cache: true,
executor: '@monodon/rust:wasm-pack',
executor: '@unbox-x/nx-rust:wasm-pack',
outputs: ['{options.target-dir}'],
options: {
...additionalOptions,

View File

@ -7,6 +7,7 @@ export function runProcess(
...args: string[]
): { success: boolean } | PromiseLike<{ success: boolean }> {
const metadata = cargoMetadata();
const cwd = metadata?.cwd ?? process.cwd();
const targetDir =
metadata?.target_directory ??
joinPathFragments(workspaceRoot, 'dist', 'cargo');
@ -18,7 +19,7 @@ export function runProcess(
}
execSync(processCmd + ' ' + args.join(' '), {
cwd: process.cwd(),
cwd,
env: {
...process.env,
RUSTC_WRAPPER: '',