Skip to content

Commit

Permalink
feat: make snapshot version non cacheable
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Sep 11, 2024
1 parent 1a716cb commit 3afe5e6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 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,
isSnapshotVersion,
MavenProjectType,
WorkspaceDataType,
} from './graph-utils';
Expand Down Expand Up @@ -75,6 +76,13 @@ async function createNodesInternal(
) {
const effectiveVersion = getEffectiveVersion(project, workspaceData);

if (isSnapshotVersion(effectiveVersion)) {
targets[targetName] = {
...targets[targetName],
inputs: [{ runtime: 'date +%s' }],
};
}

const outputDirLocalRepo = getOutputDirLocalRepo(
workspaceData.localRepo,
project.groupId,
Expand Down Expand Up @@ -120,6 +128,13 @@ async function createNodesInternal(
},
},
};

if (isSnapshotVersion(effectiveVersion)) {
targets[buildTargetName] = {
...targets[buildTargetName],
inputs: [{ runtime: 'date +%s' }],
};
}
}

projects[project.projectRoot] = {
Expand Down
15 changes: 15 additions & 0 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,
isSnapshotVersion,
} from './graph-utils';

export const createNodes: CreateNodes<NxMavenPluginOptions> = [
Expand Down Expand Up @@ -55,6 +56,13 @@ export const createNodes: CreateNodes<NxMavenPluginOptions> = [
workspaceData,
);

if (isSnapshotVersion(effectiveVersion)) {
targets[targetName] = {
...targets[targetName],
inputs: [{ runtime: 'date +%s' }],
};
}

const outputDirLocalRepo = getOutputDirLocalRepo(
workspaceData.localRepo,
project.groupId,
Expand Down Expand Up @@ -100,6 +108,13 @@ export const createNodes: CreateNodes<NxMavenPluginOptions> = [
},
},
};

if (isSnapshotVersion(effectiveVersion)) {
targets[buildTargetName] = {
...targets[buildTargetName],
inputs: [{ runtime: 'date +%s' }],
};
}
}

projects[project.projectRoot] = {
Expand Down
10 changes: 10 additions & 0 deletions packages/nx-maven/src/graph/graph-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,13 @@ export function getTask(isRootProject: boolean) {

return 'install';
}

export function isSnapshotVersion(version: string): boolean {
const index = version.indexOf('SNAPSHOT');

if (index >= 0) {
return true;
}

return false;
}

0 comments on commit 3afe5e6

Please sign in to comment.