Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace home-grown uberJar task with shadowJar plugin #4385

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
pkgname: 'package/archlinux/maptool'
- name: Build uberJar on Windows
if: matrix.os == 'windows-latest'
run: ./gradlew uberJar
run: ./gradlew shadowJar
# For debugging purposes...
- name: List releases
run: ls releases
Expand Down
22 changes: 9 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
id 'org.beryx.runtime' version '1.13.0'
id "com.google.protobuf" version "0.9.3"
id 'io.github.file5.guidesigner' version '1.0.2'

id 'com.github.johnrengelman.shadow' version '8.1.1'
}

// Definitions
Expand Down Expand Up @@ -342,7 +342,10 @@ dependencies {

// parsing of configuration data
implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.9.0'

// Specialized collections: ReferenceMap, LinkedMap.
implementation 'org.apache.commons:commons-collections4:4.4'
// Various file utilities
implementation 'commons-io:commons-io:2.15.0'
// ftp client
implementation 'commons-net:commons-net:3.9.0'
// commandline parsing
Expand Down Expand Up @@ -459,7 +462,7 @@ dependencies {
implementation 'com.vladsch.flexmark:flexmark-all:0.64.0'

// Apache Tika Parsers for determining file type
implementation 'com.github.lafa.tikaNoExternal:tika-parsers:1.0.18'
implementation 'org.apache.tika:tika-core:2.9.1'

// Noise Generator
implementation 'com.github.cwisniew:NoiseLib:1.0.0' // The most recent version, 1.0.0 is build for a later java version: major version 55 is newer than 54, the highest major version supported by this compiler
Expand Down Expand Up @@ -526,14 +529,14 @@ task configSentryRelease(type: Copy) {
inputs.properties(tokens)
}

task uberJar(type: Jar) {
group = 'distribution'
shadowJar {
zip64 = true
description = 'Create uber jar for native installers'
mergeServiceFiles()

archiveBaseName = project.name + '-' + tagVersion
destinationDirectory = file("$rootDir/releases")
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveClassifier = null

manifest {
attributes 'Implementation-Title': project.name + developerRelease,
Expand All @@ -550,13 +553,6 @@ task uberJar(type: Jar) {
'Multi-Release': true
}

from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' // Jamz: This is needed to prevent org.bouncycastle:bcmail resigning and security errors
exclude 'module-info.class' //This is to make sure maptool doesn't become a module by including module-info of dependencies. Probably needs to be fixed before we go to jdk 11+
}

Expand Down
8 changes: 1 addition & 7 deletions src/main/java/net/rptools/maptool/client/MapTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.util.*;
import java.util.concurrent.ExecutionException;
import javax.imageio.ImageIO;
import javax.imageio.spi.IIORegistry;
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import net.rptools.lib.BackupManager;
Expand Down Expand Up @@ -294,7 +293,7 @@ public static void showError(String msgKey) {
*/
public static void showError(String msgKey, Throwable t) {
String msg = generateMessage(msgKey, t);
log.error(I18N.getString(msgKey), t);
log.error(I18N.getText(msgKey), t);
showMessage(msg, "msg.title.messageDialogError", JOptionPane.ERROR_MESSAGE);
}

Expand Down Expand Up @@ -1771,11 +1770,6 @@ public static void main(String[] args) {

URL.setURLStreamHandlerFactory(factory);

// Register ImageReaderSpi for jpeg2000 from JAI manually (issue due to uberJar packaging)
// https://github.com/jai-imageio/jai-imageio-core/issues/29
IIORegistry registry = IIORegistry.getDefaultInstance();
registry.registerServiceProvider(new com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi());

final Toolkit tk = Toolkit.getDefaultToolkit();
tk.getSystemEventQueue().push(new MapToolEventQueue());

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/rptools/maptool/model/Asset.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package net.rptools.maptool.model;

import static org.apache.tika.metadata.TikaCoreProperties.RESOURCE_NAME_KEY;

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.protobuf.ByteString;
Expand Down Expand Up @@ -729,7 +731,7 @@ Object readResolve() {

private static MediaType getMediaType(String filename, TikaInputStream tis) throws IOException {
Metadata metadata = new Metadata();
metadata.set(Metadata.RESOURCE_NAME_KEY, filename);
metadata.set(RESOURCE_NAME_KEY, filename);
try {
TikaConfig tika = new TikaConfig();
MediaType mediaType = tika.getDetector().detect(tis, metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import net.rptools.maptool.transfer.AssetProducer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tika.utils.ExceptionUtils;

/**
* This class is used by the server host to receive client commands sent through {@link
Expand Down Expand Up @@ -262,8 +261,7 @@ public void handleMessage(String id, byte[] message) {
}
log.debug("from " + id + " handled: " + msgType);
} catch (Exception e) {
log.error(ExceptionUtils.getStackTrace(e));
MapTool.showError(ExceptionUtils.getStackTrace(e));
MapTool.showError("Unexpected error during message handling", e);
}
}

Expand Down
Loading