Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
# Set up the OS
runs-on: ubuntu-latest
env:
# Nexus credentials and GitHub token
NEXUS_USERNAME: '${{ secrets.NEXUS_USERNAME }}'
NEXUS_PASSWORD: '${{ secrets.NEXUS_PASSWORD }}'
# Sonatype Credentials & GitHub token
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
# Set environment
env: 'prod'
ENV: 'prod'
steps:
# Checkout the Code
- name: Checkout Code
Expand All @@ -37,7 +37,7 @@ jobs:
run: chmod +x gradlew
# Clean, Test, Publish and Build (in that order to save the artifact to the action)
- name: Test, Deploy and Build with Gradle
run: ./gradlew clean test publish shadow dokkaHtml
run: ./gradlew clean test shadowJar dokkaHtml publish publishToSonatype closeAndReleaseSonatypeStagingRepository -no-daemon
# Now we store the artifact in the action
- name: Upload the artifact
uses: actions/upload-artifact@v3
Expand All @@ -56,3 +56,5 @@ jobs:
branch: gh-pages
folder: build/dokka
clean: true
clean-exclude: |
CNAME
34 changes: 17 additions & 17 deletions .github/workflows/gradle-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ jobs:
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
# 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'
# 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 publish shadow -x dokkaHtml
# Checkout code
- name: Checkout Code
uses: actions/checkout@v3
# 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'
# 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v0.2.0 - Snapshot
* Added to sonatype
* Updated Dependencies
* Updated to gradle 8
* Updated to kotlin 1.8
* Updated to use gradle kotlin dsl
* Updated repositories

## v0.1.3 - Snapshot
* Updated Dependencies
* Migrated to JitPack
Expand Down
120 changes: 0 additions & 120 deletions build.gradle

This file was deleted.

183 changes: 183 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("cl.franciscosolis.blossom-extended") version "1.3.1"

kotlin("jvm") version "1.8.10"
id("org.jetbrains.dokka") version "1.7.20"
}

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.2.0-SNAPSHOT"

group = "xyz.theprogramsrc"
version = projectVersion
description = "File configurations and utils for the SimpleCore API"

repositories {
mavenLocal()
mavenCentral()

maven("https://s01.oss.sonatype.org/content/groups/public/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://jitpack.io/")
}

dependencies {
compileOnly("xyz.theprogramsrc:simplecoreapi:0.6.2-SNAPSHOT")

implementation("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3")

testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
}


tasks {
named<ShadowJar>("shadowJar") {
relocate("org.simpleyaml", "xyz.theprogramsrc.filesmodule.libs.simpleyaml")
relocate("org.yaml.snakeyaml", "xyz.theprogramsrc.filesmodule.libs.snakeyaml")

mergeServiceFiles()
exclude("**/*.kotlin_metadata")
exclude("**/*.kotlin_builtins")

archiveBaseName.set("FilesModule")
archiveClassifier.set("")
}

test {
useJUnitPlatform()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}

compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

compileJava {
options.encoding = "UTF-8"
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

copy {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

dokkaHtml {
outputDirectory.set(file(project.buildDir.absolutePath + "/dokka"))
}
}

configurations {
testImplementation {
extendsFrom(configurations.compileOnly.get())
}
}

val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc, tasks.dokkaHtml)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

publishing {
repositories {
if (env["ENV"] == "prod") {
if (env.containsKey("GITHUB_ACTOR") && env.containsKey("GITHUB_TOKEN")) {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/TheProgramSrc/SimpleCore-FilesModule")
credentials {
username = env["GITHUB_ACTOR"]
password = env["GITHUB_TOKEN"]
}
}
}
} else {
mavenLocal()
}
}

publications {
create<MavenPublication>("shadow") {
project.extensions.configure<ShadowExtension> {
artifactId = rootProject.name.lowercase()

component(this@create)
artifact(dokkaJavadocJar)
artifact(tasks.kotlinSourcesJar)

pom {
name.set(rootProject.name)
description.set(project.description)
url.set("https://github.com/TheProgramSrc/SimpleCore-FilesModule")

licenses {
license {
name.set("GNU GPL v3")
url.set("https://github.com/TheProgramSrc/SimpleCore-FilesModule/blob/master/LICENSE")
}
}

developers {
developer {
id.set("ImFran")
name.set("Francisco Solis")
email.set("[email protected]")
}
}

scm {
url.set("https://github.com/TheProgramSrc/SimpleCore-FilesModule")
}
}
}
}
}
}

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"])
}
}
}

tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.test, tasks.kotlinSourcesJar, dokkaJavadocJar, tasks.jar, tasks.shadowJar)
}

tasks.withType<PublishToMavenLocal> {
dependsOn(tasks.test, tasks.kotlinSourcesJar, tasks.jar, dokkaJavadocJar, tasks.shadowJar)
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading