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

[WIP] Multi module build #3704

Closed
wants to merge 90 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
fc626a6
Initial gradle build files
koppor Feb 6, 2018
a0b1397
Result of linter
koppor Feb 6, 2018
83b74c8
Fix linter
koppor Feb 7, 2018
86714e9
Create org.jabref.logic package (besides logic.shared and logic.remote)
koppor Feb 7, 2018
f23e579
Ignoure out directory
koppor Feb 7, 2018
ae1102b
Three more classes for logic
koppor Feb 7, 2018
fd3ffa2
Seperate logic from GUI
koppor Feb 7, 2018
fa1536f
Refactor OpenOffice preferences
koppor Feb 7, 2018
68335c9
autosave and backup read config from preferences at each event -> kee…
koppor Feb 7, 2018
1ee315a
Refactor CleanupPreset
koppor Feb 7, 2018
4b7ea7d
Make ModsImporter independent from JabRefPreferences
koppor Feb 7, 2018
2ba26da
FileAnnotationCache needs fileDirectoryPreferences
koppor Feb 7, 2018
7dfe2ed
Some compile fixes
koppor Feb 7, 2018
b889fed
lint build.gradle
koppor Feb 7, 2018
df4ef0d
Fix install4j location
koppor Feb 7, 2018
2f52b51
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 7, 2018
a46d569
Move jabref.install4j to right folder
koppor Feb 7, 2018
9646887
Move model tests from gui to model/logic
koppor Feb 7, 2018
76c1d29
Duplicate TreeNodeTestData, because test data is not shared across mo…
koppor Feb 7, 2018
8903b26
lint build.gradle files
koppor Feb 7, 2018
2f2e81e
Move logic tests from org.jabref.gui org.jabref.logic
koppor Feb 7, 2018
4afbb8b
Fix bibtexTestData location
koppor Feb 7, 2018
9b5e1f8
Remove GenerateCharacterTable - it was never published officially
koppor Feb 7, 2018
4fec000
Create org.jabref.cli.xmp project
koppor Feb 7, 2018
abbe777
Fix location of test resources
koppor Feb 7, 2018
ab37471
Fix locations of DatabaseTest
koppor Feb 7, 2018
7e620f7
Fix location of ImportDataTest
koppor Feb 7, 2018
40c6bf7
Remove strange CLI tests also testing logic
koppor Feb 7, 2018
e88de4f
Replace one straight-forward assertEqualsBibtexEntry
koppor Feb 7, 2018
2435aff
Fix module of BackupManagerTest
koppor Feb 7, 2018
6594f68
Remove dependency to JabRefMain
koppor Feb 7, 2018
dce1afd
Fix location of test files
koppor Feb 7, 2018
c6890d8
lint build.gradle
koppor Feb 7, 2018
7481fb6
Inline SavePreferencesFactory to JabRefPreferences
koppor Feb 7, 2018
d4b2e9a
Fix package of FallbackExceptionHandler
koppor Feb 7, 2018
211caad
Compilefix
koppor Feb 7, 2018
25dae4b
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 7, 2018
e963a6f
Switch from com.airhacks:afterburner.fx to jabref's afterburner.fx
koppor Feb 7, 2018
1013a36
Fix import
koppor Feb 7, 2018
14548e8
Add missing checkstyle files
koppor Feb 7, 2018
d7abe22
Fix location of *.css *.fxml --> resource is the key
koppor Feb 7, 2018
f821561
Integrate CodeStyleTest into StringUtilTest
koppor Feb 7, 2018
20d17ce
Add required mock to LinkedfileViewModelTest
koppor Feb 7, 2018
cf5ad67
Remove generated files
koppor Feb 7, 2018
8fcbf70
Move checkstyle
stefan-kolb Feb 7, 2018
4e13152
Revert "Fix location of *.css *.fxml --> resource is the key"
koppor Feb 7, 2018
49c24c3
Modernizer
stefan-kolb Feb 7, 2018
e505ea4
Merge branch 'multi-module-build' of https://github.com/JabRef/jabref…
stefan-kolb Feb 7, 2018
2f93792
Fix source sets
koppor Feb 7, 2018
de57cf3
Add LinkedFileViewModelTest to classes which may use Globals
koppor Feb 7, 2018
a630326
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 7, 2018
0352c00
Move more stuff
stefan-kolb Feb 7, 2018
f2f2f7a
Java compilation
stefan-kolb Feb 8, 2018
3848e51
Merge branch 'multi-module-build' of https://github.com/JabRef/jabref…
stefan-kolb Feb 8, 2018
5465fe1
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 8, 2018
e738086
Dev replacements
stefan-kolb Feb 8, 2018
fe6e2c5
Revert "Add LinkedFileViewModelTest to classes which may use Globals"
koppor Feb 8, 2018
2615756
Unused imports
stefan-kolb Feb 8, 2018
073ba4a
Merge branch 'multi-module-build' of github.com:JabRef/jabref into mu…
koppor Feb 8, 2018
a933d52
XMP dependencies
stefan-kolb Feb 8, 2018
5d7e766
XMP build
stefan-kolb Feb 8, 2018
214625d
Move stuff
stefan-kolb Feb 8, 2018
392dc7c
Merge branch 'multi-module-build' of github.com:JabRef/jabref into mu…
koppor Feb 8, 2018
e115a9d
Fix path in CircleCI upload script
koppor Feb 8, 2018
9ec6cfe
Remove obsolete scripts (was hosted at https://github.com/jabref/htdocs)
koppor Feb 8, 2018
ac35918
Move dev switch to org.jabref.gui
koppor Feb 8, 2018
266c7b8
Enable build scan
koppor Feb 8, 2018
5d258f8
Fix location of binaries
koppor Feb 8, 2018
9c54c3c
Add missing checkstyle configuration
koppor Feb 8, 2018
e91ebaa
Include changes of https://github.com/JabRef/jabref/pull/3659
koppor Feb 8, 2018
3818f10
Remove "modernizer" also from Travis build
koppor Feb 8, 2018
8064843
Load buildscan first
koppor Feb 8, 2018
8ebd604
Fix build. a) dir b) name
koppor Feb 8, 2018
5058b36
Reenable JUnit tests by global dependencies
koppor Feb 8, 2018
e4e9e86
Restructure, update Install4J
koppor Feb 8, 2018
0c96e14
Update gradle from 4.5 to 4.5.1
koppor Feb 8, 2018
ca05215
Fix iconpath (again)
koppor Feb 8, 2018
13b85df
Fix artifacts path
koppor Feb 8, 2018
ff6f440
Better 9 binaries than nothing
koppor Feb 8, 2018
297b225
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 14, 2018
9145feb
Fix file paths
koppor Feb 14, 2018
265507d
Compile fix and migrate OAI2HandlerFetcherTest @Ignore to JUnit5 @Dis…
koppor Feb 14, 2018
7c8b761
Fix Install4J build
koppor Feb 14, 2018
2985d71
Fix build on CircleCI
koppor Feb 14, 2018
17e9969
Merge remote-tracking branch 'origin/master' into multi-module-build
koppor Feb 14, 2018
92cf1a3
No daemon at CircleCI
koppor Feb 14, 2018
de4a574
Initial compilation also is a development build
koppor Feb 14, 2018
9bfea57
Replace Project.getRootProject() by rootProject
koppor Feb 14, 2018
a1deb36
Fix test
koppor Feb 14, 2018
8029a3f
Merge branch 'master' into multi-module-build
koppor Feb 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# no generated files in version control
src/main/gen/
**/src/main/gen/
Copy link
Member

