Skip to content

Commit

Permalink
Merge pull request #52 from JetBrains-Research/publishing
Browse files Browse the repository at this point in the history
Add publishing to space
  • Loading branch information
nbirillo authored Aug 16, 2023
2 parents d007374 + a5517ef commit aff0459
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*

val projectVersion = "1.0.0"

group = "org.jetbrains.research.ml.ast.transformations"
version = "1.0-SNAPSHOT"
version = projectVersion

fun properties(key: String) = project.findProperty(key).toString()

Expand All @@ -11,6 +14,7 @@ plugins {
id("org.jetbrains.intellij") version "1.10.0" apply true
id("org.jetbrains.dokka") version "1.7.0" apply true
id("org.jlleitschuh.gradle.ktlint") version "10.3.0" apply true
`maven-publish`
}

allprojects {
Expand Down Expand Up @@ -57,3 +61,45 @@ allprojects {
.forEach { it.enabled = false }
}
}

fun getLocalProperty(key: String, file: String = "local.properties"): String? {
val properties = Properties()

File("local.properties")
.takeIf { it.isFile }
?.let { properties.load(it.inputStream()) }
?: println("File $file with properties not found")

return properties.getProperty(key, null)
}

val spaceUsername = getLocalProperty("spaceUsername")
val spacePassword = getLocalProperty("spacePassword")

configure(subprojects.filter { it.name != "plugin-utilities-plugin" }) {

apply(plugin = "maven-publish")

val subprojectName = this.name

publishing {
publications {
register<MavenPublication>("maven") {
groupId = "org.jetbrains.research.ml.ast.transformations"
artifactId = subprojectName
version = projectVersion
from(components["java"])
}
}

repositories {
maven {
url = uri("https://packages.jetbrains.team/maven/p/bumblebee/bumblebee")
credentials {
username = spaceUsername
password = spacePassword
}
}
}
}
}

0 comments on commit aff0459

Please sign in to comment.