Skip to content

Commit 0dc6dd7

Browse files
kopporSiedlerchrInAnYan
authored
Initial framework for jablib-examples (#14233)
* Initial framework for jablib-examples * Rename "serializeAll" to "writeAll" * Add some `@NonNull` annotations * Even more consistent * More renamings * Add convenience constructor * Add some nullable annotations * Add cross-links * Fix typo * Fix class name * Have BibliographyFromPdfImporter implementing PlainCitationParser * Add "IEEE" as another rule option * Fix method name (and visibility) * Compilefix * Fix casing in BibTeX * Enable LLM to be used to parse references * Refine code - BibliographyFromPdfImporter is also an PdfImporter - importDatabase returns ParserResult (for consistency) * Move pdf related importers to pdf sub package * Initial PdfImporterWithPlainCitationParser * WIP: ieee_pdf_references_to_bibtex * Add link to CHANGELOG.md * Refine PlainCitationParser interface * Move methods to PdfUtils * Make LlmPlainCitationParser a real importer (and fix BibligraphyFromPdfImporter method use) * Add missing class * Wire all availble importers * Rename BibliographyFromPdfImporter to RuleBasedBibliographyPdfImporter * Introdue intermediate class BibliographyFromPdfImporter * Fix PdfGrobitImporter (to really extract the references) * Add comment * Fix JavaFX graphics dependency in ProgressCounter * Remove routing method * Remove obsolete test file * Add development hint to README.md * First version of to BibTeX conversion * Adapt test to new behavior * Apply format * Fix NullAway warning * Fix Moderinzer * Refine checkstyle supressions * Fix typo * Use release version of action-checkstyle * Move complete file ignores to checkstyle.xml * Also run if jbang scripts themselves have changed * Add link * Update checkstyle version in checkstyle-idea.xml * Remove obsolete comment * Apply suggestions from code review Co-authored-by: Ruslan <[email protected]> * Fix checkstyle * Increase IntelliJ version * Switch to other formatter * Fix checkstyle * Fix reference * Apply renaming also in script * Fix jbang build command (double .java) * Workaround for formatter issue * Switch back to other formatter (better output) * Remove one more ".java" * Try to list all files * Rename "simple" to "general" * Debug: output modified files * Add missing } * Try other way for debugging * Ohter debug * Fix debug * Fix copy and paste error * Output script * Remove obsolete ".java" * Remove debug * Remove "build" * Fix source adaption * Refine tests * Better grouping --------- Co-authored-by: Christoph <[email protected]> Co-authored-by: Ruslan <[email protected]>
1 parent e6ceac8 commit 0dc6dd7

File tree

67 files changed

+630
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+630
-375
lines changed

.github/workflows/binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
upload-to-builds-jabref-org: ${{ steps.binary.outputs.upload-to-builds-jabref-org }}
5151
secretspresent: ${{ steps.binary.outputs.secretspresent }}
5252
tagbuild: ${{ steps.binary.outputs.tagbuild }}
53-
# requried to avoid obsolete builds in case of labels != "dev: binaries"
53+
# required to avoid obsolete builds in case of labels != "dev: binaries"
5454
should-build: ${{ steps.binary.outputs.should-build }}
5555
should-notarize: ${{ steps.binary.outputs.should-notarize }}
5656

