Skip to content

Commit

Permalink
fix(jsii): flatten out dependency list (#454)
Browse files Browse the repository at this point in the history
Stop deeply nesting dependency packages and their dependencies. All
dependencies are now flattened to a single transitive dependency
closure. This will save a lot of space and processing power in
processing the assembly.

Make jsii-reflect validate the schema (including the version). It wasn't doing that before!!

Fixes #453.
  • Loading branch information
rix0rrr authored Apr 15, 2019
1 parent ae85aa5 commit ebdd10d
Show file tree
Hide file tree
Showing 36 changed files with 924 additions and 292 deletions.
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"private": true,
"license": "Apache-2.0",
"devDependencies": {
"lerna": "^3.13.1",
"nodeunit": "^0.11.3",
"nyc": "^13.3.0",
"tslint": "^5.15.0",
"typescript": "^3.4.2"
}
"private": true,
"license": "Apache-2.0",
"devDependencies": {
"lerna": "^3.13.1",
"nodeunit": "^0.11.3",
"nyc": "^13.3.0",
"tslint": "^5.15.0",
"typescript": "^3.4.2"
},
"repository": {
"type": "git",
"url": "https://github.com/awslabs/jsii.git"
}
}
4 changes: 4 additions & 0 deletions packages/jsii-calc-base-of-base/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export interface IVeryBaseInterface {
foo(): void;
}

