Skip to content

Commit

Permalink
Merge branch 'main' into rmuller/fix-java-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller authored Feb 24, 2021
2 parents e865913 + be93566 commit 617febd
Show file tree
Hide file tree
Showing 93 changed files with 5,259 additions and 2,171 deletions.
25 changes: 6 additions & 19 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,34 @@
version: 2

updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
labels:
- dependencies
versioning-strategy: increase
ignore:
- dependency-name: typescript
versions:
- '>= 3.10.a'
- dependency-name: '@types/node'
versions:
- '>= 11.a'

- package-ecosystem: nuget
directory: '/packages/@jsii/dotnet-runtime/src'
schedule:
interval: daily
interval: weekly
labels:
- dependencies
- language/dotnet

- package-ecosystem: nuget
directory: '/packages/@jsii/dotnet-runtime-test/test'
schedule:
interval: daily
interval: weekly
labels:
- dependencies
- language/dotnet

- package-ecosystem: pip
directory: '/packages/@jsii/python-runtime'
schedule:
interval: daily
interval: weekly
labels:
- dependencies
- language/python

- package-ecosystem: pip
directory: '/gh-pages'
schedule:
interval: daily
interval: weekly
labels:
- dependencies
- language/python
Expand All @@ -68,3 +53,5 @@ updates:
directory: '/'
schedule:
interval: daily
labels:
- dependencies
13 changes: 13 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Approve PRs with "pr/auto-approve". mergify takes care of the actual merge.

name: auto-approve
on: pull_request

jobs:
auto-approve:
if: contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]
with:
github-token: "${{ secrets.AUTO_APPROVE_GITHUB_TOKEN }}"
28 changes: 0 additions & 28 deletions .github/workflows/dependabot.yml

This file was deleted.

43 changes: 5 additions & 38 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
java-version: '8'
- name: Set up Node 12
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
node-version: '12'
- name: Set up Python 3.6
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
with:
java-version: '8'
- name: Set up Node 12
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
node-version: '12'
- name: Set up Python 3.6
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
with:
java-version: ${{ matrix.java }}
- name: Set up Node ${{ matrix.node }}
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
node-version: ${{ matrix.node }}
- name: Set up Python ${{ matrix.python }}
Expand Down Expand Up @@ -341,7 +341,7 @@ jobs:
with:
java-version: '8'
- name: Set up Node 10
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
node-version: '10'
- name: Set up Python 3.6
Expand Down Expand Up @@ -415,7 +415,7 @@ jobs:
- name: Integration Test (build)
run: |-
npx lerna run build --concurrency=2 --stream 2>&1 > ${{ runner.temp }}/build.log
npx lerna run build --concurrency=1 --stream 2>&1 > ${{ runner.temp }}/build.log
working-directory: aws-cdk
env:
# Make lots of memory available, aws-cdk-lib is __large__
Expand Down Expand Up @@ -456,36 +456,3 @@ jobs:
path: |-
${{ github.workspace }}/aws-cdk/dist/
${{ github.workspace }}/aws-cdk/**/dist/
push-go-runtime:
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Set up Node 12
uses: actions/[email protected]
with:
node-version: '12'
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: built-tree
path: ${{ github.workspace }}/jsii-built-tree
- name: Extract Artifact
working-directory: ${{ github.workspace }}/jsii-built-tree
run: |-
tar zxvf built-tree.tgz
rm built-tree.tgz
- name: Release
working-directory: ${{ github.workspace }}/jsii-built-tree
if: github.ref == 'refs/head/release'
run: |-
VERSION=$(node -p 'require("./lerna.json").version')
cd ./packages/@jsii/go-runtime/jsii-runtime-go
echo ${VERSION} > version
npx -p jsii-release@latest jsii-release-golang .
env:
GIT_USER_NAME: AWS CDK Team
GIT_USER_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.GO_PUBLISHING_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v2

- name: Set up Node
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
node-version: 10

Expand Down
4 changes: 2 additions & 2 deletions gh-pages/content/specification/2-type-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ value:

In **JavaScript**, `enum` entries are represented by their value equivalent. In order to support statically typed
representations in other languages, these are serialized using a dedicated wrapper object, using a single key
(`$jsii.enum`) with the fully qualified name of the `enum` entry:
(`$jsii.enum`) with the fully qualified name of the `enum` entry (formatted as `<enum type fqn>/<entry name>`):

