1 import com.google.devtools.ksp.configureKtlint 2 import com.google.devtools.ksp.configureKtlintApplyToIdea 3 4 val sonatypeUserName: String? by project 5 val sonatypePassword: String? by project 6 7 val kotlinBaseVersion: String? by project 8 if (extra.has("kspOnlyVersion") && kotlinBaseVersion != null) { 9 val kspOnlyVersion = extra.get("kspOnlyVersion") as String 10 extra.set("kspVersion", "$kotlinBaseVersion-$kspOnlyVersion") 11 } 12 13 if (!extra.has("kspVersion")) { 14 extra.set("kspVersion", "2.0.255-SNAPSHOT") 15 } 16 <lambda>null17repositories { 18 mavenCentral() 19 maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/") 20 } 21 <lambda>null22plugins { 23 kotlin("jvm") version "1.8.0" 24 id("io.github.gradle-nexus.publish-plugin") version "1.1.0" 25 } 26 <lambda>null27nexusPublishing { 28 packageGroup.set("com.google.devtools.ksp") 29 repositories { 30 sonatype { 31 username.set(sonatypeUserName) 32 password.set(sonatypePassword) 33 } 34 } 35 } 36 37 version = rootProject.extra.get("kspVersion") as String 38 39 project.configureKtlintApplyToIdea() <lambda>null40subprojects { 41 group = "com.google.devtools.ksp" 42 version = rootProject.extra.get("kspVersion") as String 43 this.configureKtlint() 44 repositories { 45 mavenCentral() 46 google() 47 maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/") 48 maven("https://www.jetbrains.com/intellij-repository/snapshots") 49 } 50 pluginManager.withPlugin("maven-publish") { 51 val publishExtension = extensions.getByType<PublishingExtension>() 52 publishExtension.repositories { 53 if (extra.has("outRepo")) { 54 val outRepo = extra.get("outRepo") as String 55 maven { 56 url = File(outRepo).toURI() 57 } 58 } else { 59 mavenLocal() 60 } 61 maven { 62 name = "test" 63 url = uri("${rootProject.buildDir}/repos/test") 64 } 65 } 66 publishExtension.publications.whenObjectAdded { 67 check(this is MavenPublication) { 68 "unexpected publication $this" 69 } 70 val publication = this 71 publication.pom { 72 url.set("https://goo.gle/ksp") 73 licenses { 74 license { 75 name.set("The Apache License, Version 2.0") 76 url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") 77 } 78 } 79 developers { 80 developer { 81 name.set("KSP Team") 82 } 83 } 84 scm { 85 connection.set("scm:git:https://github.com/google/ksp.git") 86 developerConnection.set("scm:git:https://github.com/google/ksp.git") 87 url.set("https://github.com/google/ksp") 88 } 89 } 90 } 91 } 92 93 tasks.withType<JavaCompile>().configureEach { 94 sourceCompatibility = JavaVersion.VERSION_1_8.toString() 95 targetCompatibility = JavaVersion.VERSION_1_8.toString() 96 } 97 } 98