From 55638114e912971285c69dc0a3d9e55b1a1cf979 Mon Sep 17 00:00:00 2001 From: Shitikanth Date: Mon, 5 Dec 2016 12:36:21 -0500 Subject: [PATCH 1/5] Use v8 engine for CSL (#2250) Add a dependency to com.eclipsesource.J2V8 (Java Bindings for V8) in build.gradle. Citeproc-java detects that V8 is present in the classpath and starts using it automatically. --- build.gradle | 25 +++++++++++++++++++++++++ external-libraries.txt | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/build.gradle b/build.gradle index 6fdd9c43ea0..0f4272f4924 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,26 @@ configurations { antlr4 } +def getV8Dependency() { + def arch = System.getProperty('os.arch') + def dep = null + if (OperatingSystem.current().isWindows()) { + dep = 'win32_x86' + if (arch.equals('amd64')) { + dep += '_64' + } + } else if (OperatingSystem.current().isMacOsX() && (arch.equals('amd64') || arch.equals('x86_64'))) { + dep = 'macosx_x86_64' + } else if (OperatingSystem.current().isLinux() && arch.equals('amd64')) { + dep = 'linux_x86_64' + } + if (dep == null) { + logger.error("Could not find V8 runtime compatible to this system") + return null + } + return 'com.eclipsesource.j2v8:j2v8_' + dep + ':4.5.0' +} + dependencies { compile 'com.jgoodies:jgoodies-common:1.8.1' compile 'com.jgoodies:jgoodies-forms:1.9.0' @@ -143,6 +163,11 @@ dependencies { compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.+' compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.+' + // if available, use platform specific build of V8 + if (getV8Dependency() != null) { + compile getV8Dependency() + } + testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.7.22' testCompile 'com.github.tomakehurst:wiremock:2.6.0' diff --git a/external-libraries.txt b/external-libraries.txt index 7f7484b92e5..9b7c0f8f9af 100644 --- a/external-libraries.txt +++ b/external-libraries.txt @@ -216,4 +216,9 @@ Project: latex2unicode URL: https://github.com/tomtung/latex2unicode License: Apache 2.0 +Id: com.eclipse.j2v8 +Project: J2V8 +URL: https://github.com/eclipsesource/J2V8 +Licence: EPL-1.0 + The last entry has to end with an empty line. Otherwise the entry is not present in About.html. From 513d71b614716760204422125a397e0ac1066e36 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 5 Dec 2016 19:11:36 +0100 Subject: [PATCH 2/5] Introduce different configurations --- build.gradle | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 0f4272f4924..9a30968cbee 100644 --- a/build.gradle +++ b/build.gradle @@ -64,29 +64,19 @@ repositories { configurations { antlr3 antlr4 -} -def getV8Dependency() { - def arch = System.getProperty('os.arch') - def dep = null - if (OperatingSystem.current().isWindows()) { - dep = 'win32_x86' - if (arch.equals('amd64')) { - dep += '_64' - } - } else if (OperatingSystem.current().isMacOsX() && (arch.equals('amd64') || arch.equals('x86_64'))) { - dep = 'macosx_x86_64' - } else if (OperatingSystem.current().isLinux() && arch.equals('amd64')) { - dep = 'linux_x86_64' - } - if (dep == null) { - logger.error("Could not find V8 runtime compatible to this system") - return null - } - return 'com.eclipsesource.j2v8:j2v8_' + dep + ':4.5.0' + linux_x86_64Compile.extendsFrom compile + macosx_x86_64Compile.extendsFrom compile + win32_x86Compile.extendsFrom compile + win32_x86_64Compile.extendsFrom compile } dependencies { + compile configuration: 'linux_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_linux_x86_x64', version: '4.5.0' + compile configuration: 'macosx_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_macosx_x86_x64', version: '4.5.0' + compile configuration: 'win32_x86', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86', version: '4.5.0' + compile configuration: 'win32_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86_x64', version: '4.5.0' + compile 'com.jgoodies:jgoodies-common:1.8.1' compile 'com.jgoodies:jgoodies-forms:1.9.0' compile 'com.jgoodies:jgoodies-looks:2.7.0' @@ -163,11 +153,6 @@ dependencies { compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.+' compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.+' - // if available, use platform specific build of V8 - if (getV8Dependency() != null) { - compile getV8Dependency() - } - testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.7.22' testCompile 'com.github.tomakehurst:wiremock:2.6.0' @@ -418,7 +403,7 @@ checkstyle { toolVersion = '6.17' } -task release(dependsOn: ["media", "releaseJar"]) { +task release(dependsOn: ["media"]) { group = 'JabRef - Release' description 'Creates a release for all target platforms.' } From aec54db18d79fc33a9e8d2856eb907cb109488a1 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 17 Apr 2017 22:12:10 +0200 Subject: [PATCH 3/5] Rename configurations --- build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 9a30968cbee..32b48d82f1e 100644 --- a/build.gradle +++ b/build.gradle @@ -67,15 +67,15 @@ configurations { linux_x86_64Compile.extendsFrom compile macosx_x86_64Compile.extendsFrom compile - win32_x86Compile.extendsFrom compile - win32_x86_64Compile.extendsFrom compile + windows_x86_32Compile.extendsFrom compile + windows_x86_64Compile.extendsFrom compile } dependencies { - compile configuration: 'linux_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_linux_x86_x64', version: '4.5.0' - compile configuration: 'macosx_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_macosx_x86_x64', version: '4.5.0' - compile configuration: 'win32_x86', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86', version: '4.5.0' - compile configuration: 'win32_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86_x64', version: '4.5.0' + compile configuration: 'linux_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_linux_x86_x64', version: '4.6.0' + compile configuration: 'macosx_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_macosx_x86_x64', version: '4.6.0' + compile configuration: 'windows_x86_32', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86', version: '4.6.0' + compile configuration: 'windows_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86_x64', version: '4.6.0' compile 'com.jgoodies:jgoodies-common:1.8.1' compile 'com.jgoodies:jgoodies-forms:1.9.0' From 01b6abd5722df662606fd76fe3d3d39470bf96a1 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 18 Apr 2017 07:52:58 +0200 Subject: [PATCH 4/5] Begin to use gradle-java-flavours plugin (https://github.com/uklance/gradle-java-flavours) --- build.gradle | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 32b48d82f1e..5a2f355e028 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,7 @@ plugins { id "com.simonharrer.modernizer" version "1.4.0-1" id 'me.champeau.gradle.jmh' version '0.3.1' id "net.ltgt.errorprone" version "0.0.10" + id 'com.lazan.javaflavours' version '1.2' } // use the gradle build scan feature: https://scans.gradle.com/get-started @@ -34,7 +35,6 @@ apply plugin: "project-report" apply plugin: 'jacoco' apply plugin: 'install4j' apply plugin: 'me.champeau.gradle.jmh' - apply plugin: 'checkstyle' apply from: 'eclipse.gradle' @@ -71,11 +71,18 @@ configurations { windows_x86_64Compile.extendsFrom compile } +javaFlavours { + flavour 'linux_x86_64' + flavour 'macosx_x86_64' + flavour 'windows_x86_32' + flavour 'windows_x86_64' +} + dependencies { - compile configuration: 'linux_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_linux_x86_x64', version: '4.6.0' - compile configuration: 'macosx_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_macosx_x86_x64', version: '4.6.0' - compile configuration: 'windows_x86_32', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86', version: '4.6.0' - compile configuration: 'windows_x86_64', group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86_x64', version: '4.6.0' + linux_x86_64Compile group: 'com.eclipsesource.j2v8', name: 'j2v8_linux_x86_x64', version: '4.6.0' + macosx_x86_64Compile group: 'com.eclipsesource.j2v8', name: 'j2v8_macosx_x86_x64', version: '4.6.0' + windows_x86_32Compile group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86', version: '4.6.0' + windows_x86_64Compile group: 'com.eclipsesource.j2v8', name: 'j2v8_win32_x86_x64', version: '4.6.0' compile 'com.jgoodies:jgoodies-common:1.8.1' compile 'com.jgoodies:jgoodies-forms:1.9.0' From 373cf1eaa7f57e90f6ff4de9b1dd0ffab5d5dac9 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 18 Apr 2017 11:21:14 +0200 Subject: [PATCH 5/5] Add ...ShadowJar tasks Suggested by http://stackoverflow.com/a/43460153/873282 --- build.gradle | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5a2f355e028..fe37a1f0022 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,8 @@ -import org.gradle.internal.os.OperatingSystem - // to update the gradle wrapper, execute ./gradlew wrapper --gradle-version 3.0 +import org.gradle.internal.os.OperatingSystem +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + buildscript { repositories { maven { @@ -199,6 +200,18 @@ clean { delete "src/main/gen" } +def flavours = ['linux_x86_64', 'macosx_x86_64', 'windows_x86_32', 'windows_x86_64'] +flavours.each { String flavour -> + SourceSet flavourSourceSet = sourceSets.getByName(flavour) + Configuration flavourRuntime = configurations.getByName("${flavour}Runtime") + JavaCompile flavourCompileTask = tasks.getByName("compile${flavour.capitalize()}Java") + Task shadowJarTask = tasks.create(name: "${flavour}ShadowJar", type: ShadowJar) { + classifier = "${flavour}-fat" + dependsOn flavourCompileTask + } + assemble.dependsOn shadowJarTask +} + task generateSource(dependsOn: ["generateBstGrammarSource", "generateSearchGrammarSource"]) { group = 'JabRef' description 'Generates all Java source files.'