Choose a reason for hiding this comment

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

generated code like jabref.gui/src/main/gen/org/jabref/logic/importer/fileformat/mods/RoleTermDefinition.java is put under version control; is this desired?

Copy link
Member Author

Choose a reason for hiding this comment

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

That should not happen. We have to remove that code.

I will double check.

**/out/

# private data
/buildres/jabref-cert-2016.p12
Expand All @@ -8,7 +9,7 @@ src/main/gen/
status.md

# Install4J
install4j6/
install4j7/

# Gradle
# generated when `gradlew --gui` is called
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
global:
- GRADLE_OPTS=-Dorg.gradle.daemon=false
matrix:
- TEST_SUITE=check OPTIONS=modernizer
- TEST_SUITE=check
- TEST_SUITE=fetcherTest
- TEST_SUITE=databaseTest
- TEST_SUITE=guiTest
Expand Down
604 changes: 173 additions & 431 deletions build.gradle

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
12 changes: 5 additions & 7 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ dependencies:
# openssl aes-256-cbc -e -in ./buildres/jabref-cert-2016.p12 -out jabref-cert-2016.p12.enc -k {PASSWORD}
#- openssl aes-256-cbc -d -in ./buildres/jabref-cert-2016.p12.enc -out ./buildres/jabref-cert-2016.p12 -k $CERTIFICATE
- scripts/prepare-install4j.sh
- install4j7/bin/install4jc --verbose --license=$INSTALL4J_KEY
- install4j7/bin/install4jc --verbose --license=$INSTALL4J_KEY
#--win-keystore-password $CERTIFICATE_PW --mac-keystore-password $CERTIFICATE_PW
override:
# We do this to decrease build time by using CircleCI's cache. See https://discuss.circleci.com/t/effective-caching-for-gradle/540 for a longer motivation.
- ./gradlew compileJava
- ./gradlew --no-daemon -Pdev=true compileJava
cache_directories:
- "~/.install4j7"
- "~/downloads"