export interface VeryBaseProps {
readonly foo: Very;
}
Expand Down
30 changes: 25 additions & 5 deletions packages/jsii-calc-base-of-base/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,40 @@
"sphinx": {}
},
"types": {
"@scope/jsii-calc-base-of-base.IVeryBaseInterface": {
"assembly": "@scope/jsii-calc-base-of-base",
"fqn": "@scope/jsii-calc-base-of-base.IVeryBaseInterface",
"kind": "interface",
"locationInModule": {
"filename": "lib/index.ts",
"line": 1
},
"methods": [
{
"abstract": true,
"locationInModule": {
"filename": "lib/index.ts",
"line": 2
},
"name": "foo"
}
],
"name": "IVeryBaseInterface"
},
"@scope/jsii-calc-base-of-base.Very": {
"assembly": "@scope/jsii-calc-base-of-base",
"fqn": "@scope/jsii-calc-base-of-base.Very",
"initializer": {},
"kind": "class",
"locationInModule": {
"filename": "lib/index.ts",
"line": 5
"line": 9
},
"methods": [
{
"locationInModule": {
"filename": "lib/index.ts",
"line": 6
"line": 10
},
"name": "hey",
"returns": {
Expand All @@ -71,7 +91,7 @@
"kind": "interface",
"locationInModule": {
"filename": "lib/index.ts",
"line": 1
"line": 5
},
"name": "VeryBaseProps",
"properties": [
Expand All @@ -80,7 +100,7 @@
"immutable": true,
"locationInModule": {
"filename": "lib/index.ts",
"line": 2
"line": 6
},
"name": "foo",
"type": {
Expand All @@ -91,5 +111,5 @@
}
},
"version": "0.9.0",
"fingerprint": "1O+di7RZanglLmeCs57JLdO5m98kRnkL4uLPnDbm/z4="
"fingerprint": "ENFUcMchPwpuq+F97Ft6h/qSsOv03zzW/rOn+EpnPkM="
}
6 changes: 5 additions & 1 deletion packages/jsii-calc-base/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VeryBaseProps } from '@scope/jsii-calc-base-of-base';
import { IVeryBaseInterface, VeryBaseProps } from '@scope/jsii-calc-base-of-base';

/**
* A base class.
Expand All @@ -15,3 +15,7 @@ export abstract class Base {
export interface BaseProps extends VeryBaseProps {
readonly bar: string;
}

export interface IBaseInterface extends IVeryBaseInterface {
bar(): void;
}
51 changes: 50 additions & 1 deletion packages/jsii-calc-base/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@
"version": "0.9.0"
}
},
"dependencyClosure": {
"@scope/jsii-calc-base-of-base": {
"targets": {
"dotnet": {
"namespace": "Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace",
"packageId": "Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId"
},
"java": {
"maven": {
"artifactId": "calculator-base-of-base",
"groupId": "software.amazon.jsii.tests"
},
"package": "software.amazon.jsii.tests.calculator.baseofbase"
},
"js": {
"npm": "@scope/jsii-calc-base-of-base"
},
"python": {
"distName": "scope.jsii-calc-base-of-base",
"module": "scope.jsii_calc_base_of_base"
},
"sphinx": {}
},
"version": "0.9.0"
}
},
"description": "An example direct dependency for jsii-calc.",
"homepage": "https://github.com/awslabs/jsii.git",
"jsiiVersion": "0.9.0",
Expand Down Expand Up @@ -124,8 +150,31 @@
}
}
]
},
"@scope/jsii-calc-base.IBaseInterface": {
"assembly": "@scope/jsii-calc-base",
"fqn": "@scope/jsii-calc-base.IBaseInterface",
"interfaces": [
"@scope/jsii-calc-base-of-base.IVeryBaseInterface"
],
"kind": "interface",
"locationInModule": {
"filename": "lib/index.ts",
"line": 19
},
"methods": [
{
"abstract": true,
"locationInModule": {
"filename": "lib/index.ts",
"line": 20
},
"name": "bar"
}
],
"name": "IBaseInterface"
}
},
"version": "0.9.0",
"fingerprint": "iWT7GmFaVPERM/zg8WXtKv7ydudD28ixjJDVfms7DJ4="
"fingerprint": "8qBW6Salzbq8ies06F/P6IebT87rHy8zDsbL8JqBrvI="
}
10 changes: 10 additions & 0 deletions packages/jsii-calc-lib/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ export enum EnumFromScopedModule {
Value1,
Value2
}

/**
* Interface that inherits from packages 2 levels up the tree
*
* Their presence validates that .NET/Java/jsii-reflect can track all fields
* far enough up the tree.
*/
export interface IThreeLevelsInterface extends base.IBaseInterface {
baz(): void;
}
101 changes: 76 additions & 25 deletions packages/jsii-calc-lib/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
},
"dependencies": {
"@scope/jsii-calc-base": {
"dependencies": {
"@scope/jsii-calc-base-of-base": {
"targets": {
"dotnet": {
"namespace": "Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace",
"packageId": "Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId"
},
"java": {
"maven": {
"artifactId": "calculator-base-of-base",
"groupId": "software.amazon.jsii.tests"
},
"package": "software.amazon.jsii.tests.calculator.baseofbase"
},
"js": {
"npm": "@scope/jsii-calc-base-of-base"
},
"python": {
"distName": "scope.jsii-calc-base-of-base",
"module": "scope.jsii_calc_base_of_base"
},
"sphinx": {}
"targets": {
"dotnet": {
"namespace": "Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace",
"packageId": "Amazon.JSII.Tests.CalculatorPackageId.BasePackageId"
},
"java": {
"maven": {
"artifactId": "calculator-base",
"groupId": "software.amazon.jsii.tests"
},
"version": "0.9.0"
}
"package": "software.amazon.jsii.tests.calculator.base"
},
"js": {
"npm": "@scope/jsii-calc-base"
},
"python": {
"distName": "scope.jsii-calc-base",
"module": "scope.jsii_calc_base"
},
"sphinx": {}
},
"version": "0.9.0"
}
},
"dependencyClosure": {
"@scope/jsii-calc-base": {
"targets": {
"dotnet": {
"namespace": "Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace",
Expand All @@ -57,6 +57,30 @@
"sphinx": {}
},
"version": "0.9.0"
},
"@scope/jsii-calc-base-of-base": {
"targets": {
"dotnet": {
"namespace": "Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace",
"packageId": "Amazon.JSII.Tests.CalculatorPackageId.BaseOfBasePackageId"
},
"java": {
"maven": {
"artifactId": "calculator-base-of-base",
"groupId": "software.amazon.jsii.tests"
},
"package": "software.amazon.jsii.tests.calculator.baseofbase"
},
"js": {
"npm": "@scope/jsii-calc-base-of-base"
},
"python": {
"distName": "scope.jsii-calc-base-of-base",
"module": "scope.jsii_calc_base_of_base"
},
"sphinx": {}
},
"version": "0.9.0"
}
},
"description": "A simple calcuator library built on JSII.",
Expand Down Expand Up @@ -171,6 +195,33 @@
],
"name": "IFriendly"
},
"@scope/jsii-calc-lib.IThreeLevelsInterface": {
"assembly": "@scope/jsii-calc-lib",
"docs": {
"remarks": "Their presence validates that .NET/Java/jsii-reflect can track all fields\nfar enough up the tree.",
"summary": "Interface that inherits from packages 2 levels up the tree."
},
"fqn": "@scope/jsii-calc-lib.IThreeLevelsInterface",
"interfaces": [
"@scope/jsii-calc-base.IBaseInterface"
],
"kind": "interface",
"locationInModule": {
"filename": "lib/index.ts",
"line": 108
},
"methods": [
{
"abstract": true,
"locationInModule": {
"filename": "lib/index.ts",
"line": 109
},
"name": "baz"
}
],
"name": "IThreeLevelsInterface"
},
"@scope/jsii-calc-lib.MyFirstStruct": {
"assembly": "@scope/jsii-calc-lib",
"datatype": true,
Expand Down Expand Up @@ -445,5 +496,5 @@
}
},
"version": "0.9.0",
"fingerprint": "/aA8aq2OBJL26oZOAhZj4Gi1QaKDqfEKQj3ONPxmbBM="
"fingerprint": "bBNOrdlsau3qqxF1iTo055PjEb8RSSExF6rQNNnIwAY="
}
Loading

0 comments on commit ebdd10d

Please sign in to comment.