multisrc: copy generator READMEs first before overrides

This commit is contained in:
arkon 2022-06-02 22:31:08 -04:00
parent 6b8ebe1340
commit 03568c33bc

View File

@ -136,25 +136,29 @@ ${placeholders.map { "${" ".repeat(28)}${it.key}: \"${it.value}\""}.joinToString
writeSourceClasses(projectSrcPath, srcOverridePath, source, themePkg, themeClass) writeSourceClasses(projectSrcPath, srcOverridePath, source, themePkg, themeClass)
copyThemeClasses(userDir, themePkg, projectRootPath) copyThemeClasses(userDir, themePkg, projectRootPath)
copyThemeReadmes(overridesPath, projectRootPath) copyThemeReadmes(userDir, themePkg, overridesPath, projectRootPath)
copyResFiles(resOverridePath, defaultResPath, source, projectRootPath) copyResFiles(resOverridePath, defaultResPath, source, projectRootPath)
} }
} }
private fun copyThemeReadmes(overridesPath: String, projectRootPath: String) { private fun copyThemeReadmes(userDir: String, themePkg: String, overridesPath: String, projectRootPath: String) {
val sourcePath = "$userDir/multisrc/src/main/java/${themeSuffix(themePkg, "/")}"
val destinationPath = "$projectRootPath" val destinationPath = "$projectRootPath"
File(destinationPath).mkdirs() File(destinationPath).mkdirs()
File(overridesPath) listOf(sourcePath, overridesPath).forEach { path ->
?.list() File(path)
?.filter { it.endsWith("README.md") || it.endsWith("CHANGELOG.md") } ?.list()
?.forEach { ?.filter { it.endsWith("README.md") || it.endsWith("CHANGELOG.md") }
Files.copy( ?.forEach {
File("$overridesPath/$it").toPath(), Files.copy(
File("$destinationPath/$it").toPath(), File("$path/$it").toPath(),
StandardCopyOption.REPLACE_EXISTING File("$destinationPath/$it").toPath(),
) StandardCopyOption.REPLACE_EXISTING
} )
}
}
} }
private fun copyThemeClasses(userDir: String, themePkg: String, projectRootPath: String) { private fun copyThemeClasses(userDir: String, themePkg: String, projectRootPath: String) {