[Gradle, JS] Distribution task depends on processResources
This commit is contained in:
+9
@@ -528,5 +528,14 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
||||
assertFileExists("app/build/distributions/app.js")
|
||||
assertFileExists("app/build/distributions/app.js.map")
|
||||
}
|
||||
|
||||
build("clean", "browserDistribution") {
|
||||
assertTasksExecuted(
|
||||
":app:processResources",
|
||||
":app:browserDistribution"
|
||||
)
|
||||
|
||||
assertFileExists("app/build/distributions/index.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+5
-1
@@ -153,11 +153,15 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
val baseDist = project.buildDir.resolve(basePluginConvention!!.distsDirName)
|
||||
distribution.directory = distribution.directory ?: baseDist
|
||||
|
||||
val processResourcesTask = target.project.tasks.getByName(compilation.processResourcesTaskName)
|
||||
|
||||
val distributionTask = project.registerTask<Copy>(
|
||||
disambiguateCamelCased(
|
||||
DISTRIBUTION_TASK_NAME
|
||||
)
|
||||
) {
|
||||
it.dependsOn(processResourcesTask)
|
||||
|
||||
it.from(compilation.output.resourcesDir)
|
||||
it.into(distribution.directory ?: baseDist)
|
||||
}
|
||||
@@ -176,7 +180,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
) {
|
||||
it.dependsOn(
|
||||
nodeJs.npmInstallTask,
|
||||
target.project.tasks.getByName(compilation.processResourcesTaskName),
|
||||
processResourcesTask,
|
||||
distributionTask
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user