Skip to content

Commit

Permalink
feat: add javadoc, sources and plugin jars
Browse files Browse the repository at this point in the history
  • Loading branch information
DuoDuoJuZi committed Dec 26, 2024
1 parent 5d060eb commit 13093f4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build
# run: ./gradlew shadowJar
run: ./gradlew allJar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ It should be noted that the entire library fully depends on [Fairy Framework](ht

### for developer

Please configure your Github Username and Github Token
You can use jar files ending with sources as dependencies, which include both compiled binary files and source code.

The GitHub Packages repository will open soon.

<!--Please configure your GitHub Username and GitHub Token
* Maven Repo:
```kts
Expand All @@ -42,7 +46,7 @@ dependencies {
}
```
You can get all modules and versions here [GitHub Packages](https://github.com/LegacyLands/legacy-lands-library/packages)
You can get all modules and versions here [GitHub Packages](https://github.com/LegacyLands/legacy-lands-library/packages)-->

## modules

Expand Down
31 changes: 15 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

Expand Down Expand Up @@ -84,7 +85,6 @@ subprojects {

// Configure ShadowJar task
tasks.withType(ShadowJar::class) {
archiveClassifier.set("shadow")
// Relocate fairy to avoid plugin conflict
relocate("io.fairyproject.bootstrap", "${properties("package")}.fairy.bootstrap")
relocate("net.kyori", "io.fairyproject.libs.kyori")
Expand All @@ -94,15 +94,25 @@ subprojects {
relocate("com.github.retrooper.packetevents", "io.fairyproject.libs.packetevents")
relocate("io.github.retrooper.packetevents", "io.fairyproject.libs.packetevents")
relocate("io.fairyproject.bukkit.menu", "${properties("package")}.fairy.menu")
archiveClassifier.set("plugin")
}

// Configure sourcesJar task
tasks.register<Jar>("sourcesJar") {
from(tasks.named<ShadowJar>("shadowJar").get().source)
from(sourceSets.main.get().allSource)
archiveClassifier.set("all")
archiveClassifier.set("sources")
}
tasks.named("build") {
dependsOn("shadowJar", "sourcesJar")

// Configure javadocJar task
tasks.register<Jar>("javadocJar") {
dependsOn(tasks.named("javadoc"))
from(tasks.named("javadoc"))
archiveClassifier.set("javadoc")
}

tasks.register("allJar") {
dependsOn("shadowJar", "sourcesJar", "javadocJar")
}
}

Expand All @@ -113,25 +123,14 @@ publishing {
create<MavenPublication>("shadow-${module.capitalize()}") {
project.extensions.configure<com.github.jengelman.gradle.plugins.shadow.ShadowExtension>() {
component(this@create)
//artifact(tasks.named<ShadowJar>("shadowJar").get().archiveFile.get())
artifact(tasks.named<ShadowJar>("shadowJar").get().source)
groupId = group.toString()
artifactId = "$module"
version = "${properties("version")}-${LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-MM-yy-hhmmss"))}"
}
}
}
}
// Maven Central
// publications {
// modules.forEach { module ->
// create<MavenPublication>("maven-${module.capitalize()}") {
// artifact(tasks.named<ShadowJar>("shadowJar").get().archiveFile.get())
// groupId = group.toString()
// artifactId = "$module"
// version = "${properties("version")}-${LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-MM-yy-hhmmss"))}"
// }
// }
// }

// GitHub Packages
repositories {
Expand Down

0 comments on commit 13093f4

Please sign in to comment.