Merge pull request #16 from mipt-npm/dev
0.10.0
This commit is contained in:
commit
8fe085c4bd
18
CHANGELOG.md
18
CHANGELOG.md
@ -16,6 +16,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
### Security
|
||||||
|
## [0.10.0]
|
||||||
|
### Added
|
||||||
|
- Lazy readme properties
|
||||||
|
- BOM for kotlin-wrappers on JS
|
||||||
|
- Jupyter loader
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- API validation disabled for dev versions
|
||||||
|
- Kotlin plugins are propagated downstream
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- bson support
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
## [0.9.5]
|
## [0.9.5]
|
||||||
|
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.mipt.npm"
|
group = "ru.mipt.npm"
|
||||||
version = "0.9.5"
|
version = "0.10.0"
|
||||||
|
|
||||||
description = "Build tools for DataForge and kscience projects"
|
description = "Build tools for DataForge and kscience projects"
|
||||||
|
|
||||||
@ -22,20 +22,20 @@ repositories {
|
|||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
}
|
}
|
||||||
|
|
||||||
val kotlinVersion = "1.5.0"
|
val kotlinVersion = "1.5.10"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add plugins used in buildSrc as dependencies, also we should specify version only here
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
api("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin:0.10.0-53")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
||||||
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1")
|
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1")
|
||||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
|
||||||
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
|
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
|
||||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0")
|
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply {
|
project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply {
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
rootProject.name = 'gradle-tools'
|
|
||||||
|
|
1
settings.gradle.kts
Normal file
1
settings.gradle.kts
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "gradle-tools"
|
@ -14,6 +14,7 @@ import ru.mipt.npm.gradle.internal.applyRepos
|
|||||||
import ru.mipt.npm.gradle.internal.applySettings
|
import ru.mipt.npm.gradle.internal.applySettings
|
||||||
import ru.mipt.npm.gradle.internal.fromJsDependencies
|
import ru.mipt.npm.gradle.internal.fromJsDependencies
|
||||||
|
|
||||||
|
@Suppress("UNUSED_VARIABLE")
|
||||||
open class KScienceCommonPlugin : Plugin<Project> {
|
open class KScienceCommonPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
//Common configuration
|
//Common configuration
|
||||||
@ -40,7 +41,6 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
tasks.withType<KotlinJvmCompile> {
|
tasks.withType<KotlinJvmCompile> {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
useIR = true
|
|
||||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
explicitApiWarning()
|
explicitApiWarning()
|
||||||
|
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser{
|
browser {
|
||||||
commonWebpackConfig {
|
commonWebpackConfig {
|
||||||
cssSupport.enabled = true
|
cssSupport.enabled = true
|
||||||
}
|
}
|
||||||
@ -72,6 +72,9 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
sourceSets["main"].apply {
|
sourceSets["main"].apply {
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
|
dependencies {
|
||||||
|
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
sourceSets["test"].apply {
|
||||||
@ -95,7 +98,6 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
jvm {
|
jvm {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
useIR = true
|
|
||||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||||
}
|
}
|
||||||
@ -103,7 +105,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
js(IR) {
|
js(IR) {
|
||||||
browser{
|
browser {
|
||||||
commonWebpackConfig {
|
commonWebpackConfig {
|
||||||
cssSupport.enabled = true
|
cssSupport.enabled = true
|
||||||
}
|
}
|
||||||
@ -111,7 +113,11 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.invoke {
|
sourceSets.invoke {
|
||||||
val commonMain by getting
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
val commonTest by getting {
|
val commonTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
|
@ -2,8 +2,6 @@ package ru.mipt.npm.gradle
|
|||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.ApplicationPlugin
|
import org.gradle.api.plugins.ApplicationPlugin
|
||||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
|
||||||
import org.gradle.kotlin.dsl.apply
|
|
||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
@ -49,7 +47,7 @@ class KScienceExtension(val project: Project) {
|
|||||||
fun useCoroutines(
|
fun useCoroutines(
|
||||||
version: String = KScienceVersions.coroutinesVersion,
|
version: String = KScienceVersions.coroutinesVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
): Unit = project.useCommonDependency(
|
): Unit = project.useCommonDependency(
|
||||||
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$version",
|
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$version",
|
||||||
dependencySourceSet = sourceSet,
|
dependencySourceSet = sourceSet,
|
||||||
@ -62,7 +60,7 @@ class KScienceExtension(val project: Project) {
|
|||||||
fun useAtomic(
|
fun useAtomic(
|
||||||
version: String = KScienceVersions.atomicVersion,
|
version: String = KScienceVersions.atomicVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION,
|
||||||
): Unit = project.run {
|
): Unit = project.run {
|
||||||
plugins.apply("kotlinx-atomicfu")
|
plugins.apply("kotlinx-atomicfu")
|
||||||
useCommonDependency(
|
useCommonDependency(
|
||||||
@ -79,7 +77,7 @@ class KScienceExtension(val project: Project) {
|
|||||||
version: String = KScienceVersions.serializationVersion,
|
version: String = KScienceVersions.serializationVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
block: SerializationTargets.() -> Unit = {}
|
block: SerializationTargets.() -> Unit = {},
|
||||||
): Unit = project.run {
|
): Unit = project.run {
|
||||||
plugins.apply("org.jetbrains.kotlin.plugin.serialization")
|
plugins.apply("org.jetbrains.kotlin.plugin.serialization")
|
||||||
val artifactName = if (version.startsWith("0")) {
|
val artifactName = if (version.startsWith("0")) {
|
||||||
@ -95,17 +93,23 @@ class KScienceExtension(val project: Project) {
|
|||||||
SerializationTargets(sourceSet, configuration).apply(block)
|
SerializationTargets(sourceSet, configuration).apply(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add platform-specific JavaFX dependencies with given list of [FXModule]s
|
||||||
|
*/
|
||||||
fun useFx(
|
fun useFx(
|
||||||
vararg modules: FXModule,
|
vararg modules: FXModule,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
||||||
version: String = "11",
|
version: String = "11",
|
||||||
platform: FXPlatform = defaultPlatform
|
platform: FXPlatform = defaultPlatform,
|
||||||
) = project.useFx(modules.toList(), configuration, version, platform)
|
) = project.useFx(modules.toList(), configuration, version, platform)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add dependency on kotlinx-html library
|
||||||
|
*/
|
||||||
fun useHtml(
|
fun useHtml(
|
||||||
version: String = KScienceVersions.atomicVersion,
|
version: String = KScienceVersions.htmlVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
): Unit = project.useCommonDependency(
|
): Unit = project.useCommonDependency(
|
||||||
"org.jetbrains.kotlinx:kotlinx-html:$version",
|
"org.jetbrains.kotlinx:kotlinx-html:$version",
|
||||||
dependencySourceSet = sourceSet,
|
dependencySourceSet = sourceSet,
|
||||||
@ -115,8 +119,23 @@ class KScienceExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Use kotlinx-datetime library with default version or [version]
|
* Use kotlinx-datetime library with default version or [version]
|
||||||
*/
|
*/
|
||||||
fun useDateTime(version: String = KScienceVersions.dateTimeVersion){
|
fun useDateTime(
|
||||||
project.useCommonDependency("org.jetbrains.kotlinx:kotlinx-datetime:$version")
|
version: String = KScienceVersions.dateTimeVersion,
|
||||||
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
|
) {
|
||||||
|
project.useCommonDependency(
|
||||||
|
"org.jetbrains.kotlinx:kotlinx-datetime:$version",
|
||||||
|
dependencySourceSet = sourceSet,
|
||||||
|
dependencyConfiguration = configuration
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply jupyter plugin
|
||||||
|
*/
|
||||||
|
fun useJupyter() {
|
||||||
|
project.plugins.apply("org.jetbrains.kotlin.jupyter.api")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,10 +165,6 @@ class KScienceExtension(val project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun publish() {
|
|
||||||
project.plugins.apply(MavenPublishPlugin::class)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.registerKScienceExtension() {
|
internal fun Project.registerKScienceExtension() {
|
||||||
|
@ -7,6 +7,8 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.jetbrains.changelog.ChangelogPlugin
|
import org.jetbrains.changelog.ChangelogPlugin
|
||||||
|
import org.jetbrains.changelog.ChangelogPluginExtension
|
||||||
|
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
import org.jetbrains.dokka.gradle.DokkaTask
|
import org.jetbrains.dokka.gradle.DokkaTask
|
||||||
import ru.mipt.npm.gradle.internal.*
|
import ru.mipt.npm.gradle.internal.*
|
||||||
@ -15,7 +17,7 @@ import ru.mipt.npm.gradle.internal.*
|
|||||||
class KSciencePublishingExtension(val project: Project) {
|
class KSciencePublishingExtension(val project: Project) {
|
||||||
private var initializedFlag = false
|
private var initializedFlag = false
|
||||||
|
|
||||||
fun configurePublications(vcsUrl: String) {
|
fun vcs(vcsUrl: String) {
|
||||||
if (!initializedFlag) {
|
if (!initializedFlag) {
|
||||||
project.setupPublication(vcsUrl)
|
project.setupPublication(vcsUrl)
|
||||||
initializedFlag = true
|
initializedFlag = true
|
||||||
@ -24,21 +26,37 @@ class KSciencePublishingExtension(val project: Project) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* github publishing
|
* github publishing
|
||||||
|
* @param publish include github packages in release publishing. By default - false
|
||||||
*/
|
*/
|
||||||
fun github(githubProject: String, githubOrg: String = "mipt-npm") {
|
fun github(githubProject: String, githubOrg: String = "mipt-npm", publish: Boolean = false) {
|
||||||
//automatically initialize vcs using github
|
//automatically initialize vcs using github
|
||||||
if (!initializedFlag) {
|
if (!initializedFlag) {
|
||||||
configurePublications("https://github.com/$githubOrg/$githubProject")
|
vcs("https://github.com/$githubOrg/$githubProject")
|
||||||
}
|
}
|
||||||
project.addGithubPublishing(githubOrg, githubProject)
|
project.addGithubPublishing(githubOrg, githubProject)
|
||||||
|
|
||||||
|
if (publish) {
|
||||||
|
project.tasks.findByName("publish${project.publicationTarget}ToGithubRepository")?.let {publicationTask->
|
||||||
|
releaseTask?.dependsOn(publicationTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val releaseTask by lazy {
|
||||||
|
project.tasks.findByName("release")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Space publishing
|
* Space publishing
|
||||||
*/
|
*/
|
||||||
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven") {
|
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", publish: Boolean = false) {
|
||||||
require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" }
|
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||||
project.addSpacePublishing(spaceRepo)
|
project.addSpacePublishing(spaceRepo)
|
||||||
|
if (publish) {
|
||||||
|
project.tasks.findByName("publish${project.publicationTarget}ToSpaceRepository")?.let { publicationTask ->
|
||||||
|
releaseTask?.dependsOn(publicationTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Bintray publishing
|
// // Bintray publishing
|
||||||
@ -50,9 +68,15 @@ class KSciencePublishingExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Sonatype publishing
|
* Sonatype publishing
|
||||||
*/
|
*/
|
||||||
fun sonatype() {
|
fun sonatype(publish: Boolean = true) {
|
||||||
require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" }
|
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||||
project.addSonatypePublishing()
|
project.addSonatypePublishing()
|
||||||
|
if (publish) {
|
||||||
|
project.tasks.findByName("publish${project.publicationTarget}ToSonatypeRepository")
|
||||||
|
?.let { publicationTask ->
|
||||||
|
releaseTask?.dependsOn(publicationTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,9 +87,22 @@ class KSciencePublishingExtension(val project: Project) {
|
|||||||
open class KScienceProjectPlugin : Plugin<Project> {
|
open class KScienceProjectPlugin : Plugin<Project> {
|
||||||
override fun apply(target: Project): Unit = target.run {
|
override fun apply(target: Project): Unit = target.run {
|
||||||
apply<ChangelogPlugin>()
|
apply<ChangelogPlugin>()
|
||||||
|
|
||||||
apply<DokkaPlugin>()
|
apply<DokkaPlugin>()
|
||||||
apply<BinaryCompatibilityValidatorPlugin>()
|
apply<BinaryCompatibilityValidatorPlugin>()
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
if (isSnapshot()) {
|
||||||
|
configure<ApiValidationExtension> {
|
||||||
|
validationDisabled = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
configure<ChangelogPluginExtension> {
|
||||||
|
version = project.version.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val rootReadmeExtension = KScienceReadmeExtension(this)
|
val rootReadmeExtension = KScienceReadmeExtension(this)
|
||||||
extensions.add("ksciencePublish", KSciencePublishingExtension(this))
|
extensions.add("ksciencePublish", KSciencePublishingExtension(this))
|
||||||
extensions.add("readme", rootReadmeExtension)
|
extensions.add("readme", rootReadmeExtension)
|
||||||
@ -164,7 +201,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<DokkaTask> {
|
tasks.withType<AbstractDokkaTask> {
|
||||||
dependsOn(generateReadme)
|
dependsOn(generateReadme)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,15 +36,15 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
|
|
||||||
data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
||||||
|
|
||||||
val features = ArrayList<Feature>()
|
val features: MutableList<Feature> = ArrayList()
|
||||||
|
|
||||||
@Deprecated("Use lambda builder instead")
|
@Deprecated("Use lambda builder instead")
|
||||||
fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
||||||
features.add(Feature(id, description, ref, name))
|
features += Feature(id, description, ref, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
|
fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
|
||||||
features.add(Feature(id, description(), ref, name))
|
features += Feature(id, description(), ref, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val properties: MutableMap<String, () -> Any?> = mutableMapOf(
|
private val properties: MutableMap<String, () -> Any?> = mutableMapOf(
|
||||||
@ -55,14 +55,16 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val actualizedProperties
|
val actualizedProperties
|
||||||
get() = properties.mapValues { (_, value) ->
|
get() = properties.mapValues { (_, value) -> value() }
|
||||||
value.invoke()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun property(key: String, value: Any?) {
|
fun property(key: String, value: Any?) {
|
||||||
properties[key] = { value }
|
properties[key] = { value }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun property(key: String, value: () -> Any?) {
|
||||||
|
properties[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
fun propertyByTemplate(key: String, template: String) {
|
fun propertyByTemplate(key: String, template: String) {
|
||||||
val actual = actualizedProperties
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
@ -73,7 +75,7 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
fun propertyByTemplate(key: String, template: File) {
|
fun propertyByTemplate(key: String, template: File) {
|
||||||
val actual = actualizedProperties
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
additionalFiles.add(template)
|
additionalFiles += template
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,20 +6,20 @@ import org.gradle.api.JavaVersion
|
|||||||
* Build constants
|
* Build constants
|
||||||
*/
|
*/
|
||||||
object KScienceVersions {
|
object KScienceVersions {
|
||||||
const val kotlinVersion = "1.5.0"
|
const val kotlinVersion = "1.5.10"
|
||||||
const val kotlinxNodeVersion = "0.0.7"
|
const val kotlinxNodeVersion = "0.0.7"
|
||||||
const val coroutinesVersion = "1.4.3"
|
const val coroutinesVersion = "1.5.0"
|
||||||
const val serializationVersion = "1.1.0"
|
const val serializationVersion = "1.2.1"
|
||||||
const val atomicVersion = "0.16.1"
|
const val atomicVersion = "0.16.1"
|
||||||
const val ktorVersion = "1.5.3"
|
const val ktorVersion = "1.6.0"
|
||||||
const val htmlVersion = "0.7.3"
|
const val htmlVersion = "0.7.3"
|
||||||
const val dateTimeVersion = "0.1.1"
|
const val dateTimeVersion = "0.2.1"
|
||||||
|
const val jsBom = "0.0.1-pre.213-kotlin-1.5.10"
|
||||||
|
|
||||||
val JVM_TARGET = JavaVersion.VERSION_11
|
val JVM_TARGET = JavaVersion.VERSION_11
|
||||||
|
|
||||||
object Serialization{
|
object Serialization{
|
||||||
const val xmlVersion = "0.81.2"
|
const val xmlVersion = "0.82.0"
|
||||||
const val bsonVersion = "0.4.4"
|
|
||||||
const val yamlKtVersion = "0.9.0"
|
const val yamlKtVersion = "0.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.maven
|
|
||||||
import org.gradle.kotlin.dsl.repositories
|
|
||||||
import ru.mipt.npm.gradle.internal.useCommonDependency
|
import ru.mipt.npm.gradle.internal.useCommonDependency
|
||||||
import ru.mipt.npm.gradle.internal.useDependency
|
|
||||||
|
|
||||||
class SerializationTargets(
|
class SerializationTargets(
|
||||||
val sourceSet: DependencySourceSet,
|
val sourceSet: DependencySourceSet,
|
||||||
@ -44,11 +41,8 @@ class SerializationTargets(
|
|||||||
fun Project.xml(
|
fun Project.xml(
|
||||||
version: String = KScienceVersions.Serialization.xmlVersion
|
version: String = KScienceVersions.Serialization.xmlVersion
|
||||||
) {
|
) {
|
||||||
repositories {
|
|
||||||
maven("https://dl.bintray.com/pdvrieze/maven")
|
|
||||||
}
|
|
||||||
useCommonDependency(
|
useCommonDependency(
|
||||||
"net.devrieze:xmlutil-serialization:$version",
|
"io.github.pdvrieze.xmlutil:serialization:$version",
|
||||||
dependencySourceSet = sourceSet,
|
dependencySourceSet = sourceSet,
|
||||||
dependencyConfiguration = configuration
|
dependencyConfiguration = configuration
|
||||||
)
|
)
|
||||||
@ -63,14 +57,4 @@ class SerializationTargets(
|
|||||||
dependencyConfiguration = configuration
|
dependencyConfiguration = configuration
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.bson(
|
|
||||||
version: String = KScienceVersions.Serialization.bsonVersion
|
|
||||||
) {
|
|
||||||
useDependency(
|
|
||||||
"jvm" to "com.github.jershell:kbson:$version",
|
|
||||||
dependencySourceSet = sourceSet,
|
|
||||||
dependencyConfiguration = configuration
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,6 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
|||||||
internal fun RepositoryHandler.applyRepos(): Unit {
|
internal fun RepositoryHandler.applyRepos(): Unit {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
|
|
||||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
|
internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
|
||||||
|
@ -20,33 +20,42 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
|||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
|
|
||||||
plugins.withId("ru.mipt.npm.gradle.js") {
|
plugins.withId("org.jetbrains.kotlin.js") {
|
||||||
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
|
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
||||||
|
|
||||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
||||||
archiveClassifier.set("sources")
|
archiveClassifier.set("sources")
|
||||||
from(kotlin.sourceSets["main"].kotlin)
|
kotlin.sourceSets.forEach{
|
||||||
|
from(it.kotlin)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
afterEvaluate {
|
||||||
publications {
|
publications {
|
||||||
create("js", MavenPublication::class) {
|
create("js", MavenPublication::class) {
|
||||||
from(components["kotlin"])
|
kotlin.js().components.forEach {
|
||||||
artifact(sourcesJar)
|
from(it)
|
||||||
|
}
|
||||||
|
artifact(sourcesJar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.withId("ru.mipt.npm.gradle.jvm") {
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||||
|
|
||||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
||||||
archiveClassifier.set("sources")
|
archiveClassifier.set("sources")
|
||||||
from(kotlin.sourceSets["main"].kotlin)
|
kotlin.sourceSets.forEach{
|
||||||
|
from(it.kotlin)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publications {
|
publications {
|
||||||
create("jvm", MavenPublication::class) {
|
create("jvm", MavenPublication::class) {
|
||||||
from(components["kotlin"])
|
kotlin.target.components.forEach {
|
||||||
|
from(it)
|
||||||
|
}
|
||||||
artifact(sourcesJar)
|
artifact(sourcesJar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +119,7 @@ internal val Project.publicationTarget: String
|
|||||||
|
|
||||||
internal fun Project.addGithubPublishing(
|
internal fun Project.addGithubPublishing(
|
||||||
githubOrg: String,
|
githubOrg: String,
|
||||||
githubProject: String
|
githubProject: String,
|
||||||
) {
|
) {
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||||
logger.info("Skipping github publishing because publishing is disabled")
|
logger.info("Skipping github publishing because publishing is disabled")
|
||||||
@ -139,8 +148,6 @@ internal fun Project.addGithubPublishing(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val publicationTask = tasks.getByName("publish${publicationTarget}ToGithubRepository")
|
|
||||||
rootProject.tasks.findByName("release")?.dependsOn(publicationTask)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,8 +181,6 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val publicationTask = tasks.getByName("publish${publicationTarget}ToSpaceRepository")
|
|
||||||
rootProject.tasks.findByName("release")?.dependsOn(publicationTask)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,8 +234,6 @@ internal fun Project.addSonatypePublishing() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val publicationTask = tasks.getByName("publish${publicationTarget}ToSonatypeRepository")
|
|
||||||
rootProject.tasks.findByName("release")?.dependsOn(publicationTask)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user