expo-modules-autolinking 56.0.3 → 56.0.4
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/CHANGELOG.md +4 -0
- package/android/expo-gradle-plugin/expo-autolinking-plugin/src/main/kotlin/expo/modules/plugin/ExpoRootProjectPlugin.kt +19 -9
- package/android/expo-gradle-plugin/expo-autolinking-plugin/src/main/kotlin/expo/modules/plugin/KSPLookup.kt +5 -10
- package/package.json +2 -2
- package/scripts/generateKSPLookup.js +0 -101
package/CHANGELOG.md
CHANGED
|
@@ -34,18 +34,27 @@ fun Project.defineDefaultProperties(versionCatalogs: Optional<VersionCatalog>) {
|
|
|
34
34
|
val kotlin = extra.setIfNotExist("kotlinVersion") { versionCatalogs.getVersionOrDefault("kotlin", "2.0.21") }
|
|
35
35
|
val ksp = extra.setIfNotExist("kspVersion") {
|
|
36
36
|
versionCatalogs.getVersionOrDefault("ksp") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
e
|
|
43
|
-
)
|
|
37
|
+
val kotlinVersion = extra.get("kotlinVersion") as String
|
|
38
|
+
|
|
39
|
+
KSPLookup[kotlinVersion]?.let { return@getVersionOrDefault it }
|
|
40
|
+
if (kotlinVersion >= "2.3.0") {
|
|
41
|
+
return@getVersionOrDefault latestKspVersion
|
|
44
42
|
}
|
|
43
|
+
|
|
44
|
+
val minSupported = KSPLookup.keys.min()
|
|
45
|
+
throw IllegalStateException(
|
|
46
|
+
"""
|
|
47
|
+
Kotlin $kotlinVersion is not supported by Expo modules.
|
|
48
|
+
The minimum supported Kotlin version is $minSupported.
|
|
49
|
+
Update 'kotlinVersion' in your project's build.gradle to a supported version.
|
|
50
|
+
Alternatively, you can set 'kspVersion' explicitly in build.gradle to bypass this check, but this is unsupported and may cause build failures.
|
|
51
|
+
""".trimIndent()
|
|
52
|
+
)
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
project.logger.quiet(
|
|
56
|
+
project.logger.quiet(
|
|
57
|
+
"""
|
|
49
58
|
${"[ExpoRootProject]".withColor(Colors.GREEN)} Using the following versions:
|
|
50
59
|
- buildTools: ${buildTools.withColor(Colors.GREEN)}
|
|
51
60
|
- minSdk: ${minSdk.withColor(Colors.GREEN)}
|
|
@@ -54,7 +63,8 @@ fun Project.defineDefaultProperties(versionCatalogs: Optional<VersionCatalog>) {
|
|
|
54
63
|
- ndk: ${ndk.withColor(Colors.GREEN)}
|
|
55
64
|
- kotlin: ${kotlin.withColor(Colors.GREEN)}
|
|
56
65
|
- ksp: ${ksp.withColor(Colors.GREEN)}
|
|
57
|
-
""".trimIndent()
|
|
66
|
+
""".trimIndent()
|
|
67
|
+
)
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
inline fun ExtraPropertiesExtension.setIfNotExist(name: String, value: () -> Any): Any? {
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
-
// Generated using './scripts/generateKSPLookUp.js'
|
|
3
2
|
package expo.modules.plugin
|
|
4
3
|
|
|
4
|
+
// Starting with KSP 2.3.0, KSP is no longer tied to a specific Kotlin version.
|
|
5
|
+
const val latestKspVersion = "2.3.7"
|
|
6
|
+
|
|
7
|
+
// For older Kotlin versions, KSP releases were tied to specific Kotlin versions.
|
|
5
8
|
val KSPLookup = mapOf(
|
|
6
9
|
"2.2.21" to "2.2.21-2.0.5",
|
|
7
|
-
"2.3.1" to "2.3.1",
|
|
8
|
-
"2.3.0" to "2.3.0",
|
|
9
10
|
"2.2.20" to "2.2.20-2.0.4",
|
|
10
11
|
"2.2.10" to "2.2.10-2.0.2",
|
|
11
12
|
"2.2.0" to "2.2.0-2.0.2",
|
|
12
13
|
"2.1.21" to "2.1.21-2.0.2",
|
|
13
|
-
"2.1.20" to "2.1.20-2.0.1"
|
|
14
|
-
"2.1.10" to "2.1.10-1.0.31",
|
|
15
|
-
"2.1.0" to "2.1.0-1.0.29",
|
|
16
|
-
"2.0.21" to "2.0.21-1.0.28",
|
|
17
|
-
"2.0.20" to "2.0.20-1.0.25",
|
|
18
|
-
"2.0.10" to "2.0.10-1.0.24",
|
|
19
|
-
"2.0.0" to "2.0.0-1.0.24"
|
|
14
|
+
"2.1.20" to "2.1.20-2.0.1"
|
|
20
15
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-autolinking",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.4",
|
|
4
4
|
"description": "Scripts that autolink Expo modules.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"chalk": "^4.1.0",
|
|
50
50
|
"commander": "^7.2.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "42013232893cb2aa71ab218e9b422d4a8476b3f0",
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "expo-module build",
|
|
55
55
|
"clean": "expo-module clean",
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { execSync } = require('child_process');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const minKotlinVersion = '2.0.0';
|
|
6
|
-
const maxKotlinVersion = '2.3.10';
|
|
7
|
-
|
|
8
|
-
const groupId = 'com.google.devtools.ksp';
|
|
9
|
-
const artifactId = 'symbol-processing-gradle-plugin';
|
|
10
|
-
const path = require('path').resolve(
|
|
11
|
-
__dirname,
|
|
12
|
-
'../android/expo-gradle-plugin/expo-autolinking-plugin/src/main/kotlin/expo/modules/plugin/KSPLookup.kt'
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const numberPerPage = 30;
|
|
16
|
-
const githubApiPath = '/repos/google/ksp/releases';
|
|
17
|
-
|
|
18
|
-
async function* fetchKSPReleases() {
|
|
19
|
-
let currentPage = 1;
|
|
20
|
-
while (true) {
|
|
21
|
-
const apiPath = `${githubApiPath}?per_page=${numberPerPage}&page=${currentPage}`;
|
|
22
|
-
console.log(`Fetching versions from: ${apiPath}...`);
|
|
23
|
-
|
|
24
|
-
const output = execSync(`gh api "${apiPath}"`, { encoding: 'utf-8' });
|
|
25
|
-
const data = JSON.parse(output);
|
|
26
|
-
const versions = data
|
|
27
|
-
.map((release) => release.tag_name)
|
|
28
|
-
// Filter out release candidates, beta and milestone versions
|
|
29
|
-
.filter((version) => !/(rc|beta|m1)/i.test(version));
|
|
30
|
-
|
|
31
|
-
yield versions;
|
|
32
|
-
|
|
33
|
-
currentPage += 1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function filterByKotinVersion(generator, minKotlinVersion, maxKotlinVersion) {
|
|
38
|
-
let hasMoreData = true;
|
|
39
|
-
const result = [];
|
|
40
|
-
while (hasMoreData) {
|
|
41
|
-
const { value } = await generator.next();
|
|
42
|
-
const versions = value.map((version) => {
|
|
43
|
-
const [kotlinVersion] = version.split('-');
|
|
44
|
-
return { kotlinVersion, version };
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// If the version is lower than the minKotlinVersion, we can stop fetching more data
|
|
48
|
-
hasMoreData = !versions.some(({ kotlinVersion }) => kotlinVersion < minKotlinVersion);
|
|
49
|
-
|
|
50
|
-
result.push(
|
|
51
|
-
...versions.filter(
|
|
52
|
-
({ kotlinVersion }) =>
|
|
53
|
-
kotlinVersion >= minKotlinVersion && kotlinVersion <= maxKotlinVersion
|
|
54
|
-
)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Group versions by kotlinVersion and return the most recent version for each kotlinVersion
|
|
61
|
-
function groupByKotlinVersion(versions) {
|
|
62
|
-
const mostRecentVersions = {};
|
|
63
|
-
|
|
64
|
-
// Fill the mostRecentVersions object with the newest version of each kotlinVersion
|
|
65
|
-
versions.forEach(({ kotlinVersion, version }) => {
|
|
66
|
-
if (!mostRecentVersions[kotlinVersion] || mostRecentVersions[kotlinVersion] < version) {
|
|
67
|
-
mostRecentVersions[kotlinVersion] = version;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// Convert the results object back into an array
|
|
72
|
-
return Object.entries(mostRecentVersions).map(([kotlinVersion, version]) => ({
|
|
73
|
-
kotlinVersion,
|
|
74
|
-
version,
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function generateKSPLookup() {
|
|
79
|
-
const versionsGenerator = fetchKSPReleases(groupId, artifactId, minKotlinVersion);
|
|
80
|
-
const versions = groupByKotlinVersion(
|
|
81
|
-
await filterByKotinVersion(versionsGenerator, minKotlinVersion, maxKotlinVersion)
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
console.log(`Found stable versions for ${groupId}:${artifactId}:`);
|
|
85
|
-
for (const { kotlinVersion, version } of versions) {
|
|
86
|
-
console.log(` ${kotlinVersion} => ${version}`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log('Genereating KSP lookup file...');
|
|
90
|
-
const fileContent = `// Copyright 2015-present 650 Industries. All rights reserved.
|
|
91
|
-
// Generated using './scripts/generateKSPLookUp.js'
|
|
92
|
-
package expo.modules.plugin
|
|
93
|
-
|
|
94
|
-
val KSPLookup = mapOf(
|
|
95
|
-
${versions.map(({ kotlinVersion, version }) => ` "${kotlinVersion}" to "${version}"`).join(',\n')}
|
|
96
|
-
)
|
|
97
|
-
`;
|
|
98
|
-
fs.writeFileSync(path, fileContent, 'utf-8');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
generateKSPLookup();
|