Skip to content

Commit

Permalink
update build-image task to support gradle projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Oct 7, 2024
1 parent 51a4ea1 commit 70bccfd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
12 changes: 0 additions & 12 deletions apps/openchallenges/api-gateway/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/api-gateway",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-api-gateway"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { TargetConfiguration } from '@nx/devkit';
import { ProjectBuilder } from './project-builder';

export async function buildImageTarget(
projectRoot: string,
projectName: string,
projectBuilder: ProjectBuilder | undefined,
): Promise<TargetConfiguration> {
const dependsOn = [
{
target: 'build',
},
];
if (projectBuilder === 'gradle') {
dependsOn.push({
target: 'build-image-base',
});
}

return {
executor: '@nx-tools/nx-container:build',
outputs: [],
Expand All @@ -28,6 +41,6 @@ export async function buildImageTarget(
},
},
defaultConfiguration: 'local',
dependsOn: ['build'],
dependsOn,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export async function buildProjectConfiguration(
targets[pluginConfig.buildImageTargetName] = await buildImageTarget(
options.projectRoot,
options.projectName,
options.projectBuilder,
);
}

Expand Down

0 comments on commit 70bccfd

Please sign in to comment.