build: Move to using Indra
This commit is contained in:
parent
6a100c9ca1
commit
98f389a72a
6 changed files with 138 additions and 127 deletions
16
.github/workflows/gradle.yml
vendored
16
.github/workflows/gradle.yml
vendored
|
|
@ -1,20 +1,24 @@
|
|||
# This workflow will build a Java project with Maven
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Java CI with Maven
|
||||
name: Java CI with Gradle
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Only run on PRs if the source branch is on someone else's repo
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "windows-latest"]
|
||||
runs-on: "${{ matrix.os }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 11
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean build
|
||||
|
|
|
|||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -2,6 +2,10 @@
|
|||
# Created by https://www.toptal.com/developers/gitignore/api/git,java,eclipse,jetbrains+all,gradle
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=git,java,eclipse,jetbrains+all,gradle
|
||||
|
||||
### Cloud ###
|
||||
|
||||
/examples/*/run/
|
||||
|
||||
### Eclipse ###
|
||||
.metadata
|
||||
bin/
|
||||
|
|
|
|||
194
build.gradle.kts
194
build.gradle.kts
|
|
@ -1,20 +1,21 @@
|
|||
import com.hierynomus.gradle.license.LicenseBasePlugin
|
||||
import de.marcphilipp.gradle.nexus.NexusPublishPlugin
|
||||
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
||||
import net.kyori.indra.IndraExtension
|
||||
import net.kyori.indra.sonatypeSnapshots
|
||||
import net.ltgt.gradle.errorprone.ErrorPronePlugin
|
||||
import net.ltgt.gradle.errorprone.errorprone
|
||||
import nl.javadude.gradle.plugins.license.LicenseExtension
|
||||
import org.gradle.api.plugins.JavaPlugin.*
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
signing
|
||||
id("checkstyle")
|
||||
id("com.github.hierynomus.license") version "0.15.0"
|
||||
id("com.github.johnrengelman.shadow") version "6.1.0"
|
||||
id("de.marcphilipp.nexus-publish") version "0.4.0"
|
||||
id("net.ltgt.errorprone") version "1.3.0"
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
configFile = file("config/checkstyle/checkstyle.xml")
|
||||
val indraVersion = "1.2.1"
|
||||
id("net.kyori.indra") version indraVersion apply false
|
||||
id("net.kyori.indra.checkstyle") version indraVersion apply false
|
||||
id("net.kyori.indra.publishing.sonatype") version indraVersion apply false
|
||||
id("com.github.hierynomus.license") version "0.15.0" apply false
|
||||
id("com.github.johnrengelman.shadow") version "6.1.0" apply false
|
||||
id("net.ltgt.errorprone") version "1.3.0" apply false
|
||||
id("com.github.ben-manes.versions") version "0.36.0"
|
||||
}
|
||||
|
||||
buildGroups("Minecraft", "Discord", "IRC")
|
||||
|
|
@ -29,46 +30,54 @@ gradle.taskGraph.whenReady {
|
|||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply<IdeaPlugin>()
|
||||
apply<CheckstylePlugin>()
|
||||
group = "cloud.commandframework"
|
||||
version = "1.4.0"
|
||||
description = "Command framework and dispatcher for the JVM"
|
||||
|
||||
subprojects {
|
||||
plugins.apply("net.kyori.indra")
|
||||
plugins.apply("net.kyori.indra.checkstyle")
|
||||
plugins.apply("net.kyori.indra.publishing.sonatype")
|
||||
apply<ErrorPronePlugin>()
|
||||
apply<LicenseBasePlugin>()
|
||||
|
||||
group = "cloud.commandframework"
|
||||
version = "1.4.0"
|
||||
description = "Command framework and dispatcher for the JVM"
|
||||
|
||||
/* Disable checkstyle on tests */
|
||||
project.gradle.startParameter.excludedTaskNames.add("checkstyleTest")
|
||||
|
||||
license {
|
||||
extensions.configure(LicenseExtension::class) {
|
||||
header = rootProject.file("HEADER")
|
||||
mapping("java", "DOUBLESLASH_STYLE")
|
||||
mapping("kt", "DOUBLESLASH_STYLE")
|
||||
includes(listOf("**/*.java", "**/*.kt"))
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply<JavaLibraryPlugin>()
|
||||
apply<SigningPlugin>()
|
||||
apply<NexusPublishPlugin>()
|
||||
apply<ErrorPronePlugin>()
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
extensions.configure(IndraExtension::class) {
|
||||
github("Incendo", "cloud") {
|
||||
ci = true
|
||||
}
|
||||
mitLicense()
|
||||
|
||||
javaVersions {
|
||||
testWith(8, 11, 15)
|
||||
}
|
||||
checkstyle.set("8.39")
|
||||
|
||||
configurePublications {
|
||||
pom {
|
||||
developers {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
url.set("https://alexander-soderberg.com")
|
||||
email.set("contact@alexander-soderberg.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable checkstyle on tests */
|
||||
project.gradle.startParameter.excludedTaskNames.add("checkstyleTest")
|
||||
|
||||
tasks {
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.compilerArgs.addAll(setOf("-Xlint:all", "-Xlint:-processing", "-Werror"))
|
||||
withType(JavaCompile::class) {
|
||||
options.errorprone {
|
||||
/* These are just annoying */
|
||||
disable(
|
||||
|
|
@ -80,104 +89,49 @@ subprojects {
|
|||
"CatchAndPrintStackTrace"
|
||||
)
|
||||
}
|
||||
options.compilerArgs.addAll(listOf("-Xlint:-processing", "-Werror"))
|
||||
}
|
||||
withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
}
|
||||
build {
|
||||
dependsOn(checkstyleMain)
|
||||
dependsOn(licenseMain)
|
||||
|
||||
named("check") {
|
||||
dependsOn(withType(LicenseCheck::class))
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
sonatypeSnapshots()
|
||||
jcenter()
|
||||
/* Sonatype Snapshots */
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
/* ViaVersion, used for adventure */
|
||||
maven("https://repo.viaversion.com/")
|
||||
/* Velocity, used for cloud-velocity */
|
||||
maven("https://repo.velocitypowered.com/snapshots/")
|
||||
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-release/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The Minecraft repository, used for cloud-brigadier */
|
||||
maven("https://libraries.minecraft.net/")
|
||||
maven("https://libraries.minecraft.net/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The current Sponge repository */
|
||||
maven("https://repo-new.spongepowered.org/repository/maven-public/")
|
||||
/* The Spigot repository, used for cloud-bukkit */
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* The paper repository, used for cloud-paper */
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
/* The NukkitX repository, used for cloud-cloudburst */
|
||||
maven("https://repo.nukkitx.com/maven-snapshots")
|
||||
maven("https://repo.nukkitx.com/maven-snapshots") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* JitPack, used for random dependencies */
|
||||
maven("https://jitpack.io")
|
||||
maven("https://jitpack.io") {
|
||||
content { includeGroupByRegex("com\\.github\\..*") }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.checkerframework", "checker-qual", Versions.checkerQual)
|
||||
api("io.leangen.geantyref", "geantyref", Versions.geantyref)
|
||||
testImplementation("org.junit.jupiter", "junit-jupiter-engine", Versions.jupiterEngine)
|
||||
errorprone("com.google.errorprone", "error_prone_core", Versions.errorprone)
|
||||
errorproneJavac("com.google.errorprone", "javac", Versions.errorprone_javac)
|
||||
compileOnly("com.google.errorprone", "error_prone_annotations", Versions.errorprone)
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype()
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
name.set(project.name)
|
||||
url.set("https://github.com/Incendo/cloud")
|
||||
description.set(project.description)
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
url.set("https://alexander-soderberg.com")
|
||||
email.set("contact@alexander-soderberg.com")
|
||||
}
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system.set("GitHub Issues")
|
||||
url.set("https://github.com/Incendo/cloud/issues")
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("MIT License")
|
||||
url.set("https://opensource.org/licenses/MIT")
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection.set("scm:git@github.com:Incendo/cloud.git")
|
||||
developerConnection.set("scm:git@github.com:Incendo/cloud.git")
|
||||
url.set("https://github.com/Incendo/cloud/")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
gradle.taskGraph.whenReady {
|
||||
isRequired = project.hasProperty("signing.keyId")
|
||||
&& (gradle.taskGraph.hasTask(":publish")
|
||||
|| gradle.taskGraph.hasTask(":publishToSonatype")
|
||||
|| gradle.taskGraph.hasTask(":publishToMavenLocal"))
|
||||
}
|
||||
sign(publishing.publications["mavenJava"])
|
||||
COMPILE_ONLY_API_CONFIGURATION_NAME("org.checkerframework", "checker-qual", Versions.checkerQual)
|
||||
TEST_IMPLEMENTATION_CONFIGURATION_NAME("org.junit.jupiter", "junit-jupiter-engine", Versions.jupiterEngine)
|
||||
"errorprone"("com.google.errorprone", "error_prone_core", Versions.errorprone)
|
||||
COMPILE_ONLY_API_CONFIGURATION_NAME("com.google.errorprone", "error_prone_annotations", Versions.errorprone)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
dependencies {
|
||||
api("io.leangen.geantyref", "geantyref", Versions.geantyref)
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,22 @@ plugins {
|
|||
id ("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
val velocityRunClasspath by configurations.creating {
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class, Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class, Category.LIBRARY))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements::class, LibraryElements.JAR))
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
ivy("https://versions.velocitypowered.com/download/") {
|
||||
patternLayout { artifact("[revision].[ext]") }
|
||||
metadataSources { artifact() }
|
||||
content { includeModule("com.velocitypowered", "velocity-proxy") }
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
dependencies {
|
||||
|
|
@ -11,12 +27,41 @@ tasks {
|
|||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
val pluginJar = shadowJar.map { it.outputs }
|
||||
val spongeRunFiles = velocityRunClasspath.asFileTree
|
||||
register("runVelocity", JavaExec::class) {
|
||||
group = "cloud"
|
||||
description = "Spin up a Velocity server environment"
|
||||
standardInput = System.`in`
|
||||
javaLauncher.set(project.javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) })
|
||||
|
||||
inputs.files(pluginJar)
|
||||
|
||||
classpath(spongeRunFiles)
|
||||
workingDir = layout.projectDirectory.dir("run").asFile
|
||||
|
||||
doFirst {
|
||||
// Prepare
|
||||
val modsDir = workingDir.resolve("plugins")
|
||||
if (!modsDir.isDirectory) {
|
||||
modsDir.mkdirs()
|
||||
}
|
||||
|
||||
project.copy {
|
||||
into(modsDir.absolutePath)
|
||||
from(pluginJar) {
|
||||
rename { "${rootProject.name}-${project.name}.jar" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":cloud-velocity"))
|
||||
api(project(":cloud-minecraft-extras"))
|
||||
api(project(":cloud-annotations"))
|
||||
compileOnly("com.velocitypowered", "velocity-api", Versions.velocityApi)
|
||||
annotationProcessor("com.velocitypowered", "velocity-api", Versions.velocityApi)
|
||||
annotationProcessor(compileOnly("com.velocitypowered", "velocity-api", Versions.velocityApi))
|
||||
velocityRunClasspath("com.velocitypowered", "velocity-proxy", "1.1.3")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue