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

Cleanup build file #5992

Merged
merged 9 commits into from
Feb 25, 2020
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
147 changes: 64 additions & 83 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ plugins {
id 'application'
id "com.simonharrer.modernizer" version '1.8.0-1'
id 'me.champeau.gradle.jmh' version '0.5.0'
//id 'net.ltgt.errorprone' version '0.8.1'
id 'com.github.ben-manes.versions' version '0.28.0'
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
Expand All @@ -46,10 +45,14 @@ apply from: 'eclipse.gradle'
group = "org.jabref"
version = project.findProperty('projVersion') ?: '100.0.0'

sourceCompatibility = 13
targetCompatibility = 13
java {
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
}

mainClassName = "$moduleName/org.jabref.JabRefLauncher"
application {
mainClassName = "$moduleName/org.jabref.JabRefLauncher"
}

// TODO: Ugly workaround to temporarily ignore build errors to dependencies of latex2unicode
// These should be removed, as well as the files in the lib folder, as soon as they have valid module names
Expand Down Expand Up @@ -91,7 +94,6 @@ repositories {
}

configurations {
//errorprone
libreoffice

// TODO: Remove the following workaround for split error messages such as
Expand All @@ -108,121 +110,108 @@ javafx {

dependencies {
// Include all jar-files in the 'lib' folder as dependencies
compile fileTree(dir: 'lib', includes: ['*.jar'])
implementation fileTree(dir: 'lib', includes: ['*.jar'])

compile 'org.apache.pdfbox:pdfbox:2.0.18'
compile 'org.apache.pdfbox:fontbox:2.0.18'
compile 'org.apache.pdfbox:xmpbox:2.0.18'
implementation 'org.apache.pdfbox:pdfbox:2.0.18'
implementation 'org.apache.pdfbox:fontbox:2.0.18'
implementation 'org.apache.pdfbox:xmpbox:2.0.18'

compile group: 'org.apache.commons', name: 'commons-csv', version: '1.8'
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.8'

compile group: 'org.apache.tika', name: 'tika-core', version: '1.23'
implementation group: 'org.apache.tika', name: 'tika-core', version: '1.23'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
compile 'org.bouncycastle:bcprov-jdk15on:1.64'
implementation 'org.bouncycastle:bcprov-jdk15on:1.64'

compile 'commons-cli:commons-cli:1.4'
implementation 'commons-cli:commons-cli:1.4'

// For Java 9+ compatibility, we include a bundled version of the libreoffice libraries
// See https://bugs.documentfoundation.org/show_bug.cgi?id=117331#c8 for background information
// Use the task bundleLibreOffice to update the bundled jar
//compile "org.libreoffice:juh:6.2.3"
//compile "org.libreoffice:jurt:6.2.3"
//compile "org.libreoffice:ridl:6.2.3"
//compile "org.libreoffice:unoil:6.2.3"
//implementation "org.libreoffice:juh:6.2.3"
//implementation "org.libreoffice:jurt:6.2.3"
//implementation "org.libreoffice:ridl:6.2.3"
//implementation "org.libreoffice:unoil:6.2.3"

compile 'io.github.java-diff-utils:java-diff-utils:4.5'
compile 'info.debatty:java-string-similarity:1.2.1'
implementation 'io.github.java-diff-utils:java-diff-utils:4.5'
implementation 'info.debatty:java-string-similarity:1.2.1'

antlr3 'org.antlr:antlr:3.5.2'
compile 'org.antlr:antlr-runtime:3.5.2'
implementation 'org.antlr:antlr-runtime:3.5.2'

antlr4 'org.antlr:antlr4:4.8-1'
compile 'org.antlr:antlr4-runtime:4.8-1'
implementation 'org.antlr:antlr4-runtime:4.8-1'

compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.4'
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.4'

compile 'org.postgresql:postgresql:42.2.10'
implementation 'org.postgresql:postgresql:42.2.10'

compile ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
implementation ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
// causing module issues
exclude module: 'oraclepki'
}

compile ('com.google.guava:guava:28.2-jre') {
implementation ('com.google.guava:guava:28.2-jre') {
// TODO: Remove this as soon as https://github.com/google/guava/issues/2960 is fixed
exclude module: "jsr305"
}

compile group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '1.3.5'
implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '1.3.5'

// JavaFX stuff
compile 'de.jensd:fontawesomefx-commons:11.0'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-11'
compile 'de.saxsys:mvvmfx-validation:1.9.0-SNAPSHOT'
compile 'de.saxsys:mvvmfx:1.8.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.6.1'
compile 'org.fxmisc.richtext:richtextfx:0.10.4'
compile group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
compile 'com.jfoenix:jfoenix:9.0.9'
compile 'org.controlsfx:controlsfx:11.0.1'

compile 'org.jsoup:jsoup:1.12.2'
compile 'com.konghq:unirest-java:3.6.00'

compile 'org.slf4j:slf4j-api:2.0.0-alpha1'
compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl', version: '3.0.0-SNAPSHOT'
compile group: 'org.apache.logging.log4j', name: 'log4j-plugins', version: '3.0.0-SNAPSHOT'
implementation 'de.jensd:fontawesomefx-commons:11.0'
implementation 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-11'
implementation 'de.saxsys:mvvmfx-validation:1.9.0-SNAPSHOT'
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation 'org.fxmisc.easybind:easybind:1.0.3'
implementation 'org.fxmisc.flowless:flowless:0.6.1'
implementation 'org.fxmisc.richtext:richtextfx:0.10.4'
implementation group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
implementation 'com.jfoenix:jfoenix:9.0.9'
implementation 'org.controlsfx:controlsfx:11.0.1'

implementation 'org.jsoup:jsoup:1.12.2'
implementation 'com.konghq:unirest-java:3.6.00'

implementation 'org.slf4j:slf4j-api:2.0.0-alpha1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl', version: '3.0.0-SNAPSHOT'
implementation group: 'org.apache.logging.log4j', name: 'log4j-plugins', version: '3.0.0-SNAPSHOT'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '3.0.0-SNAPSHOT'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'

compile 'de.undercouch:citeproc-java:2.0.0'
implementation 'de.undercouch:citeproc-java:2.0.0'

compile group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1'
compile group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2'
compile group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'
implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1'
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2'
implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'

compile ('com.github.tomtung:latex2unicode_2.12:0.2.6') {
implementation ('com.github.tomtung:latex2unicode_2.12:0.2.6') {
exclude module: 'fastparse_2.12'
}

/*
TODO: Reenable error prone as soon as https://github.com/google/error-prone/issues/1210 is fixed
errorprone ('com.google.errorprone:error_prone_core:2.3.2') {
exclude module: "jsr305"
exclude group: 'org.checkerframework', module: 'checker-qual'
exclude group: 'com.google.errorprone', module: 'error_prone_annotation'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'com.google.errorprone', module: 'error_prone_check_api'
}
*/

compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.4.1'
compile (group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.4.1') {
implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.4.1'
implementation (group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.4.1') {
exclude module: "log4j-core"
}


testCompile 'io.github.classgraph:classgraph:4.8.65'
testImplementation 'io.github.classgraph:classgraph:4.8.65'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.6.0'
testCompile 'org.junit.platform:junit-platform-launcher:1.6.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.6.0'

testCompile 'net.bytebuddy:byte-buddy-parent:1.10.8'
testImplementation 'net.bytebuddy:byte-buddy-parent:1.10.8'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testCompile 'org.mockito:mockito-core:3.3.0'
//testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.13.1'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.13.0'
testCompile "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
testCompile "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
testCompile "org.hamcrest:hamcrest-library:2.2"
testImplementation 'org.mockito:mockito-core:3.3.0'
testImplementation 'org.xmlunit:xmlunit-core:2.6.3'
testImplementation 'org.xmlunit:xmlunit-matchers:2.6.3'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.13.1'
testImplementation "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
testImplementation "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
testImplementation "org.hamcrest:hamcrest-library:2.2"

checkstyle 'com.puppycrawl.tools:checkstyle:8.29'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '2.3.2'
Expand Down Expand Up @@ -310,7 +299,6 @@ processResources {
}
}


task generateSource(dependsOn: ["generateBstGrammarSource",
"generateSearchGrammarSource",
"generateMedlineSource",
Expand Down Expand Up @@ -379,7 +367,6 @@ task generateModsSource(type: XjcTask) {
}

tasks.withType(JavaCompile) {
// use UTF-8
options.encoding = 'UTF-8'
}

Expand Down Expand Up @@ -552,12 +539,6 @@ checkstyle {
sourceSets = []
}

modernizer {
// We have more than 20 issues, which are not fixed yet. Nevertheless, we produce the modernizer output.
// See https://github.com/andrewgaul/modernizer-maven-plugin for more information on modernizer
failOnViolations = false
}

// Release tasks
task deleteInstallerTemp(type: Delete) {
delete "$buildDir/installer"
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/jabref/gui/fieldeditors/URLUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.gui.fieldeditors;

import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
Expand Down Expand Up @@ -53,15 +52,15 @@ public static String cleanGoogleSearchURL(String url) {
if (pair.startsWith("url=")) {
String value = pair.substring(pair.indexOf('=') + 1);

String decode = URLDecoder.decode(value, StandardCharsets.UTF_8.name());
String decode = URLDecoder.decode(value, StandardCharsets.UTF_8);
// url?
if (decode.matches(URL_EXP)) {
return decode;
}
}
}
return url;
} catch (UnsupportedEncodingException | MalformedURLException e) {
} catch (MalformedURLException e) {
return url;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/openoffice/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
Expand Down Expand Up @@ -360,7 +361,7 @@ private static void pipe(final InputStream in, final PrintStream out, final Stri
@Override
public void run() {
try {
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));

for (;;) {
String s = r.readLine();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.logic.formatter.bibtexfields;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -40,13 +39,7 @@ public String format(String value) {
if (matcher.find()) {
toDecode = matcher.group(1);
}
try {
decodedLink = URLDecoder.decode(toDecode, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOGGER.warn("Used unsupported character encoding", e);
}

return decodedLink;
return URLDecoder.decode(toDecode, StandardCharsets.UTF_8);
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/logic/xmp/XmpUtilWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ private static String generateXmpStringWithXmpDeclaration(List<BibEntry> entries
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
XmpSerializer serializer = new XmpSerializer();
serializer.serialize(meta, os, true);
return os.toString(StandardCharsets.UTF_8.name());
return os.toString(StandardCharsets.UTF_8);
} catch (TransformerException e) {
LOGGER.warn("Tranformation into xmp not possible: " + e.getMessage(), e);
LOGGER.warn("Transformation into XMP not possible: " + e.getMessage(), e);
return "";
} catch (UnsupportedEncodingException e) {
LOGGER.warn("Unsupported encoding to UTF-8 of bib entries in xmp metadata.", e);
LOGGER.warn("Unsupported encoding to UTF-8 of bib entries in XMP metadata.", e);
return "";
} catch (IOException e) {
LOGGER.warn("IO Exception thrown by closing the output stream.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void languageKeysShouldNotBeQuotedInFiles() throws IOException {
.filter(key -> key.getKey().contains("_") && key.getKey().equals(new LocalizationKey(key.getKey()).getPropertiesKey()))
.collect(Collectors.toList());

assertEquals(Collections.EMPTY_LIST, quotedEntries,
assertEquals(Collections.emptyList(), quotedEntries,
"Language keys must not be used quoted in code! Use \"This is a message\" instead of \"This_is_a_message\".\n" +
"Please correct the following entries:\n" +
quotedEntries
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/jabref/logic/xmp/XmpUtilReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void testReadArticleDublinCoreReadXmp() throws IOException, URISyntaxException,
@Test
void testReadEmtpyMetadata() throws IOException, URISyntaxException {
List<BibEntry> entries = XmpUtilReader.readXmp(Paths.get(XmpUtilShared.class.getResource("empty_metadata.pdf").toURI()), xmpPreferences);
assertEquals(Collections.EMPTY_LIST, entries);
assertEquals(Collections.emptyList(), entries);
}

/**
Expand Down