Skip to content

Commit

Permalink
Merge pull request #69 from DevScyu/build-script
Browse files Browse the repository at this point in the history
Update build script to use conventions
  • Loading branch information
0ffz authored Jul 30, 2021
2 parents b9635e6 + 42826ef commit 1913cc0
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 86 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew shadow
- name: Upload artifact
uses: actions/[email protected]
with:
name: package
path: build/libs
- uses: actions/checkout@v2

- name: Set up JDK 16
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 16

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build
run: gradle build

- name: Upload build
uses: actions/upload-artifact@v1
with:
name: build
path: build/libs
7 changes: 4 additions & 3 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: adopt
java-version: 16

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
54 changes: 13 additions & 41 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import com.mineinabyss.kotlinSpice
import com.mineinabyss.sharedSetup
val idofrontVersion: String by project

plugins {
java
idea
`maven-publish`
kotlin("jvm")
id("com.mineinabyss.conventions.kotlin")
kotlin("plugin.serialization")
id("com.github.johnrengelman.shadow")
id("com.mineinabyss.shared-gradle") version "0.0.6"
id("com.mineinabyss.conventions.papermc")
id("com.mineinabyss.conventions.publication")
id("com.mineinabyss.conventions.testing")
}

sharedSetup()

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
Expand All @@ -25,42 +20,19 @@ repositories {
maven("https://jitpack.io")
}

val serverVersion: String by project
val kotlinVersion: String by project

dependencies {
compileOnly("com.destroystokyo.paper:paper-api:$serverVersion")

// Plugin APIs
compileOnly("com.fastasyncworldedit:FAWE-Bukkit:1.17-47") { isTransitive = false }
compileOnly("com.fastasyncworldedit:FAWE-Core:1.17-47")

compileOnly(kotlin("stdlib-jdk8"))

kotlinSpice("$kotlinVersion+")
compileOnly("com.github.okkero:skedule")

compileOnly("nl.rutgerkok:blocklocker:1.9.2")
compileOnly("com.comphenix.protocol:ProtocolLib:4.5.0")

implementation("com.mineinabyss:idofront:0.6.13")

testImplementation("junit:junit:4.12")
}

tasks {
shadowJar {
relocate("com.mineinabyss.idofront", "${project.group}.${project.name}.idofront".toLowerCase())

minimize()
}

build {
dependsOn(shadowJar)
}
}
// Download at runtime
slim(kotlin("stdlib-jdk8"))
slim("org.jetbrains.kotlinx:kotlinx-serialization-json")
slim("com.github.okkero:skedule")
slim("com.charleskorn.kaml:kaml")

publishing {
mineInAbyss(project) {
from(components["java"])
}
// Shaded
implementation("com.mineinabyss:idofront:$idofrontVersion")
}
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
group=com.derongan.minecraft
version=0.3
kotlinVersion=1.5.0
serverVersion=1.16.5-R0.1-SNAPSHOT
kotlinVersion=1.5.21
serverVersion=1.17.1-R0.1-SNAPSHOT
idofrontVersion=1.17.1-0.6.23
miaConventionsVersion=1.5.21-14
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
9 changes: 9 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ pluginManagement {
id("com.github.johnrengelman.shadow") version "6.0.0"
id("io.github.0ffz.github-packages") version "1.2.0"
}

val miaConventionsVersion: String by settings

resolutionStrategy {
eachPlugin {
if (requested.id.id.startsWith("com.mineinabyss.conventions"))
useVersion(miaConventionsVersion)
}
}
}

rootProject.name = "deeperworld"
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.derongan.minecraft.deeperworld.world.WorldManagerImpl
import com.mineinabyss.idofront.commands.execution.ExperimentalCommandDSL
import com.mineinabyss.idofront.plugin.registerEvents
import com.mineinabyss.idofront.plugin.registerService
import com.mineinabyss.idofront.slimjar.LibraryLoaderInjector
import com.okkero.skedule.schedule
import org.bukkit.plugin.java.JavaPlugin

Expand All @@ -25,6 +26,8 @@ val protocolManager: ProtocolManager = ProtocolLibrary.getProtocolManager()
class DeeperWorld : JavaPlugin() {
@ExperimentalCommandDSL
override fun onEnable() {
LibraryLoaderInjector.inject(this)

saveDefaultConfig()

registerService<WorldManager>(WorldManagerImpl(config))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.derongan.minecraft.deeperworld.world

import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

class RegionTestU {
@Test
fun contains() {
val region = Region(-1, -1, 10, 10)
assertTrue(region.contains(-1, -1))
assertTrue(region.contains(10, 10))
assertTrue(region.contains(8, 5))
assertFalse(region.contains(-2, 5))
assertFalse(region.contains(11, 5))
assertFalse(region.contains(5, -2))
assertFalse(region.contains(5, 11))
}
}

0 comments on commit 1913cc0

Please sign in to comment.