@@ -19,15 +19,19 @@ buildscript {
1919 classpath(
2020 " org.jetbrains.kotlin:kotlin-serialization:$kotlin_version "
2121 )
22+ classpath(
23+ " org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version "
24+ )
2225 }
2326}
2427
2528plugins {
2629 id " maven-publish"
2730 id " java-library"
28- id ' maven'
31+ id " maven"
2932}
3033
34+ apply(plugin : " org.jetbrains.dokka" )
3135apply(plugin : " net.minecraftforge.gradle" )
3236apply(plugin : " kotlin" )
3337apply(plugin : " kotlinx-serialization" )
@@ -77,6 +81,7 @@ repositories {
7781 jcenter()
7882 mavenCentral()
7983 maven { url(" https://libraries.minecraft.net" ) }
84+ maven { url " https://jitpack.io" }
8085 maven {
8186 name = " GitHubPackages"
8287 url = uri " https://maven.pkg.github.com/projectessentials/projectessentials-core"
@@ -123,6 +128,13 @@ dependencies {
123128 )
124129}
125130
131+ dokka {
132+ outputFormat = ' html'
133+ outputDirectory = " $buildDir /libs/docs"
134+ }
135+
136+ project. tasks[" jar" ]. dependsOn(project. tasks[" dokka" ])
137+
126138jar {
127139 manifest {
128140 attributes([
@@ -143,3 +155,35 @@ sourceCompatibility = targetCompatibility =
143155
144156compileKotlin. kotlinOptions. jvmTarget =
145157 compileTestKotlin. kotlinOptions. jvmTarget = project_jvm_version_target
158+
159+ task sourcesJar (type : Jar ) {
160+ classifier = ' sources'
161+ from sourceSets. main. allSource
162+ }
163+
164+ task dokkaJar (type : Jar ) {
165+ group = JavaBasePlugin . DOCUMENTATION_GROUP
166+ description = " Assembles Kotlin docs with Dokka"
167+ classifier = " javadoc"
168+ from tasks. dokka as Object
169+ }
170+
171+ publishing {
172+ repositories {
173+ maven {
174+ name = " GitHubPackages"
175+ url = uri " https://maven.pkg.github.com/projectessentials/projectessentials-home"
176+ credentials {
177+ username = System . getenv(" GradleUser" )
178+ password = System . getenv(" GradlePass" )
179+ }
180+ }
181+ }
182+ publications {
183+ gpr(MavenPublication ) {
184+ from components. java
185+ artifact sourcesJar
186+ artifact dokkaJar
187+ }
188+ }
189+ }
0 commit comments