```json
{ "$jsii.enum": "@scope/module.EnumType.ENTRY_NAME" }
{ "$jsii.enum": "@scope/module.EnumType/ENTRY_NAME" }
```

### Identity Serialization
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
},
"devDependencies": {
"@jest/types": "^26.6.2",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"all-contributors-cli": "^6.20.0",
"eslint": "^7.19.0",
"eslint": "^7.20.0",
"eslint-config-prettier": "^7.2.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.1",
"jest-circus": "^26.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/dotnet-runtime-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@jsii/dotnet-runtime": "^0.0.0",
"@types/node": "^10.17.51",
"@types/node": "^10.17.52",
"jsii-calc": "^3.20.120",
"jsii-pacmak": "^0.0.0",
"typescript": "~3.9.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/dotnet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@jsii/runtime": "^0.0.0",
"@types/node": "^10.17.51",
"@types/node": "^10.17.52",
"@types/semver": "^7.3.4",
"jsii-build-tools": "^0.0.0",
"semver": "^7.3.4",
Expand Down
1 change: 1 addition & 0 deletions packages/@jsii/go-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/jsii-calc/
*.generated.go
*.generated_test.go

*.js
*.d.ts
43 changes: 43 additions & 0 deletions packages/@jsii/go-runtime/build-tools/all-go.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env node

import { readdirSync, statSync } from 'fs';
import { join } from 'path';
import { cwd } from 'process';

import { runCommand } from './_constants';

/**
* Recursively searches the provided directory for `go.mod` files (excluding
* sub-directories named `node_modules` and `jsii-calc`), and executes the
* supplied go command in the parent directory of eacu such file.
*
* @example
* # Running "go fmt" on all modules:
* $ all-go.js fmt ./...
*
* # Running "go test" in all modules:
* $ all-go.js test ./...
*/
function visit(dir: string): void {
for (const file of readdirSync(dir)) {
const path = join(dir, file);
if (statSync(path).isDirectory()) {
if (file !== 'node_modules' && file !== 'jsii-calc') {
visit(path);
}
continue;
}
if (file === 'go.mod') {
const args = process.argv.slice(2);
console.error(`$ go ${args.join(' ')} # ${path}`);
try {
runCommand('go', args, { cwd: dir, stdio: 'inherit' });
} catch (e) {
console.error(e.message);
process.exit(-1);
}
}
}
}

visit(cwd());
49 changes: 47 additions & 2 deletions packages/@jsii/go-runtime/build-tools/gen-calc.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env npx ts-node

import { removeSync } from 'fs-extra';
import { join, resolve } from 'path';
import { readFileSync, removeSync, writeFileSync } from 'fs-extra';
import { join, relative, resolve } from 'path';

import { runtimeModules } from '../lib';
import { localRuntimeModules } from '../lib/local-runtime-modules';
import { runCommand } from './_constants';

const genRoot = join(__dirname, '..', 'jsii-calc');
Expand All @@ -22,3 +24,46 @@ runCommand(
],
{ stdio: 'inherit' },
);

// Inject "replaces" in the go.mod files so IDEs do not struggle too much...
const genModules = localRuntimeModules(genRoot);
const localModules = {
...genModules,
...runtimeModules,
};
for (const localPath of Object.values(genModules)) {
const goModFile = join(localPath, 'go.mod');
const goMod = readFileSync(goModFile, 'utf8');

const replaces = new Array<{
readonly dep: string;
readonly depPath: string;
}>();

let matches: ReturnType<RegExp['exec']>;
const depRegex = /([a-z0-9._~/-]+)\s+v\d/gi;
while ((matches = depRegex.exec(goMod)) != null) {
const [, dep] = matches;
if (dep in localModules) {
const depPath = localModules[dep];
replaces.push({ dep, depPath });
}
}

writeFileSync(
goModFile,
[
goMod.trim(),
'',
'// Injected by "yarn gen:calc", aka build-tools/gen-calc.ts',
'replace (',
...replaces
.map(
({ dep, depPath }) => `\t${dep} => ${relative(localPath, depPath)}`,
)
.sort(),
')',
'',
].join('\n'),
);
}
Loading

0 comments on commit 617febd

Please sign in to comment.