adjust release publishing
This commit is contained in:
parent
5ff90436f5
commit
023ca7b80c
@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
version = "0.9.7"
|
||||
version = "0.9.8"
|
||||
|
||||
description = "Build tools for DataForge and kscience projects"
|
||||
|
||||
|
@ -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"
|
@ -40,7 +40,6 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
}
|
||||
tasks.withType<KotlinJvmCompile> {
|
||||
kotlinOptions {
|
||||
useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
}
|
||||
@ -95,7 +94,6 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
}
|
||||
|
@ -147,6 +147,7 @@ class KScienceExtension(val project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Replace by applying maven-publish plugin")
|
||||
fun publish() {
|
||||
project.plugins.apply(MavenPublishPlugin::class)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import ru.mipt.npm.gradle.internal.*
|
||||
class KSciencePublishingExtension(val project: Project) {
|
||||
private var initializedFlag = false
|
||||
|
||||
fun configurePublications(vcsUrl: String) {
|
||||
fun vcs(vcsUrl: String) {
|
||||
if (!initializedFlag) {
|
||||
project.setupPublication(vcsUrl)
|
||||
initializedFlag = true
|
||||
@ -25,21 +25,35 @@ class KSciencePublishingExtension(val project: Project) {
|
||||
|
||||
/**
|
||||
* 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
|
||||
if (!initializedFlag) {
|
||||
configurePublications("https://github.com/$githubOrg/$githubProject")
|
||||
vcs("https://github.com/$githubOrg/$githubProject")
|
||||
}
|
||||
project.addGithubPublishing(githubOrg, githubProject)
|
||||
|
||||
if (publish) {
|
||||
val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToGithubRepository")
|
||||
releaseTask?.dependsOn(publicationTask)
|
||||
}
|
||||
}
|
||||
|
||||
private val releaseTask by lazy {
|
||||
project.tasks.findByName("release")
|
||||
}
|
||||
|
||||
/**
|
||||
* 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" }
|
||||
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", publish: Boolean = false) {
|
||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||
project.addSpacePublishing(spaceRepo)
|
||||
if (publish) {
|
||||
val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSpaceRepository")
|
||||
releaseTask?.dependsOn(publicationTask)
|
||||
}
|
||||
}
|
||||
|
||||
// // Bintray publishing
|
||||
@ -51,9 +65,13 @@ 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(publish: Boolean = true) {
|
||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||
project.addSonatypePublishing()
|
||||
if (publish) {
|
||||
val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSonatypeRepository")
|
||||
releaseTask?.dependsOn(publicationTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +83,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = target.run {
|
||||
apply<ChangelogPlugin>()
|
||||
|
||||
if(!isSnapshot()) {
|
||||
if (!isSnapshot()) {
|
||||
configure<ChangelogPluginExtension> {
|
||||
version = project.version.toString()
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ object KScienceVersions {
|
||||
const val coroutinesVersion = "1.5.0"
|
||||
const val serializationVersion = "1.2.1"
|
||||
const val atomicVersion = "0.16.1"
|
||||
const val ktorVersion = "1.5.3"
|
||||
const val ktorVersion = "1.5.4"
|
||||
const val htmlVersion = "0.7.3"
|
||||
const val dateTimeVersion = "0.2.0"
|
||||
|
||||
|
@ -22,7 +22,6 @@ 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")
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ internal val Project.publicationTarget: String
|
||||
|
||||
internal fun Project.addGithubPublishing(
|
||||
githubOrg: String,
|
||||
githubProject: String
|
||||
githubProject: String,
|
||||
) {
|
||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
@ -139,8 +139,6 @@ internal fun Project.addGithubPublishing(
|
||||
}
|
||||
}
|
||||
}
|
||||
val publicationTask = tasks.getByName("publish${publicationTarget}ToGithubRepository")
|
||||
rootProject.tasks.findByName("release")?.dependsOn(publicationTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,8 +172,6 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
val publicationTask = tasks.getByName("publish${publicationTarget}ToSpaceRepository")
|
||||
rootProject.tasks.findByName("release")?.dependsOn(publicationTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -229,8 +225,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