Skip to content

Commit

Permalink
fix(nx-spring-boot): fix error when generating a gradle/kotlin project
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
tinesoft committed Dec 22, 2020
1 parent 241eed6 commit abfbd04
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions e2e/nx-spring-boot-e2e/tests/nx-spring-boot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ describe('nx-spring-boot e2e', () => {
}, 180000);
});

describe('--type=gradle-project and --language=kotlin', () => {
it('should create a gradle spring-boot project with kotlin', async (done) => {
const appName = uniq('nx-spring-boot');
ensureNxProject(
'@nxrocks/nx-spring-boot',
'dist/packages/nx-spring-boot'
);
await runNxCommandAsync(
`generate @nxrocks/nx-spring-boot:application ${appName} --type gradle-project --language=kotlin`
);

const resultBuildInfo= await runNxCommandAsync(`buildInfo ${appName}`);
expect(resultBuildInfo.stdout).toContain(`Executing command: ./gradlew bootBuildInfo`)

expect(() =>
checkFilesExist(`apps/${appName}/gradlew`,`apps/${appName}/build.gradle.kts`, `apps/${appName}/HELP.md`)
).not.toThrow();
done();
}, 180000);
});


describe('--directory', () => {
it('should create src in the specified directory', async (done) => {
const appName = uniq('nx-spring-boot');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ springBoot {
buildInfo()
}
`;
const buildGradlePath = `${options.projectRoot}/build.gradle`;
const ext = options.language === 'kotlin' ? '.kts' : ''
const buildGradlePath = `${options.projectRoot}/build.gradle${ext}`;
const content = tree.read(buildGradlePath).toString() + buildInfoTask;
tree.overwrite(buildGradlePath, content);

Expand Down

0 comments on commit abfbd04

Please sign in to comment.