Skip to content

Commit a455540

Browse files
committed
Fix Kotlin integration
1 parent cc6b6b8 commit a455540

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

integrations/kotlin/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all deps format format-check test generate generate-check parity check runtime-build example-build runtime-test release-check publish-local demo clean
1+
.PHONY: all deps format format-check test root-types generate generate-check parity check runtime-build example-build runtime-test release-check publish-local demo clean
22

33
GRADLE ?= ./gradlew
44
NODE ?= node
@@ -18,14 +18,17 @@ format-check:
1818
test: deps
1919
$(GRADLE) jsBrowserTest
2020

21-
generate:
21+
root-types:
22+
$(MAKE) -C ../.. types
23+
24+
generate: root-types
2225
$(NODE) tool/generate_kotlin_bindings.mjs
2326
$(GRADLE) formatKotlin
2427

25-
generate-check:
28+
generate-check: root-types
2629
$(NODE) tool/check_generated_bindings.mjs
2730

28-
parity:
31+
parity: root-types
2932
$(NODE) tool/check_ng_namespace_parity.mjs
3033
$(NODE) tool/check_ng_namespace_members.mjs
3134

integrations/kotlin/src/jsMain/kotlin/angular/ts/generated/NgFacades.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,16 @@ public external interface AnimateService {
231231
}
232232

233233
public external interface AnimationHandle {
234-
public var animations: dynamic
235234
public fun cancel(): Unit
236235
public fun catch(p0: Function<*> = definedExternally): dynamic
237-
public var cleanup: dynamic
238236
public fun complete(p0: Boolean = definedExternally): Unit
239237
public var controller: dynamic
240238
public fun done(p0: Function<*> = definedExternally): Unit
241-
public var doneCallbacks: dynamic
242239
public fun finally(p0: Function<*> = definedExternally): dynamic
243240
public fun finish(): Unit
244241
public var finished: dynamic
245242
public fun pause(): Unit
246243
public fun play(): Unit
247-
public var settled: dynamic
248-
public var status: dynamic
249244
public fun then(p0: Function<*> = definedExternally, p1: Function<*> = definedExternally): dynamic
250245
}
251246

integrations/kotlin/tool/generate_kotlin_bindings.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ function extractNamespaceTypes(sourcePath, overrides) {
6767
const sourceFile = program.getSourceFile(sourcePath);
6868
const types = [];
6969

70+
if (!sourceFile) {
71+
throw new Error(
72+
`Unable to read generated namespace declarations at ${sourcePath}. ` +
73+
"Run `make types` from the repository root first.",
74+
);
75+
}
76+
7077
function visit(node, inNgNamespace = false) {
7178
if (ts.isModuleDeclaration(node)) {
7279
const nextInNgNamespace =
@@ -127,6 +134,7 @@ function collectMembers(checker, overrides, typeName, type) {
127134
const declaration = property.valueDeclaration ?? property.declarations?.[0];
128135

129136
if (property.name === "__type" || !isRepoTypesNode(declaration)) continue;
137+
if (!isPublicDeclaration(declaration)) continue;
130138
if (skippedByOverride(typeName, property.name, manual, unsupported)) continue;
131139

132140
const propertyType = checker.getTypeOfSymbolAtLocation(property, declaration);
@@ -323,6 +331,14 @@ function isRepoTypesNode(node) {
323331
);
324332
}
325333

334+
function isPublicDeclaration(node) {
335+
return !node.modifiers?.some(
336+
(modifier) =>
337+
modifier.kind === ts.SyntaxKind.PrivateKeyword ||
338+
modifier.kind === ts.SyntaxKind.ProtectedKeyword,
339+
);
340+
}
341+
326342
if (process.argv[1] === new URL(import.meta.url).pathname) {
327343
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
328344
fs.writeFileSync(outputPath, generateBindings());

0 commit comments

Comments
 (0)