From b2aa4247b550a4ce627d3bb4a05b45002b7d912a Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Wed, 27 May 2020 19:41:37 +0200 Subject: [PATCH] feat: allow per-submodule naming configuration (#1690) Introduces a new `.jsiirc.json` file leveraged by sumodules defined using the `export * as namespace from './namespace';` syntax. The `.jsiirc.json` file is a sibling to what `./namespace` resolves to (since this typically resolves to `./namespace/index.ts`, the `.jsiirc.json` file must be at `./namespace/.jsiirc.json`). The `targets` key can je set within this `.jsiirc.json` document and include specific configuration for various targets: ```js { "targets": { "dotnet": { // Only the "namespace" key is considered/supported at this point "namespace": "Some.DotNet.Namespace" }, "java": { // Only the "package" key is considered/supported at this point "package": "some.java.package_name" }, "python": { // Only the "module" key is considered/supported at this point // The configured module name for a submodule _MUST_ be nested // under the root module name for the package. "module": "some.module_name" } } } ``` Related to #1286 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --- docs/specifications/2-type-system.md | 24 +++++++-- .../python-runtime/tests/test_compliance.py | 2 +- .../jsii-calc-lib/lib/submodule/.jsiirc.json | 13 +++++ .../@scope/jsii-calc-lib/test/assembly.jsii | 13 ++++- packages/jsii-calc/test/assembly.jsii | 13 ++++- .../lib/targets/dotnet/dotnetgenerator.ts | 6 +-- .../lib/targets/dotnet/dotnettyperesolver.ts | 34 ++++++++++-- packages/jsii-pacmak/lib/targets/java.ts | 52 ++++++++++++++----- packages/jsii-pacmak/lib/targets/python.ts | 22 +++----- .../lib/targets/python/type-name.ts | 10 ++++ .../.jsii | 13 ++++- .../IReflectable.cs | 4 +- .../IReflectableEntry.cs | 2 +- .../IReflectableProxy.cs | 8 +-- .../ReflectableEntry.cs | 4 +- .../ReflectableEntryProxy.cs | 4 +- .../Reflector.cs | 8 +-- .../IReflectable.java | 10 ++-- .../ReflectableEntry.java | 2 +- .../Reflector.java | 4 +- .../jsii/tests/calculator/lib/$Module.txt | 6 +-- .../expected.jsii-calc-lib/python/setup.py | 2 +- .../__init__.py | 0 .../.jsii | 13 ++++- .../UpcasingReflectable.cs | 10 ++-- .../tests/calculator/UpcasingReflectable.java | 10 ++-- .../python/src/jsii_calc/__init__.py | 8 +-- packages/jsii/lib/assembler.ts | 13 ++++- 28 files changed, 219 insertions(+), 91 deletions(-) create mode 100644 packages/@scope/jsii-calc-lib/lib/submodule/.jsiirc.json rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/IReflectable.cs (80%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/IReflectableEntry.cs (92%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/IReflectableProxy.cs (68%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/ReflectableEntry.cs (82%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/ReflectableEntryProxy.cs (88%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/{CalculatorNamespace/LibNamespace/Submodule => CustomSubmoduleName}/Reflector.cs (80%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/{lib/submodule => custom_submodule_name}/IReflectable.java (76%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/{lib/submodule => custom_submodule_name}/ReflectableEntry.java (98%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/{lib/submodule => custom_submodule_name}/Reflector.java (89%) rename packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/{submodule => custom_submodule_name}/__init__.py (100%) diff --git a/docs/specifications/2-type-system.md b/docs/specifications/2-type-system.md index 0e1b55ddb8..ab906b4421 100644 --- a/docs/specifications/2-type-system.md +++ b/docs/specifications/2-type-system.md @@ -325,11 +325,13 @@ qualified name of the namespace from the package's root (if a package `foo` defines a namespace `ns1`, which itself contains `ns2`, the submodule for `ns2` will be named `foo.ns1.ns2`). -*Submodules* may use different [code-generation configuration](#code-generation) -than their parent submodule or package. +*Submodules* are delcared in the *jsii* assembly under the `submodules` key. +This is also where specific [configuration](#submodule-configuration) +is registered, if different from the parent submodule or package. -> :construction: *Submodule*-level code-generation configuration is not yet -> implemented. +*Submodules* are hierarchical, and their fully qualified name is representative +of the relationship. For example the `assm.foo.bar` submodule is considered to +be nested under the `assm.foo` submodule. ### Restrictions @@ -364,13 +366,25 @@ documented using a markdown document located at `./module/README.md`. > :construction: The `./module/README.md` file support is not yet implemented. -### Code Generation +### Submodule Configuration In languages where this is relevant (e.g: **Python**), *submodules* are rendered as native *submodules*. In languages where a namespace system exists (**Java** uses *packages*, **C#** uses *namespaces*, ...), *submodules* are rendered using that. +By default, *submodule* names are rendered appropriately in the target language +(this typically involves adjusting the case of *submodule* name fragments to the +idiomatic form in the language). In certain cases however, a developer can +choose to use a different configuration by defining the *submodule* using the +namespaced-export syntax (`export * as namespace from './module-name';`) ny +placing a `.jsiirc.json` file next to the entry point of the namespaced module. +For example, if `./module-name`'s entry point is `foo/bar/module-name/index.ts`, +the *submodule* configuration resides in `foo/bar/module-name/.jsiirc.json`. + +Since *submodules* are hierarchical, the configuration of a given *submodule* +defines the default configuration of *submodules* nested under it. + ## Code Generation In order to generate code in various programming languages, [`jsii-pacmak`] diff --git a/packages/@jsii/python-runtime/tests/test_compliance.py b/packages/@jsii/python-runtime/tests/test_compliance.py index 7e24afe9f6..fadb55db26 100644 --- a/packages/@jsii/python-runtime/tests/test_compliance.py +++ b/packages/@jsii/python-runtime/tests/test_compliance.py @@ -78,7 +78,7 @@ ClassWithSelfKwarg, ) from scope.jsii_calc_lib import IFriendly, EnumFromScopedModule, Number -from scope.jsii_calc_lib.submodule import IReflectable, ReflectableEntry +from scope.jsii_calc_lib.custom_submodule_name import IReflectable, ReflectableEntry # Note: The names of these test functions have been chosen to map as closely to the diff --git a/packages/@scope/jsii-calc-lib/lib/submodule/.jsiirc.json b/packages/@scope/jsii-calc-lib/lib/submodule/.jsiirc.json new file mode 100644 index 0000000000..2fc8279c35 --- /dev/null +++ b/packages/@scope/jsii-calc-lib/lib/submodule/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.JSII.Tests.CustomSubmoduleName" + }, + "java": { + "package": "software.amazon.jsii.tests.calculator.custom_submodule_name" + }, + "python": { + "module": "scope.jsii_calc_lib.custom_submodule_name" + } + } +} diff --git a/packages/@scope/jsii-calc-lib/test/assembly.jsii b/packages/@scope/jsii-calc-lib/test/assembly.jsii index 672cc9843a..9fb1cd290e 100644 --- a/packages/@scope/jsii-calc-lib/test/assembly.jsii +++ b/packages/@scope/jsii-calc-lib/test/assembly.jsii @@ -77,6 +77,17 @@ "locationInModule": { "filename": "lib/index.ts", "line": 112 + }, + "targets": { + "dotnet": { + "namespace": "Amazon.JSII.Tests.CustomSubmoduleName" + }, + "java": { + "package": "software.amazon.jsii.tests.calculator.custom_submodule_name" + }, + "python": { + "module": "scope.jsii_calc_lib.custom_submodule_name" + } } } }, @@ -657,5 +668,5 @@ } }, "version": "0.0.0", - "fingerprint": "+7cEXNA9wAn/mht3AcwDtIFLvsfZoQhQGBQ4J1pPCO4=" + "fingerprint": "w6/8Kda6/JitSbpMK3LGPK5JGRxJ50gflR5S4sUEHKk=" } diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 6a53e319cc..b0144ed01d 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -89,6 +89,17 @@ "locationInModule": { "filename": "lib/index.ts", "line": 112 + }, + "targets": { + "dotnet": { + "namespace": "Amazon.JSII.Tests.CustomSubmoduleName" + }, + "java": { + "package": "software.amazon.jsii.tests.calculator.custom_submodule_name" + }, + "python": { + "module": "scope.jsii_calc_lib.custom_submodule_name" + } } } }, @@ -12989,5 +13000,5 @@ } }, "version": "0.0.0", - "fingerprint": "h3YiCcvHWOpzGACLQCBkRKp0glz4LOkpVZLrH4mtUvE=" + "fingerprint": "/DWCMji07IcZLGXOoefpKRPZyV9IHOIAR19tb1MHHWU=" } diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts index 9a55f6ad69..49d525b414 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts @@ -1,5 +1,4 @@ import * as clone from 'clone'; -import { toPascalCase } from 'codemaker'; import * as fs from 'fs-extra'; import * as reflect from 'jsii-reflect'; import * as spec from '@jsii/spec'; @@ -463,16 +462,15 @@ export class DotNetGenerator extends Generator { } private namespaceFor(assm: spec.Assembly, type: spec.Type): string { - const parts = [assm.targets!.dotnet!.namespace]; let ns = type.namespace; while (ns != null && assm.types?.[`${assm.name}.${ns}`] != null) { const nesting = assm.types[`${assm.name}.${ns}`]; ns = nesting.namespace; } if (ns != null) { - parts.push(...ns.split('.').map((n) => toPascalCase(n))); + return this.typeresolver.resolveNamespace(assm, assm.name, ns); } - return parts.join('.'); + return assm.targets!.dotnet!.namespace; } private emitMethod( diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts index 51775a07f3..00781bdbb8 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts @@ -54,7 +54,9 @@ export class DotNetTypeResolver { const dotnetNamespace = depMod.targets?.dotnet?.namespace; if (!dotnetNamespace) { - throw new Error('The module does not have a dotnet.namespace setting'); + throw new Error( + `The assembly ${mod} does not have a dotnet.namespace setting`, + ); } if (type.namespace) { // If the type is declared in an additional namespace. @@ -65,10 +67,8 @@ export class DotNetTypeResolver { const actualNamespace = this.toDotNetType(this.findType(namespaceFqn)); return `${actualNamespace}.${typeName}`; } - return `${dotnetNamespace}.${type.namespace - .split('.') - .map((s) => toPascalCase(s)) - .join('.')}.${typeName}`; + const ns = this.resolveNamespace(depMod, mod, type.namespace); + return `${ns}.${typeName}`; } // When undefined, the type is located at the root of the assembly return `${dotnetNamespace}.${typeName}`; @@ -137,6 +137,30 @@ export class DotNetTypeResolver { throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`); } + public resolveNamespace( + assm: spec.AssemblyConfiguration, + assmName: string, + ns: string, + ): string { + let resolved = assm.targets?.dotnet?.namespace; + if (!resolved) { + throw new Error( + `Assembly ${assmName} does not have targets.dotnet.namespace configured!`, + ); + } + const segments = ns.split('.'); + for (let i = 0; i < segments.length; i++) { + const submoduleName = `${assmName}.${segments.slice(0, i + 1).join('.')}`; + const submodule = assm.submodules?.[submoduleName]; + if (submodule && submodule.targets?.dotnet?.namespace) { + resolved = submodule.targets.dotnet.namespace; + } else { + resolved = `${resolved}.${toPascalCase(segments[i])}`; + } + } + return resolved; + } + /** * Translates a primitive in jsii to a native .NET primitive */ diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index 991be285a1..a282212dca 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -2613,13 +2613,8 @@ class JavaGenerator extends Generator { name: string | undefined, assmName: string = (assm as spec.Assembly).name, ): string { - const javaPackage = assm.targets?.java?.package; - if (!javaPackage) { - throw new Error( - `The module ${assmName} does not have a java.package setting`, - ); - } - return `${javaPackage}${name ? `.${name}` : ''}`; + const { javaPackage, tail } = resolvePackageName(assmName, assm, name); + return `${javaPackage}${tail ? `.${tail}` : ''}`; } private toNativeName(assm: spec.Assembly): { packageName: string }; @@ -2650,13 +2645,8 @@ class JavaGenerator extends Generator { typeName = `${nestingType.name}.${typeName}`; } - const packageName = - ns != null - ? `${javaPackage}.${ns - .split('.') - .map((s) => toSnakeCase(s)) - .join('.')}` - : javaPackage; + const packageName = resolvePackageName(assm.name, assm, ns).javaPackage; + return { packageName, typeName }; } @@ -2798,3 +2788,37 @@ function computeOverrides( }, }; } + +function resolvePackageName( + assmName: string, + config: spec.AssemblyConfiguration, + ns: string | undefined, +): { javaPackage: string; tail?: string } { + const rootPackage: string = config.targets?.java?.package; + if (!rootPackage) { + throw new Error( + `Assembly ${assmName} does not have a targets.java.package configured!`, + ); + } + if (!ns) { + return { javaPackage: rootPackage }; + } + + const segments = ns.split('.'); + let javaPackage = rootPackage; + for (let i = 0; i < segments.length; i++) { + const submoduleName = `${assmName}.${segments.slice(0, i + 1).join('.')}`; + const submodule = config.submodules?.[submoduleName]; + if (submodule == null) { + // We have reached a type name at this stage, so the rest is "tail". + return { javaPackage, tail: segments.slice(i).join('.') }; + } + const override = submodule.targets?.java?.package; + if (override) { + javaPackage = override; + } else { + javaPackage = `${javaPackage}.${toSnakeCase(segments[i])}`; + } + } + return { javaPackage }; +} diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 0a4f196424..d3e37f7c0a 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -24,6 +24,7 @@ import { toTypeName, PythonImports, mergePythonImports, + toPackageName, } from './python/type-name'; import { die, toPythonIdentifier } from './python/util'; @@ -1984,22 +1985,11 @@ class PythonGenerator extends Generator { } protected onBeginNamespace(ns: string) { - const module = new PythonModule( - [ - this.assembly.targets!.python!.module, - ...ns - .split('.') - .slice(1) - .map(toPythonIdentifier) - .map((s) => toSnakeCase(s)), - ].join('.'), - ns, - { - assembly: this.assembly, - assemblyFilename: this.getAssemblyFileName(), - package: this.package, - }, - ); + const module = new PythonModule(toPackageName(ns, this.assembly), ns, { + assembly: this.assembly, + assemblyFilename: this.getAssemblyFileName(), + package: this.package, + }); this.package.addModule(module); this.types.set(ns, module); diff --git a/packages/jsii-pacmak/lib/targets/python/type-name.ts b/packages/jsii-pacmak/lib/targets/python/type-name.ts index 821a7af6a1..2659c432ac 100644 --- a/packages/jsii-pacmak/lib/targets/python/type-name.ts +++ b/packages/jsii-pacmak/lib/targets/python/type-name.ts @@ -89,6 +89,16 @@ export function toTypeName(ref?: OptionalValue | TypeReference): TypeName { return optional ? new Optional(result) : result; } +/** + * Obtains the Python package name for a given submodule FQN. + * + * @param fqn the submodule FQN for which a package name is needed. + * @param rootAssm the assembly this FQN belongs to. + */ +export function toPackageName(fqn: string, rootAssm: Assembly): string { + return getPackageName(fqn, rootAssm).packageName; +} + export function mergePythonImports( ...pythonImports: readonly PythonImports[] ): PythonImports { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii index 672cc9843a..9fb1cd290e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/.jsii @@ -77,6 +77,17 @@ "locationInModule": { "filename": "lib/index.ts", "line": 112 + }, + "targets": { + "dotnet": { + "namespace": "Amazon.JSII.Tests.CustomSubmoduleName" + }, + "java": { + "package": "software.amazon.jsii.tests.calculator.custom_submodule_name" + }, + "python": { + "module": "scope.jsii_calc_lib.custom_submodule_name" + } } } }, @@ -657,5 +668,5 @@ } }, "version": "0.0.0", - "fingerprint": "+7cEXNA9wAn/mht3AcwDtIFLvsfZoQhQGBQ4J1pPCO4=" + "fingerprint": "w6/8Kda6/JitSbpMK3LGPK5JGRxJ50gflR5S4sUEHKk=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectable.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectable.cs similarity index 80% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectable.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectable.cs index cb663ed418..0fa74b3b3c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectable.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectable.cs @@ -2,7 +2,7 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { /// /// Stability: Deprecated @@ -16,7 +16,7 @@ public interface IReflectable /// [JsiiProperty(name: "entries", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.submodule.ReflectableEntry\"},\"kind\":\"array\"}}")] [System.Obsolete()] - Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectableEntry[] Entries + Amazon.JSII.Tests.CustomSubmoduleName.IReflectableEntry[] Entries { get; } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableEntry.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableEntry.cs similarity index 92% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableEntry.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableEntry.cs index 5ac2044763..e8d40a0c60 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableEntry.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableEntry.cs @@ -2,7 +2,7 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { /// /// Stability: Deprecated diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableProxy.cs similarity index 68% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableProxy.cs index 6556872948..e045a295a0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/IReflectableProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/IReflectableProxy.cs @@ -2,14 +2,14 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { /// /// Stability: Deprecated /// [JsiiTypeProxy(nativeType: typeof(IReflectable), fullyQualifiedName: "@scope/jsii-calc-lib.submodule.IReflectable")] [System.Obsolete()] - internal sealed class IReflectableProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectable + internal sealed class IReflectableProxy : DeputyBase, Amazon.JSII.Tests.CustomSubmoduleName.IReflectable { private IReflectableProxy(ByRefValue reference): base(reference) { @@ -20,9 +20,9 @@ private IReflectableProxy(ByRefValue reference): base(reference) /// [JsiiProperty(name: "entries", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.submodule.ReflectableEntry\"},\"kind\":\"array\"}}")] [System.Obsolete()] - public Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectableEntry[] Entries + public Amazon.JSII.Tests.CustomSubmoduleName.IReflectableEntry[] Entries { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntry.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntry.cs similarity index 82% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntry.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntry.cs index e19f53b677..7a7be17288 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntry.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntry.cs @@ -2,7 +2,7 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { #pragma warning disable CS8618 @@ -10,7 +10,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule /// Stability: Deprecated /// [JsiiByValue(fqn: "@scope/jsii-calc-lib.submodule.ReflectableEntry")] - public class ReflectableEntry : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectableEntry + public class ReflectableEntry : Amazon.JSII.Tests.CustomSubmoduleName.IReflectableEntry { /// /// Stability: Deprecated diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntryProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntryProxy.cs similarity index 88% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntryProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntryProxy.cs index dbf1eba4a2..5c118fb5b7 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/ReflectableEntryProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/ReflectableEntryProxy.cs @@ -2,14 +2,14 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { /// /// Stability: Deprecated /// [JsiiTypeProxy(nativeType: typeof(IReflectableEntry), fullyQualifiedName: "@scope/jsii-calc-lib.submodule.ReflectableEntry")] [System.Obsolete()] - internal sealed class ReflectableEntryProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectableEntry + internal sealed class ReflectableEntryProxy : DeputyBase, Amazon.JSII.Tests.CustomSubmoduleName.IReflectableEntry { private ReflectableEntryProxy(ByRefValue reference): base(reference) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/Reflector.cs b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/Reflector.cs similarity index 80% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/Reflector.cs rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/Reflector.cs index 63c5a9bc9d..f4603846c0 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/Submodule/Reflector.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CustomSubmoduleName/Reflector.cs @@ -2,12 +2,12 @@ #pragma warning disable CS0672,CS0809,CS1591 -namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule +namespace Amazon.JSII.Tests.CustomSubmoduleName { /// /// Stability: Deprecated /// - [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.Reflector), fullyQualifiedName: "@scope/jsii-calc-lib.submodule.Reflector")] + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CustomSubmoduleName.Reflector), fullyQualifiedName: "@scope/jsii-calc-lib.submodule.Reflector")] [System.Obsolete()] public class Reflector : DeputyBase { @@ -40,9 +40,9 @@ protected Reflector(DeputyProps props): base(props) /// [JsiiMethod(name: "asMap", returnsJson: "{\"type\":{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"map\"}}}", parametersJson: "[{\"name\":\"reflectable\",\"type\":{\"fqn\":\"@scope/jsii-calc-lib.submodule.IReflectable\"}}]")] [System.Obsolete()] - public virtual System.Collections.Generic.IDictionary AsMap(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectable reflectable) + public virtual System.Collections.Generic.IDictionary AsMap(Amazon.JSII.Tests.CustomSubmoduleName.IReflectable reflectable) { - return InvokeInstanceMethod>(new System.Type[]{typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectable)}, new object[]{reflectable}); + return InvokeInstanceMethod>(new System.Type[]{typeof(Amazon.JSII.Tests.CustomSubmoduleName.IReflectable)}, new object[]{reflectable}); } } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/IReflectable.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/IReflectable.java similarity index 76% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/IReflectable.java rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/IReflectable.java index b32a2a2f4c..c7d669f933 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/IReflectable.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/IReflectable.java @@ -1,4 +1,4 @@ -package software.amazon.jsii.tests.calculator.lib.submodule; +package software.amazon.jsii.tests.calculator.custom_submodule_name; /** */ @@ -13,12 +13,12 @@ public interface IReflectable extends software.amazon.jsii.JsiiSerializable { */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated - @org.jetbrains.annotations.NotNull java.util.List getEntries(); + @org.jetbrains.annotations.NotNull java.util.List getEntries(); /** * A proxy class which represents a concrete javascript instance of this type. */ - final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.submodule.IReflectable { + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.custom_submodule_name.IReflectable { protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } @@ -28,8 +28,8 @@ final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated - public @org.jetbrains.annotations.NotNull java.util.List getEntries() { - return java.util.Collections.unmodifiableList(this.jsiiGet("entries", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.lib.submodule.ReflectableEntry.class)))); + public @org.jetbrains.annotations.NotNull java.util.List getEntries() { + return java.util.Collections.unmodifiableList(this.jsiiGet("entries", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.custom_submodule_name.ReflectableEntry.class)))); } } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/ReflectableEntry.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/ReflectableEntry.java similarity index 98% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/ReflectableEntry.java rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/ReflectableEntry.java index adb4665c3d..2edd2ecbe2 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/ReflectableEntry.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/ReflectableEntry.java @@ -1,4 +1,4 @@ -package software.amazon.jsii.tests.calculator.lib.submodule; +package software.amazon.jsii.tests.calculator.custom_submodule_name; /** */ diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/Reflector.java b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/Reflector.java similarity index 89% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/Reflector.java rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/Reflector.java index ff0688485d..2bb2f08828 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/lib/submodule/Reflector.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/java/software/amazon/jsii/tests/calculator/custom_submodule_name/Reflector.java @@ -1,4 +1,4 @@ -package software.amazon.jsii.tests.calculator.lib.submodule; +package software.amazon.jsii.tests.calculator.custom_submodule_name; /** */ @@ -30,7 +30,7 @@ public Reflector() { */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated - public @org.jetbrains.annotations.NotNull java.util.Map asMap(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.lib.submodule.IReflectable reflectable) { + public @org.jetbrains.annotations.NotNull java.util.Map asMap(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.custom_submodule_name.IReflectable reflectable) { return java.util.Collections.unmodifiableMap(this.jsiiCall("asMap", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)), new Object[] { java.util.Objects.requireNonNull(reflectable, "reflectable is required") })); } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/resources/software/amazon/jsii/tests/calculator/lib/$Module.txt b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/resources/software/amazon/jsii/tests/calculator/lib/$Module.txt index b135e8f560..760699dfd9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/resources/software/amazon/jsii/tests/calculator/lib/$Module.txt +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/java/src/main/resources/software/amazon/jsii/tests/calculator/lib/$Module.txt @@ -7,6 +7,6 @@ @scope/jsii-calc-lib.Operation=software.amazon.jsii.tests.calculator.lib.Operation @scope/jsii-calc-lib.StructWithOnlyOptionals=software.amazon.jsii.tests.calculator.lib.StructWithOnlyOptionals @scope/jsii-calc-lib.Value=software.amazon.jsii.tests.calculator.lib.Value -@scope/jsii-calc-lib.submodule.IReflectable=software.amazon.jsii.tests.calculator.lib.submodule.IReflectable -@scope/jsii-calc-lib.submodule.ReflectableEntry=software.amazon.jsii.tests.calculator.lib.submodule.ReflectableEntry -@scope/jsii-calc-lib.submodule.Reflector=software.amazon.jsii.tests.calculator.lib.submodule.Reflector +@scope/jsii-calc-lib.submodule.IReflectable=software.amazon.jsii.tests.calculator.custom_submodule_name.IReflectable +@scope/jsii-calc-lib.submodule.ReflectableEntry=software.amazon.jsii.tests.calculator.custom_submodule_name.ReflectableEntry +@scope/jsii-calc-lib.submodule.Reflector=software.amazon.jsii.tests.calculator.custom_submodule_name.Reflector diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py index 5ac896d85e..27f201c7ad 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py @@ -19,7 +19,7 @@ "packages": [ "scope.jsii_calc_lib", "scope.jsii_calc_lib._jsii", - "scope.jsii_calc_lib.submodule" + "scope.jsii_calc_lib.custom_submodule_name" ], "package_data": { "scope.jsii_calc_lib._jsii": [ diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/submodule/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/custom_submodule_name/__init__.py similarity index 100% rename from packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/submodule/__init__.py rename to packages/jsii-pacmak/test/expected.jsii-calc-lib/python/src/scope/jsii_calc_lib/custom_submodule_name/__init__.py diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 6a53e319cc..b0144ed01d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -89,6 +89,17 @@ "locationInModule": { "filename": "lib/index.ts", "line": 112 + }, + "targets": { + "dotnet": { + "namespace": "Amazon.JSII.Tests.CustomSubmoduleName" + }, + "java": { + "package": "software.amazon.jsii.tests.calculator.custom_submodule_name" + }, + "python": { + "module": "scope.jsii_calc_lib.custom_submodule_name" + } } } }, @@ -12989,5 +13000,5 @@ } }, "version": "0.0.0", - "fingerprint": "h3YiCcvHWOpzGACLQCBkRKp0glz4LOkpVZLrH4mtUvE=" + "fingerprint": "/DWCMji07IcZLGXOoefpKRPZyV9IHOIAR19tb1MHHWU=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UpcasingReflectable.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UpcasingReflectable.cs index 6b7ea6eadd..7631f50509 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UpcasingReflectable.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UpcasingReflectable.cs @@ -9,7 +9,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Stability: Experimental /// [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UpcasingReflectable), fullyQualifiedName: "jsii-calc.UpcasingReflectable", parametersJson: "[{\"name\":\"delegate\",\"type\":{\"collection\":{\"elementtype\":{\"primitive\":\"any\"},\"kind\":\"map\"}}}]")] - public class UpcasingReflectable : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectable + public class UpcasingReflectable : DeputyBase, Amazon.JSII.Tests.CustomSubmoduleName.IReflectable { /// /// Stability: Experimental @@ -36,19 +36,19 @@ protected UpcasingReflectable(DeputyProps props): base(props) /// Stability: Experimental /// [JsiiProperty(name: "reflector", typeJson: "{\"fqn\":\"@scope/jsii-calc-lib.submodule.Reflector\"}")] - public static Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.Reflector Reflector + public static Amazon.JSII.Tests.CustomSubmoduleName.Reflector Reflector { get; } - = GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.UpcasingReflectable)); + = GetStaticProperty(typeof(Amazon.JSII.Tests.CalculatorNamespace.UpcasingReflectable)); /// /// Stability: Experimental /// [JsiiProperty(name: "entries", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"@scope/jsii-calc-lib.submodule.ReflectableEntry\"},\"kind\":\"array\"}}")] - public virtual Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Submodule.IReflectableEntry[] Entries + public virtual Amazon.JSII.Tests.CustomSubmoduleName.IReflectableEntry[] Entries { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UpcasingReflectable.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UpcasingReflectable.java index f8c163ea38..e2e2ba4cdd 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UpcasingReflectable.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UpcasingReflectable.java @@ -8,7 +8,7 @@ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.UpcasingReflectable") -public class UpcasingReflectable extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.lib.submodule.IReflectable { +public class UpcasingReflectable extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.custom_submodule_name.IReflectable { protected UpcasingReflectable(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); @@ -19,7 +19,7 @@ protected UpcasingReflectable(final software.amazon.jsii.JsiiObject.Initializati } static { - REFLECTOR = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.UpcasingReflectable.class, "reflector", software.amazon.jsii.tests.calculator.lib.submodule.Reflector.class); + REFLECTOR = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.jsii.tests.calculator.UpcasingReflectable.class, "reflector", software.amazon.jsii.tests.calculator.custom_submodule_name.Reflector.class); } /** @@ -37,14 +37,14 @@ public UpcasingReflectable(final @org.jetbrains.annotations.NotNull java.util.Ma * EXPERIMENTAL */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) - public final static software.amazon.jsii.tests.calculator.lib.submodule.Reflector REFLECTOR; + public final static software.amazon.jsii.tests.calculator.custom_submodule_name.Reflector REFLECTOR; /** * EXPERIMENTAL */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) - public @org.jetbrains.annotations.NotNull java.util.List getEntries() { - return java.util.Collections.unmodifiableList(this.jsiiGet("entries", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.lib.submodule.ReflectableEntry.class)))); + public @org.jetbrains.annotations.NotNull java.util.List getEntries() { + return java.util.Collections.unmodifiableList(this.jsiiGet("entries", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.custom_submodule_name.ReflectableEntry.class)))); } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py index cd82d9e81a..ac15e3e695 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py @@ -42,7 +42,7 @@ import scope.jsii_calc_base import scope.jsii_calc_base_of_base import scope.jsii_calc_lib -import scope.jsii_calc_lib.submodule +import scope.jsii_calc_lib.custom_submodule_name from .composition import (CompositeOperation as _CompositeOperation_1c4d123b) @@ -7598,7 +7598,7 @@ def __repr__(self) -> str: return 'UnionProperties(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) -@jsii.implements(scope.jsii_calc_lib.submodule.IReflectable) +@jsii.implements(scope.jsii_calc_lib.custom_submodule_name.IReflectable) class UpcasingReflectable(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.UpcasingReflectable"): """Ensures submodule-imported types from dependencies can be used correctly. @@ -7616,7 +7616,7 @@ def __init__(self, delegate: typing.Mapping[str, typing.Any]) -> None: @jsii.python.classproperty @jsii.member(jsii_name="reflector") - def REFLECTOR(cls) -> scope.jsii_calc_lib.submodule.Reflector: + def REFLECTOR(cls) -> scope.jsii_calc_lib.custom_submodule_name.Reflector: """ stability :stability: experimental @@ -7625,7 +7625,7 @@ def REFLECTOR(cls) -> scope.jsii_calc_lib.submodule.Reflector: @builtins.property @jsii.member(jsii_name="entries") - def entries(self) -> typing.List[scope.jsii_calc_lib.submodule.ReflectableEntry]: + def entries(self) -> typing.List[scope.jsii_calc_lib.custom_submodule_name.ReflectableEntry]: """ stability :stability: experimental diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index 0e9f92f29d..8bda394bc4 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -567,7 +567,7 @@ export class Assembler implements Emitter { this, symbol, ); - const targets = undefined; // This will be configurable in the future. + const targets = await loadSubmoduleTargetConfig(sourceFile.fileName); this._submodules.set(symbol, { fqn, @@ -603,6 +603,17 @@ export class Assembler implements Emitter { fqnResolutionPrefix: inlineNamespace ? this.projectInfo.name : fqn, }; } + + async function loadSubmoduleTargetConfig( + submoduleMain: string, + ): Promise { + const jsiirc = path.resolve(submoduleMain, '..', '.jsiirc.json'); + if (!(await fs.pathExists(jsiirc))) { + return undefined; + } + const data = await fs.readJson(jsiirc); + return data.targets; + } } /**