Add JitPack integration and maven publishing

This commit is contained in:
William committed 2022-08-29 15:39:30 +01:00
1 parent 4fbc117792
commit e6f4e4f997
4 files changed
+66 -4

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
JV=$(java -version 2>&1 >/dev/null | head -1)
echo "$JV" | sed -E 's/^.*version "([^".]*)\.[^"]*".*$/\1/'
if [ "$JV" != 16 ]; then
case "$1" in
install)
echo "installing sdkman..."
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
sdk install java 16.0.1-open
;;
use)
echo "must source ~/.sdkman/bin/sdkman-init.sh"
exit 1
;;
esac
fi
+32 -2
View File
@@ -2,6 +2,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.ajoberstar.grgit' version '5.0.0'
id 'java'
id 'maven-publish'
}
group 'net.william278'
@@ -22,9 +23,9 @@ allprojects {
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'
compileJava.options.release.set 16
javadoc.options.encoding = 'UTF-8'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
repositories {
mavenLocal()
@@ -65,6 +66,35 @@ subprojects {
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}
// API publishing
if ('bukkit'.contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
}
sourcesJar {
destinationDirectory.set(file("$rootDir/target"))
}
javadocJar {
destinationDirectory.set(file("$rootDir/target"))
}
shadowJar.dependsOn(sourcesJar, javadocJar)
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'net.william278'
artifactId = 'huskhomes'
version = "$rootProject.version"
artifact shadowJar
artifact javadocJar
artifact sourcesJar
}
}
}
}
jar.dependsOn shadowJar
clean.delete "$rootDir/target"
}
@@ -16,8 +16,8 @@ import java.util.Objects;
/**
* The HuskHomes API implementation for the Bukkit platform, providing methods to access player data, homes, warps
* & process teleports
* </p>
* and process teleports
* <p>
* Retrieve an instance of the API class via {@link #getInstance()}.
*/
@SuppressWarnings("unused")
@@ -97,6 +97,7 @@ public class HuskHomesAPI extends BaseHuskHomesAPI {
*
* @param location the bukkit location to get the {@link Position} instance for
* @param server the {@link Server} the position is on
* @return the {@link Position} instance for the given bukkit {@link Location} on the given {@link Server}
* @see Position#server
* @since 3.0
*/
+12
View File
@@ -0,0 +1,12 @@
# This file ensures jitpack builds HuskSync correctly by setting the JDK to 16
jdk:
- 'openjdk16'
before_install:
- 'git clone https://github.com/WiIIiam278/HuskHomes2.git --recurse-submodules'
- 'chmod +x gradlew'
- 'chmod +x ./.scripts/ensure-java-16'
- 'bash ./.scripts/ensure-java-16 install'
install:
- 'if ! ./.scripts/ensure-java-16 use; then source ~/.sdkman/bin/sdkman-init.sh; fi'
- 'java -version'
- './gradlew publishToMavenLocal'