@gjsify/gi-runtime-android 0.64.10 → 0.64.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/gi-runtime-android",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.11",
|
|
4
4
|
"description": "NativeScript plugin that puts the GObject-Introspection runtime into an Android APK — libnode_gi.so plus the GLib/GObject/Gio closure and their typelibs, for arm64-v8a and x86_64. Add it as a dependency and @gjsify/node-gi's `requireGi` works on the device; no hand-copied .so, no jniLibs dir in App_Resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN platforms/THIRD-PARTY-NOTICES.md",
|
|
@@ -21,9 +21,12 @@
|
|
|
21
21
|
],
|
|
22
22
|
"nativescript": {
|
|
23
23
|
"platforms": {
|
|
24
|
-
"android": "
|
|
24
|
+
"android": "9.1.1"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@nativescript/android": ">=9.1.1"
|
|
29
|
+
},
|
|
27
30
|
"gjsify": {
|
|
28
31
|
"runtimes": {
|
|
29
32
|
"gjs": "none",
|
|
@@ -15,11 +15,20 @@
|
|
|
15
15
|
// is the one thing in `platforms/` that is COMMITTED, for exactly that reason — a guard
|
|
16
16
|
// that ships with the payload is a guard that is missing whenever it is needed.
|
|
17
17
|
//
|
|
18
|
+
// A SECOND failure this turns into a gradle error is an @nativescript/android too old to
|
|
19
|
+
// have Node-API: 9.1.0-alpha.6's libNativeScript.so exports ZERO `napi_*` symbols, 9.1.1
|
|
20
|
+
// exports 145. libnode_gi.so links against them, so on the older runtime the APK builds,
|
|
21
|
+
// installs and starts, and dies in `dlopen` with `cannot locate symbol
|
|
22
|
+
// napi_create_type_error` — a message that names neither NativeScript nor a version, and
|
|
23
|
+
// that cost a day's bisection in Learn6502. The floor is declared as this package's
|
|
24
|
+
// peerDependency so npm warns at install time; the warning scrolls past, this does not.
|
|
25
|
+
//
|
|
18
26
|
// `buildscript.sourceFile` is this script's own path: `projectDir` here is the APP's, not
|
|
19
27
|
// the plugin's, and hardcoding a `node_modules` path would break under `file:` links,
|
|
20
28
|
// pnpm's store and a gjsify worktree alike.
|
|
21
29
|
def gjsifyGiRuntimeDir = buildscript.sourceFile.parentFile
|
|
22
30
|
def gjsifyGiRuntimeAar = new File(gjsifyGiRuntimeDir, 'gi-runtime-android.aar')
|
|
31
|
+
def gjsifyGiRuntimeRoot = gjsifyGiRuntimeDir.parentFile.parentFile
|
|
23
32
|
|
|
24
33
|
if (!gjsifyGiRuntimeAar.exists()) {
|
|
25
34
|
throw new GradleException("""
|
|
@@ -42,3 +51,77 @@ has a worked invocation. An installed npm tarball always carries the AAR — thi
|
|
|
42
51
|
only happen against a source checkout.
|
|
43
52
|
""")
|
|
44
53
|
}
|
|
54
|
+
|
|
55
|
+
// The floor is READ from this package's own `peerDependencies`, not written here: package.json
|
|
56
|
+
// is the only file that reaches an installed tarball AND carries the number (`files` ships
|
|
57
|
+
// `index.js`, `index.d.ts` and `platforms/` — not `build-inputs.json`, which is where the
|
|
58
|
+
// version is maintained and which a test holds equal to this range).
|
|
59
|
+
def gjsifyOwnManifest = new File(gjsifyGiRuntimeRoot, 'package.json')
|
|
60
|
+
def gjsifyNsFloor = null
|
|
61
|
+
if (gjsifyOwnManifest.exists()) {
|
|
62
|
+
def declared = new groovy.json.JsonSlurper()
|
|
63
|
+
.parseText(gjsifyOwnManifest.getText('UTF-8'))
|
|
64
|
+
?.peerDependencies?.get('@nativescript/android')
|
|
65
|
+
if (declared) gjsifyNsFloor = declared.replaceFirst(/^[^0-9]+/, '')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// `rootDir` is the GENERATED `platforms/android` project; two levels up is the app root that
|
|
69
|
+
// holds `node_modules` (the same path `settings.gradle` calls USER_PROJECT_ROOT). The app's
|
|
70
|
+
// resolution is the one that matters — the runtime AAR in `libs/runtime-libs` came from it —
|
|
71
|
+
// so it is searched first, and a walk up from the plugin covers pnpm's nesting after that.
|
|
72
|
+
def gjsifyFindNsManifest = { File from ->
|
|
73
|
+
for (File dir = from; dir != null; dir = dir.parentFile) {
|
|
74
|
+
def candidate = new File(dir, 'node_modules/@nativescript/android/package.json')
|
|
75
|
+
if (candidate.exists()) return candidate
|
|
76
|
+
}
|
|
77
|
+
return null
|
|
78
|
+
}
|
|
79
|
+
def gjsifyNsManifest = gjsifyFindNsManifest(new File(rootDir, '../..').canonicalFile)
|
|
80
|
+
if (gjsifyNsManifest == null) gjsifyNsManifest = gjsifyFindNsManifest(gjsifyGiRuntimeRoot)
|
|
81
|
+
|
|
82
|
+
// Prereleases sort BELOW their own release, which is the whole point: the runtime that broke
|
|
83
|
+
// Learn6502 was 9.1.0-alpha.6, and a floor that reads it as "9.1.0, close enough" catches
|
|
84
|
+
// nothing.
|
|
85
|
+
def gjsifyVersionBelow = { String found, String floor ->
|
|
86
|
+
def parse = { String version ->
|
|
87
|
+
def halves = version.split('-', 2)
|
|
88
|
+
def numbers = halves[0].split(/\./).collect { it.isInteger() ? it.toInteger() : 0 }
|
|
89
|
+
while (numbers.size() < 3) numbers << 0
|
|
90
|
+
[numbers, halves.size() > 1]
|
|
91
|
+
}
|
|
92
|
+
def (foundNumbers, foundPre) = parse(found)
|
|
93
|
+
def (floorNumbers, floorPre) = parse(floor)
|
|
94
|
+
for (int i = 0; i < 3; i++) {
|
|
95
|
+
if (foundNumbers[i] != floorNumbers[i]) return foundNumbers[i] < floorNumbers[i]
|
|
96
|
+
}
|
|
97
|
+
return foundPre && !floorPre
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Saying "not checked" out loud is the point of the two quiet branches: a guard that fails to
|
|
101
|
+
// run looks exactly like a guard that passed.
|
|
102
|
+
if (gjsifyNsFloor == null) {
|
|
103
|
+
println("@gjsify/gi-runtime-android: no @nativescript/android floor in ${gjsifyOwnManifest} — NOT checked.")
|
|
104
|
+
} else if (gjsifyNsManifest == null) {
|
|
105
|
+
println("@gjsify/gi-runtime-android: found no installed @nativescript/android, so its version was NOT checked against the required >= ${gjsifyNsFloor}.")
|
|
106
|
+
} else {
|
|
107
|
+
def gjsifyNsVersion = new groovy.json.JsonSlurper()
|
|
108
|
+
.parseText(gjsifyNsManifest.getText('UTF-8'))?.version
|
|
109
|
+
if (gjsifyNsVersion == null) {
|
|
110
|
+
println("@gjsify/gi-runtime-android: ${gjsifyNsManifest} declares no version, so the required >= ${gjsifyNsFloor} was NOT checked.")
|
|
111
|
+
} else if (gjsifyVersionBelow(gjsifyNsVersion, gjsifyNsFloor)) {
|
|
112
|
+
throw new GradleException("""
|
|
113
|
+
@nativescript/android ${gjsifyNsVersion} is too old for @gjsify/gi-runtime-android, which needs >= ${gjsifyNsFloor}.
|
|
114
|
+
resolved from: ${gjsifyNsManifest}
|
|
115
|
+
|
|
116
|
+
libnode_gi.so calls Node-API, and NativeScript's libNativeScript.so is what provides it on
|
|
117
|
+
Android. Runtimes before ${gjsifyNsFloor} export no `napi_*` symbols at all, so this APK would build,
|
|
118
|
+
install and launch, and then abort in dlopen at the first requireGi with
|
|
119
|
+
|
|
120
|
+
cannot locate symbol "napi_create_type_error" referenced by "libnode_gi.so"
|
|
121
|
+
|
|
122
|
+
— a message that names neither NativeScript nor a version. Raise the dependency in the app:
|
|
123
|
+
|
|
124
|
+
npm install --save-dev @nativescript/android@^${gjsifyNsFloor}
|
|
125
|
+
""")
|
|
126
|
+
}
|
|
127
|
+
}
|