Skip to content

Commit

Permalink
Merge branch 'main' into fix-issue-10372
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr authored Sep 24, 2023
2 parents f0a6d93 + c498324 commit 543fde6
Show file tree
Hide file tree
Showing 75 changed files with 824 additions and 431 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Auto Merge
on: [pull_request, workflow_dispatch]
on: [pull_request_target, workflow_dispatch]

permissions:
contents: write
Expand All @@ -9,7 +9,11 @@ jobs:
automerge:
runs-on: ubuntu-latest
# Run only if PR is inside JabRef's main repository and created by dependabot or by an update workflow
if: ${{ (github.repository == 'JabRef/jabref') && ((github.actor == 'dependabot[bot]') || (startsWith(github.event.pull_request.title, '[Bot]'))) }}
if: >
(github.repository == 'JabRef/jabref') &&
((github.actor == 'dependabot[bot]') ||
((startsWith(github.event.pull_request.title, '[Bot] ') || (startsWith(github.event.pull_request.title, 'Bump '))) &&
(github.event.pull_request.head.repo.full_name == 'JabRef/jabref')))
steps:
- name: Approve PR
run: gh pr review --approve "$PR_URL"
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,6 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
shell: bash
run: |
mkdir ${{runner.temp}}/sshkey
if [[ -z "${{ secrets.buildJabRefPrivateKey }}" ]]; then
echo "buildJabRefPrivateKey is empty, exiting"
exit 1
fi
rsync -Pavz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i ~/.ssh/id_rsa' build/distribution/ jrrsync@build-upload.jabref.org:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
- name: Upload to GitHub workflow artifacts store
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
Expand Down
231 changes: 88 additions & 143 deletions .github/workflows/deployment.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/refresh-journal-lists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cache: 'gradle'
- name: Check whether journal-list.mv can be generated (the "real" generation is done inside JabRef's build process)
run: |
./gradlew generateJournalAbbreviationList
./gradlew generateJournalListMV
- uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added an integrity check for more special characters. [#8712](https://github.com/JabRef/jabref/issues/8712)
- We added protected terms described as "Computer science". [#10222](https://github.com/JabRef/jabref/pull/10222)
- We added a checkbox to apply the selected action to all entries that have duplicates on the library. [#10372](https://github.com/JabRef/jabref/issues/10372)
- We added a link "Get more themes..." in the preferences to that points to [themes.jabref.org](https://themes.jabref.org) allowing the user to download new themes. [#10243](https://github.com/JabRef/jabref/issues/10243)
- We added a fetcher for [LOBID](https://lobid.org/resources/api) resources. [koppor#386](https://github.com/koppor/jabref/issues/386)
- When in `biblatex` mode, the [integrity check](https://docs.jabref.org/finding-sorting-and-cleaning-entries/checkintegrity) for journal titles now also checks the field `journal`.

### Changed

- In the exports listrefs, tablerefs, tablerefsabsbib, use ISO date format in the footer.
- The export formats `listrefs`, `tablerefs`, `tablerefsabsbib`, now use the ISO date format in the footer [#10383](https://github.com/JabRef/jabref/pull/10383).
- When searching for an identifier in the "Web search", the title of the search window is now "Identifier-based Web Search". [#10391](https://github.com/JabRef/jabref/pull/10391)

### Fixed

Expand All @@ -31,6 +35,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where the ISBN fetcher returned the entrytype `misc` for certain ISBN numbers [#10348](https://github.com/JabRef/jabref/issues/10348)
- We fixed a bug where an exception was raised when saving less than three export save orders in the preference. [#10157](https://github.com/JabRef/jabref/issues/10157)
- We fixed an issue where it was possible to create a group with no name or with a group separator inside the name [#9776](https://github.com/JabRef/jabref/issues/9776)
- Biblatex's `journaltitle` is now also respected for showing the journal information. [#10397](https://github.com/JabRef/jabref/issues/10397)
- JabRef does not hang anymore when exporting via CLI. [#10380](https://github.com/JabRef/jabref/issues/10380)

### Removed
Expand Down
34 changes: 16 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.3.3'
id 'org.openrewrite.rewrite' version '6.3.8'
}

// Enable following for debugging
Expand Down Expand Up @@ -92,12 +92,6 @@ repositories {

configurations {
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 {
extendsFrom implementation
exclude group: "javax.activation"
}
}

dependencyLocking {
Expand Down Expand Up @@ -136,8 +130,8 @@ dependencies {

implementation 'commons-cli:commons-cli:1.5.0'

implementation 'org.libreoffice:unoloader:7.6.0'
implementation 'org.libreoffice:libreoffice:7.6.0'
implementation 'org.libreoffice:unoloader:7.6.1'
implementation 'org.libreoffice:libreoffice:7.6.1'

implementation 'io.github.java-diff-utils:java-diff-utils:4.12'
implementation 'info.debatty:java-string-similarity:2.0.0'
Expand Down Expand Up @@ -168,7 +162,7 @@ dependencies {
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'jakarta.inject:jakarta.inject-api:2.0.1'

implementation('org.jabref:afterburner.fx:2.0.0-SNAPSHOT')
implementation('org.jabref:afterburner.fx:2.0.0')
implementation 'org.kordamp.ikonli:ikonli-javafx:12.3.1'
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.3.1'
implementation 'com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9' //jitpack
Expand Down Expand Up @@ -257,7 +251,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.2.1"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.3.0"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down Expand Up @@ -308,10 +302,10 @@ tasks.register('generateSource') {
}

tasks.register("generateBstGrammarSource", JavaExec) {
main = "org.antlr.v4.Tool"
classpath = configurations.antlr4
group = "JabRef"
description = 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr4.'
classpath = configurations.antlr4
mainClass = "org.antlr.v4.Tool"

inputs.dir('src/main/antlr4/org/jabref/bst/')
outputs.dir("src-gen/main/java/org/jabref/logic/bst/")
Expand All @@ -322,21 +316,24 @@ tasks.register("generateSearchGrammarSource", JavaExec) {
group = 'JabRef'
description = "Generates java files for Search.g antlr4."
classpath = configurations.antlr4
main = "org.antlr.v4.Tool"
mainClass = "org.antlr.v4.Tool"

inputs.dir("src/main/antlr4/org/jabref/search/")
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"]
}

tasks.register("generateJournalAbbreviationList", JavaExec) {
tasks.register("generateJournalListMV", JavaExec) {
group = "JabRef"
description = "Converts the comma-separated journal abbreviation file to a H2 MVStore"
classpath = sourceSets.main.runtimeClasspath
main = "org.jabref.cli.JournalListMvGenerator"
mainClass = "org.jabref.cli.JournalListMvGenerator"
onlyIf {
!file("build/resources/main/journals/journal-list.mv").exists()
}
}
jar.dependsOn "generateJournalAbbreviationList"
test.dependsOn "generateJournalAbbreviationList"
jar.dependsOn "generateJournalListMV"
compileTestJava.dependsOn "generateJournalListMV"

tasks.register('generateCitaviSource', XjcTask) {
group = 'JabRef'
Expand Down Expand Up @@ -556,6 +553,7 @@ tasks.register('deleteInstallerTemp', Delete) {
}

jpackage.dependsOn deleteInstallerTemp
jlinkZip.dependsOn jpackage
jlink {
addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
launcher {
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ docker run -p 4000:4000 -it --rm --volume="C:\git-repositories\jabref\docs":/srv
* With <kbd>Ctrl</kbd>+<kbd>C</kbd> you can stop the server (this is enabled by the `-it` switch).
* In case you get errors regarding `Gemfile.lock`, just delete `Gemfile.lock` and rerun.
* The current `Dockerfile` is based on <https://github.com/just-the-docs/just-the-docs/blob/main/Dockerfile>.
The [Jekyll Docker image](https://github.com/envygeeks/jekyll-docker#jekyll-docker) did not work end of 20222 (because Ruby was too new).
The [Jekyll Docker image](https://github.com/envygeeks/jekyll-docker#jekyll-docker) did not work end of 2022 (because Ruby was too new).
80 changes: 12 additions & 68 deletions docs/code-howtos/IntelliJ.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,15 @@ Did you know that [IntelliJ allows for reformatting selected code](https://www.j
* <kbd>Alt</kbd>+<kbd>F1</kbd> and then <kbd>Enter</kbd>: Locate the file in the search bar on the left side.
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd>: Navigate from a class to the test class.

---
parent: Set up a local workspace
grand_parent: Getting into the code
nav_order: 49
---

## Other notes on IntelliJ

{: .note}
Here, some notes on IntelliJ setup are written down.
These are intended for pro users.

You should use IntelliJ IDEA's internal build system for compiling and running JabRef tests during development, because it is usually more responsive.
Essentially, you now have the best of both worlds:
You can run Gradle tasks using the Gradle Tool Window.
You can compile and run tests with IntelliJ's faster internal build system
(unless you haven't made changes to input files that generate sources).

{: .important}
When using IntelliJ's build system, **it is important** that you understand that JabRef relies on generated sources which are only built through Gradle.
Therefore, to build or update these dependencies you need to run the `run` (or `assemble`) Gradle task at least once.
When you followed this guide, you should have done it in the Gradle setup.

Running JabRef itself through IntelliJ's build system is **not** possible as we encounter difficulties when reading resources though `.class.getResource(...)`.
Although solutions are discussed in length [on stackoverflow](https://stackoverflow.com/q/26328040/873282), there is no "good" solution for us.

## Running JabRef using IntelliJ's build system

{ :note }
Maybe does not work

To run JabRef from IntelliJ, we let IntelliJ create a launch configuration:

Locate the class `Launcher`:
Press <kbd>Ctrl</kbd>+<kbd>N</kbd>.
Then, the "Search for classes dialog" pops up.
Enter `Launcher`.
Now, only one class should have been found:

{% figure caption:"IntelliJ search for class “Launcher”" %}
![IntelliJ search for class "Launcher"](../images/intellij-search-for-launcher.png)
{% endfigure %}

Press <kbd>Enter</kbd> to jump to that class.

Hover on the green play button.

{% figure caption:"However on green play" %}
![However on green play](../images/intellij-hover-on-play-button.png)
{% endfigure %}

Then, click on it.
A popup menu opens.
Choose the first entry and click on it.

{% figure caption:"Run JabRef via launcher" %}
![Popup menu - Run JabRef via launcher](../images/intellij-run-jabref-from-launcher.png)
{% endfigure %}

Then, JabRef starts.

You also have an entry in the Launch configurations to directly launch the JabRef GUI:

{% figure caption:"Launch menu contains “Launcher”" %}
![Launch menu contains launcher](../images/intellij-run-launcher.png)
{% endfigure %}

You can also click on the debug symbol next to it to enable stopping at breakpoints.
## Show variable values in IntelliJ

1. Go to a test case (example: [`org.jabref.model.entry.BibEntryTest#settingTypeToNullThrowsException`](https://github.com/JabRef/jabref/blob/refine-intellij-howto/src/test/java/org/jabref/model/entry/BibEntryTest.java#L52-L52)
2. Set the breakpoint to the first line
3. Execute the test
4. Go to the settings of the debugger and activate "Show Variable Values in Editor" and "Show Method Return Values"
<figure>
<img src="intellij-debugger-configuration.png" alt="Debugger Configuration">
<figcaption>Debugger Configuration</figcaption>
</figure>

<!-- markdownlint-disable-file MD033 -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nav_order: 12
Ensure you have a Java 20 SDK configured by navigating to **File > Project Structure... > Platform Settings > SDKs**.

{% figure caption:"JDKs 11, 14, and 15 shown in available SDKs. JDK 20 is missing." %}
![Plattform Settings - SDKs](../../images/intellij-choose-jdk-adoptopenjdk-on-windows-project-settings.png)
![Plattform Settings - SDKs](intellij-choose-jdk-adoptopenjdk-on-windows-project-settings.png)
{% endfigure %}

If there is another JDK than JDK 20 selected, click on the plus button and choose "Download JDK..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@ Due to [IDEA-119280](https://youtrack.jetbrains.com/issue/IDEA-119280), it is a
3. Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to mark them for copying
4. Select the folder `classes`
5. Press <kbd>Ctrl</kbd>+<kbd>V</kbd> to start the copy process
8. Locate the class `Launcher` (e.g., by <kbd>ctrl</kbd>+<kbd>N</kbd> and then typing `Launcher`)
8. Locate the class `Launcher` (e.g., by <kbd>ctrl</kbd>+<kbd>N</kbd> and then typing `Launcher`). Press <kbd>Enter</kbd> to jump to that class.
<figure>
<img src="intellij-search-for-launcher.png" alt="IntelliJ search for class “Launcher”">
<figcaption>IntelliJ search for class “Launcher”</figcaption>
</figure>
9. Click on the green play button next to the `main` method to create a Launch configuration. IntelliJ will fail in launching.
<figure>
<img src="intellij-hover-on-play-button.png" alt="However on green play">
<figcaption>However on green play</figcaption>
</figure>

<figure>
<img src="intellij-run-jabref-from-launcher.png" alt="Run JabRef via launcher">
<figcaption>Run JabRef via launcher</figcaption>
</figure>

10. On the top right of the IntelliJ window, next to the newly created launch configuration, click on the drop down
11. Click on "Edit Configurations..."
12. On the right, click on "Modify options"
13. Ensure that "Use classpath of module" is checked
14. Select "Add VM options"
15. In the newly appearing field for VM options, insert:

```text
--add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref
--add-opens=org.controlsfx.controls/org.controlsfx.control.textfield=org.jabref
Expand All @@ -53,6 +66,12 @@ Due to [IDEA-119280](https://youtrack.jetbrains.com/issue/IDEA-119280), it is a
--add-reads org.jabref=org.fxmisc.flowless
--add-reads org.jabref=org.apache.commons.csv
```
16. Click "Apply"
17. Click "Run". You can also click on the debug symbol next to it to enable stopping at breakpoints.
<figure>
<img src="intellij-run-launcher.png" alt="Launch menu contains “Launcher”">
<figcaption>Launch menu contains “Launcher”</figcaption>
</figure>

14. Click "Apply"
15. Click "Run"
<!-- MD031 is disabled, because otherwise the numbering does not work properly. MD029 and M032 are disabled as a consequence. -->
<!-- markdownlint-disable-file MD029 MD031 MD032 MD033 -->
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ In older IntelliJ setups, more things were necessary:

Ignore the Gradle project "buildSrc" by clicking the button **Select Project Data To Import** in the Gradle Tool Window and unchecking the folder "buildSrc".

![Ignore the Gradle project "buildSrc"](../../images/intellij-gradle-config-ignore-buildSrc.png)
![Ignore the Gradle project "buildSrc"](intellij-gradle-config-ignore-buildSrc.png)

Add `src-gen` as root:

Expand Down
Binary file removed docs/images/intellij-gradle-config.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The package `org.jabref.cli` is responsible for handling the command line option

During development, one can configure IntelliJ to pass command line parameters:

![IntelliJ-run-configuration](<images/intellij-run-configuration-command-line.png>)
![IntelliJ-run-configuration](images/intellij-run-configuration-command-line.png)

Passing command line arguments using gradle is currently not possible as all arguments (such as `-Dfile.encoding=windows-1252`) are passed to the application.

Expand Down
3 changes: 2 additions & 1 deletion rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ recipeList:
# - org.openrewrite.staticanalysis.AvoidBoxedBooleanExpressions
# Leads to exception
# - org.openrewrite.staticanalysis.CombineSemanticallyEqualCatchBlocks
# Needs parameters
# - org.openrewrite.staticanalysis.DeclarationSiteTypeVariance
# Unreadable code
# .ifPresent((Path selectedDirectory) -> {
# - org.openrewrite.staticanalysis.ExplicitLambdaArgumentTypes
Expand Down Expand Up @@ -121,7 +123,6 @@ recipeList:
- org.openrewrite.staticanalysis.CompareEnumsWithEqualityOperator
- org.openrewrite.staticanalysis.ControlFlowIndentation
- org.openrewrite.staticanalysis.CovariantEquals
- org.openrewrite.staticanalysis.DeclarationSiteTypeVariance
# Needs manual intervention
# - org.openrewrite.staticanalysis.DefaultComesLast
- org.openrewrite.staticanalysis.EmptyBlock
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/jabref/cli/JournalListMvGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public static void main(String[] args) throws IOException {
System.exit(0);
}
Path journalListMvFile = Path.of("build", "resources", "main", "journals", "journal-list.mv");
if (Files.exists(journalListMvFile)) {
System.out.println("Target " + journalListMvFile.toAbsolutePath() + " already exists.");
System.out.println("Skipping generation.");
System.out.println("If you really want to re-generate, please delete the file.");
System.exit(0);
}

Set<String> ignoredNames = Set.of(
// remove all lists without dot in them:
Expand Down
Loading

0 comments on commit 543fde6

Please sign in to comment.