Skip to content

Commit 65216ce

Browse files
committed
Dokka added to build.gradle.
Publishing as library added. Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent 6a68140 commit 65216ce

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

build.gradle

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

2528
plugins {
2629
id "maven-publish"
2730
id "java-library"
28-
id 'maven'
31+
id "maven"
2932
}
3033

34+
apply(plugin: "org.jetbrains.dokka")
3135
apply(plugin: "net.minecraftforge.gradle")
3236
apply(plugin: "kotlin")
3337
apply(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+
126138
jar {
127139
manifest {
128140
attributes([
@@ -143,3 +155,35 @@ sourceCompatibility = targetCompatibility =
143155

144156
compileKotlin.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+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ kotlin_jdk_version_target=jdk8
1313
project_jvm_version_target=1.8
1414
kotlin_version=1.3.70
1515
kotlinx_serialization_version=0.20.0
16+
dokka_version=0.10.1
1617
module_version=1.14.4-1.2.0
1718
module_name=Project Essentials Home
1819
module_id=project_essentials_home

0 commit comments

Comments
 (0)