Merge pull request #13 from mipt-npm/dev
0.9.3
This commit is contained in:
commit
ac4b34c054
@ -9,6 +9,9 @@ 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
|
||||
|
||||
|
@ -3,12 +3,12 @@ plugins {
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
signing
|
||||
id("org.jetbrains.changelog") version "1.0.0"
|
||||
id("org.jetbrains.dokka") version "1.4.20"
|
||||
id("org.jetbrains.changelog") version "1.1.2"
|
||||
id("org.jetbrains.dokka") version "1.4.30"
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
version = "0.9.0"
|
||||
version = "0.9.3"
|
||||
|
||||
description = "Build tools for DataForge and kscience projects"
|
||||
|
||||
@ -17,12 +17,10 @@ repositories {
|
||||
jcenter()
|
||||
maven("https://repo.kotlin.link")
|
||||
maven("https://kotlin.bintray.com/kotlinx")
|
||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||
|
||||
}
|
||||
|
||||
val kotlinVersion = "1.4.31"
|
||||
val kotlinVersion = "1.4.32"
|
||||
|
||||
java {
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
@ -32,10 +30,10 @@ 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.1")
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
|
||||
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.0.0")
|
||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0")
|
||||
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.2")
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.30")
|
||||
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
|
||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0")
|
||||
}
|
||||
|
||||
project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply {
|
||||
@ -52,12 +50,6 @@ project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply {
|
||||
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
||||
}
|
||||
|
||||
create("publishing") {
|
||||
id = "ru.mipt.npm.gradle.publish"
|
||||
description = "The publication plugin for bintray and github"
|
||||
implementationClass = "ru.mipt.npm.gradle.KSciencePublishingPlugin"
|
||||
}
|
||||
|
||||
create("mpp") {
|
||||
id = "ru.mipt.npm.gradle.mpp"
|
||||
description = "Pre-configured multiplatform project"
|
||||
|
@ -42,6 +42,9 @@ enum class DependencySourceSet(val setName: String, val suffix: String) {
|
||||
|
||||
class KScienceExtension(val project: Project) {
|
||||
|
||||
/**
|
||||
* Use coroutines-core with default version or [version]
|
||||
*/
|
||||
fun useCoroutines(
|
||||
version: String = KScienceVersions.coroutinesVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
@ -52,13 +55,25 @@ class KScienceExtension(val project: Project) {
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
|
||||
fun useAtomic(version: String = KScienceVersions.atomicVersion): Unit = project.run {
|
||||
/**
|
||||
* Use kotlinx-atmicfu plugin and library
|
||||
*/
|
||||
fun useAtomic(
|
||||
version: String = KScienceVersions.atomicVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
||||
): Unit = project.run {
|
||||
plugins.apply("kotlinx-atomicfu")
|
||||
useCommonDependency(
|
||||
"org.jetbrains.kotlinx:atomicfu:$version"
|
||||
"org.jetbrains.kotlinx:atomicfu:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use core serialization library and configure targets
|
||||
*/
|
||||
fun useSerialization(
|
||||
version: String = KScienceVersions.serializationVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
@ -79,26 +94,20 @@ class KScienceExtension(val project: Project) {
|
||||
SerializationTargets(sourceSet, configuration).apply(block)
|
||||
}
|
||||
|
||||
fun useAtomic(
|
||||
version: String = KScienceVersions.atomicVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
|
||||
): Unit = project.run {
|
||||
plugins.apply("kotlinx-atomicfu")
|
||||
useCommonDependency(
|
||||
"org.jetbrains.kotlinx:atomicfu-common:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
}
|
||||
|
||||
fun useFx(
|
||||
vararg modules: FXModule,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
||||
version: String = "14",
|
||||
version: String = "11",
|
||||
platform: FXPlatform = defaultPlatform
|
||||
) = project.useFx(modules.toList(), configuration, version, platform)
|
||||
|
||||
/**
|
||||
* Use kotlinx-datetime library with default version or [version]
|
||||
*/
|
||||
fun useDateTime(version: String = KScienceVersions.dateTimeVersion){
|
||||
project.useCommonDependency("org.jetbrains.kotlinx:kotlinx-datetime:$version")
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this module as an application module. JVM application should be enabled separately
|
||||
*/
|
||||
|
@ -17,10 +17,12 @@ import ru.mipt.npm.gradle.internal.setupPublication
|
||||
class KSciencePublishingExtension(val project: Project) {
|
||||
private var initializedFlag = false
|
||||
|
||||
fun setup(vcsUrl: String){
|
||||
fun configurePublications(vcsUrl: String){
|
||||
if(!initializedFlag) {
|
||||
project.setupPublication(vcsUrl)
|
||||
initializedFlag = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* github publishing
|
||||
@ -28,7 +30,7 @@ class KSciencePublishingExtension(val project: Project) {
|
||||
fun github(githubProject: String, githubOrg: String = "mipt-npm") {
|
||||
//automatically initialize vcs using github
|
||||
if(!initializedFlag){
|
||||
setup("https://github.com/$githubOrg/$githubProject")
|
||||
configurePublications("https://github.com/$githubOrg/$githubProject")
|
||||
}
|
||||
project.addGithubPublishing(githubOrg, githubProject)
|
||||
}
|
||||
@ -37,7 +39,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 'setup' method to do so"}
|
||||
require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
|
||||
project.addSpacePublishing(spaceRepo)
|
||||
}
|
||||
|
||||
@ -48,10 +50,10 @@ class KSciencePublishingExtension(val project: Project) {
|
||||
// var bintrayRepo: String? by project.extra
|
||||
|
||||
/**
|
||||
* Sonatype publising
|
||||
* Sonatype publishing
|
||||
*/
|
||||
fun sonatype(){
|
||||
require(initializedFlag){"The publishing is not set up use 'setup' method to do so"}
|
||||
require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
|
||||
project.addSonatypePublishing()
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,14 @@ import org.gradle.api.JavaVersion
|
||||
* Build constants
|
||||
*/
|
||||
object KScienceVersions {
|
||||
const val kotlinVersion = "1.4.31"
|
||||
const val kotlinVersion = "1.4.32"
|
||||
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 dateTimeVersion = "0.1.1"
|
||||
|
||||
val JVM_TARGET = JavaVersion.VERSION_11
|
||||
|
||||
|
@ -22,10 +22,7 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
||||
internal fun RepositoryHandler.applyRepos(): Unit {
|
||||
mavenCentral()
|
||||
maven("https://repo.kotlin.link")
|
||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||
maven("https://kotlin.bintray.com/kotlinx")
|
||||
maven("https://kotlin.bintray.com/kotlin-js-wrappers/")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
|
||||
}
|
||||
|
||||
internal fun Copy.fromJsDependencies(configurationName: String) = project.afterEvaluate {
|
||||
|
@ -59,6 +59,7 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
||||
}
|
||||
|
||||
// Process each publication we have in this project
|
||||
afterEvaluate {
|
||||
publications.withType<MavenPublication>().forEach { publication ->
|
||||
publication.artifact(dokkaJar)
|
||||
publication.pom {
|
||||
@ -92,13 +93,14 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Project.isSnapshot() = version.toString().contains("dev") || version.toString().endsWith("SNAPSHOT")
|
||||
|
||||
internal val Project.publicationTarget: String
|
||||
get() {
|
||||
val publicationPlatform = project.findProperty("publication.platform") as? String
|
||||
val publicationPlatform = project.findProperty("publishing.platform") as? String
|
||||
return if (publicationPlatform == null) {
|
||||
"AllPublications"
|
||||
} else {
|
||||
@ -110,8 +112,12 @@ internal fun Project.addGithubPublishing(
|
||||
githubOrg: String,
|
||||
githubProject: String
|
||||
) {
|
||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
return
|
||||
}
|
||||
if (requestPropertyOrNull("publishing.github") == "false") {
|
||||
logger.info("Skipping github publishing based on flag value")
|
||||
logger.info("Skipping github publishing because `publishing.github == false`")
|
||||
return
|
||||
}
|
||||
|
||||
@ -140,8 +146,12 @@ internal fun Project.addGithubPublishing(
|
||||
}
|
||||
|
||||
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
return
|
||||
}
|
||||
if (requestPropertyOrNull("publishing.space") == "false") {
|
||||
logger.info("Skipping space publishing based on flag value")
|
||||
logger.info("Skipping space publishing because `publishing.space == false`")
|
||||
return
|
||||
}
|
||||
|
||||
@ -171,12 +181,16 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
}
|
||||
|
||||
internal fun Project.addSonatypePublishing() {
|
||||
if(isSnapshot()){
|
||||
if(requestPropertyOrNull("publishing.enabled")!="true"){
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
return
|
||||
}
|
||||
if (isSnapshot()) {
|
||||
logger.info("Sonatype publishing skipped for dev version")
|
||||
return
|
||||
}
|
||||
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
||||
logger.info("Skipping sonatype publishing based on flag value")
|
||||
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user