Bump shadow, minimize discord bridge JAR, disable distribution tasks

master
Lars Mueller 2020-07-21 19:40:57 +02:00
parent d3b921183a
commit f66c4cc5ec
6 changed files with 65 additions and 43 deletions

View File

@ -5,7 +5,7 @@ buildscript {
}
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'java'
}
@ -26,6 +26,15 @@ dependencies {
compile group: 'com.google.guava', name: 'guava', version: '23.5-jre'
}
tasks.distTar.enabled = false
tasks.distZip.enabled = false
tasks.shadowDistTar.enabled = false
tasks.shadowDistZip.enabled = false
shadowJar {
minimize()
}
jar {
manifest {
attributes(

View File

@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
@ -33,11 +49,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
@ -138,35 +154,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save() {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" -jar "\"$CLASSPATH\"" "$APP_ARGS"
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $MINETEST_CHAT_BRIDGE_BOT_OPTS -jar "\"$CLASSPATH\"" "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"

View File

@ -30,10 +30,11 @@ local conf_spec={type="table", required_children={
},
possible_children={
bridge={type="string", possible_values={"files", "sockets"}},
convert_minetest_colors={type="string", possible_values={"disabled", "hex", "safer", "safest"}},
convert_minetest_colors={type="string", possible_values={"disabled", "hex", "safer", "safest"}},
handle_discord_markdown={type="boolean"},
handle_minetest_markdown={type="boolean"}
}},
}
},
discord={type="table", required_children={
token={type="string"},
channelname={type="string"},

View File

@ -1,5 +1,6 @@
adv_chat={}
modlib.mod.extend("adv_chat", "conf")
local mod = modlib.mod
mod.create_namespace()
mod.extend("conf")
-- Some IFNDEFS
local bridge_ifndefs={
@ -8,34 +9,34 @@ local bridge_ifndefs={
irc=adv_chat.bridges.irc
}
modlib.mod.extend_string("adv_chat", modlib.text.handle_ifndefs(modlib.file.read(modlib.mod.get_resource("adv_chat", "colorize_message.lua")), bridge_ifndefs))
mod.extend_string(modlib.text.handle_ifndefs(modlib.file.read(mod.get_resource("colorize_message.lua")), bridge_ifndefs))
modlib.mod.extend_string("adv_chat", modlib.text.handle_ifndefs(modlib.file.read(modlib.mod.get_resource("adv_chat", "main.lua")), bridge_ifndefs))
mod.extend_string(modlib.text.handle_ifndefs(modlib.file.read(mod.get_resource("main.lua")), bridge_ifndefs))
-- Basic API stuff
modlib.mod.extend("adv_chat", "unicode")
modlib.mod.extend("adv_chat", "closest_color")
mod.extend("unicode")
mod.extend("closest_color")
if cmdlib.trie then
adv_chat.trie = cmdlib.trie
else
modlib.mod.extend("adv_chat", "trie")
mod.extend("trie")
end
modlib.mod.extend("adv_chat", "text_styles")
modlib.mod.extend("adv_chat", "message")
modlib.mod.extend("adv_chat", "hud_channels")
mod.extend("text_styles")
mod.extend("message")
mod.extend("hud_channels")
-- Chat bridges
if bridge_ifndefs.bridge then
modlib.mod.extend("adv_chat", "chatcommands")
modlib.mod.extend("adv_chat", "process_bridges")
mod.extend("chatcommands")
mod.extend("process_bridges")
local env = minetest.request_insecure_environment() or error("Error: adv_chat needs to be added to the trusted mods for chat bridges to work. See the Readme for more info.")
adv_chat.set_insecure_environment(env)
if adv_chat.bridges.irc then
modlib.mod.extend("adv_chat", "irc")
mod.extend("irc")
end
if adv_chat.bridges.discord then
modlib.mod.extend("adv_chat", "discord")
mod.extend("discord")
end
adv_chat.build_socket_bridge = nil
@ -45,5 +46,5 @@ end
-- Tests - don't uncomment unless you actually want to test something
--[[
-- -- -- modlib.mod.extend("adv_chat", "test")
-- -- -- mod.extend("test")
]]