2020-08-20 10:02:28 +03:00
|
|
|
package ru.mipt.npm.gradle
|
2019-07-24 15:03:12 +03:00
|
|
|
|
2020-05-04 19:57:27 +03:00
|
|
|
import org.gradle.api.artifacts.ProjectDependency
|
2019-07-24 15:03:12 +03:00
|
|
|
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
2020-05-04 19:57:27 +03:00
|
|
|
import org.gradle.api.tasks.Copy
|
2020-10-02 19:07:10 +03:00
|
|
|
import org.gradle.kotlin.dsl.get
|
2019-07-24 15:03:12 +03:00
|
|
|
import org.gradle.kotlin.dsl.maven
|
|
|
|
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
|
|
|
|
|
|
|
|
internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
|
|
|
progressiveMode = true
|
2020-04-07 12:49:40 +03:00
|
|
|
enableLanguageFeature("InlineClasses")
|
2019-12-01 19:59:29 +03:00
|
|
|
useExperimentalAnnotation("kotlin.Experimental")
|
2019-09-12 09:42:08 +03:00
|
|
|
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
|
|
|
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
|
|
|
|
useExperimentalAnnotation("kotlin.time.ExperimentalTime")
|
2020-08-31 12:40:13 +03:00
|
|
|
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
2019-07-24 15:03:12 +03:00
|
|
|
}
|
|
|
|
|
2020-03-14 14:42:11 +03:00
|
|
|
internal fun RepositoryHandler.applyRepos(): Unit {
|
2019-07-24 15:03:12 +03:00
|
|
|
mavenCentral()
|
|
|
|
jcenter()
|
|
|
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
2020-09-09 10:18:00 +03:00
|
|
|
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
2019-07-24 15:03:12 +03:00
|
|
|
maven("https://kotlin.bintray.com/kotlinx")
|
2020-08-20 10:02:28 +03:00
|
|
|
maven("https://kotlin.bintray.com/kotlin-js-wrappers/")
|
|
|
|
maven("https://dl.bintray.com/mipt-npm/kscience")
|
2019-07-24 15:03:12 +03:00
|
|
|
maven("https://dl.bintray.com/mipt-npm/dev")
|
2019-10-04 17:50:48 +03:00
|
|
|
maven("https://dl.bintray.com/mipt-npm/dataforge")
|
2020-03-14 14:42:11 +03:00
|
|
|
}
|
|
|
|
|
2020-10-02 19:07:10 +03:00
|
|
|
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
|
2020-05-04 19:57:27 +03:00
|
|
|
}
|
2020-10-02 19:07:10 +03:00
|
|
|
into(buildDir.resolve("processedResources/js"))
|
2020-07-06 09:52:54 +03:00
|
|
|
projectDeps.forEach { dep ->
|
2020-10-02 19:07:10 +03:00
|
|
|
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"))
|
2020-07-06 09:52:54 +03:00
|
|
|
}
|
2020-10-02 19:07:10 +03:00
|
|
|
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"))
|
2020-07-06 09:52:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-04 19:57:27 +03:00
|
|
|
|
2020-10-02 19:07:10 +03:00
|
|
|
//
|
|
|
|
//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)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|