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

[WIP] Modularize JabRef with JPMS #4230

Closed
wants to merge 16 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# no generated files in version control
src/main/gen/
**/src/main/gen/

# private data
/buildres/jabref-cert-2016.p12
Expand Down Expand Up @@ -348,3 +348,6 @@ gradle-app.setting

# do not distribute Oracle's JDBC driver
lib/ojdbc.jar

# do not ignore the source of the build
!/buildSrc/src/
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We changed the default keyboard shortcuts for moving between entries when the entry editor is active to ̀<kbd>alt</kbd> + <kbd>up/down</kbd>.
- Opening a new file now prompts the directory of the currently selected file, instead of the directory of the last opened file.
- Window state is saved on close and restored on start.
- Files without a defined external file type are now directly opened with the default aplication of the operating system
- We streamlined the process to rename and move files by removing the confirmation dialogs.







### Fixed
- We fixed an issue where custom exports could not be selected in the 'Export (selected) entries' dialog [#4013](https://github.com/JabRef/jabref/issues/4013)
- Italic text is now rendered correctly. https://github.com/JabRef/jabref/issues/3356
Expand All @@ -58,7 +60,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the "Convert to BibTeX-Cleanup" moved the content of the `file` field to the `pdf` field [#4120](https://github.com/JabRef/jabref/issues/4120)
- We fixed an issue where the preview pane in entry preview in preferences wasn't showing the citation style selected [#3849](https://github.com/JabRef/jabref/issues/3849)
- We fixed an issue where the default entry preview style still contained the field `review`. The field `review` in the style is now replaced with comment to be consistent with the entry editor [#4098](https://github.com/JabRef/jabref/issues/4098)

- We fixed an issue where users were vulnerable to XXE attacks during parsing [#4229](https://github.com/JabRef/jabref/issues/4229)
- We fixed an issue where files added via the "Attach file" contextmenu of an entry were not made relative. [#4201](https://github.com/JabRef/jabref/issues/4201)



Expand Down
183 changes: 51 additions & 132 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ plugins {
id 'com.install4j.gradle' version '7.0.6'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id "de.sebastianboegl.shadow.transformer.log4j" version "2.1.1"
id "com.simonharrer.modernizer" version '1.6.0-1'
// id "com.simonharrer.modernizer" version '1.6.0-1'
id 'me.champeau.gradle.jmh' version '0.4.7'
id 'com.zyxist.chainsaw' version '0.3.1'
//id 'net.ltgt.errorprone' version '0.0.14'
//id 'net.ltgt.errorprone' version '0.0.15'
id 'com.github.ben-manes.versions' version '0.20.0'
}

Expand All @@ -38,20 +38,36 @@ apply plugin: 'project-report'
apply plugin: 'jacoco'
apply plugin: 'install4j'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'checkstyle'
//apply plugin: 'checkstyle'
apply plugin: org.jabref.build.antlr.AntlrPlugin

apply from: 'eclipse.gradle'
apply from: 'localization.gradle'
apply from: 'xjc.gradle'

group = "org.jabref"
version = "5.0-dev"
project.ext.threeDotVersion = "5.0.0.0"
project.ext.install4jDir = hasProperty("install4jDir") ? getProperty("install4jDir") : (OperatingSystem.current().isWindows() ? 'C:/Program Files/install4j7' : 'install4j7')
sourceCompatibility = 9
targetCompatibility = 9
mainClassName = "org.jabref.JabRefMain"

allprojects {
group = "org.jabref"
version = "5.0-dev"
project.ext.threeDotVersion = "5.0.0.0"

sourceCompatibility = 9
targetCompatibility = 9

repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
}

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

javaModule {
name = "org.jabref"
hacks {
Expand All @@ -69,36 +85,25 @@ ext.allowJava9 = true

sourceSets {
main {
java {
srcDirs = ["src/main/java", "src/main/gen"]
}

resources {
srcDirs = ["src/main/java", "src/main/resources"]
}
}
}

repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
}

configurations {
antlr3
antlr4

compile {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
}

// FIXME: bug in chainsaw does not build multi module projects in right order
compileJava.dependsOn ":jabref-model:assemble"
compileJava.dependsOn ":jabref-logic:assemble"

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

compile 'com.jgoodies:jgoodies-common:1.8.1'
compile 'com.jgoodies:jgoodies-forms:1.9.0'
Expand All @@ -118,43 +123,24 @@ dependencies {
compile "org.libreoffice:ridl:5.4.2"
compile "org.libreoffice:unoil:5.4.2"*/

compile 'io.github.java-diff-utils:java-diff-utils:2.2.0'
compile 'info.debatty:java-string-similarity:1.1.0'

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

antlr4 'org.antlr:antlr4:4.7.1'
compile 'org.antlr:antlr4-runtime:4.7.1'

// VersionEye states that 6.0.5 is the most recent version, but http://dev.mysql.com/downloads/connector/j/ shows that as "Development Release"
compile 'mysql:mysql-connector-java:5.1.46'

compile 'org.postgresql:postgresql:42.2.4'

compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1'

compile 'com.google.guava:guava:25.1-jre'

compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

// JavaFX stuff
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
compile 'de.jensd:fontawesomefx-commons:9.1.2'
compile 'de.saxsys:mvvmfx-validation:1.7.0'
compile 'de.saxsys:mvvmfx:1.7.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.6.1'
compile 'org.fxmisc.richtext:richtextfx:0.9.0'
compile 'org.fxmisc.richtext:richtextfx:0.9.1'
// compile 'com.sibvisions.external.jvxfx:dndtabpane:0.1'
compile 'javax.inject:javax.inject:1'

// Cannot be updated to 9.*.* until Jabref works with Java 9
compile 'org.controlsfx:controlsfx:9.0.0'

compile 'org.jsoup:jsoup:1.11.3'
compile 'com.mashape.unirest:unirest-java:1.4.9'

// >1.8.0-beta is required for java 9 compatibility
compile 'org.slf4j:slf4j-api:1.8.0-beta2'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0'
Expand All @@ -165,11 +151,6 @@ dependencies {
// need to use snapshots as the stable version is from 2013 and doesn't support v1.0.1 CitationStyles
compile 'org.citationstyles:styles:1.0.1-SNAPSHOT'
compile 'org.citationstyles:locales:1.0.1-SNAPSHOT'
compile 'de.undercouch:citeproc-java:1.0.1'

// JAX-B is considered JavaEE API and is no longer part of JavaSE (JDK 9)
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'

// TODO: recognized as 'latex2unicode.2.12', which is an invalid module name, temporarily removed
// compile 'com.github.tomtung:latex2unicode_2.12:0.2.2'
Expand All @@ -186,17 +167,17 @@ dependencies {
testCompile 'org.junit-pioneer:junit-pioneer:0.1.2'
testRuntime 'org.apache.logging.log4j:log4j-core:2.11.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.11.0'
testCompile 'org.mockito:mockito-core:2.19.1'
testCompile 'org.mockito:mockito-core:2.20.0'
testCompile 'com.github.tomakehurst:wiremock:2.18.0'
testCompile 'org.assertj:assertj-swing-junit:3.8.0'
testCompile 'org.reflections:reflections:0.9.11'
testCompile 'org.xmlunit:xmlunit-core:2.6.0'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.0'
testCompile 'com.tngtech.archunit:archunit-junit:0.8.2'
testCompile 'com.tngtech.archunit:archunit-junit:0.8.3'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.11'
// checkstyle 'com.puppycrawl.tools:checkstyle:8.11'
}

jacoco {
Expand Down Expand Up @@ -256,80 +237,18 @@ clean {
processResources {
filteringCharset = 'UTF-8'

filesMatching("build.properties") {
expand(version: project.version,
"year": String.valueOf(Calendar.getInstance().get(Calendar.YEAR)),
"authors": new File('AUTHORS').readLines().findAll { !it.startsWith("#") }.join(", "),
"developers": new File('DEVELOPERS').readLines().findAll { !it.startsWith("#") }.join(", "),
"azureInstrumentationKey": System.getenv('AzureInstrumentationKey'),
"minRequiredJavaVersion": minRequiredJavaVersion,
"allowJava9": allowJava9

)
filteringCharset = 'UTF-8'
}

filesMatching("resource/**/meta.xml") {
expand version: project.version
}
}


task generateSource(dependsOn: ["generateBstGrammarSource", "generateSearchGrammarSource"]) {
group = 'JabRef'
description 'Generates all Java source files.'
}

task generateBstGrammarSource(type: JavaExec) {
group 'JabRef'
description 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr3.'

File antlrSource = file('src/main/antlr3/org/jabref/bst/Bst.g')

inputs.file antlrSource
outputs.file file('src/main/gen/org/jabref/logic/bst/BstLexer.java')
outputs.file file('src/main/gen/org/jabref/logic/bst/BstParser.java')

main = 'org.antlr.Tool'
classpath = configurations.antlr3
args = ["-o", file('src/main/gen/org/jabref/logic/bst/'), antlrSource]
}

task generateSearchGrammarSource(type: JavaExec) {
String grammarFile = "Search"

group 'JabRef'
description "Generates java files for ${grammarFile}.g antlr4."

String packagePath = "org/jabref/search"
File antlrPath = file("src/main/antlr4")
File genPath = file("src/main/gen")

File antlrSource = file("$antlrPath/$packagePath/${grammarFile}.g4")
File destinationDir = file("$genPath/$packagePath")

inputs.file antlrSource
outputs.file file("$destinationDir/${grammarFile}Parser.java")
outputs.file file("$destinationDir/${grammarFile}Lexer.java")
outputs.file file("$destinationDir/${grammarFile}Visitor.java")
outputs.file file("$destinationDir/${grammarFile}BaseVisitor.java")
outputs.file file("$destinationDir/${grammarFile}.tokens")
outputs.file file("$destinationDir/${grammarFile}Lexer.tokens")

main = 'org.antlr.v4.Tool'
classpath = configurations.antlr4
args = ["-o", destinationDir, "-visitor", "-no-listener", "-package", "org.jabref.search", antlrSource]
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8' // use UTF-8 for regular and test compilation
}

compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:none"
}
compileJava.dependsOn "generateSource"

compileTestJava {
options.encoding = 'UTF-8'
}

javadoc {
options {
Expand Down Expand Up @@ -401,20 +320,20 @@ jacocoTestReport {
}

// Code quality tasks
checkstyle {
// do not use other packages for checkstyle, excluding gen(erated) sources
checkstyleMain.source = "src/main/java"
toolVersion = '8.5'

// do not perform checkstyle checks by default
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
}
//checkstyle {
// // do not use other packages for checkstyle, excluding gen(erated) sources
// checkstyleMain.source = "src/main/java"
// toolVersion = '8.5'
//
// // do not perform checkstyle checks by default
// 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
shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.jabref.build.antlr

import org.gradle.api.file.FileCollection

class Antlr3CommandLine implements AntlrCommandLine {

private final task

Antlr3CommandLine(AntlrTask task) {
this.task = task
}

@Override
String getMain() {
return "org.antlr.Tool"
}

@Override
FileCollection getClasspath() {
return task.project.configurations.antlr3
}

@Override
List<String> getArguments() {
return ["-o", task.project.file(task.outputDir).toString(), task.project.file(task.inputFile).toString()]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jabref.build.antlr

import org.gradle.api.file.FileCollection

class Antlr4CommandLine implements AntlrCommandLine {

private final AntlrTask task

Antlr4CommandLine(AntlrTask task) {
this.task = task
}

@Override
String getMain() {
return "org.antlr.v4.Tool"
}

@Override
FileCollection getClasspath() {
return task.project.configurations.antlr4
}

@Override
List<String> getArguments() {
return ["-o", file(task.outputDir), "-visitor", "-no-listener", "-package", task.javaPackage, file(task.inputFile)]
}

private String file(String path) {
return task.project.file(path).toString()
}
}
Loading