Skip to content

Commit

Permalink
fix(pacmak): development version cannot pack java (#3121)
Browse files Browse the repository at this point in the history
When the version of `jsii-pacmak` is `0.0.0`, it will write the following
requirement for `jsii-runtime`: `[,0.0.1)`. There is no version that satisfies
that dependency, so the build fails.

Make an exception: if the version we're trying to install is `^0.0.0`,
translate it to "any old version" instead.

Fixes #3107.


---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
rix0rrr authored Nov 6, 2021
1 parent 0638345 commit 0d9cf51
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/version-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function toBracketNotation(
target = TargetName.JAVASCRIPT,
}: { semver?: boolean; target?: TargetName } = {},
): string {
if (semverRange === '*') {
if (semverRange === '*' || semverRange === '^0.0.0') {
semverRange = '>=0.0.0';
}
const range = new Range(semverRange);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/jsii-pacmak/test/targets/version-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ describe(toMavenVersionRange, () => {
}
});

test('Maven dependency on jsii-runtime for a development version is workable', () => {
expect(toMavenVersionRange('^0.0.0')).toEqual('[0.0.0,)');
});

describe(toNuGetVersionRange, () => {
for (const [semver, { nuget }] of Object.entries(examples)) {
test(`${semver} translates to ${nuget}`, () =>
Expand Down

0 comments on commit 0d9cf51

Please sign in to comment.