Skip to content

Commit 1b65e21

Browse files
Add C api version for native components (#318)
#### Summary of Changes For native components read the C api version information from the bundle similarly to what we do for "platform" information. The C api version is specific to each bundle. If the bundle doesn't contain a C api version, then return "N/A" and skip this information in the manifest file. Otherwise use the C api version to populate the manifest inside appPackageManifest. #### Description of testing Checked the changes are backwards compatible by generating a manifest for a native component without C api version. Checked that the manifest contains the C api version information if it is present in the native component. Signed-off-by: Catalina Mocanu <catalinamocanu@google.com>
1 parent ce21112 commit 1b65e21

8 files changed

Lines changed: 32912 additions & 18 deletions

src/__snapshots__/appPackageManifest.test.ts.snap

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,57 @@ Object {
3333
}
3434
`;
3535

36+
exports[`builds a package manifest for native app with platform C API version 1`] = `
37+
Object {
38+
"appId": "b4ae822e-eca9-4fcb-8747-217f2a1f53a1",
39+
"buildId": "0x0f75775f470c1585",
40+
"components": Object {
41+
"watch": Object {
42+
"hera": Object {
43+
"filename": "device-hera.zip",
44+
"platform": Array [
45+
"128.1.1+",
46+
],
47+
"platformCApiVersion": "1.2.3",
48+
},
49+
},
50+
},
51+
"manifestVersion": 6,
52+
"requestedPermissions": Array [],
53+
"sourceMaps": Object {},
54+
}
55+
`;
56+
57+
exports[`builds a package manifest for native app with platform C API version and companinon 1`] = `
58+
Object {
59+
"appId": "b4ae822e-eca9-4fcb-8747-217f2a1f53a1",
60+
"buildId": "0x0f75775f470c1585",
61+
"components": Object {
62+
"companion": Object {
63+
"filename": "companion.zip",
64+
},
65+
"watch": Object {
66+
"hera": Object {
67+
"filename": "device-hera.zip",
68+
"platform": Array [
69+
"128.1.1+",
70+
],
71+
"platformCApiVersion": "1.2.3",
72+
},
73+
},
74+
},
75+
"manifestVersion": 6,
76+
"requestedPermissions": Array [],
77+
"sdkVersion": Object {
78+
"companionApi": "3.5.0",
79+
},
80+
"sourceMaps": Object {
81+
"companion": "sourceMaps/companion/companion.js.json",
82+
"settings": "sourceMaps/settings/settings.js.json",
83+
},
84+
}
85+
`;
86+
3687
exports[`builds a package manifest with a companion 1`] = `
3788
Object {
3889
"appId": "b4ae822e-eca9-4fcb-8747-217f2a1f53a1",
@@ -256,6 +307,8 @@ Object {
256307
}
257308
`;
258309

310+
exports[`doesn't include platform C api version for non native apps 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>)) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>))/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
311+
259312
exports[`doesn't include tile data if app type is not APP 1`] = `
260313
Object {
261314
"appId": "b4ae822e-eca9-4fcb-8747-217f2a1f53a1",
@@ -276,13 +329,13 @@ Object {
276329
}
277330
`;
278331
279-
exports[`emits an error if a component bundle tag has a device type but invalid platform 1`] = `"Unknown bundle component tag: Invalid value \\"1.1.1+\\" supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
332+
exports[`emits an error if a component bundle tag has a device type but invalid platform 1`] = `"Unknown bundle component tag: Invalid value \\"1.1.1+\\" supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>)) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>))/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
280333
281-
exports[`emits an error if a component bundle tag has a device type but missing family 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/family: string"`;
334+
exports[`emits an error if a component bundle tag has a device type but missing family 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>)) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>))/0: { type: \\"device\\", family: string, platform: Array<string> }/family: string"`;
282335
283-
exports[`emits an error if a component bundle tag has a device type but missing platform 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>)/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
336+
exports[`emits an error if a component bundle tag has a device type but missing platform 1`] = `"Unknown bundle component tag: Invalid value undefined supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>)) | { type: \\"companion\\" })/0: ({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>))/0: { type: \\"device\\", family: string, platform: Array<string> }/platform: Array<string>"`;
284337
285-
exports[`emits an error if a component bundle tag has an invalid type field 1`] = `"Unknown bundle component tag: Invalid value {\\"type\\":\\"__invalid__\\"} supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & Partial<{ isNative: true }>) | { type: \\"companion\\" })"`;
338+
exports[`emits an error if a component bundle tag has an invalid type field 1`] = `"Unknown bundle component tag: Invalid value {\\"type\\":\\"__invalid__\\"} supplied to : (({ type: \\"device\\", family: string, platform: Array<string> } & ({ isNative: true, platformCApiVersion: string } | Partial<{ isNative: (true | undefined), platformCApiVersion: undefined }>)) | { type: \\"companion\\" })"`;
286339
287340
exports[`emits an error if both JS and native device components are present 1`] = `"Cannot bundle mixed native/JS device components"`;
288341

0 commit comments

Comments
 (0)