Skip to content

Commit c298913

Browse files
authored
Save dependencies as a file and figure out the dep relations (#90)
1 parent 0ce11b9 commit c298913

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

stability-compiler/src/main/kotlin/com/skydoves/compose/stability/compiler/StabilityAnalyzerCommandLineProcessor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public class StabilityAnalyzerCommandLineProcessor : CommandLineProcessor {
5555

5656
public val OPTION_PROJECT_DEPENDENCIES: CliOption = CliOption(
5757
optionName = "projectDependencies",
58-
valueDescription = "<module1,module2,...>",
59-
description = "Comma-separated list of project module names",
58+
valueDescription = "<path>",
59+
description = "Path to file containing project module names (one per line)",
6060
required = false,
6161
)
6262
}

stability-compiler/src/main/kotlin/com/skydoves/compose/stability/compiler/StabilityAnalyzerIrGenerationExtension.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ public class StabilityAnalyzerIrGenerationExtension(
3636
null
3737
}
3838

39-
// Parse project dependencies from comma-separated string
39+
// Read project dependencies from file (projectDependencies is now a file path)
4040
val dependencyModules = if (projectDependencies.isNotEmpty()) {
41-
projectDependencies.split(",").map { it.trim() }.filter { it.isNotEmpty() }
41+
try {
42+
val dependenciesFile = File(projectDependencies)
43+
if (dependenciesFile.exists()) {
44+
dependenciesFile.readLines()
45+
.map { it.trim() }
46+
.filter { it.isNotEmpty() }
47+
} else {
48+
emptyList()
49+
}
50+
} catch (e: Exception) {
51+
emptyList()
52+
}
4253
} else {
4354
emptyList()
4455
}

stability-gradle/src/main/kotlin/com/skydoves/compose/stability/gradle/StabilityAnalyzerGradlePlugin.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,24 @@ public class StabilityAnalyzerGradlePlugin : KotlinCompilerPluginSupportPlugin {
154154
return project.provider {
155155
val projectDependencies = collectProjectDependencies(project)
156156

157+
// Write project dependencies to a file to avoid empty string issues with SubpluginOption
158+
val stabilityDir = project.layout.buildDirectory.dir("stability").get().asFile
159+
stabilityDir.mkdirs()
160+
val dependenciesFile = java.io.File(stabilityDir, "project-dependencies.txt")
161+
dependenciesFile.writeText(projectDependencies.joinToString("\n"))
162+
157163
listOf(
158164
SubpluginOption(
159165
key = OPTION_ENABLED,
160166
value = extension.enabled.get().toString(),
161167
),
162168
SubpluginOption(
163169
key = OPTION_STABILITY_OUTPUT_DIR,
164-
value = project.layout.buildDirectory.dir("stability").get().asFile.absolutePath,
170+
value = stabilityDir.absolutePath,
165171
),
166172
SubpluginOption(
167173
key = OPTION_PROJECT_DEPENDENCIES,
168-
value = projectDependencies.joinToString(","),
174+
value = dependenciesFile.absolutePath,
169175
),
170176
)
171177
}

0 commit comments

Comments
 (0)