Skip to content

Commit

Permalink
Merge pull request #1396 from rachanamamillapalli/default-version
Browse files Browse the repository at this point in the history
return 0.0.0 as default when no version found in gradle properties
  • Loading branch information
hipstersmoothie authored Aug 20, 2020
2 parents f7a20d5 + dfcc6a0 commit 23ffc33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
7 changes: 0 additions & 7 deletions plugins/gradle/__tests__/gradle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ describe("Gradle Plugin", () => {
exec.mockReturnValueOnce("version: 1.0.0-SNAPSHOT");
expect(await hooks.getPreviousVersion.promise()).toBe("v1.0.0");
});

test("should throw when no version", async () => {
exec.mockReturnValueOnce("");
await expect(hooks.getPreviousVersion.promise()).rejects.toThrowError(
"No version was found in gradle properties."
);
});
});

describe("beforeRun & version", () => {
Expand Down
8 changes: 2 additions & 6 deletions plugins/gradle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,11 @@ async function getVersion(
gradleOptions: string[]
): Promise<string> {
const {
version,
version = "0.0.0",
snapshotSuffix = defaultSnapshotSuffix,
} = await getProperties(gradleCommand, gradleOptions);

if (version) {
return version.replace(snapshotSuffix, "");
}

throw new Error("No version was found in gradle properties.");
return version.replace(snapshotSuffix, "");
}

/** A plugin to release java projects with gradle */
Expand Down

0 comments on commit 23ffc33

Please sign in to comment.