Skip to content
Snippets Groups Projects
Unverified Commit 9f8dceff authored by Mikhail Yakushin's avatar Mikhail Yakushin Committed by GitHub
Browse files

fix(gradle-wrapper): executions files update fix (#5874)

parent d90d94fc
No related branches found
No related tags found
No related merge requests found
...@@ -40,9 +40,7 @@ describe('manager/gradle-wrapper/update', () => { ...@@ -40,9 +40,7 @@ describe('manager/gradle-wrapper/update', () => {
'gradle/wrapper/gradle-wrapper.jar', 'gradle/wrapper/gradle-wrapper.jar',
'gradlew', 'gradlew',
'gradlew.bat', 'gradlew.bat',
].map(filename => ],
resolve(__dirname, `./__fixtures__/testFiles/${filename}`)
),
} as Git.StatusResult); } as Git.StatusResult);
const res = await dcUpdate.updateArtifacts({ const res = await dcUpdate.updateArtifacts({
...@@ -64,19 +62,21 @@ describe('manager/gradle-wrapper/update', () => { ...@@ -64,19 +62,21 @@ describe('manager/gradle-wrapper/update', () => {
'gradle/wrapper/gradle-wrapper.jar', 'gradle/wrapper/gradle-wrapper.jar',
'gradlew', 'gradlew',
'gradlew.bat', 'gradlew.bat',
] ].map(fileProjectPath => {
.map(filename => return {
resolve(__dirname, `./__fixtures__/testFiles/${filename}`) artifactError: null,
) file: {
.map(filePath => { name: fileProjectPath,
return { contents: readFileSync(
artifactError: null, resolve(
file: { __dirname,
name: filePath, `./__fixtures__/testFiles/${fileProjectPath}`
contents: readFileSync(filePath, 'utf8'), ),
}, 'utf8'
}; ),
}) },
};
})
); );
[ [
......
...@@ -12,13 +12,15 @@ import { gradleWrapperFileName, prepareGradleCommand } from '../gradle/index'; ...@@ -12,13 +12,15 @@ import { gradleWrapperFileName, prepareGradleCommand } from '../gradle/index';
async function addIfUpdated( async function addIfUpdated(
status: Git.StatusResult, status: Git.StatusResult,
filePath: string projectDir: string,
fileProjectPath: string
): Promise<UpdateArtifactsResult | null> { ): Promise<UpdateArtifactsResult | null> {
if (status.modified.includes(filePath)) { if (status.modified.includes(fileProjectPath)) {
const filePath = resolve(projectDir, `./${fileProjectPath}`);
return { return {
artifactError: null, artifactError: null,
file: { file: {
name: filePath, name: fileProjectPath,
contents: await readLocalFile(filePath), contents: await readLocalFile(filePath),
}, },
}; };
...@@ -66,11 +68,13 @@ export async function updateArtifacts({ ...@@ -66,11 +68,13 @@ export async function updateArtifacts({
const updateArtifactsResult = ( const updateArtifactsResult = (
await Promise.all( await Promise.all(
[ [
resolve(projectDir, './gradle/wrapper/gradle-wrapper.properties'), 'gradle/wrapper/gradle-wrapper.properties',
resolve(projectDir, './gradle/wrapper/gradle-wrapper.jar'), 'gradle/wrapper/gradle-wrapper.jar',
resolve(projectDir, './gradlew'), 'gradlew',
resolve(projectDir, './gradlew.bat'), 'gradlew.bat',
].map(async filePath => addIfUpdated(status, filePath)) ].map(async fileProjectPath =>
addIfUpdated(status, projectDir, fileProjectPath)
)
) )
).filter(e => e != null); ).filter(e => e != null);
logger.debug( logger.debug(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment