Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gradle): fix gradle plugin path #22405

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/gradle/src/generators/init/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('@nx/gradle:init', () => {
"classesTargetName": "classes",
"testTargetName": "test",
},
"plugin": "@nx/gradle/plugin",
"plugin": "@nx/gradle",
},
]
`);
Expand All @@ -49,15 +49,15 @@ describe('@nx/gradle:init', () => {
"classesTargetName": "classes",
"testTargetName": "test",
},
"plugin": "@nx/gradle/plugin",
"plugin": "@nx/gradle",
},
]
`);
});

it('should not add plugin if already in array', async () => {
updateNxJson(tree, {
plugins: ['@nx/gradle/plugin'],
plugins: ['@nx/gradle'],
});
await initGenerator(tree, {
skipFormat: true,
Expand All @@ -66,7 +66,7 @@ describe('@nx/gradle:init', () => {
const nxJson = readNxJson(tree);
expect(nxJson.plugins).toMatchInlineSnapshot(`
[
"@nx/gradle/plugin",
"@nx/gradle",
]
`);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/gradle/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function addPlugin(tree: Tree) {
if (!hasGradlePlugin(tree)) {
nxJson.plugins ??= [];
nxJson.plugins.push({
plugin: '@nx/gradle/plugin',
plugin: '@nx/gradle',
options: {
testTargetName: 'test',
classesTargetName: 'classes',
Expand Down
4 changes: 1 addition & 3 deletions packages/gradle/src/utils/has-gradle-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { readNxJson, Tree } from '@nx/devkit';
export function hasGradlePlugin(tree: Tree): boolean {
const nxJson = readNxJson(tree);
return !!nxJson.plugins?.some((p) =>
typeof p === 'string'
? p === '@nx/gradle/plugin'
: p.plugin === '@nx/gradle/plugin'
typeof p === 'string' ? p === '@nx/gradle' : p.plugin === '@nx/gradle'
);
}