From 84f38cdc71c9b3a4eb801c99daf0b11ff8047d8e Mon Sep 17 00:00:00 2001 From: Exlll Date: Mon, 11 Oct 2021 16:14:45 +0200 Subject: [PATCH] Migrate build scripts to Kotlin DSL. --- .github/workflows/publish-on-master-push.yml | 32 ++++++++ build.gradle | 48 ------------ build.gradle.kts | 77 ++++++++++++++++++++ settings.gradle | 8 -- settings.gradle.kts | 8 ++ 5 files changed, 117 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/publish-on-master-push.yml delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.github/workflows/publish-on-master-push.yml b/.github/workflows/publish-on-master-push.yml new file mode 100644 index 0000000..c9754cd --- /dev/null +++ b/.github/workflows/publish-on-master-push.yml @@ -0,0 +1,32 @@ +name: publish-on-master-push + +on: + push: + branches: [ dev ] # TODO: change to master + paths-ignore: + - '**/README.md' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 16 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '16' + - name: Build with Gradle + run: ./gradlew build + - name: Archive test reports + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: test-reports + path: | + build/reports/**/* + - name: Publish to GitHub Packages + run: ./gradlew publish + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 2a00f52..0000000 --- a/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -allprojects { - group 'de.exlll' - version '2.2.0' -} -subprojects { - apply plugin: 'java' - - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - - repositories { mavenCentral() } - - dependencies { - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.3' - testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.3' - testImplementation group: 'org.junit.platform', name: 'junit-platform-suite-api', version: '1.0.3' - testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' - testImplementation group: 'com.google.jimfs', name: 'jimfs', version: '1.1' - } -} -buildscript { - if (project.hasProperty("local_script")) { - apply from: file(local_script + "/buildscript.gradle"), to: buildscript - } -} -if (project.hasProperty("local_script")) { - apply from: file(local_script + "/build.gradle") -} - -project(':configlib-core') { - dependencies { implementation group: 'org.yaml', name: 'snakeyaml', version: '1.20' } -} -project(':configlib-bukkit') { - repositories { maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } } - dependencies { - implementation project(':configlib-core') - implementation group: 'org.bukkit', name: 'bukkit', version: '1.12.2-R0.1-SNAPSHOT' - } - jar { from { project(':configlib-core').sourceSets.main.output } } -} -project(':configlib-bungee') { - repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } - dependencies { - implementation project(':configlib-core') - implementation group: 'net.md-5', name: 'bungeecord-api', version: '1.12-SNAPSHOT' - } - jar { from { project(':configlib-core').sourceSets.main.output } } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..a6f15d3 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,77 @@ +plugins { + java + idea + `maven-publish` +} + +allprojects { + group = "de.exlll" + version = "2.2.0" +} + +subprojects { + apply(plugin = "java") + apply(plugin = "idea") + apply(plugin = "maven-publish") + + java.sourceCompatibility = JavaVersion.VERSION_1_8 + java.targetCompatibility = JavaVersion.VERSION_1_8 + + repositories { + mavenCentral() + } + + dependencies { + testImplementation("org.junit.jupiter:junit-jupiter-api:5.0.3") + testImplementation("org.junit.platform:junit-platform-runner:1.0.3") + testImplementation("org.junit.platform:junit-platform-suite-api:1.0.3") + testImplementation("org.hamcrest:hamcrest-all:1.3") + testImplementation("com.google.jimfs:jimfs:1.1") + } + + publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/Exlll/ConfigLib") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + publications { + register("gpr") { + from(components["java"]) + } + } + } + } +} + +project(":configlib-core") { + dependencies { + implementation("org.yaml:snakeyaml:1.20") + } +} +project(":configlib-bukkit") { + repositories { + maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + } + dependencies { + implementation(project(":configlib-core")) + implementation("org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT") + } + + tasks.jar { from(project(":configlib-core").sourceSets["main"].output) } +} +project(":configlib-bungee") { + repositories { + maven(url = "https://oss.sonatype.org/content/repositories/snapshots") + } + dependencies { + implementation(project(":configlib-core")) + implementation("net.md-5:bungeecord-api:1.12-SNAPSHOT") + } + + tasks.jar { from(project(":configlib-core").sourceSets["main"].output) } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 76920c8..0000000 --- a/settings.gradle +++ /dev/null @@ -1,8 +0,0 @@ -rootProject.name = 'configlib' -include 'ConfigLib-Core' -findProject(':ConfigLib-Core')?.name = 'configlib-core' -include 'ConfigLib-Bukkit' -findProject(':ConfigLib-Bukkit')?.name = 'configlib-bukkit' -include 'ConfigLib-Bungee' -findProject(':ConfigLib-Bungee')?.name = 'configlib-bungee' - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..7293ea3 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,8 @@ +rootProject.name = "configlib" +include("ConfigLib-Core") +findProject(":ConfigLib-Core")?.name = "configlib-core" +include("ConfigLib-Bukkit") +findProject(":ConfigLib-Bukkit")?.name = "configlib-bukkit" +include("ConfigLib-Bungee") +findProject(":ConfigLib-Bungee")?.name = "configlib-bungee" +