@invarn/cli 0.9.364 → 0.9.365
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/dist/capture/ios/{InvarnAgent-0.90.0.dylib → InvarnAgent-0.91.0.dylib} +0 -0
- package/dist/capture/ios/InvarnComposeReader-0.91.0/VERSION +1 -0
- package/dist/capture/ios/InvarnComposeReader-0.91.0/invarn-compose.gradle +168 -0
- package/dist/capture/ios/{InvarnComposeReader-0.90.0.tar → InvarnComposeReader-0.91.0.tar} +0 -0
- package/dist/capture/ios/{InvarnFold-0.90.0 → InvarnFold-0.91.0} +0 -0
- package/dist/capture/ios/{InvarnHinge-0.90.0 → InvarnHinge-0.91.0} +0 -0
- package/dist/capture/ios/{InvarnQuit-0.90.0 → InvarnQuit-0.91.0} +0 -0
- package/dist/capture/ios/{InvarnReencode-0.90.0 → InvarnReencode-0.91.0} +0 -0
- package/dist/capture/ios/{InvarnSystemRunner-0.90.0.dylib → InvarnSystemRunner-0.91.0.dylib} +0 -0
- package/dist/capture/ios/VERSION +1 -1
- package/dist/capture/ios/capture-build.cjs +1 -1
- package/dist/capture/ios/controller.cjs +1 -1
- package/dist/capture/ios/index.cjs +1 -1
- package/dist/invarn.cjs +7 -7
- package/dist/local-run-worker.mjs +1 -1
- package/dist/sdk.mjs +5 -13
- package/package.json +1 -1
- package/dist/capture/ios/InvarnComposeReader-0.90.0/VERSION +0 -1
- package/dist/capture/ios/InvarnComposeReader-0.90.0/invarn-compose.gradle +0 -90
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/scan.groovy +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Ivx.kt +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Zmn0.kt +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Znn0.kt +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Zpn0.kt +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Zqn0.kt +0 -0
- /package/dist/capture/ios/{InvarnComposeReader-0.90.0 → InvarnComposeReader-0.91.0}/src/Zsn0.kt +0 -0
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.91.0
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
def readerHome = System.getenv('INVARN_COMPOSE_READER') ?: buildscript.sourceFile?.parentFile?.absolutePath
|
|
2
|
+
def READER = (new File(readerHome, 'VERSION').with { it.exists() ? it.text.trim() : 'dev' })
|
|
3
|
+
|
|
4
|
+
@org.gradle.api.tasks.UntrackedTask(because = 'reads every Kotlin file of the build')
|
|
5
|
+
abstract class InvarnReaderSources extends DefaultTask {
|
|
6
|
+
static final List<Integer> FLOOR = [1, 10, 0]
|
|
7
|
+
|
|
8
|
+
@Input abstract Property<String> getReaderHome()
|
|
9
|
+
@Input abstract Property<String> getReaderVersion()
|
|
10
|
+
@Input abstract Property<String> getRootPath()
|
|
11
|
+
@Input abstract Property<String> getGradleHomePath()
|
|
12
|
+
@Input abstract Property<String> getLabel()
|
|
13
|
+
@Internal abstract ConfigurableFileCollection getLibraries()
|
|
14
|
+
@OutputDirectory abstract DirectoryProperty getOutputDir()
|
|
15
|
+
|
|
16
|
+
static List<Integer> versionOf(String v) {
|
|
17
|
+
def m = (v =~ /^(\d+)\.(\d+)(?:\.(\d+))?/)
|
|
18
|
+
m.find() ? [m.group(1) as int, m.group(2) as int, (m.group(3) ?: '0') as int] : null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static boolean atLeast(List a, List b) {
|
|
22
|
+
for (int i = 0; i < 3; i++) { if (a[i] != b[i]) return a[i] > b[i] }
|
|
23
|
+
true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static FileCollection external(Configuration c) {
|
|
27
|
+
c.incoming.artifactView { v -> v.componentFilter { id -> id instanceof org.gradle.api.artifacts.component.ModuleComponentIdentifier } }.files
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@TaskAction
|
|
31
|
+
void write() {
|
|
32
|
+
def dir = outputDir.get().asFile
|
|
33
|
+
dir.deleteDir(); dir.mkdirs()
|
|
34
|
+
def found = []
|
|
35
|
+
libraries.files.each { f ->
|
|
36
|
+
def m = (f.absolutePath =~ /compose[\/.]runtime[\/.]runtime-(?:ios|uikit)[a-z0-9]*[\/.](\d[^\/]*)[\/]/)
|
|
37
|
+
if (m.find()) { def v = versionOf(m.group(1)); if (v) found << v }
|
|
38
|
+
}
|
|
39
|
+
def runtime = found.max { a, b -> atLeast(a, b) ? (a == b ? 0 : 1) : -1 }
|
|
40
|
+
if (runtime == null || !atLeast(runtime, FLOOR)) {
|
|
41
|
+
logger.lifecycle("[invarn-compose] ${label.get()}: no reader (Compose runtime ${runtime ? runtime.join('.') : 'not found'}, reader needs ${FLOOR.join('.')} or later)")
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
def readerHome = readerHome.get()
|
|
45
|
+
['src'].each { sub -> new File(readerHome, sub).eachFileRecurse { f -> if (f.name.endsWith('.kt')) new File(dir, f.name).text = f.text } }
|
|
46
|
+
def zvg0 = new TreeSet<String>()
|
|
47
|
+
def zhk0 = new TreeMap<String, String>()
|
|
48
|
+
def scanFile = new File(readerHome, 'scan.groovy')
|
|
49
|
+
def scanner = scanFile.exists() ? new GroovyShell(InvarnReaderSources.classLoader).evaluate(scanFile) : null
|
|
50
|
+
def ztm0 = new TreeSet<String>()
|
|
51
|
+
def root = new File(rootPath.get())
|
|
52
|
+
def buildSrc = new File(root, 'buildSrc').canonicalPath
|
|
53
|
+
def home = new File(gradleHomePath.get()).canonicalPath
|
|
54
|
+
def walk
|
|
55
|
+
walk = { File d ->
|
|
56
|
+
d.listFiles()?.each { f ->
|
|
57
|
+
if (f.isDirectory()) {
|
|
58
|
+
if (f.name == 'build' || f.name.startsWith('.') || f.canonicalPath == home) return
|
|
59
|
+
walk(f)
|
|
60
|
+
} else if (f.name.endsWith('.kt')) {
|
|
61
|
+
def pm = (f.text =~ /(?m)^\s*package\s+([A-Za-z_`][\w.`]*)/)
|
|
62
|
+
def pkg = pm.find() ? pm.group(1).replace('`', '') : ''
|
|
63
|
+
def key = f.name + '#' + Integer.toString(Math.abs(pkg.hashCode()), 36)
|
|
64
|
+
zvg0 << key
|
|
65
|
+
zhk0[key] = pkg
|
|
66
|
+
if (scanner != null && !scanner.inTestSources(f) && !f.canonicalPath.startsWith(buildSrc + File.separator))
|
|
67
|
+
scanner.scan(f.text, { String l -> ztm0 << String.format('%016x', scanner.hash(l)) } as java.util.function.Consumer)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
walk(root)
|
|
72
|
+
def literal = { String joined ->
|
|
73
|
+
def chunks = []
|
|
74
|
+
for (int i = 0; i < joined.length(); i += 20000) chunks << joined.substring(i, Math.min(joined.length(), i + 20000))
|
|
75
|
+
chunks.collect { '"' + it.replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$').replace('\n', '\\n') + '"' }.join(' +\n ')
|
|
76
|
+
}
|
|
77
|
+
def lit = literal(zvg0.join('\n'))
|
|
78
|
+
def pkgs = literal(zhk0.collect { k, v -> k + '=' + v }.join('\n'))
|
|
79
|
+
def hashes = literal(ztm0.join('\n'))
|
|
80
|
+
new File(dir, 'zmb0.kt').text = """package zp6
|
|
81
|
+
|
|
82
|
+
internal object zmb0 {
|
|
83
|
+
val zvg0: Set<String>? = (${lit ?: '""'}).split('\\n').filter { it.isNotEmpty() }.toSet().takeIf { it.isNotEmpty() }
|
|
84
|
+
val zhk0: Map<String, String>? = (${pkgs ?: '""'}).split('\\n').filter { it.contains('=') }
|
|
85
|
+
.associate { it.substringBefore('=') to it.substringAfter('=') }.takeIf { it.isNotEmpty() }
|
|
86
|
+
val ztm0: LongArray? = (${hashes ?: '""'}).split('\\n').filter { it.isNotEmpty() }.map { it.toULong(16).toLong() }
|
|
87
|
+
.toLongArray().also { it.sort() }.takeIf { it.isNotEmpty() }
|
|
88
|
+
}
|
|
89
|
+
"""
|
|
90
|
+
logger.lifecycle("[invarn-compose] ${label.get()}: reader ${readerVersion.get()} added (Compose runtime ${runtime.join('.')}, ${zvg0.size()} Kotlin files, ${ztm0.size()} literals)")
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
def FRAMEWORK_TASK = ~/^(embedAndSign\w*|link\w*Framework\w*|syncFramework)$/
|
|
95
|
+
def requested = [] as Set
|
|
96
|
+
gradle.startParameter.taskNames.each { String n ->
|
|
97
|
+
def name = n.contains(':') ? n.substring(n.lastIndexOf(':') + 1) : n
|
|
98
|
+
if (!(name ==~ FRAMEWORK_TASK)) return
|
|
99
|
+
if (n.contains(':')) {
|
|
100
|
+
def path = n.substring(0, n.lastIndexOf(':'))
|
|
101
|
+
requested << (path.startsWith(':') ? (path ?: ':') : ':' + path)
|
|
102
|
+
} else {
|
|
103
|
+
requested << gradle.startParameter.currentDir.canonicalPath
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
def frameworks = []
|
|
108
|
+
|
|
109
|
+
gradle.beforeProject { p ->
|
|
110
|
+
p.pluginManager.withPlugin('org.jetbrains.kotlin.plugin.compose') {
|
|
111
|
+
def ext = p.extensions.findByName('composeCompiler')
|
|
112
|
+
if (ext != null && ext.hasProperty('includeSourceInformation')) ext.includeSourceInformation.set(true)
|
|
113
|
+
}
|
|
114
|
+
p.pluginManager.withPlugin('org.jetbrains.kotlin.multiplatform') {
|
|
115
|
+
p.afterEvaluate {
|
|
116
|
+
def kotlin = p.extensions.getByName('kotlin')
|
|
117
|
+
def targets = kotlin.targets.findAll { t ->
|
|
118
|
+
t.hasProperty('konanTarget') && t.konanTarget.family.name() == 'IOS' && t.binaries.any { it.getClass().name.contains('Framework') }
|
|
119
|
+
}
|
|
120
|
+
if (targets) frameworks << [p, targets]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
gradle.projectsEvaluated {
|
|
126
|
+
if (frameworks.isEmpty()) return
|
|
127
|
+
def chosen = frameworks.findAll { e -> e[0].path in requested || e[0].projectDir.canonicalPath in requested }
|
|
128
|
+
def why = 'the framework task asked for'
|
|
129
|
+
if (chosen.isEmpty()) {
|
|
130
|
+
def edges = [:].withDefault { [] as Set }
|
|
131
|
+
gradle.rootProject.allprojects.each { q ->
|
|
132
|
+
q.configurations.each { c ->
|
|
133
|
+
try {
|
|
134
|
+
c.dependencies.withType(ProjectDependency).each { d ->
|
|
135
|
+
def path = d.metaClass.respondsTo(d, 'getPath') ? d.path : d.dependencyProject.path
|
|
136
|
+
if (path != q.path) edges[q.path] << path
|
|
137
|
+
}
|
|
138
|
+
} catch (Exception ignored) { }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
def linked = [] as Set
|
|
142
|
+
frameworks.each { e ->
|
|
143
|
+
def seen = [] as Set
|
|
144
|
+
def next = new ArrayDeque<String>(edges[e[0].path])
|
|
145
|
+
while (!next.isEmpty()) { def n = next.poll(); if (seen.add(n)) next.addAll(edges[n]) }
|
|
146
|
+
linked.addAll(seen)
|
|
147
|
+
}
|
|
148
|
+
chosen = frameworks.findAll { e -> !(e[0].path in linked) }
|
|
149
|
+
why = 'no other framework links it'
|
|
150
|
+
}
|
|
151
|
+
chosen.each { e ->
|
|
152
|
+
def p = e[0]
|
|
153
|
+
p.logger.lifecycle("[invarn-compose] ${p.path}: the reader goes into this framework (${why})")
|
|
154
|
+
e[1].each { t ->
|
|
155
|
+
def main = t.compilations.getByName('main')
|
|
156
|
+
def gen = p.tasks.register("invarnComposeReader${t.name.capitalize()}", InvarnReaderSources) { task ->
|
|
157
|
+
task.readerHome.set(readerHome)
|
|
158
|
+
task.readerVersion.set(READER)
|
|
159
|
+
task.rootPath.set(p.rootDir.absolutePath)
|
|
160
|
+
task.gradleHomePath.set(p.gradle.gradleUserHomeDir.absolutePath)
|
|
161
|
+
task.label.set("${p.path} ${t.name}".toString())
|
|
162
|
+
task.libraries.from(InvarnReaderSources.external(p.configurations.getByName(main.compileDependencyConfigurationName)))
|
|
163
|
+
task.outputDir.set(p.layout.buildDirectory.dir("generated/invarn-compose/${t.name}"))
|
|
164
|
+
}
|
|
165
|
+
main.defaultSourceSet.kotlin.srcDir(gen)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/capture/ios/{InvarnSystemRunner-0.90.0.dylib → InvarnSystemRunner-0.91.0.dylib}
RENAMED
|
Binary file
|
package/dist/capture/ios/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.91.0
|