1-
21/*
32 * This file was generated by the Gradle 'init' task.
43 *
@@ -12,8 +11,15 @@ plugins {
1211
1312 // Apply the java-library plugin for API and implementation separation.
1413 `java- library`
14+
15+ `maven- publish`
16+ alias(libs.plugins.dokka)
17+ signing
1518}
1619
20+ group = " computer.iroh"
21+ version = " 0.31.0"
22+
1723repositories {
1824 // Use Maven Central for resolving dependencies.
1925 mavenCentral()
@@ -35,6 +41,8 @@ dependencies {
3541
3642// Apply a specific Java toolchain to ease working on different environments.
3743java {
44+ withJavadocJar()
45+ withSourcesJar()
3846 toolchain {
3947 languageVersion = JavaLanguageVersion .of(21 )
4048 }
@@ -57,3 +65,106 @@ tasks.named<Test>("test") {
5765 events(" passed" , " skipped" , " failed" )
5866 }
5967}
68+
69+ val stagingDir = layout.buildDirectory.dir(" staging" )
70+
71+ signing {
72+ // Use property `signing.keyId` to pick GPG signing key
73+ // e.g. `./gradlew publish -Psigning.keyId=24875D73`
74+ // Or, place it in `~/.gradle/gradle.properties` for persistence.
75+
76+ useGpgCmd()
77+ sign(publishing.publications)
78+ }
79+
80+ dokka {
81+ moduleName = " Iroh"
82+ dokkaSourceSets.main {
83+ includes.from(rootProject.projectDir.resolve(" README.md" ))
84+ sourceLink {
85+ localDirectory = file(" src/main/kotlin" )
86+ remoteUrl(" https://github.com/n0-computer/iroh-ffi/blob/main/kotlin/lib/src/main/kotlin" )
87+ remoteLineSuffix.set(" #L" )
88+ }
89+ }
90+ pluginsConfiguration.html {
91+ footerMessage.set(" © n0, inc." )
92+ }
93+ // Runs Dokka in the current Gradle process
94+ dokkaGeneratorIsolation = ClassLoaderIsolation ()
95+ }
96+
97+ tasks.named(" javadocJar" , Jar ::class ) {
98+ dependsOn(tasks.dokkaGenerate)
99+ from(layout.buildDirectory.dir(" dokka/html" ))
100+ }
101+
102+ publishing {
103+ publications {
104+ register<MavenPublication >(" maven" ) {
105+ groupId = project.group.toString()
106+ version = project.version.toString()
107+ artifactId = " iroh"
108+
109+ pom {
110+ // https://central.sonatype.org/publish/requirements/#required-pom-metadata
111+
112+ name = " Iroh"
113+ description = " A toolkit for building distributed applications"
114+ inceptionYear = " 2025"
115+ url = " https://iroh.computer"
116+
117+ developers {
118+ developer {
119+ id = " number0"
120+ 121+ organization = " number0"
122+ organizationUrl = " https://n0.computer"
123+ }
124+ }
125+
126+ licenses {
127+ license {
128+ name = " Apache License, Version 2.0"
129+ url = " https://opensource.org/license/apache-2-0"
130+ }
131+ license {
132+ name = " The MIT License"
133+ url = " https://opensource.org/licenses/MIT"
134+ }
135+ }
136+
137+ scm {
138+ connection = " scm:git:git://https://github.com/n0-computer/iroh-ffi.git"
139+ developerConnection = " scm:git:ssh://https://github.com/n0-computer/iroh-ffi.git"
140+ url = " https://github.com/n0-computer/iroh-ffi"
141+ }
142+ }
143+
144+ from(components[" java" ])
145+ }
146+ }
147+
148+ repositories {
149+ maven(uri(stagingDir)) {
150+ name = " staging"
151+ }
152+ }
153+ }
154+
155+ val cleanStagingDir by tasks.register<Delete >(" cleanStagingDir" ) {
156+ delete(stagingDir)
157+ }
158+
159+ val zipStagingDir by tasks.register<Zip >(" zipStagingDir" ) {
160+ from(stagingDir)
161+ archiveFileName.set(" deploy.jar" )
162+ }
163+
164+ tasks.named(" publishMavenPublicationToStagingRepository" ) {
165+ dependsOn(cleanStagingDir)
166+ }
167+
168+ tasks.publish {
169+ finalizedBy(zipStagingDir)
170+ }
0 commit comments