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 Gradle from 6.8.3 to 7.0 #7619

Merged
merged 50 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e09a9c9
Update Gradle Wrapper from 6.8.3 to 7.0.
gradle-update-robot Apr 12, 2021
25594e0
fix gradle compile errors
Siedlerchr Apr 12, 2021
d37d5f9
Merge branch 'main' into gradlew-update-7.0
Siedlerchr Apr 12, 2021
b5e4a81
update cache workflows
Siedlerchr Apr 12, 2021
ff0f558
update cachem, rename key to gradle 7
Siedlerchr Apr 12, 2021
5849c32
Try to fix compile issue
koppor Apr 12, 2021
5916595
Merge branch 'main' into gradlew-update-7.0
koppor Apr 12, 2021
a1ff517
Update build.gradle
koppor Apr 12, 2021
9dc446b
disable daemon and watch-fs
koppor Apr 12, 2021
d172824
Merge remote-tracking branch 'upstream/main' into gradlew-update-7.0
Siedlerchr Apr 16, 2021
64769ec
try to use tasks register
Siedlerchr Apr 16, 2021
f1b6a50
Try to ensure source generation
koppor Apr 17, 2021
37c6e1c
Merge branch 'main' into gradlew-update-7.0
Siedlerchr Apr 24, 2021
21585b4
Add extension for compile to make jlink work
Siedlerchr Apr 25, 2021
7ea3496
try with new cache
Siedlerchr Apr 25, 2021
76a4715
Merge remote-tracking branch 'upstream/main' into gradlew-update-7.0
Siedlerchr Apr 26, 2021
012dfb9
update modularity plugin
Siedlerchr Apr 26, 2021
5b6e522
Try with org.javamodularity.moduleplugin:1.8.1
koppor Apr 27, 2021
e756362
Remove quickfix
koppor Apr 27, 2021
01b53fb
specify outputs dir and use modulary 1.8.2
Siedlerchr May 2, 2021
858e5fb
dowmgrade plugin
Siedlerchr May 2, 2021
068cfdd
Update deployment.yml
Siedlerchr May 2, 2021
4adaa3f
add duplicate strategy exclude
Siedlerchr May 2, 2021
3635513
Merge branch 'gradlew-update-7.0' of github.com:JabRef/jabref into gr…
Siedlerchr May 2, 2021
69b3682
set inferModularity to false
Siedlerchr May 2, 2021
1f37009
Fix empty lines
koppor May 2, 2021
d351505
Fix empty lines
koppor May 2, 2021
398875a
Fix empty line
koppor May 2, 2021
7b63bbc
Disable full strack traces ALWAYS
koppor May 2, 2021
2ae05b9
add duplicate strategy
Siedlerchr May 2, 2021
168b110
Small code improvments
koppor May 2, 2021
5c288d6
Merge branch 'gradlew-update-7.0' of github.com:JabRef/jabref into gr…
koppor May 2, 2021
3630774
Remove jcenter()
koppor May 2, 2021
47b3ade
Merge remote-tracking branch 'origin/main' into gradlew-update-7.0
koppor May 2, 2021
d192a7e
Fix mavenCentral
koppor May 2, 2021
f14becd
Fix groovy
koppor May 2, 2021
b86837f
add maven central
Siedlerchr May 2, 2021
2f79358
Merge branch 'gradlew-update-7.0' of github.com:JabRef/jabref into gr…
Siedlerchr May 2, 2021
5126721
add maven central
Siedlerchr May 2, 2021
532596c
Switch to mavenCentral
koppor May 2, 2021
8b35c21
Improve readability
koppor May 2, 2021
7e6c623
Merge branch 'gradlew-update-7.0' of github.com:JabRef/jabref into gr…
koppor May 2, 2021
aec1a20
Resolve quirks with generateJournalAbbreviationList by copying java c…
koppor May 3, 2021
ad66a8c
Refine documentation for buildSrc
koppor May 3, 2021
1b3a1fe
Generated sources flow into "src-gen/" directory having the same layo…
koppor May 3, 2021
35ce3a6
add checkstyle suppression
Siedlerchr May 3, 2021
295a62f
fix markdownlint
Siedlerchr May 3, 2021
e42432e
JabRef runs out ouf IntelliJ again
koppor May 3, 2021
dd32aa0
Add some try-again hint
koppor May 3, 2021
3f19cab
Remove idea config block -> we do it manually
koppor May 3, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# no generated files in version control
src/main/gen/
src/main/generated/
src-gen/

