Skip to content

Commit

Permalink
Add <packageNodeModules> as placeholder for Karakum config
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire authored and sgrishchenko committed Sep 22, 2024
1 parent 754a3bc commit 9bc7000
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class KarakumPlugin : Plugin<Project> {
cwd.convention(project.kotlinJsCompilation.npmProject.dir)
buildSrc.convention(project.rootProject.layout.projectDirectory.dir("buildSrc"))
nodeModules.convention(project.rootProject.layout.buildDirectory.dir("js/node_modules"))
packageNodeModules.convention(project.rootProject.layout.buildDirectory.dir("js/packages").map { it.dir(project.name).dir("node_modules") })

destinationFile.convention(layout.buildDirectory.file("karakum/$KARAKUM_CONFIG_FILE"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ abstract class KarakumConfig : DefaultTask() {
@get:Input
val nodeModulesPath = nodeModules.map { it.asFile.absoluteFile.invariantSeparatorsPath }

@get:Internal("Only the path matters, handled in packageNodeModulesPath")
abstract val packageNodeModules: DirectoryProperty

@get:Input
val packageNodeModulesPath = packageNodeModules.map { it.asFile.absoluteFile.invariantSeparatorsPath }

@get:OutputFile
abstract val destinationFile: RegularFileProperty

Expand All @@ -50,6 +56,7 @@ abstract class KarakumConfig : DefaultTask() {
get() = mapOf(
"<buildSrc>" to buildSrcPath.get(),
"<nodeModules>" to nodeModulesPath.get(),
"<packageNodeModules>" to packageNodeModulesPath.get(),
)

private fun String.replaceTokens() = replacements.entries.fold(this) { acc, (token, replacement) ->
Expand Down

0 comments on commit 9bc7000

Please sign in to comment.