Skip to content

Commit

Permalink
chore(release): 1.42.0 (#3114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 2, 2021
2 parents a274beb + 9a229a4 commit 5f6b62c
Show file tree
Hide file tree
Showing 58 changed files with 1,398 additions and 439 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ on: pull_request

jobs:
auto-approve:
if: >
github.event.pull_request.user.login == 'dependabot[bot]'
|| github.event.pull_request.user.login == 'dependabot-preview[bot]'
|| (contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
&& github.event.pull_request.user.login == 'aws-cdk-automation')
if: contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
17 changes: 17 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Apply various labels on PRs

name: pr-labeler
on:
pull_request:
types: [ opened ]

jobs:
auto-approve:
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot-preview[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- run: gh pr edit ${{ github.event.pull_request.number }} --add-label "pr/auto-approve" -R ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

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.42.0](https://github.com/aws/jsii/compare/v1.41.0...v1.42.0) (2021-11-02)


### Features

* **rosetta:** reuse translation results from a cache ([#3101](https://github.com/aws/jsii/issues/3101)) ([b08a50e](https://github.com/aws/jsii/commit/b08a50e381351afab093bbf8e78fffd5a4cd58c0))


### Bug Fixes

* **jsii:** deprecation warnings erroneously warn for duplicate enum values ([#3105](https://github.com/aws/jsii/issues/3105)) ([c477422](https://github.com/aws/jsii/commit/c4774225b0f134cdb3705eb95905c0f7937fa8c4)), closes [#3103](https://github.com/aws/jsii/issues/3103)
* **jsii:** generated deprecation-warning code is platform dependent ([#3096](https://github.com/aws/jsii/issues/3096)) ([9aa6f02](https://github.com/aws/jsii/commit/9aa6f022734ebcc57ef06fbf5c437479e49b408c))
* **jsii:** unexpected deprecated warnings when a deprecated interface is extended ([#3112](https://github.com/aws/jsii/issues/3112)) ([bd7e07c](https://github.com/aws/jsii/commit/bd7e07c562a06a0d5a25f58a0d0307a61c23a554)), closes [#3111](https://github.com/aws/jsii/issues/3111)
* **pacmak:** '*/' not escaped in JavaDocs ([#3104](https://github.com/aws/jsii/issues/3104)) ([7ab109a](https://github.com/aws/jsii/commit/7ab109a376911d8034d73abd7f392df0e746ba37))
* **rosetta:** arrays aren't handled properly ([#3098](https://github.com/aws/jsii/issues/3098)) ([de4648b](https://github.com/aws/jsii/commit/de4648b6ba25154afcac07e99c964a0457b3a9a0))

## [1.41.0](https://github.com/aws/jsii/compare/v1.40.0...v1.41.0) (2021-10-27)


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.41.0"
"version": "1.42.0"
}
2 changes: 1 addition & 1 deletion packages/@jsii/go-runtime/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.15

require (
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
golang.org/x/tools v0.1.6
golang.org/x/tools v0.1.7
)
4 changes: 2 additions & 2 deletions packages/@jsii/go-runtime/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.6 h1:SIasE1FVIQOWz2GEAHFOmoW7xchJcqlucjSULTL0Ag4=
golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
Expand Down
36 changes: 17 additions & 19 deletions packages/jsii-pacmak/lib/targets/dotnet/dotnetdocgenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
TargetLanguage,
Translation,
enforcesStrictMode,
typeScriptSnippetFromSource,
markDownToXmlDoc,
ApiLocation,
} from 'jsii-rosetta';
import * as xmlbuilder from 'xmlbuilder';

Expand Down Expand Up @@ -44,7 +44,7 @@ export class DotNetDocGenerator {
* Returns
* Remarks (includes examples, links, deprecated)
*/
public emitDocs(obj: spec.Documentable): void {
public emitDocs(obj: spec.Documentable, apiLocation: ApiLocation): void {
const docs = obj.docs;

// The docs may be undefined at the method level but not the parameters level
Expand Down Expand Up @@ -76,7 +76,7 @@ export class DotNetDocGenerator {
// Remarks does not use emitXmlDoc() because the remarks can contain code blocks
// which are fenced with <code> tags, which would be escaped to
// &lt;code&gt; if we used the xml builder.
const remarks = this.renderRemarks(docs);
const remarks = this.renderRemarks(docs, apiLocation);
if (remarks.length > 0) {
this.code.line('/// <remarks>');
remarks.forEach((r) => this.code.line(`/// ${r}`.trimRight()));
Expand All @@ -85,18 +85,21 @@ export class DotNetDocGenerator {

if (docs.example) {
this.code.line('/// <example>');
this.emitXmlDoc('code', this.convertExample(docs.example));
this.emitXmlDoc('code', this.convertExample(docs.example, apiLocation));
this.code.line('/// </example>');
}
}

public emitMarkdownAsRemarks(markdown: string | undefined) {
public emitMarkdownAsRemarks(
markdown: string | undefined,
apiLocation: ApiLocation,
) {
if (!markdown) {
return;
}

const translated = markDownToXmlDoc(
this.convertSamplesInMarkdown(markdown),
this.convertSamplesInMarkdown(markdown, apiLocation),
);
const lines = translated.split('\n');

Expand All @@ -110,12 +113,12 @@ export class DotNetDocGenerator {
/**
* Returns the lines that should go into the <remarks> section
*/
private renderRemarks(docs: spec.Docs): string[] {
private renderRemarks(docs: spec.Docs, apiLocation: ApiLocation): string[] {
const ret: string[] = [];

if (docs.remarks) {
const translated = markDownToXmlDoc(
this.convertSamplesInMarkdown(docs.remarks),
this.convertSamplesInMarkdown(docs.remarks, apiLocation),
);
ret.push(...translated.split('\n'));
ret.push('');
Expand Down Expand Up @@ -161,24 +164,19 @@ export class DotNetDocGenerator {
}
}

private convertExample(example: string): string {
const snippet = typeScriptSnippetFromSource(
private convertExample(example: string, apiLocation: ApiLocation): string {
const translated = this.rosetta.translateExample(
apiLocation,
example,
'example',
enforcesStrictMode(this.assembly),
);
const translated = this.rosetta.translateSnippet(
snippet,
TargetLanguage.CSHARP,
enforcesStrictMode(this.assembly),
);
if (!translated) {
return example;
}
return this.prefixDisclaimer(translated);
}

private convertSamplesInMarkdown(markdown: string): string {
private convertSamplesInMarkdown(markdown: string, api: ApiLocation): string {
return this.rosetta.translateSnippetsInMarkdown(
api,
markdown,
TargetLanguage.CSHARP,
enforcesStrictMode(this.assembly),
Expand Down
78 changes: 63 additions & 15 deletions packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class DotNetGenerator extends Generator {
this.assembly.name,
jsiiNs,
);
this.emitNamespaceDocs(dotnetNs, submodule);
this.emitNamespaceDocs(dotnetNs, jsiiNs, submodule);
}
}

Expand All @@ -174,7 +174,7 @@ export class DotNetGenerator extends Generator {
const namespace = this.namespaceFor(this.assembly, ifc);
this.openFileIfNeeded(interfaceName, namespace, this.isNested(ifc));

this.dotnetDocGenerator.emitDocs(ifc);
this.dotnetDocGenerator.emitDocs(ifc, { api: 'type', fqn: ifc.fqn });
this.dotnetRuntimeGenerator.emitAttributesForInterface(ifc);

if (implementations.length > 0) {
Expand Down Expand Up @@ -204,7 +204,11 @@ export class DotNetGenerator extends Generator {
}

protected onInterfaceMethod(ifc: spec.InterfaceType, method: spec.Method) {
this.dotnetDocGenerator.emitDocs(method);
this.dotnetDocGenerator.emitDocs(method, {
api: 'member',
fqn: ifc.fqn,
memberName: method.name,
});
this.dotnetRuntimeGenerator.emitAttributesForMethod(ifc, method);
const returnType = method.returns
? this.typeresolver.toDotNetType(method.returns.type)
Expand Down Expand Up @@ -243,7 +247,11 @@ export class DotNetGenerator extends Generator {
}

this.emitNewLineIfNecessary();
this.dotnetDocGenerator.emitDocs(prop);
this.dotnetDocGenerator.emitDocs(prop, {
api: 'member',
fqn: ifc.fqn,
memberName: prop.name,
});
this.dotnetRuntimeGenerator.emitAttributesForProperty(prop);

const propType = this.typeresolver.toDotNetType(prop.type);
Expand Down Expand Up @@ -308,7 +316,11 @@ export class DotNetGenerator extends Generator {

const implementsExpr = ` : ${baseTypeNames.join(', ')}`;

this.dotnetDocGenerator.emitDocs(cls);
this.dotnetDocGenerator.emitDocs(cls, {
api: 'type',
fqn: cls.fqn,
});

this.dotnetRuntimeGenerator.emitAttributesForClass(cls);

this.code.openBlock(
Expand All @@ -320,7 +332,10 @@ export class DotNetGenerator extends Generator {
let parametersBase = '';
const initializer = cls.initializer;
if (initializer) {
this.dotnetDocGenerator.emitDocs(initializer);
this.dotnetDocGenerator.emitDocs(initializer, {
api: 'initializer',
fqn: cls.fqn,
});
this.dotnetRuntimeGenerator.emitDeprecatedAttributeIfNecessary(
initializer,
);
Expand Down Expand Up @@ -452,7 +467,10 @@ export class DotNetGenerator extends Generator {
const namespace = this.namespaceFor(this.assembly, enm);
this.openFileIfNeeded(enumName, namespace, this.isNested(enm));
this.emitNewLineIfNecessary();
this.dotnetDocGenerator.emitDocs(enm);
this.dotnetDocGenerator.emitDocs(enm, {
api: 'type',
fqn: enm.fqn,
});
this.dotnetRuntimeGenerator.emitAttributesForEnum(enm, enumName);
this.code.openBlock(`public enum ${enm.name}`);
}
Expand All @@ -465,7 +483,11 @@ export class DotNetGenerator extends Generator {
}

protected onEnumMember(enm: spec.EnumType, member: spec.EnumMember) {
this.dotnetDocGenerator.emitDocs(member);
this.dotnetDocGenerator.emitDocs(member, {
api: 'member',
fqn: enm.fqn,
memberName: member.name,
});
const enumMemberName = this.nameutils.convertEnumMemberName(member.name);
this.dotnetRuntimeGenerator.emitAttributesForEnumMember(
enumMemberName,
Expand Down Expand Up @@ -544,7 +566,11 @@ export class DotNetGenerator extends Generator {
method,
)})`;

this.dotnetDocGenerator.emitDocs(method);
this.dotnetDocGenerator.emitDocs(method, {
api: 'member',
fqn: cls.fqn,
memberName: method.name,
});
this.dotnetRuntimeGenerator.emitAttributesForMethod(
cls,
method /*, emitForProxyOrDatatype*/,
Expand Down Expand Up @@ -669,7 +695,10 @@ export class DotNetGenerator extends Generator {
this.openFileIfNeeded(name, namespace, isNested);

this.code.line();
this.dotnetDocGenerator.emitDocs(ifc);
this.dotnetDocGenerator.emitDocs(ifc, {
api: 'type',
fqn: ifc.fqn,
});
this.dotnetRuntimeGenerator.emitAttributesForInterfaceProxy(ifc);

const interfaceFqn = this.typeresolver.toNativeFqn(ifc.fqn);
Expand Down Expand Up @@ -758,7 +787,10 @@ export class DotNetGenerator extends Generator {
this.code.line();
}

this.dotnetDocGenerator.emitDocs(ifc);
this.dotnetDocGenerator.emitDocs(ifc, {
api: 'type',
fqn: ifc.fqn,
});
const suffix = `: ${this.typeresolver.toNativeFqn(ifc.fqn)}`;
this.dotnetRuntimeGenerator.emitAttributesForInterfaceDatatype(ifc);
this.code.openBlock(`public class ${name} ${suffix}`);
Expand Down Expand Up @@ -888,7 +920,11 @@ export class DotNetGenerator extends Generator {
const staticKeyWord = prop.static ? 'static ' : '';
const propName = this.nameutils.convertPropertyName(prop.name);

this.dotnetDocGenerator.emitDocs(prop);
this.dotnetDocGenerator.emitDocs(prop, {
api: 'member',
fqn: cls.fqn,
memberName: prop.name,
});
if (prop.optional) {
this.code.line('[JsiiOptional]');
}
Expand Down Expand Up @@ -969,7 +1005,11 @@ export class DotNetGenerator extends Generator {
this.flagFirstMemberWritten(true);
const propType = this.typeresolver.toDotNetType(prop.type);
const isOptional = prop.optional ? '?' : '';
this.dotnetDocGenerator.emitDocs(prop);
this.dotnetDocGenerator.emitDocs(prop, {
api: 'member',
fqn: cls.fqn,
memberName: prop.name,
});
this.dotnetRuntimeGenerator.emitAttributesForProperty(prop);
const access = this.renderAccessLevel(prop);
const propName = this.nameutils.convertPropertyName(prop.name);
Expand Down Expand Up @@ -1086,6 +1126,7 @@ export class DotNetGenerator extends Generator {
private emitAssemblyDocs() {
this.emitNamespaceDocs(
this.assembly.targets!.dotnet!.namespace,
this.assembly.name,
this.assembly,
);
}
Expand All @@ -1102,15 +1143,22 @@ export class DotNetGenerator extends Generator {
* In any case, we need a place to attach the docs where they can be transported around,
* might as well be this method.
*/
private emitNamespaceDocs(namespace: string, docSource: spec.Targetable) {
private emitNamespaceDocs(
namespace: string,
jsiiFqn: string,
docSource: spec.Targetable,
) {
if (!docSource.readme) {
return;
}

const className = 'NamespaceDoc';
this.openFileIfNeeded(className, namespace, false, false);

this.dotnetDocGenerator.emitMarkdownAsRemarks(docSource.readme.markdown);
this.dotnetDocGenerator.emitMarkdownAsRemarks(docSource.readme.markdown, {
api: 'moduleReadme',
moduleFqn: jsiiFqn,
});
this.emitHideAttribute();
// Traditionally this class is made 'internal', but that interacts poorly with DocFX's default filters
// which aren't overridable. So we make it public, but use attributes to hide it from users' IntelliSense,
Expand Down
Loading

0 comments on commit 5f6b62c

Please sign in to comment.