@threenative/runtime-native 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +236 -1
- package/android/app/build.gradle.kts +37 -2
- package/android/app/src/main/java/com/mystral/engine/MystralActivity.java +62 -0
- package/android/build.gradle.kts +1 -1
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/package.json +15 -4
- package/scripts/asset-manifest.mjs +190 -0
- package/scripts/asset-preflight.mjs +137 -6
- package/scripts/bundle.mjs +25 -5
- package/scripts/check-android-16kb-alignment.mjs +413 -0
- package/scripts/desktop-distribution.mjs +1084 -0
- package/scripts/inspect-container-brand.mjs +748 -0
- package/scripts/install-prebuilt.mjs +56 -10
- package/scripts/package-android.mjs +478 -32
- package/scripts/package-desktop.mjs +191 -15
- package/scripts/package-ios.mjs +53 -10
- package/scripts/production-evidence.mjs +7 -3
- package/scripts/profile-production.mjs +109 -28
- package/scripts/verify-starter-consumer.mjs +732 -0
- package/scripts/verify-starter-desktop-base.mjs +448 -0
- package/scripts/verify-starter-desktop.mjs +27 -220
- package/scripts/verify-windows-installer.mjs +63 -0
- package/scripts/windows-installer.mjs +181 -0
- package/scripts/windows-installer.nsi +114 -0
- package/scripts/xvfb.sh +48 -1
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
|
@@ -117,6 +117,27 @@ function isLoopbackFixture(url) {
|
|
|
117
117
|
!url.username && !url.password;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* The keys a manifest declares it advertises.
|
|
122
|
+
*
|
|
123
|
+
* A manifest may carry `requiredKeys`; absent, the strict full-cohort default below is unchanged, so
|
|
124
|
+
* the official CI release keeps its guarantee. A scoped manifest is how a local release states which
|
|
125
|
+
* of the platform matrices this host actually built, without claiming the rest.
|
|
126
|
+
*/
|
|
127
|
+
function declaredRequiredKeys(manifest) {
|
|
128
|
+
if (manifest.requiredKeys === undefined) return undefined;
|
|
129
|
+
if (!Array.isArray(manifest.requiredKeys) || manifest.requiredKeys.length === 0 ||
|
|
130
|
+
manifest.requiredKeys.some((key) => typeof key !== 'string')) {
|
|
131
|
+
throw new Error('Prebuilt manifest requiredKeys must be a non-empty array of prebuilt release keys.');
|
|
132
|
+
}
|
|
133
|
+
for (const key of manifest.requiredKeys) {
|
|
134
|
+
if (!Object.hasOwn(PREBUILT_ASSET_NAMES, key)) {
|
|
135
|
+
throw new Error(`Unknown prebuilt release key '${key}' in manifest requiredKeys.`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return manifest.requiredKeys;
|
|
139
|
+
}
|
|
140
|
+
|
|
120
141
|
function validateManifestEnvelope(manifest, options) {
|
|
121
142
|
if (manifest?.schemaVersion !== 1) throw new Error('Unsupported or missing prebuilt manifest schemaVersion.');
|
|
122
143
|
const version = options.version ?? packageVersion;
|
|
@@ -129,6 +150,7 @@ function validateManifestEnvelope(manifest, options) {
|
|
|
129
150
|
if (options.sourceSha !== undefined && manifest.sourceSha !== options.sourceSha) {
|
|
130
151
|
throw new Error(`Prebuilt source SHA mismatch: expected ${options.sourceSha}, received ${manifest.sourceSha}.`);
|
|
131
152
|
}
|
|
153
|
+
declaredRequiredKeys(manifest);
|
|
132
154
|
if (!manifest.artifacts || typeof manifest.artifacts !== 'object' || Array.isArray(manifest.artifacts)) {
|
|
133
155
|
throw new Error('Prebuilt manifest artifacts must be an object.');
|
|
134
156
|
}
|
|
@@ -151,23 +173,39 @@ function validateManifestArtifact(manifest, key, version) {
|
|
|
151
173
|
/** Validate the entire advertised cohort before selecting even one consumer artifact. */
|
|
152
174
|
export function validateReleaseManifest(manifest, options = {}) {
|
|
153
175
|
const version = validateManifestEnvelope(manifest, options);
|
|
154
|
-
//
|
|
155
|
-
|
|
176
|
+
// A caller's explicit scope wins; then the manifest's own advertised keys; then the strict
|
|
177
|
+
// non-iOS cohort. iOS retains its separate release gate, so it is not a prerequisite for a
|
|
178
|
+
// non-iOS consumer, and a scoped local manifest is accepted for exactly the keys it names.
|
|
179
|
+
const requiredKeys = options.requiredKeys ?? declaredRequiredKeys(manifest) ??
|
|
156
180
|
PUBLISHED_PREBUILT_KEYS.filter((key) => !key.startsWith('ios-'));
|
|
157
181
|
for (const key of requiredKeys) releaseFromManifest(manifest, key);
|
|
158
182
|
for (const key of Object.keys(manifest.artifacts)) validateManifestArtifact(manifest, key, version);
|
|
159
183
|
return manifest;
|
|
160
184
|
}
|
|
161
185
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
186
|
+
/**
|
|
187
|
+
* The release workflow uses this same validator, including its existing iOS requirement.
|
|
188
|
+
*
|
|
189
|
+
* `keys` narrows the matrix to the artifacts this caller staged: the lock then advertises exactly
|
|
190
|
+
* those keys (`requiredKeys`) and refuses if one is missing from the directory. Omitted, the full
|
|
191
|
+
* published matrix is required and the lock carries no `requiredKeys`, so every consumer keeps the
|
|
192
|
+
* strict default.
|
|
193
|
+
*/
|
|
194
|
+
export function generateReleaseManifest(directory, { repository, tag, sourceSha, keys }) {
|
|
164
195
|
if (repository !== RELEASE_REPOSITORY) {
|
|
165
196
|
throw new Error(`Prebuilt releases must be published by ${RELEASE_REPOSITORY}, received ${repository}.`);
|
|
166
197
|
}
|
|
167
|
-
if (tag !==
|
|
168
|
-
throw new Error(`Prebuilt release tag must be
|
|
198
|
+
if (tag !== releaseTag()) {
|
|
199
|
+
throw new Error(`Prebuilt release tag must be ${releaseTag()}, received ${tag}.`);
|
|
169
200
|
}
|
|
170
|
-
const
|
|
201
|
+
const selectedKeys = keys === undefined ? [...PUBLISHED_PREBUILT_KEYS] : keys;
|
|
202
|
+
if (!Array.isArray(selectedKeys) || selectedKeys.length === 0) {
|
|
203
|
+
throw new Error('Prebuilt release keys must be a non-empty array.');
|
|
204
|
+
}
|
|
205
|
+
const published = selectedKeys.map((key) => {
|
|
206
|
+
if (!Object.hasOwn(PREBUILT_ASSET_NAMES, key)) throw new Error(`Unknown prebuilt release key '${key}'.`);
|
|
207
|
+
return [key, PREBUILT_ASSET_NAMES[key]];
|
|
208
|
+
});
|
|
171
209
|
const expected = published.map(([, name]) => name).sort();
|
|
172
210
|
const actual = readdirSync(directory).sort();
|
|
173
211
|
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
@@ -179,8 +217,11 @@ export function generateReleaseManifest(directory, { repository, tag, sourceSha
|
|
|
179
217
|
return [key, { sha256: sha256(contents), size: contents.length,
|
|
180
218
|
url: `${releaseManifestUrl().replace('/prebuilt-lock.json', '')}/${name}` }];
|
|
181
219
|
}));
|
|
182
|
-
return validateReleaseManifest(
|
|
183
|
-
{
|
|
220
|
+
return validateReleaseManifest(
|
|
221
|
+
{ schemaVersion: 1, version: packageVersion, sourceSha, artifacts,
|
|
222
|
+
...(keys === undefined ? {} : { requiredKeys: [...selectedKeys] }) },
|
|
223
|
+
{ sourceSha, requiredKeys: selectedKeys },
|
|
224
|
+
);
|
|
184
225
|
}
|
|
185
226
|
|
|
186
227
|
export function readRelease(manifestPath, key) {
|
|
@@ -198,8 +239,13 @@ export function readRelease(manifestPath, key) {
|
|
|
198
239
|
return releaseFromManifest(manifest, key);
|
|
199
240
|
}
|
|
200
241
|
|
|
242
|
+
/** The GitHub release tag a version's prebuilt payload is published under. */
|
|
243
|
+
export function releaseTag(version = packageVersion) {
|
|
244
|
+
return `runtime-native-v${version}`;
|
|
245
|
+
}
|
|
246
|
+
|
|
201
247
|
export function releaseManifestUrl(version = packageVersion) {
|
|
202
|
-
return `https://github.com/${RELEASE_REPOSITORY}/releases/download
|
|
248
|
+
return `https://github.com/${RELEASE_REPOSITORY}/releases/download/${releaseTag(version)}/prebuilt-lock.json`;
|
|
203
249
|
}
|
|
204
250
|
|
|
205
251
|
export function writeInstallStatus(status, statusPath = join(packageRoot, 'prebuilt', 'install-status.json')) {
|