Skip to content

Commit f614666

Browse files
1 parent 55e7d15 commit f614666

File tree

13 files changed

+98
-27
lines changed

13 files changed

+98
-27
lines changed

.github/workflows/close-stale-issues.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
name: Stale issue job
1414
steps:
15-
- uses: aws-actions/stale-issue-cleanup@v4
15+
- uses: aws-actions/stale-issue-cleanup@v5
1616
with:
1717
# Setting messages to an empty string will cause the automation to skip
1818
# that category

.github/workflows/gh-pages.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
--site-dir ${{ runner.temp }}/site
4545
working-directory: gh-pages
4646
- name: Upload Artifact
47-
uses: actions/upload-artifact@v2
47+
uses: actions/upload-artifact@v3
4848
with:
4949
name: doc-site
5050
path: ${{ runner.temp }}/site/
@@ -63,7 +63,7 @@ jobs:
6363
ref: gh-pages
6464
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
6565
- name: Download Artifact
66-
uses: actions/download-artifact@v2
66+
uses: actions/download-artifact@v3
6767
with:
6868
name: doc-site
6969
path: ${{ runner.temp }}/site

.github/workflows/main.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
with:
3333
dotnet-version: '5.0.x'
3434
- name: Set up Go 1.16
35-
uses: actions/setup-go@v2
35+
uses: actions/setup-go@v3
3636
with:
3737
go-version: '1.16'
3838
- name: Set up Java 8
39-
uses: actions/setup-java@v2
39+
uses: actions/setup-java@v3
4040
with:
4141
java-version: '8'
4242
distribution: 'zulu'
@@ -93,7 +93,7 @@ jobs:
9393
.
9494
# Upload artifact (we'll tar it up to save time)
9595
- name: 'Upload Artifact: built-tree'
96-
uses: actions/upload-artifact@v2
96+
uses: actions/upload-artifact@v3
9797
with:
9898
name: built-tree
9999
path: ${{ runner.temp }}/built-tree.tgz
@@ -126,11 +126,11 @@ jobs:
126126
with:
127127
dotnet-version: '5.0.x'
128128
- name: Set up Go 1.16
129-
uses: actions/setup-go@v2
129+
uses: actions/setup-go@v3
130130
with:
131131
go-version: '1.16'
132132
- name: Set up Java 8
133-
uses: actions/setup-java@v2
133+
uses: actions/setup-java@v3
134134
with:
135135
java-version: '8'
136136
distribution: 'zulu'
@@ -198,7 +198,7 @@ jobs:
198198
yarn package
199199
# Upload artifacts
200200
- name: 'Upload Artifact: release-package'
201-
uses: actions/upload-artifact@v2
201+
uses: actions/upload-artifact@v3
202202
with:
203203
name: release-package
204204
path: ${{ github.workspace }}/dist/
@@ -277,7 +277,7 @@ jobs:
277277
steps:
278278
# Check out the code
279279
- name: Download Artifact
280-
uses: actions/download-artifact@v2
280+
uses: actions/download-artifact@v3
281281
with:
282282
name: built-tree
283283
- name: Extract Artifact
@@ -294,11 +294,11 @@ jobs:
294294
dotnet-version: ${{ matrix.dotnet }}
295295
include-prerelease: ${{ matrix.dotnet-prerelease }}
296296
- name: Set up Go ${{ matrix.go }}
297-
uses: actions/setup-go@v2
297+
uses: actions/setup-go@v3
298298
with:
299299
go-version: ${{ matrix.go }}
300300
- name: Set up Java ${{ matrix.java }}
301-
uses: actions/setup-java@v2
301+
uses: actions/setup-java@v3
302302
with:
303303
java-version: ${{ matrix.java }}
304304
distribution: 'zulu'

.github/workflows/yarn-upgrade.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
git add .
102102
git diff --patch --staged > ${{ runner.temp }}/upgrade.patch
103103
- name: Upload Patch
104-
uses: actions/upload-artifact@v2
104+
uses: actions/upload-artifact@v3
105105
with:
106106
name: upgrade.patch
107107
path: ${{ runner.temp }}/upgrade.patch
@@ -118,7 +118,7 @@ jobs:
118118
uses: actions/checkout@v3
119119

