Merge pull request #14 from mipt-npm/dev

Dev
This commit is contained in:
Alexander Nozik 2021-04-26 19:19:52 +03:00 committed by GitHub
commit dad49b0c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 95 additions and 73 deletions

View File

@ -9,9 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
### Changed
- `publication.platform` changed to `publishing.platform`
- Dokka version to `1.4.30`
- `useDateTime` in extension
### Deprecated
@ -21,6 +18,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
## [0.9.5]
### Added
- Disable API validation for snapshots
- `-Xjvm-default=all` on JVM
### Changed
- `publication.platform` changed to `publishing.platform`
- Dokka version to `1.4.30`
- `useDateTime` in extension
- Kotlin 1.5
### Deprecated
### Removed
- Publish plugin. Use MavenPublish instead
### Fixed
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
### Security
## [0.9.0]
### Added
- Skip sonatype publishing for dev versions

View File

@ -4,23 +4,25 @@ plugins {
`maven-publish`
signing
id("org.jetbrains.changelog") version "1.1.2"
id("org.jetbrains.dokka") version "1.4.30"
id("org.jetbrains.dokka") version "1.4.32"
}
group = "ru.mipt.npm"
version = "0.9.3"
version = "0.9.5"
description = "Build tools for DataForge and kscience projects"
repositories {
gradlePluginPortal()
jcenter()
maven("https://repo.kotlin.link")
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
changelog{
version = project.version.toString()
}
val kotlinVersion = "1.4.32"
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://repo.kotlin.link")
}
val kotlinVersion = "1.5.0"
java {
targetCompatibility = JavaVersion.VERSION_1_8
@ -30,8 +32,8 @@ java {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.2")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.30")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0")
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -42,6 +42,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
kotlinOptions {
useIR = true
jvmTarget = KScienceVersions.JVM_TARGET.toString()
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
}
}
@ -96,6 +97,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
kotlinOptions {
useIR = true
jvmTarget = KScienceVersions.JVM_TARGET.toString()
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
}
}
}

View File

@ -2,6 +2,7 @@ package ru.mipt.npm.gradle
import org.gradle.api.Project
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.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
@ -101,6 +102,16 @@ class KScienceExtension(val project: Project) {
platform: FXPlatform = defaultPlatform
) = project.useFx(modules.toList(), configuration, version, platform)
fun useHtml(
version: String = KScienceVersions.atomicVersion,
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
): Unit = project.useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-html:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration
)
/**
* Use kotlinx-datetime library with default version or [version]
*/
@ -137,7 +148,7 @@ class KScienceExtension(val project: Project) {
}
fun publish() {
project.plugins.apply(KSciencePublishingPlugin::class)
project.plugins.apply(MavenPublishPlugin::class)
}
}

View File