test:
override:
- ./gradlew -Pdev=true -Pinstall4jDir="install4j7" release --stacktrace
- ./gradlew --no-daemon -Pdev=true -Pinstall4jDir="install4j7" --stacktrace release
- ./gradlew --no-daemon -Drevision=release -DoutputFormatter=json -DoutputDir=build/releases dependencyUpdates
post:
# save test reports as build artifacts
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
Expand All @@ -33,19 +34,16 @@ deployment:
tag: /v[0-9]+(\.[0-9]+)*(-.+)?/
commands:
# we have to do a clean build as changing gradle's "project.version" does not lead to a rebuild of resources (mirroring project.version)
- ./gradlew -Pinstall4jDir="install4j7" clean release --stacktrace
- ./gradlew --no-daemon -Pinstall4jDir="install4j7" --stacktrace clean release
# upload at all circumstances
- scripts/upload-to-builds.jabref.org.sh
- ./gradlew dependencyUpdates -Drevision=release -DoutputFormatter=json -DoutputDir=build/releases
development:
# match all branches; this is executed, if "release" is not matched - see https://circleci.com/docs/configuration/
branch: /.*/
commands:
# if upload fails, it is accepted; CircleCI provides deep links to the binaries as fallback
- timeout 580 scripts/upload-to-builds.jabref.org.sh || exit 0



