Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
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/
236 changes: 114 additions & 122 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import groovy.json.JsonSlurper
import org.gradle.internal.os.OperatingSystem
import org.jabref.build.xjc.XjcTask

import static org.jabref.build.Dependencies.libraries

// to update the gradle wrapper, execute
// ./gradlew wrapper --gradle-version=4.4.1 --distribution-type=bin
Expand Down Expand Up @@ -38,10 +41,11 @@ apply plugin: 'jacoco'
apply plugin: 'install4j'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'checkstyle'
apply plugin: org.jabref.build.antlr.AntlrPlugin
apply plugin: org.jabref.build.xjc.XjcPlugin
apply plugin: org.jabref.build.localization.LocalizationPlugin

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

group = "org.jabref"
version = "5.0-dev"
Expand All @@ -55,17 +59,8 @@ mainClassName = "org.jabref.JabRefMain"
ext.minRequiredJavaVersion = "1.8.0_171"
ext.allowJava9 = false

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

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

repositories {
mavenLocal()
Expand All @@ -75,102 +70,77 @@ repositories {
}
}

configurations {
antlr3
antlr4
}

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

compile 'com.jgoodies:jgoodies-common:1.8.1'
compile 'com.jgoodies:jgoodies-forms:1.9.0'
compile libraries.jGoodiesCommon
compile libraries.jGoodiesForms

compile 'org.apache.pdfbox:pdfbox:2.0.10'
compile 'org.apache.pdfbox:fontbox:2.0.10'
compile 'org.apache.pdfbox:xmpbox:2.0.10'
compile libraries.pdfbox

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

compile 'commons-cli:commons-cli:1.4'
compile libraries.commonsCli

compile "org.libreoffice:juh:5.4.2"
compile "org.libreoffice:jurt:5.4.2"
compile "org.libreoffice:ridl:5.4.2"
compile "org.libreoffice:unoil:5.4.2"
compile libraries.libreOffice

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

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

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

// 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 libraries.mySqlConnector

compile 'org.postgresql:postgresql:42.2.2'
compile libraries.postgres

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

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

// JavaFX stuff
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
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 'com.sibvisions.external.jvxfx:dndtabpane:0.1'
compile 'javax.inject:javax.inject:1'
compile libraries.fontawesome
compile libraries.mvvmfx
compile libraries.easybind
compile libraries.flowless
compile libraries.richtextfx
compile libraries.dndtabpane
compile libraries.javaInject

// Cannot be updated to 9.*.* until Jabref works with Java 9
compile 'org.controlsfx:controlsfx:8.40.15-SNAPSHOT'
compile libraries.controlsFx

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

// >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'
compile 'org.apache.logging.log4j:log4j-jcl:2.11.0'
compile 'org.apache.logging.log4j:log4j-api:2.11.0'
compile 'org.apache.logging.log4j:log4j-core:2.11.0'
compile libraries.loggingApi
compile libraries.logging

// 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'
compile libraries.citationStyles
compile libraries.citeproc

compile 'com.github.tomtung:latex2unicode_2.12:0.2.2'
compile libraries.latex2unicode

compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.1.1'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.1.1'
compile libraries.applicationInsights

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
testCompile 'org.junit.jupiter:junit-jupiter-params:5.2.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.2.0'
testCompile 'org.junit.platform:junit-platform-launcher:1.2.0'
testCompile 'org.junit-pioneer:junit-pioneer:0.1-SNAPSHOT'
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.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 "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"
testCompile libraries.junit
testRuntimeOnly libraries.junitRuntime
testCompile libraries.junitPlatformLauncher
testCompile libraries.junitPioneer
testRuntime libraries.testLogging
testCompile libraries.mockito
testCompile libraries.wiremock
testCompile libraries.assertjSwing
testCompile libraries.reflections
testCompile libraries.xmlUnit
testCompile libraries.archUnit
testCompile libraries.testFx

checkstyle 'com.puppycrawl.tools:checkstyle:8.10.1'
checkstyle libraries.checkstyle
xjc libraries.xjc
jython 'org.python:jython-standalone:2.7.1'
}

jacoco {
Expand Down Expand Up @@ -212,7 +182,6 @@ dependencyUpdates.resolutionStrategy = {
selection.reject("http://dev.mysql.com/downloads/connector/j/ lists the version 5.* as last stable version.")
}
}

}
}

Expand Down Expand Up @@ -249,60 +218,81 @@ processResources {
}


task generateSource(dependsOn: ["generateBstGrammarSource", "generateSearchGrammarSource"]) {
task generateSource(dependsOn: ["generateBstGrammarSource",
"generateSearchGrammarSource",
"generateMedlineSource",
"generateBibtexmlSource",
"generateEndnoteSource",
"generateModsSource"]) {
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.'
task generateBstGrammarSource(type: org.jabref.build.antlr.AntlrTask) {
group = "JabRef"
description = 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr3.'

antlr = ANTLR3
inputFile = 'src/main/antlr3/org/jabref/bst/Bst.g'
outputDir = 'src/main/gen/org/jabref/logic/bst/'
}

task generateSearchGrammarSource(type: org.jabref.build.antlr.AntlrTask) {
group = 'JabRef'
description = "Generates java files for Search.g antlr4."

File antlrSource = file('src/main/antlr3/org/jabref/bst/Bst.g')
antlr = ANTLR4
inputFile = "src/main/antlr4/org/jabref/search/Search.g4"
outputDir = "src/main/gen/org/jabref/search"
javaPackage = "org.jabref.search"
}

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')
task generateMedlineSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the medline importer."

main = 'org.antlr.Tool'
classpath = configurations.antlr3
args = ["-o", file('src/main/gen/org/jabref/logic/bst/'), antlrSource]
schemaFile = "src/main/resources/xjc/medline/medline.xsd"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.medline"
}

task generateSearchGrammarSource(type: JavaExec) {
String grammarFile = "Search"
task generateBibtexmlSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the bibtexml importer."

schemaFile = "src/main/resources/xjc/bibtexml/bibtexml.xsd"
outputDirectory = "src/main/gen"
javaPackage = "org.jabref.logic.importer.fileformat.bibtexml"
}

group 'JabRef'
description "Generates java files for ${grammarFile}.g antlr4."
task generateEndnoteSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the endnote importer."

String packagePath = "org/jabref/search"
File antlrPath = file("src/main/antlr4")
File genPath = file("src/main/gen")
schemaFile = "src/main/resources/xjc/endnote/RSXML.dtd"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.endnote"
arguments = '-dtd'
}

File antlrSource = file("$antlrPath/$packagePath/${grammarFile}.g4")
File destinationDir = file("$genPath/$packagePath")
task generateModsSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the mods importer."

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")
schemaFile = "src/main/resources/xjc/mods/mods-3-7.xsd"
bindingFile = "src/main/resources/xjc/mods/mods-binding.xjb"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.mods"
arguments = '-npa'
}

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'
dependsOn "generateSource"
}

javadoc {
Expand All @@ -313,6 +303,8 @@ javadoc {
}
}

localization.script = 'scripts/syncLang.py'

// Test tasks
test {
useJUnitPlatform {
Expand Down
13 changes: 13 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id 'java'
id 'groovy'
}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this now duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specifies the repositories used for resolving dependencies for the buildSrc project.
As far as I know, this does not overwrite or duplicate the buildscript.repositories property in the build.gradle.


dependencies {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this if it's empty?

Loading