Skip to content

Commit

Permalink
Merge pull request #7097 from JabRef/updateAntlrTask
Browse files Browse the repository at this point in the history
Update antlr task + gradle
  • Loading branch information
Siedlerchr authored Nov 16, 2020
2 parents 3fe142e + e43323a commit 1dc91ca
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
codesign --entitlements buildres/mac/myapp.entitlements --options runtime -vvv -f --sign "Developer ID Application: Tobias Diez (W2PU6LW5U5)" build/distribution/JabRef.app
jpackage --type pkg --dest build/distribution --name JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type dmg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac
codesign -s "Developer ID Application: Tobias Diez (W2PU6LW5U5)" --options runtime --entitlements buildres/mac/myapp.entitlements -vvvv --deep "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.dmg"
jpackage --type pkg --dest build/distribution --name JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type pkg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac
jpackage --type pkg --dest build/distribution --name JabRef --mac-package-identifier JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type pkg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac
productsign --sign "Developer ID Installer: Tobias Diez (W2PU6LW5U5)" "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.pkg" "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-signed.pkg"
- name: Notarize dmg and pkg installer
if: matrix.os == 'macos-latest' && github.ref == 'refs/heads/master'
Expand Down
29 changes: 16 additions & 13 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 @@ -17,7 +16,6 @@ plugins {
id 'org.javamodularity.moduleplugin' version '1.7.0'
id 'org.openjfx.javafxplugin' version '0.0.9'
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 Expand Up @@ -702,6 +703,8 @@ jlink {
installerOptions = [
'--verbose',
'--vendor', 'JabRef',
'--mac-package-identifier', "JabRef",
'--mac-package-name', "JabRef",
'--app-version', "${project.version}",
'--file-associations', "${projectDir}/buildres/mac/bibtexAssociations.properties",
'--resource-dir', "${projectDir}/buildres/mac"
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

0 comments on commit 1dc91ca

Please sign in to comment.