general:
artifacts:
- "build/releases"
File renamed without changes.
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
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
12 changes: 6 additions & 6 deletions jabref.install4j
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
<components />
</files>
<launchers>
<launcher name="JabRef" id="23" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="" icnsFile="./src/main/resources/icons/jabref.icns" customMacBundleIdentifier="false" macBundleIdentifier="" swtApp="false" fileset="" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="false" customMacosExecutableName="" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
<executable name="JabRef" type="1" iconSet="true" iconFile="./src/main/resources/icons/jabref.ico" executableDir="" redirectStderr="true" stderrFile="error.log" stderrMode="overwrite" redirectStdout="false" stdoutFile="output.log" stdoutMode="overwrite" failOnStderrOutput="true" executableMode="1" changeWorkingDirectory="true" workingDirectory="." singleInstance="false" serviceStartType="2" serviceDependencies="" serviceDescription="" jreLocation="" executionLevel="asInvoker" checkConsoleParameter="true" globalSingleInstance="false" singleInstanceActivate="true" dpiAware="false">
<launcher name="JabRef" id="23" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="" icnsFile="./buildres/jabref.icns" customMacBundleIdentifier="false" macBundleIdentifier="" swtApp="false" fileset="" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="false" customMacosExecutableName="" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
<executable name="JabRef" type="1" iconSet="true" iconFile="./buildres/jabref.ico" executableDir="" redirectStderr="true" stderrFile="error.log" stderrMode="overwrite" redirectStdout="false" stdoutFile="output.log" stdoutMode="overwrite" failOnStderrOutput="true" executableMode="1" changeWorkingDirectory="true" workingDirectory="." singleInstance="false" serviceStartType="2" serviceDependencies="" serviceDescription="" jreLocation="" executionLevel="asInvoker" checkConsoleParameter="true" globalSingleInstance="false" singleInstanceActivate="true" dpiAware="false">
<versionInfo include="true" fileVersion="${compiler:versionFourDots}" fileDescription="${compiler:sys.fullName}" legalCopyright="${compiler:sys.fullName}" internalName="${compiler:sys.fullName}" productName="" />
</executable>
<splashScreen show="false" width="0" height="0" bitmapFile="" textOverlay="false">
Expand Down Expand Up @@ -102,7 +102,7 @@
<customAttributes />
</autoUpdate>
<applications>
<application name="" id="installer" customizedId="" beanClass="com.install4j.runtime.beans.applications.InstallerApplication" enabled="true" commentSet="false" comment="" actionElevationType="none" styleId="" fileset="" customIcnsFile="./src/main/resources/icons/jabref.icns" customIcoFile="./src/main/resources/icons/jabref.ico" macEntitlementsFile="" automaticLauncherIntegration="false" launchMode="startupFirstWindow" launchInNewProcess="false" launchSchedule="updateSchedule" allLaunchers="true">
<application name="" id="installer" customizedId="" beanClass="com.install4j.runtime.beans.applications.InstallerApplication" enabled="true" commentSet="false" comment="" actionElevationType="none" styleId="" fileset="" customIcnsFile="./buildres/jabref.icns" customIcoFile="./buildres/jabref.ico" macEntitlementsFile="" automaticLauncherIntegration="false" launchMode="startupFirstWindow" launchInNewProcess="false" launchSchedule="updateSchedule" allLaunchers="true">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.applications.InstallerApplication">
Expand Down Expand Up @@ -183,7 +183,7 @@
context.setInstallationDirectory(new File(System.getenv("LOCALAPPDATA"), "JabRef"));
} else {
context.setInstallationDirectory(new File(System.getProperty("user.home"), "JabRef"));
}
}
}
return true;</string>
</void>
Expand Down Expand Up @@ -608,7 +608,7 @@ return console.askOkCancel(message, true);
</void>
<void property="macIconFile">
<object class="com.install4j.api.beans.ExternalFile">
<string>./src/main/resources/icons/jabref.icns</string>
<string>./buildres/jabref.icns</string>
</object>
</void>
<void property="macRole">
Expand All @@ -622,7 +622,7 @@ return console.askOkCancel(message, true);
</void>
<void property="windowsIconFile">
<object class="com.install4j.api.beans.ExternalFile">
<string>./src/main/resources/icons/jabref.ico</string>
<string>./buildres/jabref.ico</string>
</object>
</void>
</object>
Expand Down
6 changes: 6 additions & 0 deletions org.jabref.cli.xmp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies {
compile project(':org.jabref.model')
compile project(':org.jabref.logic')

compile 'org.apache.pdfbox:jempbox:1.8.13'
}
57 changes: 57 additions & 0 deletions org.jabref.cli.xmp/config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="Header">
<property name="header" value=""/>
</module>

<module name="TreeWalker">

<module name="UnusedImports"/>

<module name="RedundantImport"/>

<module name="AvoidStarImport"/>

<module name="IllegalImport"/>

<module name="ImportOrder">
<property name="groups" value="java,javax,javafx,org.jabref,*"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<module name="EmptyLineSeparator">
<property name="tokens"
value="IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>

<module name="DeclarationOrder"/>

<!-- RCULRY causes issues if classes are nested within arrays, therefore not activated -->
<module name="WhitespaceAround">
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,
DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
PLUS, PLUS_ASSIGN, QUESTION,
SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
</module>

<module name="ConstantName">
<property name="format" value="^log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
</module>

<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml"/>
</module>
</module>
10 changes: 10 additions & 0 deletions org.jabref.cli.xmp/config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress checks="[a-zA-Z0-9]*" files="[\\/]gen[\\/]" />
<suppress checks="[a-zA-Z0-9]*" files="[\\/]test[\\/]" />
</suppressions>
1 change: 1 addition & 0 deletions org.jabref.cli.xmp/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include 'org.jabref.model', 'org.jabref.logic'
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import javax.xml.transform.TransformerException;

