From 116146a577f2469e03490ba43e7d6c77ea3458e6 Mon Sep 17 00:00:00 2001 From: Francisco Solis <30329003+Im-Fran@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:51:18 -0300 Subject: [PATCH] feat: updates & comply with simplecoreapi 0.8.0 (#52) --- .github/workflows/gradle-build.yml | 4 +- .github/workflows/gradle-test.yml | 10 ++--- .../workflows/gradle-wrapper-validation.yml | 4 +- build.gradle.kts | 41 ++++++++++++------- .../xyz/theprogramsrc/loggingmodule/Main.kt | 21 +++++++++- src/main/resources/module.properties | 6 --- 6 files changed, 54 insertions(+), 32 deletions(-) delete mode 100644 src/main/resources/module.properties diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 869c7c2..d2df7bf 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -17,7 +17,7 @@ jobs: steps: # Checkout the Code - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set up git hashes environment variables - name: Git Hashes uses: Im-Fran/git-hashes-action@v1.0.3 @@ -52,7 +52,7 @@ jobs: args: ./build/libs/${{ env.PROJECT_NAME }}-${{ env.VERSION }}.jar application/java-archive # Now we deploy the documents to GitHub pages - name: Deploy Dokka - uses: JamesIves/github-pages-deploy-action@v4.4.1 + uses: JamesIves/github-pages-deploy-action@v4.4.3 with: branch: gh-pages folder: build/dokka diff --git a/.github/workflows/gradle-test.yml b/.github/workflows/gradle-test.yml index e2bcf6e..751318f 100644 --- a/.github/workflows/gradle-test.yml +++ b/.github/workflows/gradle-test.yml @@ -7,26 +7,26 @@ jobs: fail-fast: false max-parallel: 4 matrix: - java-version: [11,16,17] + java-version: [11, 16, 17] # Set up OS runs-on: ubuntu-latest # Set up environment variables env: - ENV: 'local' # Set to local, so it won't deploy the jar to the repos + ENV: "local" # Set to local, so it won't deploy the jar to the repos steps: # Checkout code - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup java and maven - name: Set up JDK ${{ matrix.java-version }} uses: actions/setup-java@v3 with: distribution: adopt java-version: ${{ matrix.java-version }} - cache: 'gradle' + cache: "gradle" # Setup executable gradle - name: Make Gradle executable run: chmod +x gradlew # Test building without dokka - name: Build Jar with Java ${{ matrix.java-version }} - run: ./gradlew clean shadowJar test -x dokkaHtml -no-daemon \ No newline at end of file + run: ./gradlew clean shadowJar test -x dokkaHtml -no-daemon diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 91e75b3..b63fdf3 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -6,5 +6,5 @@ jobs: name: "Validation" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: gradle/wrapper-validation-action@v1 \ No newline at end of file + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v1 diff --git a/build.gradle.kts b/build.gradle.kts index b2ce8a9..b1e5347 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,18 +4,18 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { `maven-publish` id("io.github.gradle-nexus.publish-plugin") version "1.3.0" - id("com.github.johnrengelman.shadow") version "8.1.0" + id("com.github.johnrengelman.shadow") version "8.1.1" id("cl.franciscosolis.blossom-extended") version "1.3.1" - kotlin("jvm") version "1.8.10" - id("org.jetbrains.dokka") version "1.8.10" + kotlin("jvm") version "1.9.10" + id("org.jetbrains.dokka") version "1.9.0" } val env = project.rootProject.file(".env").let { file -> if(file.exists()) file.readLines().filter { it.isNotBlank() && !it.startsWith("#") && it.split("=").size == 2 }.associate { it.split("=")[0] to it.split("=")[1] } else emptyMap() }.toMutableMap().apply { putAll(System.getenv()) } -val projectVersion = env["VERSION"] ?: "0.3.1-SNAPSHOT" +val projectVersion = env["VERSION"] ?: "0.4.0-SNAPSHOT" group = "xyz.theprogramsrc" version = projectVersion @@ -26,21 +26,31 @@ repositories { mavenCentral() maven("https://s01.oss.sonatype.org/content/groups/public/") + maven("https://oss.sonatype.org/content/repositories/snapshots/") + maven("https://oss.sonatype.org/content/repositories/releases/") maven("https://oss.sonatype.org/content/groups/public/") maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven("https://repo.papermc.io/repository/maven-public/") maven("https://repo.codemc.org/repository/maven-public/") maven("https://jitpack.io/") } dependencies { - compileOnly("xyz.theprogramsrc:simplecoreapi:0.6.2-SNAPSHOT") + compileOnly("xyz.theprogramsrc:simplecoreapi:0.8.0-SNAPSHOT") implementation("org.apache.logging.log4j:log4j-api:2.20.0") implementation("org.apache.logging.log4j:log4j-core:2.20.0") - testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") + testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") } +blossom { + replaceToken("@name@", rootProject.name) + replaceToken("@version@", project.version.toString()) + replaceToken("@description@", project.description) + replaceToken("@git_short@", env["GIT_COMMIT_SHORT_HASH"] ?: "unknown") + replaceToken("@git_full@", env["GIT_COMMIT_LONG_HASH"] ?: "unknown") +} tasks { named("shadowJar") { @@ -88,8 +98,7 @@ tasks { } dokkaHtml { - outputDirectory.set(file(project.buildDir.absolutePath + "/dokka")) - + outputDirectory.set(layout.buildDirectory.dir("dokka/")) } } @@ -161,14 +170,16 @@ publishing { } } -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) +if(env["ENV"] == "prod") { + nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - username.set(env["SONATYPE_USERNAME"]) - password.set(env["SONATYPE_PASSWORD"]) + username.set(env["SONATYPE_USERNAME"]) + password.set(env["SONATYPE_PASSWORD"]) + } } } } diff --git a/src/main/kotlin/xyz/theprogramsrc/loggingmodule/Main.kt b/src/main/kotlin/xyz/theprogramsrc/loggingmodule/Main.kt index 8e5d820..6bf9fc0 100644 --- a/src/main/kotlin/xyz/theprogramsrc/loggingmodule/Main.kt +++ b/src/main/kotlin/xyz/theprogramsrc/loggingmodule/Main.kt @@ -1,5 +1,22 @@ package xyz.theprogramsrc.loggingmodule -import xyz.theprogramsrc.simplecoreapi.global.module.Module +import xyz.theprogramsrc.simplecoreapi.global.models.module.Module +import xyz.theprogramsrc.simplecoreapi.global.models.module.ModuleDescription -class Main: Module() \ No newline at end of file +class FilesModule: Module { + + override val description: ModuleDescription = + ModuleDescription( + name = "@name@", + version = "@version@", + authors = listOf("Im-Fran") + ) + + override fun onEnable() { + // Do nothing + } + + override fun onDisable() { + // Do nothing + } +} \ No newline at end of file diff --git a/src/main/resources/module.properties b/src/main/resources/module.properties deleted file mode 100644 index 838c8ac..0000000 --- a/src/main/resources/module.properties +++ /dev/null @@ -1,6 +0,0 @@ -main=xyz.theprogramsrc.loggingmodule.Main -name=LoggingModule -description=@description@ -version=@version@ -author=TheProgramSrc -module-id=loggingmodule