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): gradle wrapper execution files updates #5842

Merged
merged 20 commits into from
Apr 3, 2020

Conversation

driver733
Copy link
Contributor

Closes #3565

@driver733

This comment has been minimized.

Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
@driver733
Copy link
Contributor Author

@viceice The build (yarn test) runs fine on my local machine(macOS Catalina), but fails on macos-latest CI. Can you take a look?

@viceice
Copy link
Member

viceice commented Apr 1, 2020

Java install is skipped on mac, so skip gradle tests or install java

@driver733
Copy link
Contributor Author

@viceice Can you enable the Set up Java command in the CI?
Screenshot 2020-04-01 at 11 09 14

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitattributes Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
driver733 and others added 2 commits April 1, 2020 11:52
Co-Authored-By: Michael Kriese <michael.kriese@visualon.de>
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
@driver733 driver733 requested a review from viceice April 1, 2020 09:02
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test needs fix

@driver733 driver733 force-pushed the fix/gradle-wrapper branch 4 times, most recently from 536d5c0 to 5ac430b Compare April 1, 2020 13:11
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
@driver733 driver733 requested a review from viceice April 1, 2020 13:55
@driver733 driver733 requested a review from viceice April 1, 2020 15:08
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soory, forgot to mentions that we need to add docker compatibillity. see below for invoking gradle with docker

function gradleWrapperFileName(config: ExtractConfig): string {
if (
os.platform() === 'win32' &&
config.binarySource !== BinarySource.Docker
) {
return 'gradlew.bat';
}
return './gradlew';
}
async function prepareGradleCommandLine(
config: ExtractConfig,
cwd: string,
gradlew: Stats | null
): Promise<string> {
const args = GRADLE_DEPENDENCY_REPORT_OPTIONS;
const gradlewName = gradleWrapperFileName(config);
/* eslint-disable no-bitwise */
// istanbul ignore if
if (gradlew?.isFile() === true) {
// if the file is not executable by others
if ((gradlew.mode & 0o1) === 0) {
// add the execution permission to the owner, group and others
await fs.chmod(upath.join(cwd, gradlewName), gradlew.mode | 0o111);
}
return `${gradlewName} ${args}`;
}
/* eslint-enable no-bitwise */
return `gradle ${args}`;
}
export async function executeGradle(
config: ExtractConfig,
cwd: string,
gradlew: Stats | null
): Promise<void> {
let stdout: string;
let stderr: string;
const timeout =
config.gradle && config.gradle.timeout
? config.gradle.timeout * 1000
: undefined;
const cmd = await prepareGradleCommandLine(config, cwd, gradlew);
const execOptions: ExecOptions = {
timeout,
cwd,
docker: {
image: 'renovate/gradle',
},
};
try {
logger.debug({ cmd }, 'Start gradle command');
({ stdout, stderr } = await exec(cmd, execOptions));
} catch (err) /* istanbul ignore next */ {
if (err.code === TIMEOUT_CODE) {
const error = new DatasourceError(err);
error.datasource = 'gradle';
throw error;
}
logger.warn({ errMessage: err.message }, 'Gradle extraction failed');
return;
}
logger.debug(stdout + stderr);
logger.debug('Gradle report complete');

Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks like github has some trouble with the macos workers. So wee need to wait and hope it will be resolved tomorrow.

@driver733
Copy link
Contributor Author

@viceice One macos build got cancelled due to the timeout. I guess increasing the timeout of the total build time can fix this problem.

@viceice
Copy link
Member

viceice commented Apr 1, 2020

see #5851

lib/manager/gradle-wrapper/artifacts.ts Show resolved Hide resolved
lib/manager/gradle-wrapper/artifacts.ts Show resolved Hide resolved
lib/manager/gradle-wrapper/artifacts.ts Outdated Show resolved Hide resolved
lib/manager/gradle-wrapper/artifacts.ts Show resolved Hide resolved
lib/manager/gradle-wrapper/artifacts.ts Show resolved Hide resolved
lib/manager/gradle-wrapper/artifacts.ts Show resolved Hide resolved
driver733 and others added 2 commits April 2, 2020 10:57
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
Co-Authored-By: Michael Kriese <michael.kriese@visualon.de>
Signed-off-by: Mikhail Yakushin <driver733@gmail.com>
@driver733 driver733 requested a review from rarkins April 2, 2020 09:05
@rarkins rarkins merged commit 5e56a9a into renovatebot:master Apr 3, 2020
@driver733 driver733 deleted the fix/gradle-wrapper branch April 3, 2020 09:11
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 19.192.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gradle wrapper upgrade should update more files
4 participants