Skip to content

Commit

Permalink
fix(gradle): fix gradle unit test (#29224)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
xiongemi authored Dec 5, 2024
1 parent 59a3db8 commit 2e98918
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion e2e/gradle/src/utils/create-gradle-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export function createGradleProject(
packageName: string = 'gradleProject',
addProjectJsonNamePrefix: string = ''
) {
e2eConsoleLogger(`Using java version: ${execSync('java -version')}`);
e2eConsoleLogger(
`Using java version: ${execSync('java -version')} ${execSync(
'echo $JAVA_HOME'
)}`
);
const gradleCommand = isWindows()
? resolve(`${__dirname}/../../gradlew.bat`)
: resolve(`${__dirname}/../../gradlew`);
Expand Down
4 changes: 4 additions & 0 deletions packages/gradle/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ describe('@nx/gradle/plugin', () => {
gradleFileToOutputDirsMap: new Map<string, Map<string, string>>([
['proj/build.gradle', new Map([['build', 'build']])],
]),
gradleProjectToTasksMap: new Map<string, Set<string>>([
['proj', new Set(['test'])],
]),
gradleProjectToTasksTypeMap: new Map<string, Map<string, string>>([
['proj', new Map([['test', 'Verification']])],
]),
Expand Down Expand Up @@ -86,6 +89,7 @@ describe('@nx/gradle/plugin', () => {
],
},
"name": "proj",
"projectType": "application",
"targets": {
"test": {
"cache": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/gradle/src/utils/get-project-report-lines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export async function getProjectReportLines(
'projectReport',
]);
logger.warn(
`Could not run 'projectReportAll' task. Ran 'projectReport' instead. Please run 'nx generate @nx/gradle:init' to generate the necessary tasks.`
`Could not run 'projectReportAll' task. Ran 'projectReport' instead. Please run 'nx generate @nx/gradle:init' to generate the necessary tasks. ${e.message}`
);
} catch (e) {
throw new AggregateCreateNodesError(
[
[
gradlewFile,
new Error(
`Could not run 'projectReportAll' or 'projectReport' task. Please run 'nx generate @nx/gradle:init' to generate the necessary tasks.`
`Could not run 'projectReportAll' or 'projectReport' task. Please run 'nx generate @nx/gradle:init' to generate the necessary tasks. ${e.message}`
),
],
],
Expand Down

0 comments on commit 2e98918

Please sign in to comment.