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

Update antlr task + gradle #7097

Merged
merged 7 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
29 changes: 15 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import groovy.json.JsonSlurper
import org.gradle.internal.os.OperatingSystem
import org.jabref.build.JournalAbbreviationConverter
import org.jabref.build.antlr.JabRefAntlrPlugin
import org.jabref.build.localization.LocalizationPlugin
import org.jabref.build.xjc.XjcPlugin
import org.jabref.build.xjc.XjcTask
Expand All @@ -16,8 +15,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.36.0'
id 'org.javamodularity.moduleplugin' version '1.7.0'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.jlink' version '2.22.1'

id 'org.beryx.jlink' version '2.22.3'
// nicer test outputs during running and completion
// Homepage: https://github.com/radarsh/gradle-test-logger-plugin
id 'com.adarshr.test-logger' version '2.1.1'
Expand All @@ -31,7 +29,6 @@ apply plugin: 'project-report'
apply plugin: 'jacoco'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'checkstyle'
apply plugin: JabRefAntlrPlugin
apply plugin: XjcPlugin
apply plugin: LocalizationPlugin

Expand All @@ -43,9 +40,11 @@ version = project.findProperty('projVersion') ?: '100.0.0'
java {
sourceCompatibility = JavaVersion.VERSION_14
targetCompatibility = JavaVersion.VERSION_14
modularity.inferModulePath.set(true)
}

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

Expand Down Expand Up @@ -88,7 +87,8 @@ repositories {

configurations {
libreoffice

antlr3
antlr4
// TODO: Remove the following workaround for split error messages such as
// error: module java.xml.bind reads package javax.annotation from both jsr305 and java.annotation
compile {
Expand Down Expand Up @@ -304,23 +304,24 @@ task generateSource(dependsOn: ["generateBstGrammarSource",
description 'Generates all necessary (Java) source files.'
}

task generateBstGrammarSource(type: org.jabref.build.antlr.AntlrTask) {
task generateBstGrammarSource(type: JavaExec) {
main = "org.antlr.Tool"
classpath = configurations.antlr3
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/generated/org/jabref/logic/bst/'
inputs.dir('src/main/antlr3/org/jabref/bst/')
args = ["-o", "$projectDir/src/main/generated/org/jabref/logic/bst/" , "$projectDir/src/main/antlr3/org/jabref/bst/Bst.g" ]
}

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

antlr = ANTLR4
inputFile = "src/main/antlr4/org/jabref/search/Search.g4"
outputDir = "src/main/generated/org/jabref/search"
javaPackage = "org.jabref.search"
inputs.dir("src/main/antlr4/org/jabref/search/")
args = ["-o","$projectDir/src/main/generated/org/jabref/search" , "-visitor", "-no-listener", "-package", "org.jabref.search", "$projectDir/src/main/antlr4/org/jabref/search/Search.g4"]
}

task generateMedlineSource(type: XjcTask) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

68 changes: 0 additions & 68 deletions buildSrc/src/main/groovy/org/jabref/build/antlr/AntlrTask.groovy

This file was deleted.

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
22 changes: 4 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down