120120
- name: Download patch
121-
uses: actions/download-artifact@v2
121+
uses: actions/download-artifact@v3
122122
with:
123123
name: upgrade.patch
124124
path: ${{ runner.temp }}

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
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.
44

5+
## [1.57.0](https://github.com/aws/jsii/compare/v1.56.0...v1.57.0) (2022-04-19)
6+
7+
8+
### Bug Fixes
9+
10+
* **go:** object type not recognized ([#3485](https://github.com/aws/jsii/issues/3485)) ([fe2fa94](https://github.com/aws/jsii/commit/fe2fa947891ab5d517efbec37998b9b57203aa8d)), closes [#2880](https://github.com/aws/jsii/issues/2880)
11+
* **jsii:** some submodules are not exported from `aws-cdk-lib` ([#3491](https://github.com/aws/jsii/issues/3491)) ([47f70a2](https://github.com/aws/jsii/commit/47f70a26383f401a8b3df700787d6ce7934f66f9))
12+
* make jsii --watch work ([#3487](https://github.com/aws/jsii/issues/3487)) ([4a46f7d](https://github.com/aws/jsii/commit/4a46f7d7db3e6f9f1cf2730b02f4af0c1da9f237)), closes [#3467](https://github.com/aws/jsii/issues/3467)
13+
514
## [1.56.0](https://github.com/aws/jsii/compare/v1.55.1...v1.56.0) (2022-04-08)
615

716

gh-pages/requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mkdocs~=1.3.0
22
mkdocs-awesome-pages-plugin~=2.7.0
3-
mkdocs-material~=8.2.8
3+
mkdocs-material~=8.2.9
44
mkdocs-git-revision-date-plugin~=0.3.2

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"rejectCycles": true
1111
}
1212
},
13-
"version": "1.56.0"
13+
"version": "1.57.0"
1414
}

packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/conversions.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (c *Client) castAndSetToPtr(ptr reflect.Value, data reflect.Value) {
6565

6666
targetType := ptr.Type()
6767
if typ, ok := c.Types().FindType(ref.TypeFQN()); ok && typ.AssignableTo(ptr.Type()) {
68-
// Specialize the return type to be the dynamic value type
68+
// Specialize the return type to be the dynamic value type
6969
targetType = typ
7070
}
7171

@@ -191,6 +191,11 @@ func (c *Client) CastPtrToRef(dataVal reflect.Value) interface{} {
191191
},
192192
}
193193
}
194+
} else if dataVal.Elem().Kind() == reflect.Ptr {
195+
// Typically happens when a struct pointer is passed into an interface{}
196+
// typed API (such as a place where a union is accepted).
197+
elemVal := dataVal.Elem()
198+
return c.CastPtrToRef(elemVal)
194199
}
195200

196201
if ref, err := c.ManageObject(dataVal); err != nil {

packages/jsii-pacmak/lib/targets/python.ts

+36-1
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,21 @@ class PythonModule implements PythonType {
16371637
}
16381638

16391639
// Whatever names we've exported, we'll write out our __all__ that lists them.
1640-
const exportedMembers = this.members.map((m) => `"${m.pythonName}"`);
1640+
//
1641+
// __all__ is normally used for when users write `from library import *`, but we also
1642+
// use it with the `publication` module to hide everything that's NOT in the list.
1643+
//
1644+
// Normally adding submodules to `__all__` has the (negative?) side-effect
1645+
// that all submodules get loaded when the user does `import *`, but we
1646+
// already load submodules anyway so it doesn't make a difference, and in combination
1647+
// with the `publication` module NOT having them in this list hides any submodules
1648+
// we import as part of typechecking.
1649+
const exportedMembers = [
1650+
...this.members.map((m) => `"${m.pythonName}"`),
1651+
...this.modules
1652+
.filter((m) => this.isDirectChild(m))
1653+
.map((m) => `"${lastComponent(m.pythonName)}"`),
1654+
];
16411655
if (this.loadAssembly) {
16421656
exportedMembers.push('"__jsii_assembly__"');
16431657
}
@@ -1747,6 +1761,19 @@ class PythonModule implements PythonType {
17471761
return scripts;
17481762
}
17491763

1764+
private isDirectChild(pyMod: PythonModule) {
1765+
if (
1766+
this.pythonName === pyMod.pythonName ||
1767+
!pyMod.pythonName.startsWith(`${this.pythonName}.`)
1768+
) {
1769+
return false;
1770+
}
1771+
// Must include only one more component
1772+
return !pyMod.pythonName
1773+
.substring(this.pythonName.length + 1)
1774+
.includes('.');
1775+
}
1776+
17501777
/**
17511778
* Emit the README as module docstring if this is the entry point module (it loads the assembly)
17521779
*/
@@ -3114,3 +3141,11 @@ function nestedContext(
31143141
}
31153142

31163143
const isDeprecated = (x: PythonBase) => x.docs?.deprecated !== undefined;
3144+
3145+
/**
3146+
* Last component of a .-separated name
3147+
*/
3148+
function lastComponent(n: string) {
3149+
const parts = n.split('.');
3150+
return parts[parts.length - 1];
3151+
}

packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii/bin/jsii.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { enabledWarnings } from '../lib/warnings';
1414

1515
const warningTypes = Object.keys(enabledWarnings);
1616

17-
(() => {
17+
(async () => {
1818
const argv = yargs
1919
.env('JSII')
2020
.command(
@@ -117,7 +117,7 @@ const warningTypes = Object.keys(enabledWarnings);
117117
generateTypeScriptConfig: argv['generate-tsconfig'],
118118
});
119119

120-
const emitResult = argv.watch ? compiler.watch() : compiler.emit();
120+
const emitResult = argv.watch ? await compiler.watch() : compiler.emit();
121121

122122
const allDiagnostics = [...projectInfoDiagnostics, ...emitResult.diagnostics];
123123

@@ -127,7 +127,10 @@ const warningTypes = Object.keys(enabledWarnings);
127127
if (emitResult.emitSkipped) {
128128
process.exitCode = 1;
129129
}
130-
})();
130+
})().catch((e) => {
131+
console.error(`Error: ${e.stack}`);
132+
process.exitCode = -1;
133+
});
131134

132135
function _configureLog4js(verbosity: number) {
133136
const stderrColor = !!process.stderr.isTTY;

packages/jsii/lib/compiler.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,17 @@ export class Compiler implements Emitter {
118118
*
119119
* @internal
120120
*/
121-
public watch(opts: NonBlockingWatchOptions): ts.Watch<ts.BuilderProgram>;
121+
public async watch(
122+
opts: NonBlockingWatchOptions,
123+
): Promise<ts.Watch<ts.BuilderProgram>>;
122124
/**
123125
* Watches for file-system changes and dynamically recompiles the project as needed. In blocking mode, this results
124126
* in a never-resolving promise.
125127
*/
126-
public watch(): never;
127-
public watch(
128+
public async watch(): Promise<never>;
129+
public async watch(
128130
opts?: NonBlockingWatchOptions,
129-
): ts.Watch<ts.BuilderProgram> | never {
131+
): Promise<ts.Watch<ts.BuilderProgram> | never> {
130132
this._prepareForBuild();
131133

132134
const pi = this.options.projectInfo;
@@ -184,7 +186,7 @@ export class Compiler implements Emitter {
184186
return watch;
185187
}
186188
// In blocking mode, returns a never-resolving promise.
187-
return undefined as never;
189+
return new Promise<never>(() => null);
188190
}
189191

190192
/**

packages/jsii/test/compiler.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe(Compiler, () => {
7272
onWatchClosed = ok;
7373
onWatchFailed = ko;
7474
});
75-
const watch = compiler.watch({
75+
const watch = await compiler.watch({
7676
nonBlocking: true,
7777
// Ignore diagnostics reporting (not to pollute test console output)
7878
reportDiagnostics: () => null,

0 commit comments

Comments
 (0)