Skip to content

Commit f69f99b

Browse files
committed
excluding wasm from generation
1 parent dcefb16 commit f69f99b

File tree

3 files changed

+9
-39
lines changed

3 files changed

+9
-39
lines changed

src/tools/schema2kotlin.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ package ${this.scope}
5454
// Current implementation doesn't support references or optional field detection
5555
5656
import arcs.sdk.*
57+
${this.opts.wasm ?
58+
`import arcs.sdk.wasm.*` :
59+
`\
5760
import arcs.sdk.Entity
5861
import arcs.core.data.*
59-
${this.opts.wasm ? 'import arcs.sdk.wasm.*' : 'import arcs.core.storage.api.toPrimitiveValue\nimport arcs.core.data.RawEntity\nimport arcs.core.data.util.toReferencable\nimport arcs.core.data.util.ReferencablePrimitive'}
62+
import arcs.core.data.util.toReferencable
63+
import arcs.core.data.util.ReferencablePrimitive
64+
import arcs.core.storage.api.toPrimitiveValue`}
6065
`;
6166
}
6267

@@ -296,6 +301,7 @@ ${this.opts.wasm ? `
296301
297302
class ${name}_Spec() : ${this.getType('EntitySpec')}<${name}> {
298303
304+
${this.opts.wasm ? '' : `\
299305
companion object {
300306
init {
301307
SchemaRegistry.schemas.plusAssign(mapOf(
@@ -304,7 +310,7 @@ ${this.leftPad(this.createSchema(schemaHash), 16)}
304310
))
305311
}
306312
}
307-
313+
`}
308314
override fun create() = ${name}()
309315
${!this.opts.wasm ? `
310316
override fun deserialize(data: RawEntity): ${name} {

src/tools/tests/goldens/generated-schemas.jvm.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ package arcs.sdk
1111
import arcs.sdk.*
1212
import arcs.sdk.Entity
1313
import arcs.core.data.*
14-
import arcs.core.storage.api.toPrimitiveValue
15-
import arcs.core.data.RawEntity
1614
import arcs.core.data.util.toReferencable
1715
import arcs.core.data.util.ReferencablePrimitive
16+
import arcs.core.storage.api.toPrimitiveValue
1817

1918
class GoldInternal1() : Entity {
2019

src/tools/tests/goldens/generated-schemas.wasm.kt

-35
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ package arcs.sdk
99
// Current implementation doesn't support references or optional field detection
1010

1111
import arcs.sdk.*
12-
import arcs.sdk.Entity
13-
import arcs.core.data.*
1412
import arcs.sdk.wasm.*
1513

1614
class GoldInternal1() : WasmEntity {
@@ -71,21 +69,6 @@ class GoldInternal1() : WasmEntity {
7169

7270
class GoldInternal1_Spec() : WasmEntitySpec<GoldInternal1> {
7371

74-
companion object {
75-
init {
76-
SchemaRegistry.schemas.plusAssign(mapOf(
77-
"485712110d89359a3e539dac987329cd2649d889" to
78-
Schema(
79-
listOf(),
80-
SchemaFields(
81-
singletons = mapOf("val" to FieldType.Text),
82-
collections = emptyMap()
83-
),
84-
"485712110d89359a3e539dac987329cd2649d889"
85-
)
86-
))
87-
}
88-
}
8972

9073
override fun create() = GoldInternal1()
9174

@@ -223,24 +206,6 @@ class Gold_Data() : WasmEntity {
223206

224207
class Gold_Data_Spec() : WasmEntitySpec<Gold_Data> {
225208

226-
companion object {
227-
init {
228-
SchemaRegistry.schemas.plusAssign(mapOf(
229-
"d8058d336e472da47b289eafb39733f77eadb111" to
230-
Schema(
231-
listOf(),
232-
SchemaFields(
233-
singletons = mapOf("num" to FieldType.Number,
234-
"txt" to FieldType.Text,
235-
"lnk" to FieldType.Text,
236-
"flg" to FieldType.Boolean),
237-
collections = emptyMap()
238-
),
239-
"d8058d336e472da47b289eafb39733f77eadb111"
240-
)
241-
))
242-
}
243-
}
244209

245210
override fun create() = Gold_Data()
246211

0 commit comments

Comments
 (0)