Skip to content

Commit

Permalink
Merge branch 'ai-pr-1' into use-gradle-modules-plugin-snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Jul 4, 2024
2 parents bd1e5bb + 6ac6b31 commit 644e98a
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 60 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/deployment-jdk-ea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, buildjet-4vcpu-ubuntu-2204-arm]
os: [ubuntu-latest, windows-latest, macos-latest, buildjet-8vcpu-ubuntu-2204-arm]
jdk: [22]
javafx: [23]
include:
Expand All @@ -45,7 +45,7 @@ jobs:
- os: windows-latest
displayName: windows
archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip ./build/distribution/JabRef && rm -R build/distribution/JabRef
- os: buildjet-4vcpu-ubuntu-2204-arm
- os: buildjet-8vcpu-ubuntu-2204-arm
displayName: "linux-arm"
archivePortable: "tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux-arm64.tar.gz && rm -R build/distribution/JabRef"
- os: macos-latest
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
submodules: 'true'
show-progress: 'false'
- name: Install pigz and cache (linux)
if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'buildjet-4vcpu-ubuntu-2204-arm')
if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'buildjet-8vcpu-ubuntu-2204-arm')
uses: awalsh128/cache-apt-pkgs-action@master
with:
packages: pigz
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
# JavaFX
- name: Download and extract JavaFX ${{ matrix.javafx }}
if: (matrix.os != 'buildjet-4vcpu-ubuntu-2204-arm')
if: (matrix.os != 'buildjet-8vcpu-ubuntu-2204-arm')
shell: bash
run: |
cd javafx
Expand All @@ -127,7 +127,7 @@ jobs:
EXTRACT="tar xzf *.tar.gz"
EXT="tar.gz"
;;
"buildjet-4vcpu-ubuntu-2204-arm")
"buildjet-8vcpu-ubuntu-2204-arm")
OS="linux"
EXTRACT="tar xzf *.tar.gz"
EXT="tar.gz"
Expand Down Expand Up @@ -163,19 +163,19 @@ jobs:
$EXTRACT
rm *.$EXT
- name: 'Set JavaFX ${{ matrix.javafx }} (linux, Windows)'
if: (matrix.os != 'macos-latest') && (matrix.os != 'buildjet-4vcpu-ubuntu-2204-arm')
if: (matrix.os != 'macos-latest') && (matrix.os != 'buildjet-8vcpu-ubuntu-2204-arm')
run: |
sed -i '/javafx {/{n;s#version = ".*"#sdk = "javafx/javafx-sdk-${{ matrix.javafx }}"#}' build.gradle
sed -i "s#jlink {#jlink { addExtraModulePath 'javafx/javafx-jmods-${{ matrix.javafx }}'#" build.gradle
cat build.gradle
- name: 'Set JavaFX ${{ matrix.javafx }} (macOS)'
if: (matrix.os == 'macos-latest') && (matrix.os != 'buildjet-4vcpu-ubuntu-2204-arm')
if: (matrix.os == 'macos-latest') && (matrix.os != 'buildjet-8vcpu-ubuntu-2204-arm')
run: |
sed -i '.bak' -e '/javafx {/{n' -e 's#version = ".*"#sdk = "javafx/javafx-sdk-${{ matrix.javafx }}"#;}' build.gradle
sed -i '.bak' -e "s#jlink {#jlink { addExtraModulePath 'javafx/javafx-jmods-${{ matrix.javafx }}'#" build.gradle
cat build.gradle
- name: 'Set JavaFX ${{ matrix.javafx }} (linux-arm)'
if: (matrix.os == 'buildjet-4vcpu-ubuntu-2204-arm')
if: (matrix.os == 'buildjet-8vcpu-ubuntu-2204-arm')
# No JavaFX EA build for ARM at https://jdk.java.net/javafx23/, therefore using Maven Central artifact
run: |
curl -s "https://search.maven.org/solrsearch/select?q=g:org.openjfx+AND+a:javafx&rows=10&core=gav" > /tmp/versions.json
Expand Down
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ application {
modularity.disableEffectiveArgumentsAdjustment()

// Required as workaround for https://github.com/langchain4j/langchain4j/issues/1066
modularity.patchModule("langchain4j", "langchain4j-core-0.31.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-0.31.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-all-minilm-l6-v2-0.31.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-all-minilm-l6-v2-q-0.31.0.jar")
modularity.patchModule("langchain4j", "langchain4j-open-ai-0.31.0.jar")
modularity.patchModule("langchain4j", "langchain4j-core-0.32.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-0.32.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-all-minilm-l6-v2-0.32.0.jar")
modularity.patchModule("langchain4j", "langchain4j-embeddings-all-minilm-l6-v2-q-0.32.0.jar")
modularity.patchModule("langchain4j", "langchain4j-open-ai-0.32.0.jar")

sourceSets {
main {
Expand Down Expand Up @@ -165,7 +165,7 @@ dependencies {
exclude group: 'commons-logging'
}

def luceneVersion = "9.11.0"
def luceneVersion = "9.11.1"
implementation "org.apache.lucene:lucene-core:$luceneVersion"
implementation "org.apache.lucene:lucene-queryparser:$luceneVersion"
implementation "org.apache.lucene:lucene-queries:$luceneVersion"
Expand Down Expand Up @@ -232,7 +232,7 @@ dependencies {
exclude group: 'org.openjfx'
}
implementation 'org.fxmisc.flowless:flowless:0.7.3'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
implementation 'org.fxmisc.richtext:richtextfx:0.11.3'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.32.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude module: 'commons-lang3'
Expand Down Expand Up @@ -321,10 +321,10 @@ dependencies {
implementation 'org.yaml:snakeyaml:2.2'

// AI
implementation 'dev.langchain4j:langchain4j:0.31.0'
implementation 'dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2:0.31.0'
implementation 'dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2-q:0.31.0'
implementation('dev.langchain4j:langchain4j-open-ai:0.31.0') {
implementation 'dev.langchain4j:langchain4j:0.32.0'
implementation 'dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2:0.32.0'
implementation 'dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2-q:0.32.0'
implementation('dev.langchain4j:langchain4j-open-ai:0.32.0') {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
// openai depends on okhttp, which needs kotlin - see https://github.com/square/okhttp/issues/5299 for details
Expand All @@ -340,8 +340,8 @@ dependencies {
implementation 'commons-io:commons-io:2.16.1'

testImplementation 'io.github.classgraph:classgraph:4.8.174'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3'

testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
Expand Down
2 changes: 1 addition & 1 deletion docs/code-howtos/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ See also: [https://help.github.com/articles/syncing-a-fork/](https://help.github
(As Administrator - one time)

1. Install [chocolatey](https://chocolatey.org)
2. `choco install git.install -y --params "/GitAndUnixToolsOnPath /WindowsTerminal`
2. `choco install git.install -y --params "/GitAndUnixToolsOnPath /WindowsTerminal"`
3. `choco install notepadplusplus`
4. If you want to have your JDK also managed via chocolatey: `choco install temurin`

Expand Down
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 @@ -40,14 +40,17 @@ Navigate to **Project Settings > Project** and ensure that the projects' SDK is

Click "OK" to store the changes.

## Configure the Build System
## Ensure correct JDK setting for Gradle

Navigate to **File > Settings... > Build, Execution, Deployment > Build Tools > Gradle** and select the "Project SDK" as the Gradle JVM at the bottom. If that does not exist, just select JDK 21.
Navigate to **File > Settings... > Build, Execution, Deployment > Build Tools > Gradle** and select the "Project SDK" as the Gradle JVM at the bottom.
If that does not exist, just select JDK 21.

{% figure caption:"Gradle JVM is project SDK (showing JDK 21 as example)" %}
{% figure caption:"Gradle JVM is project SDK (showing "Projekt SDK temurin-21" as example)" %}
![Gradle JVM is project SDK](guidelines-intellij-settings-gradle-gradlejvm-is-projectjvm.png)
{% endfigure %}

## Enable compiliation by IntelliJ

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

Navigate to **Build, Execution, Deployment > Compiler > Java Compiler**, and under "Override compiler parameters per-module", click add (\[+]) and choose `JabRef.main`:
Expand All @@ -56,28 +59,38 @@ Navigate to **Build, Execution, Deployment > Compiler > Java Compiler**, and und
![Gradle JVM is project SDK](guidelines-choose-module.png)
{% endfigure %}

Then double click inside the cell "Compilation options" and enter following parameters:
Copy following text into your clipboard:

```text
--add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref
--add-exports=org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref
--add-reads org.jabref=org.fxmisc.flowless
--add-exports=langchain4j/dev.langchain4j.data.document=org.jabref
--add-exports=langchain4j/dev.langchain4j.model.input=org.jabref
--add-reads org.jabref=org.apache.commons.csv
--add-reads org.jabref=org.fxmisc.flowless
--add-reads org.jabref=langchain4j.core
--add-reads org.jabref=langchain4j.embeddings.all.minilm.l6.v2
--add-reads org.jabref=langchain4j.embeddings.all.minilm.l6.v2.q
--add-reads org.jabref=langchain4j.core
--add-reads org.jabref=langchain4j.open.ai
```

Then double click inside the cell "Compilation options".
Press <kbd>Ctrl</kbd>+<kbd>A</kbd> to mark all text.
Press <kbd>Ctrl</kbd>+<kbd>V</kbd> to paste all text.
Press <kbd>Enter</kbd> to have the value really stored.
Otherwise, it seems like the setting is stored, but it is not there if you reopen this preference dialog.
Then click on "Apply" to store the setting.

Note: If you use the expand arrow, you need to press <kbd>Shift</kbd>+<kbd>Enter</kbd> to close the expansion and then <kbd>Enter</kbd> to commit the value.

{% figure caption:"Resulting settings for module JabRef.main" %}
![Overridden compiler parameters](guidelines-overridden-compiler-parameters.png)
{% endfigure %}

If this step is omitted, 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)`.
Then click on "Apply" to store the setting.

Note: If this step is omitted, 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)`.

## Enable annotation processors

Enable annotation processors by navigating to **Build, Execution, Deployment > Compiler > Annotation processors** and check "Enable annotation processing"

Expand Down Expand Up @@ -140,7 +153,7 @@ This should happen without any error.

Now you can use IntelliJ IDEA's internal build system by using **Build > Build Project**.

## Final build system checks (optional)
## Final build system checks

To run an example test from IntelliJ, we let IntelliJ create a launch configuration:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ Due to [IDEA-119280](https://youtrack.jetbrains.com/issue/IDEA-119280), it is a

1. Navigate to **File > Settings... > Build, Execution, Deployment > Build Tools > Gradle**.
2. Change the setting "Build and run using:" to "IntelliJ IDEA".
3. Navigate to **File > Settings... > Build, Execution, Deployment > Compiler > Java Compiler**.
4. Uncheck `--Use 'release' option for cross-compilation`.
5. **Build > Build Project**
6. Open the project view (<kbd>Alt</kbd>+<kbd>1</kbd>, on macOS <kbd>cmd</kbd>+<kbd>1</kbd>)
7. Copy all build resources to the folder of the build classes
1. Navigate to the folder `build/resources/main`
1. Right click -> "Open In" -> "Explorer (Finder on macOS)"
1. Navigate into directory "main"
1. Select the folder `out/production/classes`
1. Right click -> "Open In" -> "Explorer (Finder on macOS)"
1. Navigate into directory "classes"
1. Now you have two Explorer windows opened. Copy all files and directories from the first one to the second one.
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.
3. Navigate to **File > Settings... > Build, Execution, Deployment > Compiler**.
4. Uncheck `Clear output directory on rebuild`.
5. Navigate to **File > Settings... > Build, Execution, Deployment > Compiler > Java Compiler**.
6. Uncheck `--Use 'release' option for cross-compilation`.
7. Click "OK" to store the preferences and close the dialog.
8. **Build > Build Project** (<kbd>Ctrl</kbd>+<kbd>F9</kbd>)
9. Open the project view (<kbd>Alt</kbd>+<kbd>1</kbd>, on macOS <kbd>cmd</kbd>+<kbd>1</kbd>)
10. Copy all build resources to the folder of the build classes
1. Navigate to the folder `build/resources/main`
1. Right click -> "Open In" -> "Explorer (Finder on macOS)"
1. Navigate into directory "main"
1. Select the folder `out/production/classes`
1. Right click -> "Open In" -> "Explorer (Finder on macOS)"
1. Navigate into directory "classes"
1. Now you have two Explorer windows opened. Copy all files and directories from the first one to the second one.
11. 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.
12. 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>
Expand All @@ -40,12 +43,12 @@ Due to [IDEA-119280](https://youtrack.jetbrains.com/issue/IDEA-119280), it is a
<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:
13. On the top right of the IntelliJ window, next to the newly created launch configuration, click on the drop down
14. Click on "Edit Configurations..."
15. On the right, click on "Modify options"
16. Ensure that "Use classpath of module" is checked
17. Select "Add VM options"
18. 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 @@ -68,8 +71,8 @@ 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.
19. Click "Apply"
20. 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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ It is strongly recommended that you have git installed.

## Installed IDE

We suggest [IntelliJ IDEA](https://www.jetbrains.com/idea/?from=jabref).
The Community Edition works well.
Most contributors use the Ultimate Edition, because they are students getting that edition for free.
We highly encourdage [IntelliJ IDEA](https://www.jetbrains.com/idea/?from=jabref), because all other IDEs work less good.
Especially using VS.Code has issues.

{: .highlight }
Currently, the 2023.1 version does **not** work for initial setup.
Please head to <https://www.jetbrains.com/idea/download/other.html> and get 2022.3.3.
You can update the IDE after a proper setup to the newest version.
IntelliJ's Community Edition works well.
Most contributors use the Ultimate Edition, because they are students getting that edition for free.

## Other Tooling

Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Add\ new\ String=Adicionar nova String
String\ constants=Constantes do texto
Must\ not\ be\ empty\!=Não pode estar vazio\!
A\ string\ with\ the\ label\ '%0'\ already\ exists.=Uma string com a etiqueta '%0' já existe.
String\ constant\ "%0"\ was\ not\ imported\ because\ it\ is\ not\ a\ valid\ string\ constant=A constante de string "%0" não foi importada porque não é uma constante de string válida
String\ constant\ %0\ was\ not\ imported\ because\ it\ already\ exists\ in\ this\ library=A constante de string %0 não foi importada porque já existe nesta biblioteca
Could\ not\ import\ the\ following\ string\ constants\:\n\ %0=Não foi possível importar as seguintes constantes de string\:\n%0
Importing\ String\ constants=Importando constantes de string

All\ entries=Todas as referências

Expand Down Expand Up @@ -999,6 +1003,7 @@ Line\ %0\:\ Found\ corrupted\ citation\ key\ %1\ (comma\ missing).=Linha %0\: En
Check\ integrity=Verificação de integridade
Checking\ integrity...=Verificando integridade...
Field\ Presence\ Consistency\ Check\ Result=Resultado da Verificação de Consistência da Presença de Campos
required\ field\ is\ present=campo obrigatório está presente
optional\ field\ is\ present=campo opcional está presente
unknown\ field\ is\ present=campo desconhecido está presente
Expand Down

0 comments on commit 644e98a

Please sign in to comment.