Skip to content

Commit

Permalink
Use a dedicated GitHub maven repository
Browse files Browse the repository at this point in the history
  • Loading branch information
GlennFolker committed Dec 10, 2024
1 parent 898ae64 commit 4940502
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 131 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deployment

on:
push:
branches:
- main
tags:
- 'v*'

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.repository == 'GlennFolker/glTFrenzy' }}

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set Artifact Version
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
# This is a release, so use the release's tag as the version.
echo "ARTIFACT_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
elif [ "${GITHUB_REF_TYPE}" = "branch" ] && [ "${GITHUB_REF_NAME}" = "main" ]; then
# This is a bleeding-edge, so use the short commit's hash as the version.
echo "ARTIFACT_VERSION=$(git rev-parse --short=10 HEAD)" >> $GITHUB_ENV
else
# Sanity checks.
echo "Error: Unsupported branch '${GITHUB_REF_NAME}' or ref type '${GITHUB_REF_TYPE}'" >&2
exit 1
fi
- name: Publish Artifacts
run: |
chmod +x gradlew
./gradlew -P version="${ARTIFACT_VERSION}" -D maven.repo.local="$(pwd)/.out" publishToMavenLocal
git clone https://${{ secrets.MAVEN_TOKEN_GITHUB }}@github.com/GlennFolker/glTFrenzyMaven.git --depth=1 ../glTFrenzyMaven
cp -r .out/* ../glTFrenzyMaven
cd ../glTFrenzyMaven
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "Publishing for ${ARTIFACT_VERSION}"
git push https://${{ secrets.MAVEN_TOKEN_GITHUB }}@github.com/GlennFolker/glTFrenzyMaven.git
89 changes: 0 additions & 89 deletions build.gradle

This file was deleted.

147 changes: 147 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import java.io.*

plugins{
`java-library`
`maven-publish`
}

val arcVersion: String by project
val mindustryVersion: String by project
val entVersion: String by project
val javapoetVersion: String by project

fun arc(module: String): String{
return "com.github.Anuken.Arc$module:$arcVersion"
}

fun mindustry(module: String): String{
return "com.github.Anuken.Mindustry$module:$mindustryVersion"
}

fun entity(module: String): String{
return "com.github.GlennFolker.EntityAnno$module:$entVersion"
}

fun javapoet(): String{
return "com.squareup:javapoet:$javapoetVersion"
}

allprojects{
apply(plugin = "java-library")

sourceSets["main"].java.setSrcDirs(listOf(layout.projectDirectory.file("src")))
dependencies{
annotationProcessor(entity(":downgrader"))
}

repositories{
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/releases/")
maven("https://raw.githubusercontent.com/GlennFolker/EntityAnnoMaven/main")

maven("https://raw.githubusercontent.com/Zelaux/MindustryRepo/master/repository")
maven("https://jitpack.io")
}
}

project(":annotations"){
sourceSets["main"].resources.setSrcDirs(listOf(layout.projectDirectory.file("assets")))

dependencies{
implementation(arc(":arc-core"))
implementation(arc(":g3d"))
implementation(javapoet())
}

tasks.withType<JavaCompile>().configureEach{
options.apply{
isIncremental = true
encoding = "UTF-8"
compilerArgs.add("-Xlint:-options")
}

sourceCompatibility = "17"
targetCompatibility = "8"

doFirst{
sourceCompatibility = "8"
}
}
}

project(":"){
apply(plugin = "maven-publish")

group = "com.github.GlennFolker"

java{
withJavadocJar()
withSourcesJar()
}

dependencies{
annotationProcessor(project(":annotations"))
compileOnly(project(":annotations"))

compileOnlyApi(arc(":arc-core"))
compileOnlyApi(arc(":g3d"))
}

tasks.withType<Jar>().configureEach{
exclude("gltfrenzy/spec/**")
metaInf{
from(layout.projectDirectory.file("LICENSE"))
}
}

tasks.withType<JavaCompile>().configureEach{
sourceCompatibility = "17"
options.apply{
release = 8
compilerArgs.add("-Xlint:-options")

isIncremental = true
encoding = "UTF-8"
}
}

tasks.withType<Javadoc>().configureEach{
options{
encoding = "UTF-8"

val exports = (project.property("org.gradle.jvmargs") as String)
.split(Regex("\\s+"))
.filter{it.startsWith("--add-opens")}
.map{"--add-exports ${it.substring("--add-opens=".length)}"}
.reduce{accum, arg -> "$accum $arg"}

val opts = File(temporaryDir, "exports.options")
BufferedWriter(FileWriter(opts, Charsets.UTF_8, false)).use{it.write("-Xdoclint:none $exports")}
optionFiles(opts)
}
}

publishing.publications.register<MavenPublication>("maven"){
from(components["java"])
pom{
name = "glTFrenzy"
description = "A glTF loader for Arc-based projects."
url = "https://github.com/GlennFolker/glTFrenzy"
inceptionYear = "2024"

licenses{
license{
name = "GPL-3.0-or-later"
url = "https://www.gnu.org/licenses/gpl-3.0.en.html"
distribution = "repo"
}
}

issueManagement{
system = "GitHub Issue Tracker"
url = "https://github.com/GlennFolker/EntityAnno/issues"
}
}
}
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
projectVersion = v146.0.0
entVersion = v146.0.6
entVersion = v146.0.10
arcVersion = v146
javapoetVersion = 1.13.0

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
9 changes: 2 additions & 7 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
before_install:
- sdk install java 17.0.10-tem
- sdk use java 17.0.10-tem
install:
- chmod +x gradlew
- ./gradlew publishToMavenLocal
- echo -n > gradle.properties
build:
skip: true
7 changes: 0 additions & 7 deletions settings.gradle

This file was deleted.

6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if(JavaVersion.current().ordinal < JavaVersion.VERSION_17.ordinal){
throw IllegalStateException("JDK 17 is a required minimum version. Yours: ${System.getProperty("java.version")}")
}

rootProject.name = "glTFrenzy"
include(":annotations")

0 comments on commit 4940502

Please sign in to comment.