.github/workflows/tests-code.yml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
distribution: 'corretto'
5757
check-latest: true
5858
- name: Run checkstyle reporter
59-
uses: dbelyaev/action-checkstyle@master
59+
uses: dbelyaev/action-checkstyle@v3
6060
with:
6161
reporter: github-pr-review
6262
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -119,7 +119,7 @@ jobs:
119119
runs-on: ubuntu-latest
120120
steps:
121121
- uses: actions/checkout@v5
122-
- uses: koppor/intellij-idea-format@update-to-latest-intellij
122+
- uses: leventeBajczi/intellij-idea-format@master
123123
with:
124124
file-mask: "*.java"
125125
settings-file: ".idea/codeStyles/Project.xml"
@@ -438,13 +438,25 @@ jobs:
438438
with:
439439
submodules: 'false'
440440
show-progress: 'false'
441+
- name: Detect changed jablib classes
442+
id: changed-jablib-files
443+
uses: tj-actions/changed-files@v47
444+
with:
445+
files: |
446+
.jbang/*.java
447+
jablib/src/main/java/**/*.java
448+
jablib-examples/**/*.java
449+
files_ignore: |
450+
jablib/src/main/java/**/*-*.java
441451
- name: Set up JDK
452+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
442453
uses: actions/setup-java@v5
443454
with:
444455
java-version: 24
445456
distribution: 'corretto'
446457
check-latest: true
447458
- name: Generate JBang cache key
459+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
448460
id: cache-key
449461
shell: bash
450462
run: |
@@ -457,15 +469,30 @@ jobs:
457469
restore-keys:
458470
jbang-
459471
- name: Setup JBang
472+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
460473
uses: jbangdev/setup-jbang@main
474+
475+
# Build all JBang scripts
461476
- run: jbang build .jbang/CheckoutPR.java
477+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
462478
- run: jbang build .jbang/CloneJabRef.java
479+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
463480
- run: jbang build --fresh .jbang/JabKitLauncher.java
481+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
464482
- run: jbang build --fresh .jbang/JabLsLauncher.java
483+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
465484
- run: jbang build --fresh .jbang/JabSrvLauncher.java
485+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
486+
- run: jbang build --fresh jablib-examples/*.java
487+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
488+
489+
# *Launcher.java should support "--help"
466490
- run: jbang run .jbang/JabKitLauncher.java --help
491+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
467492
- run: jbang run .jbang/JabLsLauncher.java --help
493+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
468494
- run: jbang run .jbang/JabSrvLauncher.java --help
495+
if: steps.changed-jablib-files.outputs.any_changed != 'true'
469496

470497
jbang-pr:
471498
name: JBang (PR)
@@ -475,13 +502,23 @@ jobs:
475502
strategy:
476503
fail-fast: false
477504
matrix:
478-
launcher: [JabKitLauncher, JabLsLauncher, JabSrvLauncher]
505+
script: [.jbang/JabKitLauncher.java, .jbang/JabLsLauncher.java, .jbang/JabSrvLauncher.java, jablib-examples/ieee_pdf_references_to_bibtex.java]
479506
steps:
480507
- name: Checkout source
481508
uses: actions/checkout@v5
482509
with:
483510
submodules: 'false'
484511
show-progress: 'false'
512+
- name: Detect changed jablib classes
513+
id: changed-jablib-files
514+
uses: tj-actions/changed-files@v47
515+
with:
516+
files: |
517+
.jbang/*.java
518+
jablib/src/main/java/**/*.java
519+
jablib-examples/**/*.java
520+
files_ignore: |
521+
jablib/src/main/java/**/*-*.java
485522
- name: Set up JDK
486523
uses: actions/setup-java@v5
487524
with:
@@ -502,24 +539,21 @@ jobs:
502539
jbang-
503540
- name: Setup JBang
504541
uses: jbangdev/setup-jbang@main
505-
- name: Detect changed jablib classes
506-
id: changed-jablib-files
507-
uses: tj-actions/changed-files@v47
508-
with:
509-
files: |
510-
jablib/src/main/java/**/*.java
511-
files_ignore: |
512-
jablib/src/main/java/**/*-*.java
513-
- name: Build ${{ matrix.launcher }} launcher including changed classes
542+
- name: Modify ${{ matrix.script }} to include changed classes
514543
shell: bash
515544
# We always run, because changes in jabls, jabsrv also could cause JBang to fail
516545
run: |
517546
# We modify the JBang scripts directly to avoid issues with relative paths
518547
for f in ${{ steps.changed-jablib-files.outputs.all_changed_files }}; do
519-
echo "//SOURCES ../$f" >> ".jbang/${{ matrix.launcher }}.java"
548+
case "$f" in
549+
jablib-examples/*) continue ;; # skip scripts
550+
esac
551+
echo "//SOURCES ../$f" >> "${{ matrix.script }}"
520552
done
521-
jbang build --fresh ".jbang/${{ matrix.launcher }}.java"
522-
- run: jbang ".jbang/${{ matrix.launcher }}.java" --help
553+
- run: jbang build "${{ matrix.script }}"
554+
shell: bash
555+
- run: jbang "${{ matrix.script }}" --help
556+
if: ${{ contains(matrix.script, 'Launcher.java') }}
523557
shell: bash
524558

525559
codecoverage:

.idea/checkstyle-idea.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1111

1212
### Added
1313

14+
- We added "IEEE" as another option for parsing plain text citations. [#14233](github.com/JabRef/jabref/pull/14233)
1415
- We added automatic date-based groups that create year/month/day subgroups from an entry’s date fields. [#10822](https://github.com/JabRef/jabref/issues/10822)
1516

1617
### Changed

config/checkstyle/checkstyle.xml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,38 @@
66
<module name="Checker">
77
<property name="charset" value="UTF-8"/>
88

9-
<module name="Header">
10-
<property name="header" value=""/>
9+
<module name="BeforeExecutionExclusionFileFilter">
10+
<property name="fileNamePattern" value="[/\\]\.idea[/\\]" />
11+
</module>
12+
<module name="BeforeExecutionExclusionFileFilter">
13+
<property name="fileNamePattern" value="[/\\]\.jbang[/\\]" />
14+
</module>
15+
<module name="BeforeExecutionExclusionFileFilter">
16+
<property name="fileNamePattern" value="[/\\]build-support[/\\]" />
17+
</module>
18+
<module name="BeforeExecutionExclusionFileFilter">
19+
<property name="fileNamePattern" value="[/\\]generated(-sources|-src)?[/\\]" />
20+
</module>
21+
<module name="BeforeExecutionExclusionFileFilter">
22+
<property name="fileNamePattern" value="[/\\]jablib-examples[/\\]" />
23+
</module>
24+
<module name="BeforeExecutionExclusionFileFilter">
25+
<property name="fileNamePattern" value="[/\\]src-gen[/\\]" />
26+
</module>
27+
<module name="BeforeExecutionExclusionFileFilter">
28+
<!-- We ignore this file because it's a modification of the original java code https://github.com/openjdk/jfx/blob/jfx15/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java -->
29+
<property name="fileNamePattern" value="CustomTitledPaneSkin\.java$" />
30+
</module>
31+
<module name="BeforeExecutionExclusionFileFilter">
32+
<property name="fileNamePattern" value="module\-info\.java$"/>
1133
</module>
1234

1335
<module name="SuppressionFilter">
1436
<property name="file" value="${config_loc}/suppressions.xml"/>
1537
</module>
1638

17-
<module name="BeforeExecutionExclusionFileFilter">
18-
<property name="fileNamePattern" value="module\-info\.java$"/>
39+
<module name="Header">
40+
<property name="header" value=""/>
1941
</module>
2042

2143
<module name="FileTabCharacter"/>

config/checkstyle/checkstyle_reviewdog.xml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,38 @@
66
<module name="Checker">
77
<property name="charset" value="UTF-8"/>
88

9-
<module name="Header">
10-
<property name="header" value=""/>
9+
<module name="BeforeExecutionExclusionFileFilter">
10+
<property name="fileNamePattern" value="[/\\]\.idea[/\\]" />
1111
</module>
12-
12+
<module name="BeforeExecutionExclusionFileFilter">
13+
<property name="fileNamePattern" value="[/\\]\.jbang[/\\]" />
14+
</module>
15+
<module name="BeforeExecutionExclusionFileFilter">
16+
<property name="fileNamePattern" value="[/\\]build-support[/\\]" />
17+
</module>
18+
<module name="BeforeExecutionExclusionFileFilter">
19+
<property name="fileNamePattern" value="[/\\]generated(-sources|-src)?[/\\]" />
20+
</module>
21+
<module name="BeforeExecutionExclusionFileFilter">
22+
<property name="fileNamePattern" value="[/\\]jablib-examples[/\\]" />
23+
</module>
24+
<module name="BeforeExecutionExclusionFileFilter">
25+
<property name="fileNamePattern" value="[/\\]src-gen[/\\]" />
26+
</module>
27+
<module name="BeforeExecutionExclusionFileFilter">
28+
<!-- We ignore this file because it's a modification of the original java code https://github.com/openjdk/jfx/blob/jfx15/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java -->
29+
<property name="fileNamePattern" value="CustomTitledPaneSkin\.java$" />
30+
</module>
31+
<module name="BeforeExecutionExclusionFileFilter">
32+
<property name="fileNamePattern" value="(module\-info|heylogs)\.java$"/>
33+
</module>
34+
1335
<module name="SuppressionFilter">
1436
<property name="file" value="config/checkstyle/suppressions.xml"/>
1537
</module>
1638

17-
<module name="BeforeExecutionExclusionFileFilter">
18-
<property name="fileNamePattern" value="(module\-info|heylogs)\.java$"/>
39+
<module name="Header">
40+
<property name="header" value=""/>
1941
</module>
2042

2143
<module name="FileTabCharacter"/>

config/checkstyle/suppressions.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
"http://www.checkstyle.org/dtds/suppressions_1_1.dtd">
66

77
<suppressions>
8-
<suppress checks="[a-zA-Z0-9]*" files="[\\/].jbang[\\/]" />
9-
<suppress checks="[a-zA-Z0-9]*" files="[\\/]build-support[\\/]" />
10-
<suppress checks="[a-zA-Z0-9]*" files="[\\/]generated[\\/]" />
11-
<suppress checks="[a-zA-Z0-9]*" files="[\\/]generated-sources[\\/]" />
12-
<suppress checks="[a-zA-Z0-9]*" files="[\\/]generated-src[\\/]" />
13-
<suppress checks="[a-zA-Z0-9]*" files="[\\/]src-gen[\\/]" />
14-
<suppress checks="[a-zA-Z0-9]*" files="[\\/].idea[\\/]" />
15-
<!-- We ignore this file because it's a modification of the original java code https://github.com/openjdk/jfx/blob/jfx15/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java -->
16-
<suppress checks="[a-zA-Z0-9]*" files="CustomTitledPaneSkin.java" />
178
<!-- Following contain examples or comments with "}}" that are necessary -->
189
<suppress id="NoMultipleClosingBracesAtEndOfLine" files="(BibtexParserTest|StringUtil).java" />
1910
</suppressions>

jabgui/src/main/java/org/jabref/gui/ClipBoardManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ private String serializeEntries(List<BibEntry> entries, BibEntryTypesManager ent
168168
// At reading of the clipboard in JabRef, we parse the plain string in all cases, so we don't need to flag we put BibEntries here
169169
// Furthermore, storing a string also enables other applications to work with the data
170170
BibEntryWriter writer = new BibEntryWriter(new FieldWriter(preferences.getFieldPreferences()), entryTypesManager);
171-
return writer.serializeAll(entries, BibDatabaseMode.BIBTEX);
171+
return writer.write(entries, BibDatabaseMode.BIBTEX);
172172
}
173173
}

jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ void performBackup(Path backupPath) {
285285
preferences.getCitationKeyPatternPreferences(),
286286
entryTypesManager)
287287
// we save the clone to prevent the original database (and thus the UI) from being changed
288-
.saveDatabase(bibDatabaseContextClone);
288+
.writeDatabase(bibDatabaseContextClone);
289289
backupFilesQueue.add(backupPath);
290290

291291
// We wrote the file successfully

jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
import org.jabref.logic.help.HelpFile;
6161
import org.jabref.logic.importer.EntryBasedFetcher;
6262
import org.jabref.logic.importer.WebFetchers;
63-
import org.jabref.logic.importer.fileformat.PdfMergeMetadataImporter;
63+
import org.jabref.logic.importer.fileformat.pdf.PdfMergeMetadataImporter;
6464
import org.jabref.logic.journals.JournalAbbreviationRepository;
6565
import org.jabref.logic.util.BuildInfo;
6666
import org.jabref.logic.util.TaskExecutor;

0 commit comments

Comments
 (0)