Skip to content

Commit

Permalink
Merge pull request #2116 from ykhandelwal913/main
Browse files Browse the repository at this point in the history
fixing gradle issue
  • Loading branch information
adierkens committed Dec 10, 2021
2 parents 956f88a + e3fc4bd commit 123fcfd
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@
]
},
{
"login": "yogikhan",
"name": "Yogesh Khandlewal",
"login": "ykhandelwal913",
"name": "Yogesh Khandelwal",
"avatar_url": "https://avatars3.githubusercontent.com/u/16071601?v=4",
"profile": "https://github.com/yogikhan",
"profile": "https://github.com/ykhandelwal913",
"contributions": [
"code"
]
Expand Down
81 changes: 51 additions & 30 deletions plugins/gradle/__tests__/gradle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.patch });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=1.0.1`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
]);
});

Expand All @@ -81,12 +84,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.major });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=2.0.0`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
]);
});

Expand All @@ -102,12 +108,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.major });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=2.0.0`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
]);
});

Expand All @@ -122,12 +131,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.minor });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=1.2.0`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
]);
});

Expand All @@ -142,12 +154,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.patch });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=1.0.0`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
`-Prelease.newVersion=1.0.0`
]);
});

Expand Down Expand Up @@ -332,12 +347,15 @@ describe("Gradle Plugin", () => {
await hooks.version.promise({ bump: Auto.SEMVER.patch });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradle"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=1.0.0`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
]);
});
});
Expand Down Expand Up @@ -367,12 +385,15 @@ describe("Gradle Plugin - Custom Command", () => {
await hooks.version.promise({ bump: Auto.SEMVER.patch });

expect(spy).toHaveBeenCalledWith(expect.stringMatching("gradlew"), [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=1.0.1`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
"-P prop=val",
]);
});
Expand Down Expand Up @@ -408,4 +429,4 @@ describe("getProperties", () => {
exec.mockReturnValueOnce("");
expect(await getProperties("", [])).toStrictEqual({});
});
});
});
13 changes: 8 additions & 5 deletions plugins/gradle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ export default class GradleReleasePluginPlugin implements IPlugin {
if (buildFlag) {
// don't create release, tag, or commit since auto will do this
await execPromise(this.options.gradleCommand, [
"release",
"createScmAdapter",
"initScmAdapter",
"checkCommitNeeded",
"checkUpdateNeeded",
"checkSnapshotDependencies",
"runBuildTasks",
"updateVersion",
"-Prelease.useAutomaticVersion=true",
`-Prelease.newVersion=${version}`,
"-x createReleaseTag",
"-x preTagCommit",
"-x commitNewVersion",
...this.options.gradleOptions,
]);
} else {
Expand Down Expand Up @@ -374,4 +377,4 @@ export default class GradleReleasePluginPlugin implements IPlugin {
]);
});
}
}
}

0 comments on commit 123fcfd

Please sign in to comment.