Dev #5
@ -6,7 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
version = "0.6.2-dev-1.4.20-M1"
|
||||
version = "0.6.3-dev-1.4.20-M1"
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
|
@ -40,17 +40,8 @@ open class KScienceJSPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
|
||||
val processResources by getting(Copy::class)
|
||||
processResources.copyJSResources(configurations["runtimeClasspath"])
|
||||
|
||||
findByName("jsBrowserDistribution")?.apply {
|
||||
doLast {
|
||||
val indexFile = project.jsDistDirectory.resolve("index.html")
|
||||
if (indexFile.exists()) {
|
||||
println("Run JS distribution at: ${indexFile.canonicalPath}")
|
||||
}
|
||||
}
|
||||
val processResources by getting(Copy::class) {
|
||||
fromDependencies("runtimeClasspath")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.*
|
||||
@ -78,9 +77,9 @@ open class KScienceJVMPlugin : Plugin<Project> {
|
||||
withType<Test>() {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
val processResources by getting(Copy::class)
|
||||
processResources.copyJVMResources(configurations["runtimeClasspath"])
|
||||
//
|
||||
// val processResources by getting(Copy::class)
|
||||
// processResources.copyJVMResources(configurations["runtimeClasspath"])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,20 +89,10 @@ open class KScienceMPPlugin : Plugin<Project> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
val jsProcessResources by getting(Copy::class)
|
||||
jsProcessResources.copyJSResources(configurations["jsRuntimeClasspath"])
|
||||
|
||||
val jvmProcessResources by getting(Copy::class)
|
||||
jvmProcessResources.copyJVMResources(configurations["jvmRuntimeClasspath"])
|
||||
|
||||
findByName("jsBrowserDistribution")?.apply {
|
||||
doLast {
|
||||
val indexFile = project.jsDistDirectory.resolve("index.html")
|
||||
if (indexFile.exists()) {
|
||||
println("Run JS distribution at: ${indexFile.canonicalPath}")
|
||||
}
|
||||
}
|
||||
val jsProcessResources by getting(Copy::class) {
|
||||
fromDependencies("jsRuntimeClasspath")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.maven
|
||||
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
|
||||
import java.io.File
|
||||
|
||||
internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
||||
progressiveMode = true
|
||||
@ -31,73 +29,54 @@ internal fun RepositoryHandler.applyRepos(): Unit {
|
||||
maven("https://dl.bintray.com/mipt-npm/dataforge")
|
||||
}
|
||||
|
||||
|
||||
internal fun Copy.copyJSResources(configuration: Configuration): Unit = project.afterEvaluate {
|
||||
val projectDeps = configuration
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.map { it.dependencyProject }
|
||||
|
||||
val destination = destinationDir
|
||||
|
||||
projectDeps.forEach { dep ->
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
dep.tasks.findByName("jsProcessResources")?.let { task ->
|
||||
val sourceDir = (task as Copy).destinationDir
|
||||
inputs.files(sourceDir)
|
||||
dependsOn(task)
|
||||
from(sourceDir)
|
||||
}
|
||||
}
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||
dep.tasks.findByName("processResources")?.let { task ->
|
||||
val sourceDir = (task as Copy).destinationDir
|
||||
inputs.files(sourceDir)
|
||||
dependsOn(task)
|
||||
from(sourceDir)
|
||||
}
|
||||
}
|
||||
internal fun Copy.fromDependencies(configurationName: String) = project.afterEvaluate {
|
||||
val configuration = configurations[configurationName]
|
||||
?: error("Configuration with name $configurationName could not be resolved.")
|
||||
val projectDeps = configuration.allDependencies.filterIsInstance<ProjectDependency>().map {
|
||||
it.dependencyProject
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate {
|
||||
val projectDeps = configuration
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.map { it.dependencyProject }
|
||||
|
||||
val destination = destinationDir
|
||||
|
||||
into(buildDir.resolve("processedResources/js"))
|
||||
projectDeps.forEach { dep ->
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
dep.tasks.findByName("jvmProcessResources")?.let { task ->
|
||||
val sourceDir = (task as Copy).destinationDir
|
||||
inputs.files(sourceDir)
|
||||
dependsOn(task)
|
||||
from(sourceDir)
|
||||
dep.afterEvaluate {
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
dep.tasks.findByName("jsProcessResources")?.let { task ->
|
||||
dependsOn(task)
|
||||
from(task)
|
||||
//from(dep.buildDir.resolve("processedResources/js"))
|
||||
}
|
||||
//from(dep.buildDir.resolve("processedResources/js"))
|
||||
}
|
||||
}
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
dep.tasks.findByName("processResources")?.let { task ->
|
||||
val sourceDir = (task as Copy).destinationDir
|
||||
inputs.files(sourceDir)
|
||||
dependsOn(task)
|
||||
from(sourceDir)
|
||||
dep.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||
dep.tasks.findByName("processResources")?.let { task ->
|
||||
dependsOn(task)
|
||||
from(task)
|
||||
//from(dep.buildDir.resolve("processedResources/js"))
|
||||
}
|
||||
// from(dep.buildDir.resolve("processedResources/js"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val Project.jsDistDirectory: File
|
||||
get() {
|
||||
val distributionName = listOf(
|
||||
name,
|
||||
"js",
|
||||
version.toString()
|
||||
).joinToString("-")
|
||||
|
||||
return buildDir.resolve(
|
||||
"distributions/$distributionName"
|
||||
)
|
||||
}
|
||||
//
|
||||
//internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate {
|
||||
// val projectDeps = configuration.allDependencies
|
||||
// .filterIsInstance<ProjectDependency>()
|
||||
// .map { it.dependencyProject }
|
||||
//
|
||||
// projectDeps.forEach { dep ->
|
||||
// dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
// dep.tasks.findByName("jvmProcessResources")?.let { task ->
|
||||
// dependsOn(task)
|
||||
// from(task)
|
||||
// }
|
||||
// }
|
||||
// dep.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
// dep.tasks.findByName("processResources")?.let { task ->
|
||||
// dependsOn(task)
|
||||
// from(task)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
Loading…
Reference in New Issue
Block a user