From de2823da779c3188be1dd211b916b26f4d245a8a Mon Sep 17 00:00:00 2001 From: Shitikanth Date: Mon, 5 Dec 2016 12:36:21 -0500 Subject: [PATCH] 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 bda11fe14aa8..37243969817f 100644 --- a/build.gradle +++ b/build.gradle @@ -72,6 +72,26 @@ configurations { integrationTestRuntime.extendsFrom testRuntime } +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' @@ -133,6 +153,11 @@ dependencies { compile 'com.github.lgooddatepicker:LGoodDatePicker:8.2.2' + // if available, use platform specific build of V8 + if (getV8Dependency() != null) { + compile getV8Dependency() + } + testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.2.26' testCompile 'com.github.tomakehurst:wiremock:2.4.1' diff --git a/external-libraries.txt b/external-libraries.txt index 4d969fa02dac..43d08f900981 100644 --- a/external-libraries.txt +++ b/external-libraries.txt @@ -171,4 +171,9 @@ Project: Citeproc-Java URL: http://michel-kraemer.github.io/citeproc-java/ Licence: 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.