Skip to content

Commit

Permalink
feat: don't set outputDirLocalRepo if present in target.options (#1439)
Browse files Browse the repository at this point in the history
* feat: don't set outputDirLocalRepo if present in target.options

* build: work in progress

* build: work in progress
  • Loading branch information
khalilou88 authored Dec 4, 2024
1 parent 4fd6cd0 commit f83ad8b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
11 changes: 6 additions & 5 deletions packages/nx-maven/src/graph/create-nodes-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
getOutputDirLocalRepo,
getTask,
getWorkspaceData,
ifOutputDirLocalRepoNotPresent,
MavenProjectType,
validateTargetInputs,
WorkspaceDataType,
Expand All @@ -31,7 +32,6 @@ export const createNodesV2: CreateNodesV2<NxMavenPluginOptions> = [
},
];

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function createNodesInternal(
configFilePath: string,
options: NxMavenPluginOptions | undefined,
Expand Down Expand Up @@ -72,10 +72,11 @@ async function createNodesInternal(
validateTargetInputs(targetName, 'project.json', target.inputs);

if (
workspaceData.targetDefaults.includes(targetName) ||
(target.outputs ?? []).some(
(element: string) => element === '{options.outputDirLocalRepo}',
)
ifOutputDirLocalRepoNotPresent(target?.options) &&
(workspaceData.targetDefaults.includes(targetName) ||
(target.outputs ?? []).some(
(element: string) => element === '{options.outputDirLocalRepo}',
))
) {
const effectiveVersion = getEffectiveVersion(project, workspaceData);

Expand Down
10 changes: 6 additions & 4 deletions packages/nx-maven/src/graph/create-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getOutputDirLocalRepo,
getTask,
getWorkspaceData,
ifOutputDirLocalRepoNotPresent,
validateTargetInputs,
} from './graph-utils';

Expand Down Expand Up @@ -49,10 +50,11 @@ export const createNodes: CreateNodes<NxMavenPluginOptions> = [
validateTargetInputs(targetName, 'project.json', target.inputs);

if (
workspaceData.targetDefaults.includes(targetName) ||
(target.outputs ?? []).some(
(element: string) => element === '{options.outputDirLocalRepo}',
)
ifOutputDirLocalRepoNotPresent(target?.options) &&
(workspaceData.targetDefaults.includes(targetName) ||
(target.outputs ?? []).some(
(element: string) => element === '{options.outputDirLocalRepo}',
))
) {
const effectiveVersion = getEffectiveVersion(
project,
Expand Down
13 changes: 13 additions & 0 deletions packages/nx-maven/src/graph/graph-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,16 @@ export function getTask(isRootProject: boolean) {

return 'install';
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function ifOutputDirLocalRepoNotPresent(options: any): boolean {
if (!options) {
return true;
}

if ('outputDirLocalRepo' in options) {
return false;
}

return true;
}

0 comments on commit f83ad8b

Please sign in to comment.