Skip to content

Commit

Permalink
chore(release): 1.43.0 (#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 8, 2021
2 parents 5f6b62c + 6c353ab commit b69a797
Show file tree
Hide file tree
Showing 42 changed files with 722 additions and 257 deletions.
5 changes: 2 additions & 3 deletions .mergify/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ pull_request_rules:
dismiss_reviews:
approved: true
changes_requested: false
merge:
strict: smart+fasttrack
queue:
name: default
method: merge
strict_method: merge
commit_message: title+body
comment:
message: Merging (no-squash)...
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

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


### Features

* **pacmak:** fail on untranslated snippets ([#3127](https://github.com/aws/jsii/issues/3127)) ([874e8e2](https://github.com/aws/jsii/commit/874e8e2c6a4cc61ae049c5b23f25ff390504d345)), closes [cdklabs/cdk-ops#1777](https://github.com/cdklabs/cdk-ops/issues/1777)
* **rosetta:** find fixtures based on submodules ([#3131](https://github.com/aws/jsii/issues/3131)) ([236dd88](https://github.com/aws/jsii/commit/236dd88f816f2251e62239feb8dfb51c729b7d30))


### Bug Fixes

* **pacmak:** add 'silly' loglevel for command output ([#3125](https://github.com/aws/jsii/issues/3125)) ([bf769da](https://github.com/aws/jsii/commit/bf769daa4785d1e2c686547bfb50577c3f5006a5))
* **pacmak:** API locations for inherited members are incorrect ([#3130](https://github.com/aws/jsii/issues/3130)) ([8d0a248](https://github.com/aws/jsii/commit/8d0a24826052600c3ab51cac7e31a2666930ef39)), closes [cdklabs/cdk-ops#1777](https://github.com/cdklabs/cdk-ops/issues/1777)
* **pacmak:** development version cannot pack java ([#3121](https://github.com/aws/jsii/issues/3121)) ([0d9cf51](https://github.com/aws/jsii/commit/0d9cf511e58d0329dbff7e749109be76c61fb84e)), closes [#3107](https://github.com/aws/jsii/issues/3107)
* **pacmak:** re-introduce parallelism for Python and Go builds ([#3124](https://github.com/aws/jsii/issues/3124)) ([87ba35d](https://github.com/aws/jsii/commit/87ba35d894baff68b1ce3a1dec8b17f19667e162)), closes [#3045](https://github.com/aws/jsii/issues/3045)
* **rosetta:** `infuse` creates untranslated examples ([#3126](https://github.com/aws/jsii/issues/3126)) ([ab60275](https://github.com/aws/jsii/commit/ab602757634b836728f32eca6620836d1b641ec4))
* **rosetta:** crashes on outdated tablet files in a package ([#3119](https://github.com/aws/jsii/issues/3119)) ([80ff0dc](https://github.com/aws/jsii/commit/80ff0dc22f5d04016812c993f07ed3b4893e518d))
* **rosetta:** remember live-translated snippets without fixtures ([#3129](https://github.com/aws/jsii/issues/3129)) ([0638345](https://github.com/aws/jsii/commit/0638345e7712638f01e809994f4b38b50523622e))
* **rosetta:** stop skipping example values ([#3128](https://github.com/aws/jsii/issues/3128)) ([ee0620a](https://github.com/aws/jsii/commit/ee0620aa9d5fdc595d505be7fa4a7e30e827ad62))

## [1.42.0](https://github.com/aws/jsii/compare/v1.41.0...v1.42.0) (2021-11-02)


Expand Down
6 changes: 3 additions & 3 deletions gh-pages/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mkdocs~=1.2.2
mkdocs-awesome-pages-plugin~=2.5.0
mkdocs-material~=7.3.1
mkdocs~=1.2.3
mkdocs-awesome-pages-plugin~=2.6.0
mkdocs-material~=7.3.2
mkdocs-git-revision-date-plugin~=0.3.1
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.42.0"
"version": "1.43.0"
}
4 changes: 2 additions & 2 deletions packages/@jsii/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="5.0.0" />

<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" />
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" />
<PackageReference Update="Microsoft.CodeQuality.Analyzers" Version="3.3.2" />

<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Update="NSubstitute" Version="4.2.2" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.3" />
Expand Down
6 changes: 3 additions & 3 deletions packages/@jsii/python-runtime/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
black~=21.9b0
black~=21.10b0
mypy==0.812
pip~=21.2
pip~=21.3
pytest~=6.2
pytest-mypy~=0.8
setuptools~=58.1
setuptools~=58.2
wheel~=0.37

-e .
17 changes: 16 additions & 1 deletion packages/jsii-pacmak/bin/jsii-pacmak.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
import '@jsii/check-node/run';

import { UnknownSnippetMode } from 'jsii-rosetta';
import * as yargs from 'yargs';

import { pacmak, configureLogging, TargetName } from '../lib';
Expand Down Expand Up @@ -93,9 +94,20 @@ import { VERSION_DESC } from '../lib/version';
})
.option('rosetta-translate-live', {
type: 'boolean',
desc: "Translate code samples on-the-fly if they can't be found in the samples tablet",
desc: "Translate code samples on-the-fly if they can't be found in the samples tablet (deprecated)",
default: true,
})
.option('rosetta-unknown-snippets', {
type: 'string',
requiresArg: true,
optional: true,
choices: [
UnknownSnippetMode.VERBATIM,
UnknownSnippetMode.TRANSLATE,
UnknownSnippetMode.FAIL,
],
desc: "What to do with code samples if they can't be found in the samples tablet",
})
.option('parallel', {
type: 'boolean',
desc: 'Generate all configured targets in parallel (disabling this might help if you encounter EMFILE errors)',
Expand Down Expand Up @@ -136,6 +148,9 @@ import { VERSION_DESC } from '../lib/version';
parallel: argv.parallel,
recurse: argv.recurse,
rosettaLiveConversion: argv['rosetta-translate-live'],
rosettaUnknownSnippets: argv['rosetta-unknown-snippets'] as
| UnknownSnippetMode
| undefined,
rosettaTablet: argv['rosetta-tablet'],
targets: argv.targets?.map((target) => target as TargetName),
updateNpmIgnoreFiles: argv.npmignore,
Expand Down
38 changes: 26 additions & 12 deletions packages/jsii-pacmak/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import * as logging from './logging';
import { JsiiModule } from './packaging';
import { TargetConstructor, Target } from './target';
import { TargetName } from './targets';
import { Scratch } from './util';
import { Toposorted } from './toposort';
import { Scratch, flatten } from './util';

export interface BuildOptions {
/**
Expand Down Expand Up @@ -56,25 +57,38 @@ export interface TargetBuilder {
}

/**
* Builds the targets for the given language sequentially
* Base implementation, building the package targets for the given language independently of each other
*
* Some languages can gain substantial speedup in preparing an "uber project" for all packages
* and compiling them all in one go (Those will be implementing a custom Builder).
*
* For languages where it doesn't matter--or where we haven't figured out how to
* do that yet--this class can serve as a base class: it will build each package
* independently, taking care to build them in the right order.
*/
export class OneByOneBuilder implements TargetBuilder {
export class IndependentPackageBuilder implements TargetBuilder {
public constructor(
private readonly targetName: TargetName,
private readonly targetConstructor: TargetConstructor,
private readonly modules: readonly JsiiModule[],
private readonly modules: Toposorted<JsiiModule>,
private readonly options: BuildOptions,
) {}

public async buildModules(): Promise<void> {
for (const module of this.modules) {
if (this.options.codeOnly) {
// eslint-disable-next-line no-await-in-loop
await this.generateModuleCode(module, this.options);
} else {
// eslint-disable-next-line no-await-in-loop
await this.buildModule(module, this.options);
}
if (this.options.codeOnly) {
await Promise.all(
flatten(this.modules).map((module) =>
this.generateModuleCode(module, this.options),
),
);
return;
}

for (const modules of this.modules) {
// eslint-disable-next-line no-await-in-loop
await Promise.all(
modules.map((module) => this.buildModule(module, this.options)),
);
}
}

Expand Down
97 changes: 66 additions & 31 deletions packages/jsii-pacmak/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TypeSystem } from 'jsii-reflect';
import { Rosetta } from 'jsii-rosetta';
import { Rosetta, UnknownSnippetMode } from 'jsii-rosetta';

import * as logging from './logging';
import { findJsiiModules, updateAllNpmIgnores } from './npm-modules';
import { JsiiModule } from './packaging';
import { ALL_BUILDERS, TargetName } from './targets';
import { Timers } from './timer';
import { Toposorted } from './toposort';
import { flatten } from './util';

//#region Exported APIs

Expand All @@ -31,50 +33,66 @@ export async function pacmak({
rosettaTablet,
targets = Object.values(TargetName),
timers = new Timers(),
rosettaUnknownSnippets = undefined,
updateNpmIgnoreFiles = false,
validateAssemblies = false,
}: PacmakOptions): Promise<void> {
const rosetta = new Rosetta({ liveConversion: rosettaLiveConversion });
const unknownSnippets =
rosettaUnknownSnippets ??
(rosettaLiveConversion
? UnknownSnippetMode.TRANSLATE
: UnknownSnippetMode.VERBATIM);

const rosetta = new Rosetta({ unknownSnippets });
if (rosettaTablet) {
await rosetta.loadTabletFromFile(rosettaTablet);
}

const modulesToPackage = await findJsiiModules(inputDirectories, recurse);
logging.info(`Found ${modulesToPackage.length} modules to package`);
if (modulesToPackage.length === 0) {
const modulesToPackageSorted = await findJsiiModules(
inputDirectories,
recurse,
);
const modulesToPackageFlat = flatten(modulesToPackageSorted);

logging.info(`Found ${modulesToPackageFlat.length} modules to package`);
if (modulesToPackageFlat.length === 0) {
logging.warn('Nothing to do');
return;
}

if (outputDirectory) {
for (const mod of modulesToPackage) {
for (const mod of modulesToPackageFlat) {
mod.outputDirectory = outputDirectory;
}
} else if (updateNpmIgnoreFiles) {
// if outdir is coming from package.json, verify it is excluded by .npmignore. if it is explicitly
// defined via --out, don't perform this verification.
await updateAllNpmIgnores(modulesToPackage);
await updateAllNpmIgnores(modulesToPackageFlat);
}

await timers.recordAsync('npm pack', () => {
logging.info('Packaging NPM bundles');
return Promise.all(modulesToPackage.map((m) => m.npmPack()));
return Promise.all(modulesToPackageFlat.map((m) => m.npmPack()));
});

await timers.recordAsync('load jsii', () => {
logging.info('Loading jsii assemblies and translations');
const system = new TypeSystem();
return Promise.all(
modulesToPackage.map(async (m) => {
modulesToPackageFlat.map(async (m) => {
await m.load(system, validateAssemblies);
return rosetta.addAssembly(m.assembly.spec, m.moduleDirectory);
}),
);
});

try {
const targetSets = sliceTargets(modulesToPackage, targets, forceTarget);
if (targetSets.every((s) => s.modules.length === 0)) {
const targetSets = sliceTargets(
modulesToPackageSorted,
targets,
forceTarget,
);
if (targetSets.every((s) => s.modulesSorted.length === 0)) {
throw new Error(
`None of the requested packages had any targets to build for '${targets.join(
', ',
Expand All @@ -96,15 +114,19 @@ export async function pacmak({
);
return timers
.recordAsync(targetSet.targetType, () =>
buildTargetsForLanguage(targetSet.targetType, targetSet.modules, {
argv,
clean,
codeOnly,
fingerprint,
force,
perLanguageDirectory,
rosetta,
}),
buildTargetsForLanguage(
targetSet.targetType,
targetSet.modulesSorted,
{
argv,
clean,
codeOnly,
fingerprint,
force,
perLanguageDirectory,
rosetta,
},
),
)
.then(
() => logging.info(`${targetSet.targetType} finished`),
Expand All @@ -121,10 +143,10 @@ export async function pacmak({
if (clean) {
logging.debug('Cleaning up');
await timers.recordAsync('cleanup', () =>
Promise.all(modulesToPackage.map((m) => m.cleanup())),
Promise.all(modulesToPackageFlat.map((m) => m.cleanup())),
);
} else {
logging.debug('Temporary directories retained (--no-clean)');
logging.info('Temporary directories retained (--no-clean)');
}
}

Expand Down Expand Up @@ -219,9 +241,17 @@ export interface PacmakOptions {
* already translated in the `rosettaTablet` file.
*
* @default false
* @deprecated Use `rosettaUnknownSnippets` instead.
*/
readonly rosettaLiveConversion?: boolean;

/**
* How rosetta should treat snippets that cannot be loaded from a translation tablet.
*
* @default - falls back to the default of `rosettaLiveConversion`.
*/
readonly rosettaUnknownSnippets?: UnknownSnippetMode;

/**
* A Rosetta tablet file where translations for code examples can be found.
*
Expand Down Expand Up @@ -264,7 +294,7 @@ export interface PacmakOptions {

async function buildTargetsForLanguage(
targetLanguage: string,
modules: readonly JsiiModule[],
modules: Toposorted<JsiiModule>,
{
argv,
clean,
Expand Down Expand Up @@ -309,21 +339,25 @@ async function buildTargetsForLanguage(
*/
interface TargetSet {
targetType: string;
modules: readonly JsiiModule[];

// Sorted into toposorted tranches
modulesSorted: Toposorted<JsiiModule>;
}

function sliceTargets(
modules: readonly JsiiModule[],
modulesSorted: Toposorted<JsiiModule>,
requestedTargets: readonly TargetName[],
force: boolean,
): readonly TargetSet[] {
const ret = new Array<TargetSet>();
for (const target of requestedTargets) {
ret.push({
targetType: target,
modules: modules.filter(
(m) => force || m.availableTargets.includes(target),
),
modulesSorted: modulesSorted
.map((modules) =>
modules.filter((m) => force || m.availableTargets.includes(target)),
)
.filter((ms) => ms.length > 0),
});
}
return ret;
Expand Down Expand Up @@ -359,10 +393,11 @@ function mapParallelOrSerial<T, R>(
//#region Misc. Utilities

function describePackages(target: TargetSet) {
if (target.modules.length > 0 && target.modules.length < 5) {
return target.modules.map((m) => m.name).join(', ');
const modules = flatten(target.modulesSorted);
if (modules.length > 0 && modules.length < 5) {
return modules.map((m) => m.name).join(', ');
}
return `${target.modules.length} modules`;
return `${modules.length} modules`;
}

//#endregion
Loading

0 comments on commit b69a797

Please sign in to comment.