diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 932d513..e65f0f6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,8 +9,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
- strategy:
- fail-fast: true
steps:
- name: Checkout Code
uses: actions/checkout@v2
@@ -28,15 +26,10 @@ jobs:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- # If the cache was not present, run BuildTools to install the relevant versions to Maven.
- # This will take approximately forever.
+ # Install Spigot dependencies.
+ # This script uses Maven to check all required installations and ensure that they are present.
- name: Install Spigot Dependencies
- if: steps.cache.outputs.cache-hit != 'true'
- run: |
- mkdir ~/buildtools
- cd ~/buildtools
- wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- java -jar BuildTools.jar --rev 1.16.4
+ run: . scripts/install_spigot_dependencies.sh
- name: Build With Maven
run: mvn -e clean package -am -P all
diff --git a/internal/v1_16_R3/pom.xml b/internal/v1_16_R3/pom.xml
index d7998c9..74905ed 100644
--- a/internal/v1_16_R3/pom.xml
+++ b/internal/v1_16_R3/pom.xml
@@ -32,7 +32,7 @@
org.spigotmc
spigot
- 1.16.4-R0.1-SNAPSHOT
+ 1.16.5-R0.1-SNAPSHOT
provided
diff --git a/scripts/install_spigot_dependencies.sh b/scripts/install_spigot_dependencies.sh
new file mode 100644
index 0000000..09e93e1
--- /dev/null
+++ b/scripts/install_spigot_dependencies.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Copyright (C) 2011-2021 lishid. All rights reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+# A script for installing required Spigot versions.
+#
+# Note that this script is designed for use in GitHub Actions, and is
+# not particularly robust nor configurable.
+# In its current state, the script must be run from OpenInv's parent
+# project directory and will always install BuildTools to ~/buildtools.
+
+buildtools_dir=~/buildtools
+buildtools=$buildtools_dir/BuildTools.jar
+
+get_spigot_versions () {
+ # Get all submodules of internal module
+ modules=$(mvn help:evaluate -Dexpression=project.modules -q -DforceStdout -P all -pl internal | grep -oP '(?<=)(.*)(?=<\/string>)')
+ for module in "${modules[@]}"; do
+
+ # Get number of dependencies declared in pom of specified internal module
+ max_index=$(mvn help:evaluate -Dexpression=project.dependencies -q -DforceStdout -P all -pl internal/"$module" | grep -c "")
+
+ for ((i=0; i < max_index; i++)); do
+ # Get artifactId of dependency
+ artifact_id=$(mvn help:evaluate -Dexpression=project.dependencies["$i"].artifactId -q -DforceStdout -P all -pl internal/"$module")
+
+ # Ensure dependency is spigot
+ if [[ "$artifact_id" == spigot ]]; then
+ # Get spigot version
+ spigot_version=$(mvn help:evaluate -Dexpression=project.dependencies["$i"].version -q -DforceStdout -P all -pl internal/"$module")
+ echo "$spigot_version"
+ break
+ fi
+ done
+ done
+}
+
+get_buildtools () {
+ if [[ -d $buildtools_dir && -f $buildtools ]]; then
+ return
+ fi
+
+ mkdir $buildtools_dir
+ wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -O $buildtools
+}
+
+versions=$(get_spigot_versions)
+echo Found Spigot dependencies: "$versions"
+
+for version in "${versions[@]}"; do
+ set -e
+ exit_code=0
+ mvn dependency:get -Dartifact=org.spigotmc:spigot:"$version" -q -o || exit_code=$?
+ if [ $exit_code -ne 0 ]; then
+ echo Installing missing Spigot version "$version"
+ revision=$(echo "$version" | grep -oP '(\d+\.\d+(\.\d+)?)(?=-R[0-9\.]+-SNAPSHOT)')
+ get_buildtools
+ java -jar $buildtools -rev "$revision"
+ else
+ echo Spigot "$version" is already installed
+ fi
+done