2020-11-27 15:10:15 +03:00
|
|
|
package ru.mipt.npm.gradle.internal
|
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 {
|
2021-04-07 11:13:23 +03:00
|
|
|
languageVersion = "1.5"
|
|
|
|
apiVersion = "1.5"
|
2019-07-24 15:03:12 +03:00
|
|
|
progressiveMode = true
|
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")
|
2020-11-25 12:16:09 +03:00
|
|
|
useExperimentalAnnotation("kotlin.js.ExperimentalJsExport")
|
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()
|
2021-03-06 20:50:17 +03:00
|
|
|
maven("https://repo.kotlin.link")
|
2021-04-07 11:13:23 +03:00
|
|
|
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
|
2021-03-24 13:28:09 +03:00
|
|
|
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
|
2020-03-14 14:42:11 +03:00
|
|
|
}
|
|
|
|
|
2021-01-18 22:06:13 +03:00
|
|
|
internal fun Copy.fromJsDependencies(configurationName: String) = project.afterEvaluate {
|
2020-10-02 19:07:10 +03:00
|
|
|
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-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)
|
|
|
|
}
|
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)
|
|
|
|
}
|
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)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|