Skip to content

Commit

Permalink
Merge branch 'master' into rmuller/omit
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 4, 2020
2 parents 842baa8 + 61f8883 commit 9155bd0
Show file tree
Hide file tree
Showing 34 changed files with 922 additions and 31 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.6.0](https://github.com/aws/jsii/compare/v1.5.0...v1.6.0) (2020-06-02)


### Features

* **java:** add a Builder<T> interface implemented by all builders ([#1654](https://github.com/aws/jsii/issues/1654)) ([52e73b5](https://github.com/aws/jsii/commit/52e73b511ffc3a2887ca96dec98482bcdd86cc8d)), closes [#1652](https://github.com/aws/jsii/issues/1652)
* **java:** use covariant types for collection elements ([#1653](https://github.com/aws/jsii/issues/1653)) ([bc5e200](https://github.com/aws/jsii/commit/bc5e20085b26af6d8662fb30b2add95459f93875)), closes [#1517](https://github.com/aws/jsii/issues/1517)
* **jsii:** use incremental builders ([aaa7593](https://github.com/aws/jsii/commit/aaa75934c989965d49490f8090e9d908d1aa5ffe))
* allow per-submodule naming configuration ([#1690](https://github.com/aws/jsii/issues/1690)) ([b2aa424](https://github.com/aws/jsii/commit/b2aa4247b550a4ce627d3bb4a05b45002b7d912a)), closes [#1286](https://github.com/aws/jsii/issues/1286)
* **pacmak/java:** isolate maven repositories ([#1709](https://github.com/aws/jsii/issues/1709)) ([4904cd8](https://github.com/aws/jsii/commit/4904cd80dfa47090e4ff2235fc0fd693703571da))
* **python:** add explicit return type to setters ([#1645](https://github.com/aws/jsii/issues/1645)) ([0f3c6e2](https://github.com/aws/jsii/commit/0f3c6e23d42a097786143ccac9ee0ccbef059fdc))


### Bug Fixes

* **dotnet:** F# dictionaries cause NullReferenceException ([#1655](https://github.com/aws/jsii/issues/1655)) ([50c656c](https://github.com/aws/jsii/commit/50c656c4be6856b843fd2e56895c0d57ca8f1554)), closes [#1322](https://github.com/aws/jsii/issues/1322)
* **jsii:** dependency submodules are not tagged ([#1663](https://github.com/aws/jsii/issues/1663)) ([18e3702](https://github.com/aws/jsii/commit/18e3702ed1a621cf0a71c328b37f11fa73c8cb05))
* package runtimes as private for integ test ([#1677](https://github.com/aws/jsii/issues/1677)) ([7afe761](https://github.com/aws/jsii/commit/7afe7619ceded745a6fcc9e95fff172ca6f6a28e))
* **jsii-pacmak:** computeIfAbsent throws ConcurrentModificationException ([#1706](https://github.com/aws/jsii/issues/1706)) ([fa60b7f](https://github.com/aws/jsii/commit/fa60b7f3d4268cd426d519bab9c738507c1ae503))
* **kernel:** error raised during rename operation on win32 ([#1702](https://github.com/aws/jsii/issues/1702)) ([38ee336](https://github.com/aws/jsii/commit/38ee336cd9fd5ceed3a19c85cd106a82d7073264)), closes [#992](https://github.com/aws/jsii/issues/992)
* **pacmak:** label "External" stability as "Stable" ([#1633](https://github.com/aws/jsii/issues/1633)) ([8569c00](https://github.com/aws/jsii/commit/8569c00045f8ee25356e8fa3074674558ec41732))
* **python:** `self` as property name leads to assignment error ([#1330](https://github.com/aws/jsii/issues/1330)) ([a877f34](https://github.com/aws/jsii/commit/a877f34c5dc4cbfcd615ed521f345c86501b0c56))
* **python:** imports between subpackages are broken ([#1528](https://github.com/aws/jsii/issues/1528)) ([84e0f48](https://github.com/aws/jsii/commit/84e0f4892e6da680f24dc8793322d228a0203e9e))

## [1.5.0](https://github.com/aws/jsii/compare/v1.4.1...v1.5.0) (2020-05-07)


Expand Down
10 changes: 5 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Field | Required | Extensions
// ...
}
```
The `organization` field is an extention from the [package.json schema] that
The `organization` field is an extension from the [package.json schema] that
can be used to signal the `author` field refers to an `organization` and not
and individual person.
* The [`license`][npm-license] field must be set to a valid [SPDX license id].
Expand Down Expand Up @@ -95,15 +95,15 @@ which a stability declaration is not found can be configured using the
`stability` field of the `package.json` file. It can be set to one of the
following values: `experimental`, `stable`, `deprecated` and `external`. While
the exact semantic value of those fields is defined by the package maintainer,
the generic interepretation for those on packages is:
the generic interpretation for those on packages is:

* `experimental` - the package is not yet ready for production usage, as it is
still in the early stages if it's development.
* `stable` - the package is ready for production and it's APIs should be
expected to adhere to [semantic versioning].
* `deprecated` - the package should no longer be used and may no longer be
maintained. It is a good practice to set the `deprecated` field in
`packgae.json` with an explanation of how consumers of the package should
`package.json` with an explanation of how consumers of the package should
update their dependencies.
* `external` - the package includes APIs that are derived from external
artifacts, and the owners of those artifacts control their stability.
Expand All @@ -126,7 +126,7 @@ Field | Type | Required | Default
### `excludeTypescript`

By default, `jsii` will include _all_ `*.ts` files (except `.d.ts` files) in the
`TypeScript` compier input. This can be problematic for example when the
`TypeScript` compiler input. This can be problematic for example when the
package's build or test procedure generates `.ts` files that cannot be compiled
with `jsii`'s compiler settings.

Expand Down Expand Up @@ -315,7 +315,7 @@ into the [`peerDependencies`][npm-peer-deps] section.

The `jsii` runtimes in non-**javascript** languages do not use `npm install`,
and as a consequence cannot rely on `npm install` bringing in a package's
dependecies. As a consequence, dependencies that are not themselves `jsii`
dependencies. As a consequence, dependencies that are not themselves `jsii`
modules, __must__ also be referenced in the [`bundledDependencies`][npm-bundled]
section, so that they are bundled within the NPM package.

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"rejectCycles": true
}
},
"version": "1.5.0"
"version": "1.6.0"
}
1 change: 1 addition & 0 deletions packages/@jsii/java-runtime-test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.m2
.vscode
!*.js
maven-repo
Expand Down
3 changes: 3 additions & 0 deletions packages/@jsii/java-runtime-test/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ set -euo pipefail
staging="maven-repo"
rm -fr ${staging} && mkdir -p ${staging}

# Remove local artifacts from local maven repository
rm -fr project/.m2/software/amazon/jsii

# generate user.xml & pom.xml
node ./user.xml.t.js > ./project/user.xml
node ./pom.xml.t.js > ./project/pom.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import software.amazon.jsii.tests.calculator.lib.Number;
import software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals;
import software.amazon.jsii.tests.calculator.lib.Value;
import software.amazon.jsii.tests.calculator.submodule.child.OuterClass;

import java.io.IOException;
import java.lang.reflect.Constructor;
Expand Down Expand Up @@ -1758,4 +1759,10 @@ public void collectionOfInterfaces_MapOfInterfaces() {
assertTrue(obj instanceof IBell, () -> obj + " is an instance of " + IBell.class.getCanonicalName());
}
}

@Test
public void classesCanSelfReferenceDuringClassInitialization() {
final OuterClass outerClass = new OuterClass();
assertNotNull(outerClass.getInnerClass());
}
}
7 changes: 6 additions & 1 deletion packages/@jsii/java-runtime-test/user.xml.t.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const jsiiJavaRuntime = require('@jsii/java-runtime');
const path = require('path');

process.stdout.write(`<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
Expand All @@ -7,17 +8,21 @@ process.stdout.write(`<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by ${__filename} at ${new Date().toISOString()} -->
<localRepository>${path.resolve(__dirname, 'project', '.m2', 'repository')}</localRepository>
<profiles>
<profile>
<id>local</id>
<repositories>
<repository>
<id>jsii-runtime</id>
<name>Locally built jsii runtime for Java</name>
<url>file://${jsiiJavaRuntime.repository}</url>
</repository>
<repository>
<id>jsii-calc</id>
<url>file://${process.cwd()}/maven-repo</url>
<name>Locally built artifacts for jsii-calc and dependencies</name>
<url>file://${__dirname}/maven-repo/java</url>
</repository>
</repositories>
</profile>
Expand Down
1 change: 1 addition & 0 deletions packages/@jsii/java-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.m2
.vscode
*.js
*.d.ts
Expand Down
1 change: 1 addition & 0 deletions packages/@jsii/java-runtime/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mkdir -p conf

# generate pom.xml and JsiiVersion.java with version from package.json
/usr/bin/env node ./pom.xml.t.js > ${project}/pom.xml
/usr/bin/env node ./user.xml.t.js > ${project}/user.xml
/usr/bin/env node JsiiVersion.t.js > ${project}/src/main/java/software/amazon/jsii/JsiiVersion.java

# embed @jsii/runtime as a resource
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/java-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"types": "lib/index.d.ts",
"scripts": {
"gen": "/bin/bash ./generate.sh",
"build": "tsc --build && npm run gen && cd project && mvn -B deploy -D altDeploymentRepository=local::default::file://${PWD}/../maven-repo",
"dist-clean": "rm -rf dist maven-repo && cd project && mvn -B clean",
"build": "tsc --build && npm run gen && cd project && mvn -B deploy -D altDeploymentRepository=local::default::file://${PWD}/../maven-repo --settings=user.xml",
"dist-clean": "rm -rf dist maven-repo && cd project && mvn -B clean --settings=user.xml",
"test": "echo 'Tests are run as part of the build target'",
"test:update": "UPDATE_DIFF=1 npm run test",
"package": "package-java && package-private"
Expand Down
1 change: 1 addition & 0 deletions packages/@jsii/java-runtime/project/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bin/
!index.js
.idea
pom.xml
user.xml

# generated by JsiiVersion.java.t.js
src/main/java/software/amazon/jsii/JsiiVersion.java
Expand Down
13 changes: 13 additions & 0 deletions packages/@jsii/java-runtime/user.xml.t.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jsiiJavaRuntime = require('@jsii/java-runtime');
const path = require('path');

process.stdout.write(`<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- Generated by ${__filename} at ${new Date().toISOString()} -->
<localRepository>${path.resolve(__dirname, 'project', '.m2', 'repository')}</localRepository>
</settings>
`);
23 changes: 23 additions & 0 deletions packages/jsii-calc/lib/submodule/child/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,26 @@ export enum Awesomeness {
/** It was awesome! */
AWESOME
}

/**
* Checks that classes can self-reference during initialization.
* @see: https://github.com/aws/jsii/pull/1706
*/
export class OuterClass {
public readonly innerClass: InnerClass;

public constructor() {
this.innerClass = new InnerClass();
}
}
export enum SomeEnum {
SOME = 'SOME'
}
export interface SomeStruct {
readonly prop: SomeEnum;
}
export class InnerClass {
public static readonly staticProp: SomeStruct = { prop: SomeEnum.SOME };

public constructor() { }
}
130 changes: 129 additions & 1 deletion packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -12885,6 +12885,134 @@
"name": "Goodness",
"namespace": "submodule.child"
},
"jsii-calc.submodule.child.InnerClass": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.child.InnerClass",
"initializer": {
"docs": {
"stability": "experimental"
}
},
"kind": "class",
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 37
},
"name": "InnerClass",
"namespace": "submodule.child",
"properties": [
{
"const": true,
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 38
},
"name": "staticProp",
"static": true,
"type": {
"fqn": "jsii-calc.submodule.child.SomeStruct"
}
}
]
},
"jsii-calc.submodule.child.OuterClass": {
"assembly": "jsii-calc",
"docs": {
"see": ": https://github.com/aws/jsii/pull/1706",
"stability": "experimental",
"summary": "Checks that classes can self-reference during initialization."
},
"fqn": "jsii-calc.submodule.child.OuterClass",
"initializer": {
"docs": {
"stability": "experimental"
}
},
"kind": "class",
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 24
},
"name": "OuterClass",
"namespace": "submodule.child",
"properties": [
{
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 25
},
"name": "innerClass",
"type": {
"fqn": "jsii-calc.submodule.child.InnerClass"
}
}
]
},
"jsii-calc.submodule.child.SomeEnum": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.child.SomeEnum",
"kind": "enum",
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 31
},
"members": [
{
"docs": {
"stability": "experimental"
},
"name": "SOME"
}
],
"name": "SomeEnum",
"namespace": "submodule.child"
},
"jsii-calc.submodule.child.SomeStruct": {
"assembly": "jsii-calc",
"datatype": true,
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.child.SomeStruct",
"kind": "interface",
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 34
},
"name": "SomeStruct",
"namespace": "submodule.child",
"properties": [
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 35
},
"name": "prop",
"type": {
"fqn": "jsii-calc.submodule.child.SomeEnum"
}
}
]
},
"jsii-calc.submodule.child.Structure": {
"assembly": "jsii-calc",
"datatype": true,
Expand Down Expand Up @@ -13000,5 +13128,5 @@
}
},
"version": "0.0.0",
"fingerprint": "/DWCMji07IcZLGXOoefpKRPZyV9IHOIAR19tb1MHHWU="
"fingerprint": "5SbCJfv1kDW24DUhPcwzoQ1k7Moq+rKOB+Q4TSZlKPE="
}
18 changes: 12 additions & 6 deletions packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,17 @@ export class JavaBuilder implements TargetBuilder {
'#comment': [
`Generated by jsii-pacmak@${VERSION_DESC} on ${new Date().toISOString()}`,
],
// Do *not* attempt to ask the user for stuff...
interactiveMode: false,
// Use a non-default local repository to isolate from cached artifacts...
localRepository: path.resolve(where, '.m2', 'repository'),
// Register locations of locally-sourced dependencies
profiles: {
profile: {
id: profileName,
repositories: {
repository: localRepos.map((repo, index) => ({
id: `local${index}`,
repository: localRepos.map((repo) => ({
id: repo,
url: `file://${repo}`,
})),
},
Expand Down Expand Up @@ -2529,11 +2534,12 @@ class JavaGenerator extends Generator {
'throw new ClassNotFoundException("Unknown JSII type: " + fqn);',
);
this.code.closeBlock();
this.code.line(
'return this.cache.computeIfAbsent(MODULE_TYPES.get(fqn), this::findClass);',
);
this.code.line('String className = MODULE_TYPES.get(fqn);');
this.code.openBlock('if (!this.cache.containsKey(className))');
this.code.line('this.cache.put(className, this.findClass(className));');
this.code.closeBlock();
this.code.line('return this.cache.get(className);');
this.code.closeBlock();

this.code.line();
this.code.openBlock('private Class<?> findClass(final String binaryName)');
this.code.openBlock('try');
Expand Down
Loading

0 comments on commit 9155bd0

Please sign in to comment.