|
| 1 | +package com.openai.snapo.buildlogic.publishing |
| 2 | + |
| 3 | +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary |
| 4 | +import com.vanniktech.maven.publish.JavadocJar |
| 5 | +import com.vanniktech.maven.publish.MavenPublishBaseExtension |
| 6 | +import com.vanniktech.maven.publish.SourcesJar |
| 7 | +import org.gradle.api.Plugin |
| 8 | +import org.gradle.api.Project |
| 9 | +import org.gradle.kotlin.dsl.configure |
| 10 | + |
| 11 | +class MavenPublishConventionPlugin : Plugin<Project> { |
| 12 | + override fun apply(target: Project) { |
| 13 | + target.pluginManager.withPlugin("com.android.library") { |
| 14 | + target.pluginManager.apply("com.vanniktech.maven.publish") |
| 15 | + |
| 16 | + target.extensions.configure<MavenPublishBaseExtension> { |
| 17 | + configure( |
| 18 | + AndroidSingleVariantLibrary( |
| 19 | + javadocJar = JavadocJar.Empty(), |
| 20 | + sourcesJar = SourcesJar.Sources(), |
| 21 | + variant = "release", |
| 22 | + ), |
| 23 | + ) |
| 24 | + coordinates( |
| 25 | + groupId = target.group.toString(), |
| 26 | + artifactId = target.name, |
| 27 | + version = target.version.toString(), |
| 28 | + ) |
| 29 | + publishToMavenCentral() |
| 30 | + signAllPublications() |
| 31 | + |
| 32 | + pom { |
| 33 | + name.set("Snap-O ${target.name}") |
| 34 | + description.set("Android network inspection integration for Snap-O.") |
| 35 | + inceptionYear.set("2025") |
| 36 | + url.set("https://github.com/openai/snap-o") |
| 37 | + |
| 38 | + licenses { |
| 39 | + license { |
| 40 | + name.set("The Apache License, Version 2.0") |
| 41 | + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") |
| 42 | + distribution.set("repo") |
| 43 | + } |
| 44 | + } |
| 45 | + developers { |
| 46 | + developer { |
| 47 | + id.set("openai") |
| 48 | + name.set("OpenAI") |
| 49 | + url.set("https://openai.com") |
| 50 | + } |
| 51 | + } |
| 52 | + scm { |
| 53 | + url.set("https://github.com/openai/snap-o") |
| 54 | + connection.set("scm:git:https://github.com/openai/snap-o.git") |
| 55 | + developerConnection.set("scm:git:ssh://git@github.com/openai/snap-o.git") |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | +} |
0 commit comments