import org.jabref.Globals;
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.FieldContentParserPreferences;
import org.jabref.logic.bibtex.LatexFieldFormatter;
import org.jabref.logic.bibtex.LatexFieldFormatterPreferences;
import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.fileformat.BibtexParser;
import org.jabref.logic.xmp.XMPPreferences;
import org.jabref.logic.xmp.XMPUtil;
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.JabRefPreferences;
import org.jabref.model.util.DummyFileUpdateMonitor;

import org.apache.jempbox.impl.XMLUtil;
import org.apache.jempbox.xmp.XMPMetadata;

public class XMPUtilMain {
public class XmpUtilMain {

private XMPUtilMain() {
private XmpUtilMain() {
}

/**
Expand Down Expand Up @@ -56,27 +60,27 @@ private XMPUtilMain() {
* If the given BibEntry is malformed.
*/
public static void main(String[] args) throws IOException, TransformerException {

// Don't forget to initialize the preferences
if (Globals.prefs == null) {
Globals.prefs = JabRefPreferences.getInstance();
}

XMPPreferences xmpPreferences = Globals.prefs.getXMPPreferences();
ImportFormatPreferences importFormatPreferences = Globals.prefs.getImportFormatPreferences();
final ImportFormatPreferences importFormatPreferences = new ImportFormatPreferences(
Collections.emptySet(),
StandardCharsets.UTF_8,
',',
new BibtexKeyPatternPreferences("", "", false, true, true, GlobalBibtexKeyPattern.fromPattern("[auth][year]"), ','),
new FieldContentParserPreferences(),
false);
final BibtexParser bibtexParser = new BibtexParser(importFormatPreferences, new DummyFileUpdateMonitor());
final XMPPreferences xmpPreferences = new XMPPreferences(false, Collections.emptyList(), ';');

switch (args.length) {
case 0:
usage();
break;
case 1:

if (args[0].endsWith(".pdf")) {
// Read from pdf and write as BibTex
List<BibEntry> l = XMPUtil.readXMP(new File(args[0]), xmpPreferences);

BibEntryWriter bibtexEntryWriter = new BibEntryWriter(
new LatexFieldFormatter(Globals.prefs.getLatexFieldFormatterPreferences()), false);
new LatexFieldFormatter(new LatexFieldFormatterPreferences()), false);

for (BibEntry entry : l) {
StringWriter sw = new StringWriter();
Expand All @@ -87,7 +91,7 @@ public static void main(String[] args) throws IOException, TransformerException
} else if (args[0].endsWith(".bib")) {
// Read from BIB and write as XMP
try (FileReader fr = new FileReader(args[0])) {
ParserResult result = new BibtexParser(importFormatPreferences, Globals.getFileUpdateMonitor()).parse(fr);
ParserResult result = bibtexParser.parse(fr);
Collection<BibEntry> entries = result.getDatabase().getEntries();

if (entries.isEmpty()) {
Expand All @@ -114,7 +118,7 @@ public static void main(String[] args) throws IOException, TransformerException
}

if (args[0].endsWith(".bib") && args[1].endsWith(".pdf")) {
ParserResult result = new BibtexParser(importFormatPreferences, Globals.getFileUpdateMonitor()).parse(new FileReader(args[0]));
ParserResult result = bibtexParser.parse(new FileReader(args[0]));

Collection<BibEntry> entries = result.getDatabase().getEntries();

Expand All @@ -135,7 +139,7 @@ public static void main(String[] args) throws IOException, TransformerException
break;
}

ParserResult result = new BibtexParser(importFormatPreferences, Globals.getFileUpdateMonitor()).parse(new FileReader(args[1]));
ParserResult result = bibtexParser.parse(new FileReader(args[1]));

Optional<BibEntry> bibEntry = result.getDatabase().getEntryByKey(args[0]);

Expand All @@ -155,8 +159,6 @@ public static void main(String[] args) throws IOException, TransformerException

/**
* Print usage information for the command line tool xmpUtil.
*
* @see XMPUtilMain#main(String[])
*/
private static void usage() {
System.out.println("Read or write XMP-metadata from or to pdf file.");
Expand Down
Loading