# private data
/buildres/jabref-cert-2016.p12
Expand Down
33 changes: 22 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ plugins {
id 'checkstyle'

id 'project-report'

id 'idea'
}

// Enable following for debugging
Expand Down Expand Up @@ -72,9 +74,9 @@ modularity.disableEffectiveArgumentsAdjustment()
sourceSets {
main {
java {
srcDirs = ["src/main/java", "src/main/generated"]
// src-gen reasoning: https://stackoverflow.com/a/64612308/873282
srcDirs = ["src/main/java", "src-gen/main/java"]
}

resources {
srcDirs = ["src/main/java", "src/main/resources"]
}
Expand Down Expand Up @@ -274,6 +276,7 @@ task checkOutdatedDependencies(dependsOn: dependencyUpdates) {

clean {
delete "src/main/generated"
delete "src-gen"
}

processResources {
Expand Down Expand Up @@ -322,8 +325,8 @@ tasks.register("generateBstGrammarSource", JavaExec) {
description = 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr3.'

inputs.dir('src/main/antlr3/org/jabref/bst/')
outputs.dir("src/main/generated/org/jabref/logic/bst/")
args = ["-o", "$projectDir/src/main/generated/org/jabref/logic/bst/" , "$projectDir/src/main/antlr3/org/jabref/bst/Bst.g" ]
outputs.dir("src-gen/main/java/org/jabref/logic/bst/")
args = ["-o", "src-gen/main/java/org/jabref/logic/bst/" , "$projectDir/src/main/antlr3/org/jabref/bst/Bst.g" ]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
args = ["-o", "src-gen/main/java/org/jabref/logic/bst/" , "$projectDir/src/main/antlr3/org/jabref/bst/Bst.g" ]
args = ["-o", "$projectDir/src-gen/main/java/org/jabref/logic/bst/" , "$projectDir/src/main/antlr3/org/jabref/bst/Bst.g" ]

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not added to outputs.dir. To avoid cluttering the build.gradle file, I would leave this change out and "just" use the relative path. (And it works with the relative path).

I'll keep it in my head though.

}

tasks.register("generateSearchGrammarSource", JavaExec) {
Expand All @@ -333,16 +336,16 @@ tasks.register("generateSearchGrammarSource", JavaExec) {
description = "Generates java files for Search.g antlr4."

inputs.dir("src/main/antlr4/org/jabref/search/")
outputs.dir("src/main/generated/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"]
outputs.dir("src-gen/main/java/org/jabref/search/")
args = ["-o","src-gen/main/java/org/jabref/search" , "-visitor", "-no-listener", "-package", "org.jabref.search", "$projectDir/src/main/antlr4/org/jabref/search/Search.g4"]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
args = ["-o","src-gen/main/java/org/jabref/search" , "-visitor", "-no-listener", "-package", "org.jabref.search", "$projectDir/src/main/antlr4/org/jabref/search/Search.g4"]
args = ["-o","$projectDir/src-gen/main/java/org/jabref/search" , "-visitor", "-no-listener", "-package", "org.jabref.search", "$projectDir/src/main/antlr4/org/jabref/search/Search.g4"]

}

task generateMedlineSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the medline importer."

schemaFile = "src/main/resources/xjc/medline/medline.xsd"
outputDirectory = "src/main/generated"
outputDirectory = "src-gen/main/java"
javaPackage = "org.jabref.logic.importer.fileformat.medline"
}

Expand All @@ -351,7 +354,7 @@ task generateBibtexmlSource(type: XjcTask) {
description = "Generates java files for the bibtexml importer."

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

Expand All @@ -360,7 +363,7 @@ task generateEndnoteSource(type: XjcTask) {
description = "Generates java files for the endnote importer."

schemaFile = "src/main/resources/xjc/endnote/endnote.xsd"
outputDirectory = "src/main/generated/"
outputDirectory = "src-gen/main/java/"
javaPackage = "org.jabref.logic.importer.fileformat.endnote"
}

Expand All @@ -370,7 +373,7 @@ task generateModsSource(type: XjcTask) {

schemaFile = "src/main/resources/xjc/mods/mods-3-7.xsd"
bindingFile = "src/main/resources/xjc/mods/mods-binding.xjb"
outputDirectory = "src/main/generated/"
outputDirectory = "src-gen/main/java"
javaPackage = "org.jabref.logic.importer.fileformat.mods"
arguments = '-npa'
}
Expand All @@ -394,7 +397,7 @@ compileJava {
options.compilerArgs << "-Xlint:none"
dependsOn "generateSource"

options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/main/generated")
options.annotationProcessorGeneratedSourcesDirectory = file("src-gen/main/java")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
options.annotationProcessorGeneratedSourcesDirectory = file("src-gen/main/java")
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src-gen/main/java")


moduleOptions {
// TODO: Remove access to internal api
Expand Down Expand Up @@ -776,3 +779,11 @@ task downloadDependencies {
}
}
}

idea {
module {
// documentation: https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html
generatedSourceDirs += file("src-gen/main/java")
downloadJavadoc = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Navigate to **File \| Settings \| Build, Execution, Deployment \| Build Tools \|

To prepare IntelliJ's build system two additional steps are required:

* Navigate to **File \| Settings \| Build, Execution, Deployment \| Compiler \| Java Compiler**, and under "Override compiler parameters per-module" add \(\[+\]\) the following compiler arguments for the `JabRef.main` module:
* Navigate to **File \| Settings \| Build, Execution, Deployment \| Compiler \| Java Compiler**, and under "Override compiler parameters per-module" add \(\[+\]\) the following compiler arguments for the `JabRef.main` module. Otherwise, you will get: `java: package com.sun.javafx.scene.control is not visible (package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to module org.jabref)`

```text
--add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref
Expand Down Expand Up @@ -171,7 +171,7 @@ To use IntelliJ IDEA's internal build system when you build JabRef through **Bui

Essentially, you now have the best of both worlds: You can run Gradle tasks using the Gradle Tool Window and unless you haven't made changes to input files that generate sources, you can compile and run with IntelliJ's faster internal build system.

In case all steps are followed, and there are still issues with `SearchBaseVisitor` \(e.g., `Error:(16, 25) java: package org.jabref.search does not exist`\), you have to delete `generated\org\jabref\gui\logging\plugins\Log4jPlugins.java`. This is independent of having enabled or disabled Annotation Processing \(see above at "Enable Annotation Processing"\).
In case all steps are followed, and there are still issues with `SearchBaseVisitor` \(e.g., `Error:(16, 25) java: package org.jabref.search does not exist`\), you have to delete `src\main\generated\org\jabref\gui\logging\plugins\Log4jPlugins.java`. This is independent of having enabled or disabled Annotation Processing \(see above at "Enable Annotation Processing"\).

#### Using JabRef's code style

Expand Down Expand Up @@ -271,11 +271,17 @@ Another indication is following output
java.lang.UnsupportedClassVersionError: org/javamodularity/moduleplugin/ModuleSystemPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
```

### Problems with generated source files
### Issues with generated source files

In rare cases you might encounter problems due to out-dated automatically generated source files. Running `./gradlew clean` deletes these old copies. Do not forget to run at least `./gradlew eclipse` or `./gradlew build` afterwards to regenerate the source files.
``
### Issues with `buildSrc`

### Problems with openjfx libraries in local maven repository
1. Open the context menu of `buildSrc`.
1. Select "Load/Unload modules".
1. Unload `jabRef.buildSrc`.

### Issues with openjfx libraries in local maven repository

There might be problems with building if you have openjfx libraries in local maven repository, resulting in errors like this:

Expand Down