@ -1,6 +1,7 @@
package ru.mipt.npm.gradle
import groovy.text.SimpleTemplateEngine
import kotlinx.validation.ApiValidationExtension
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
@ -8,17 +9,14 @@ import org.gradle.kotlin.dsl.*
import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask
import ru.mipt.npm.gradle.internal.addGithubPublishing
import ru.mipt.npm.gradle.internal.addSonatypePublishing
import ru.mipt.npm.gradle.internal.addSpacePublishing
import ru.mipt.npm.gradle.internal.setupPublication
import ru.mipt.npm.gradle.internal.*
@Suppress("unused")
class KSciencePublishingExtension(val project: Project) {
private var initializedFlag = false
fun configurePublications(vcsUrl: String){
if(!initializedFlag) {
fun configurePublications(vcsUrl: String) {
if (!initializedFlag) {
project.setupPublication(vcsUrl)
initializedFlag = true
}
@ -29,7 +27,7 @@ class KSciencePublishingExtension(val project: Project) {
*/
fun github(githubProject: String, githubOrg: String = "mipt-npm") {
//automatically initialize vcs using github
if(!initializedFlag){
if (!initializedFlag) {
configurePublications("https://github.com/$githubOrg/$githubProject")
}
project.addGithubPublishing(githubOrg, githubProject)
@ -39,7 +37,7 @@ class KSciencePublishingExtension(val project: Project) {
* Space publishing
*/
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven") {
require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" }
project.addSpacePublishing(spaceRepo)
}
@ -52,8 +50,8 @@ class KSciencePublishingExtension(val project: Project) {
/**
* Sonatype publishing
*/
fun sonatype(){
require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
fun sonatype() {
require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" }
project.addSonatypePublishing()
}
}
@ -139,19 +137,19 @@ open class KScienceProjectPlugin : Plugin<Project> {
val name = subproject.name
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
val ext = subproject.extensions.findByType<KScienceReadmeExtension>()
appendln("<hr/>")
appendln("\n* ### [$name]($path)")
appendLine("<hr/>")
appendLine("\n* ### [$name]($path)")
if (ext != null) {
appendln("> ${ext.description}")
appendln(">\n> **Maturity**: ${ext.maturity}")
appendLine("> ${ext.description}")
appendLine(">\n> **Maturity**: ${ext.maturity}")
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
if (featureString.isNotBlank()) {
appendln(">\n> **Features:**")
appendln(featureString)
appendLine(">\n> **Features:**")
appendLine(featureString)
}
}
}
appendln("<hr/>")
appendLine("<hr/>")
}
val rootReadmeProperties: Map<String, Any?> =
@ -170,13 +168,21 @@ open class KScienceProjectPlugin : Plugin<Project> {
dependsOn(generateReadme)
}
val patchChangelog by tasks.getting
//val patchChangelog by tasks.getting
val release by tasks.creating {
group = RELEASE_GROUP
description = "Publish development or production release based on version suffix"
dependsOn(generateReadme)
}
// Disable API validation for snapshots
if (isSnapshot()) {
extensions.findByType<ApiValidationExtension>()?.apply {
validationDisabled = true
logger.warn("API validation is disabled for snapshot or dev version")
}
}
}
companion object {

View File

@ -1,17 +0,0 @@
package ru.mipt.npm.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
@Deprecated("To be replaced by maven-publish")
open class KSciencePublishingPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
if (plugins.findPlugin("maven-publish") == null) {
plugins.apply("maven-publish")
}
}
}

View File

@ -38,6 +38,7 @@ class KScienceReadmeExtension(val project: Project) {
val features = ArrayList<Feature>()
@Deprecated("Use lambda builder instead")
fun feature(id: String, description: String, ref: String? = null, name: String = id) {
features.add(Feature(id, description, ref, name))
}
@ -80,7 +81,7 @@ class KScienceReadmeExtension(val project: Project) {
*/
fun featuresString(itemPrefix: String = " - ", pathPrefix: String = "") = buildString {
features.forEach {
appendln("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
}
}

View File

@ -6,19 +6,19 @@ import org.gradle.api.JavaVersion
* Build constants
*/
object KScienceVersions {
const val kotlinVersion = "1.4.32"
const val kotlinVersion = "1.5.0"
const val kotlinxNodeVersion = "0.0.7"
const val coroutinesVersion = "1.4.3"
const val serializationVersion = "1.1.0"
const val atomicVersion = "0.15.1"
const val ktorVersion = "1.5.2"
const val htmlVersion = "0.7.2"
const val atomicVersion = "0.16.1"
const val ktorVersion = "1.5.3"
const val htmlVersion = "0.7.3"
const val dateTimeVersion = "0.1.1"
val JVM_TARGET = JavaVersion.VERSION_11
object Serialization{
const val xmlVersion = "0.81.1"
const val xmlVersion = "0.81.2"
const val bsonVersion = "0.4.4"
const val yamlKtVersion = "0.9.0"
}

View File

@ -8,9 +8,9 @@ import org.gradle.kotlin.dsl.maven
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
internal fun LanguageSettingsBuilder.applySettings(): Unit {
languageVersion = "1.4"
languageVersion = "1.5"
apiVersion = "1.5"
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("kotlin.Experimental")
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
@ -22,17 +22,17 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit {
internal fun RepositoryHandler.applyRepos(): Unit {
mavenCentral()
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.afterEvaluate {
internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
val configuration = configurations[configurationName]
?: error("Configuration with name $configurationName could not be resolved.")
val projectDeps = configuration.allDependencies.filterIsInstance<ProjectDependency>().map {
it.dependencyProject
}
projectDeps.forEach { dep ->
dep.afterEvaluate {
dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
dep.tasks.findByName("jsProcessResources")?.let { task ->
dependsOn(task)
@ -46,7 +46,6 @@ internal fun Copy.fromJsDependencies(configurationName: String) = project.afterE
}
}
}
}
}