From bd207e948a353a3435961e4cd93f5ccfc27a870a Mon Sep 17 00:00:00 2001 From: Jikoo Date: Wed, 21 Apr 2021 11:07:15 -0400 Subject: [PATCH] Simplify dependency management Use dependencyManagement for versioning shared dependencies Use pluginManagement for versioning and configuring plugins --- README.MD | 95 +++++-------- api/pom.xml | 18 ++- assembly/pom.xml | 2 +- assembly/src/assembly/reactor-uberjar.xml | 20 ++- internal/pom.xml | 42 ------ internal/v1_16_R3/pom.xml | 35 ++--- plugin/pom.xml | 25 +--- pom.xml | 162 +++++++++++++--------- scripts/get_spigot_versions.sh | 9 +- 9 files changed, 176 insertions(+), 232 deletions(-) delete mode 100644 internal/pom.xml diff --git a/README.MD b/README.MD index 66c183f..3cf7cd9 100644 --- a/README.MD +++ b/README.MD @@ -15,48 +15,7 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi - **AnyContainer**: Open containers, even if blocked by ocelots or blocks. ## Commands - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CommandAliasesDescription
/openinv [player]oi, inv, openOpen a player's inventory. If unspecified, will select last player opened or own if none opened previously.
/openender [player]oeOpen a player's ender chest. If unspecified, will select last player opened or own if none opened previously.
/searchinv <item> [minAmount]siLists all online players that have a certain item in their inventory.
/searchender <item> [minAmount]seLists all online players that have a certain item in their ender chest.
/searchenchant <[enchantment] [MinLevel]>searchenchantsLists all online players with a specific enchantment.
/anycontainer [check]ac, anychestCheck or toggle the AnyContainer function, allowing opening blocked containers.
/silentcontainer [check]sc, silentchestCheck or toggle the SilentContainer function, allowing opening containers silently.
+See [the wiki](https://github.com/Jikoo/OpenInv/wiki/Commands). ## Permissions @@ -143,8 +102,39 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
## For Developers -To compile, the relevant Craftbukkit/Spigot jars must be installed in your local repository using the install plugin. -Ex: `mvn install:install-file -Dpackaging=jar -Dfile=spigot-1.8-R0.1-SNAPSHOT.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.8-R0.1-SNAPSHOT` + +### As a Dependency +The OpenInv API is available via [JitPack](https://jitpack.io/). +```xml + + + jitpack.io + https://jitpack.io + + +``` +```xml + + + com.github.jikoo.OpenInv + openinvapi + ${openinv.version} + + +``` + +### Compilation +To compile, the relevant Spigot jars must be installed in your local repository using the `install` plugin: +```shell +mvn install:install-file -Dpackaging=jar -Dfile=spigot-1.8-R0.1-SNAPSHOT.jar \ + -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.8-R0.1-SNAPSHOT +``` +Note that BuildTools automatically installs produced files. If you use BuildTools to compile Spigot locally, you don't need to install it manually. +If you want to use Paper as a dependency, you can install it by executing PaperClip with the property `paperclip.install` set to true: +```shell +wget -O paperclip.jar https://papermc.io/api/v1/paper/1.16.5/latest/download +java -jar -Dpaperclip.install=true paperclip.jar +``` To compile for a single version, specify the NMS revision you are targeting: `mvn -pl -am clean install` @@ -153,20 +143,3 @@ To compile for a set of versions, you'll need to use a profile. The only provide For more information, check out the [official Maven guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html). The final file is `target/OpenInv.jar` - -## License -``` -Copyright (C) 2011-2020 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 . -``` diff --git a/api/pom.xml b/api/pom.xml index dfba6c4..a04210b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -19,23 +19,29 @@ 4.0.0 - com.lishid openinvparent + com.lishid 4.1.7-SNAPSHOT openinvapi OpenInvAPI + + + annotations + org.jetbrains + + + spigot-api + org.spigotmc + + + maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - diff --git a/assembly/pom.xml b/assembly/pom.xml index d982b92..51126a4 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -26,6 +26,7 @@ openinvassembly OpenInvAssembly + pom ../target @@ -34,7 +35,6 @@ maven-assembly-plugin - 3.2.0 reactor-uberjar diff --git a/assembly/src/assembly/reactor-uberjar.xml b/assembly/src/assembly/reactor-uberjar.xml index 36beb33..afe5bfa 100644 --- a/assembly/src/assembly/reactor-uberjar.xml +++ b/assembly/src/assembly/reactor-uberjar.xml @@ -14,9 +14,9 @@ ~ along with this program. If not, see . --> - + reactor-uberjar @@ -34,8 +34,18 @@ / true - - + + + + META-INF/** + + + + false diff --git a/internal/pom.xml b/internal/pom.xml deleted file mode 100644 index e5c7354..0000000 --- a/internal/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - 4.0.0 - - - com.lishid - openinvparent - 4.1.7-SNAPSHOT - - - openinvinternal - OpenInvInternal - - pom - - - - - all - - v1_16_R3 - - - - - - diff --git a/internal/v1_16_R3/pom.xml b/internal/v1_16_R3/pom.xml index 3446dcd..69e9502 100644 --- a/internal/v1_16_R3/pom.xml +++ b/internal/v1_16_R3/pom.xml @@ -20,8 +20,9 @@ 4.0.0 + openinvparent com.lishid - openinvinternal + ../../pom.xml 4.1.7-SNAPSHOT @@ -30,44 +31,32 @@ - org.spigotmc spigot - 1.16.5-R0.1-SNAPSHOT + org.spigotmc provided + 1.16.5-R0.1-SNAPSHOT + openinvapi com.lishid + + openinvplugincore - 4.1.7-SNAPSHOT + com.lishid + + + annotations + org.jetbrains - org.apache.maven.plugins maven-shade-plugin - 3.2.2 - - true - - - - package - - shade - - - - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - diff --git a/plugin/pom.xml b/plugin/pom.xml index e926663..1ae03f7 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -19,8 +19,8 @@ 4.0.0 - com.lishid openinvparent + com.lishid 4.1.7-SNAPSHOT @@ -29,9 +29,8 @@ - com.lishid openinvapi - 4.1.7-SNAPSHOT + com.lishid @@ -42,31 +41,13 @@ true + - org.apache.maven.plugins maven-shade-plugin - 3.2.2 - - true - - - - package - - shade - - - - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - diff --git a/pom.xml b/pom.xml index 0101a38..a166257 100644 --- a/pom.xml +++ b/pom.xml @@ -27,33 +27,32 @@ UTF-8 + 1.8 + 1.8 - - api - plugin - internal - assembly - - - - - all - - - all - true - - + + api + plugin + internal/v1_16_R3 + assembly + + + default + + true + + + api + plugin + assembly + + @@ -63,57 +62,84 @@ - - - org.jetbrains - annotations - 17.0.0 - provided - - - org.spigotmc - spigot-api - 1.16.5-R0.1-SNAPSHOT - provided - - + + + + annotations + org.jetbrains + provided + 20.1.0 + + + spigot-api + org.spigotmc + provided + 1.16.5-R0.1-SNAPSHOT + + + openinvapi + com.lishid + compile + 4.1.7-SNAPSHOT + + + openinvplugincore + com.lishid + compile + 4.1.7-SNAPSHOT + + + - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.2 - - - - *:* - - - META-INF/maven/** - - - - - - - package - - shade - - - - + + + + maven-shade-plugin + + + + + com.lishid:openinv* + + ** + + + + *:* + + + META-INF/MANIFEST.MF + + + + true + + + + package + + shade + + + + org.apache.maven.plugins + 3.2.4 + - - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - + + maven-compiler-plugin + org.apache.maven.plugins + 3.8.1 + + + + maven-assembly-plugin + org.apache.maven.plugins + 3.3.0 + + + diff --git a/scripts/get_spigot_versions.sh b/scripts/get_spigot_versions.sh index 252291d..64c2fea 100644 --- a/scripts/get_spigot_versions.sh +++ b/scripts/get_spigot_versions.sh @@ -32,22 +32,23 @@ if [[ ${spigot_versions[@]} ]]; then fi # Pull Spigot dependency information from Maven. -modules=$(mvn help:evaluate -Dexpression=project.modules -q -DforceStdout -P all -pl internal | grep -oP '(?<=)(.*)(?=<\/string>)') +# Since we only care about Spigot versions, only check modules in the folder internal. +readarray -t modules <<< "$(mvn help:evaluate -Dexpression=project.modules -q -DforceStdout -P all | grep -oP '(?<=)(internal/.*)(?=)')" declare -n versions="spigot_versions" 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 "") + max_index=$(mvn help:evaluate -Dexpression=project.dependencies -q -DforceStdout -P all -pl "$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") + artifact_id=$(mvn help:evaluate -Dexpression=project.dependencies["$i"].artifactId -q -DforceStdout -P all -pl "$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") + spigot_version=$(mvn help:evaluate -Dexpression=project.dependencies["$i"].version -q -DforceStdout -P all -pl "$module") versions+=("$spigot_version") echo "$spigot_version" break