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 1 commit
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.strings.StringUtil;
import org.jabref.preferences.SavePreferencesFactory;
import org.jabref.preferences.SearchPreferences;

import com.google.common.base.Throwables;
Expand Down Expand Up @@ -358,7 +359,7 @@ private boolean generateAux(List<ParserResult> loaded, String[] data) {

try {
System.out.println(Localization.lang("Saving") + ": " + subName);
SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs);
SavePreferences prefs = SavePreferencesFactory.loadForSaveFromPreferences(Globals.prefs);
BibDatabaseWriter<SaveSession> databaseWriter = new BibtexDatabaseWriter<>(FileSaveSession::new);
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
SaveSession session = databaseWriter.saveDatabase(new BibDatabaseContext(newBase, defaults), prefs);
Expand Down Expand Up @@ -397,7 +398,7 @@ private void exportFile(List<ParserResult> loaded, String[] data) {
if (!pr.isInvalid()) {
try {
System.out.println(Localization.lang("Saving") + ": " + data[0]);
SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs);
SavePreferences prefs = SavePreferencesFactory.loadForSaveFromPreferences(Globals.prefs);
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
BibDatabaseWriter<SaveSession> databaseWriter = new BibtexDatabaseWriter<>(
FileSaveSession::new);
Expand Down Expand Up @@ -465,7 +466,7 @@ private void importPreferences() {
Globals.journalAbbreviationLoader);
LayoutFormatterPreferences layoutPreferences = Globals.prefs
.getLayoutFormatterPreferences(Globals.journalAbbreviationLoader);
SavePreferences savePreferences = SavePreferences.loadForExportFromPreferences(Globals.prefs);
SavePreferences savePreferences = SavePreferencesFactory.loadForExportFromPreferences(Globals.prefs);
Globals.exportFactory = ExporterFactory.create(customExporters, layoutPreferences, savePreferences);
} catch (JabRefException ex) {
LOGGER.error("Cannot import preferences", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jabref.logic.util.FileType;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.ExporterFactoryFactory;
import org.jabref.preferences.JabRefPreferences;

import org.slf4j.Logger;
Expand Down Expand Up @@ -67,7 +68,7 @@ public InternalExportAction(JabRefFrame frame, boolean selectedOnly) {

@Override
public void actionPerformed(ActionEvent e) {
Globals.exportFactory = ExporterFactory.create(Globals.prefs, Globals.journalAbbreviationLoader);
Globals.exportFactory = ExporterFactoryFactory.create(Globals.prefs, Globals.journalAbbreviationLoader);
FileDialogConfiguration fileDialogConfiguration = ExportAction.createExportFileChooser(Globals.exportFactory, Globals.prefs.get(JabRefPreferences.EXPORT_WORKING_DIRECTORY));
DialogService dialogService = new FXDialogService();
DefaultTaskExecutor.runInJavaFXThread(() ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import ca.odell.glazedlists.swing.DefaultEventTableModel;
import com.jgoodies.forms.builder.ButtonBarBuilder;

import static org.jabref.preferences.SavePreferencesFactory.loadForExportFromPreferences;

/**
* <p>Title: </p>
* <p>Description: </p>
Expand Down Expand Up @@ -75,7 +77,7 @@ public ExportCustomizationDialog(final JabRefFrame frame) {
if (ecd.okPressed()) {
Globals.prefs.customExports.addFormat(ecd.name(), ecd.layoutFile(), ecd.extension(),
Globals.prefs.getLayoutFormatterPreferences(Globals.journalAbbreviationLoader),
SavePreferences.loadForExportFromPreferences(Globals.prefs));
loadForExportFromPreferences(Globals.prefs));
Globals.prefs.customExports.store(Globals.prefs);
}
});
Expand Down Expand Up @@ -111,7 +113,7 @@ public ExportCustomizationDialog(final JabRefFrame frame) {
}
LayoutFormatterPreferences layoutPreferences = Globals.prefs
.getLayoutFormatterPreferences(Globals.journalAbbreviationLoader);
SavePreferences savePreferences = SavePreferences.loadForExportFromPreferences(Globals.prefs);
SavePreferences savePreferences = loadForExportFromPreferences(Globals.prefs);
for (List<String> list : entries) {
Globals.prefs.customExports.remove(list, layoutPreferences, savePreferences);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void readPrefs(JabRefPreferences prefs, JournalAbbreviationLoader loader
int i = 0;
List<String> s;
LayoutFormatterPreferences layoutPreferences = prefs.getLayoutFormatterPreferences(loader);
SavePreferences savePreferences = SavePreferences.loadForExportFromPreferences(prefs);
SavePreferences savePreferences = SavePreferencesFactory.loadForExportFromPreferences(prefs);
while (!((s = prefs.getStringList(JabRefPreferences.CUSTOM_EXPORT_FORMAT + i)).isEmpty())) {
Optional<TemplateExporter> format = createFormat(s.get(EXPORTER_NAME_INDEX), s.get(EXPORTER_FILENAME_INDEX), s.get(EXPORTER_EXTENSION_INDEX), layoutPreferences, savePreferences);
if (format.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.jabref.preferences;

import org.jabref.logic.exporter.ExporterFactory;
import org.jabref.logic.exporter.SavePreferences;
import org.jabref.logic.exporter.TemplateExporter;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.layout.LayoutFormatterPreferences;

import java.util.Map;

public class ExporterFactoryFactory {

public static ExporterFactory create(JabRefPreferences preferences, JournalAbbreviationLoader abbreviationLoader) {
Map<String, TemplateExporter> customFormats = preferences.customExports.getCustomExportFormats(preferences, abbreviationLoader);
LayoutFormatterPreferences layoutPreferences = preferences.getLayoutFormatterPreferences(abbreviationLoader);
SavePreferences savePreferences = SavePreferencesFactory.loadForExportFromPreferences(preferences);
return ExporterFactory.create(customFormats, layoutPreferences, savePreferences);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.jabref.preferences;

import org.jabref.logic.bibtex.LatexFieldFormatterPreferences;
import org.jabref.logic.exporter.SavePreferences;
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.metadata.SaveOrderConfig;

import java.nio.charset.Charset;

public class SavePreferencesFactory {
Copy link
Member

Choose a reason for hiding this comment

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

You can just move these methods to JabRefPreferences.


public static SavePreferences loadForExportFromPreferences(JabRefPreferences preferences) {
Boolean saveInOriginalOrder = preferences.getBoolean(JabRefPreferences.EXPORT_IN_ORIGINAL_ORDER);
SaveOrderConfig saveOrder = null;
if (!saveInOriginalOrder) {
if (preferences.getBoolean(JabRefPreferences.EXPORT_IN_SPECIFIED_ORDER)) {
saveOrder = preferences.loadExportSaveOrder();
} else {
saveOrder = preferences.loadTableSaveOrder();
}
}
Charset encoding = preferences.getDefaultEncoding();
Boolean makeBackup = preferences.getBoolean(JabRefPreferences.BACKUP);
SavePreferences.DatabaseSaveType saveType = SavePreferences.DatabaseSaveType.ALL;
Boolean takeMetadataSaveOrderInAccount = false;
Boolean reformatFile = preferences.getBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT);
LatexFieldFormatterPreferences latexFieldFormatterPreferences = preferences.getLatexFieldFormatterPreferences();
GlobalBibtexKeyPattern globalCiteKeyPattern = preferences.getKeyPattern();
return new SavePreferences(saveInOriginalOrder, saveOrder, encoding, makeBackup, saveType,
takeMetadataSaveOrderInAccount, reformatFile, latexFieldFormatterPreferences, globalCiteKeyPattern);
}

public static SavePreferences loadForSaveFromPreferences(JabRefPreferences preferences) {
Boolean saveInOriginalOrder = false;
SaveOrderConfig saveOrder = null;
Charset encoding = preferences.getDefaultEncoding();
Boolean makeBackup = preferences.getBoolean(JabRefPreferences.BACKUP);
SavePreferences.DatabaseSaveType saveType = SavePreferences.DatabaseSaveType.ALL;
Boolean takeMetadataSaveOrderInAccount = true;
Boolean reformatFile = preferences.getBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT);
LatexFieldFormatterPreferences latexFieldFormatterPreferences = preferences.getLatexFieldFormatterPreferences();
GlobalBibtexKeyPattern globalCiteKeyPattern = preferences.getKeyPattern();
return new SavePreferences(saveInOriginalOrder, saveOrder, encoding, makeBackup, saveType,
takeMetadataSaveOrderInAccount, reformatFile, latexFieldFormatterPreferences, globalCiteKeyPattern);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
import java.util.Objects;
import java.util.Optional;

import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.layout.LayoutFormatterPreferences;
import org.jabref.logic.util.FileType;
import org.jabref.preferences.JabRefPreferences;

public class ExporterFactory {

Expand Down Expand Up @@ -61,13 +59,6 @@ public static ExporterFactory create(Map<String, TemplateExporter> customFormats
return new ExporterFactory(exporters);
}

public static ExporterFactory create(JabRefPreferences preferences, JournalAbbreviationLoader abbreviationLoader) {
Map<String, TemplateExporter> customFormats = preferences.customExports.getCustomExportFormats(preferences, abbreviationLoader);
LayoutFormatterPreferences layoutPreferences = preferences.getLayoutFormatterPreferences(abbreviationLoader);
SavePreferences savePreferences = SavePreferences.loadForExportFromPreferences(preferences);
return create(customFormats, layoutPreferences, savePreferences);
}

/**
* Build a string listing of all available exporters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.jabref.logic.bibtex.LatexFieldFormatterPreferences;
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.metadata.SaveOrderConfig;
import org.jabref.preferences.JabRefPreferences;

public class SavePreferences {

Expand Down Expand Up @@ -42,41 +41,6 @@ public SavePreferences(Boolean saveInOriginalOrder, SaveOrderConfig saveOrder, C
this.globalCiteKeyPattern = globalCiteKeyPattern;
}

public static SavePreferences loadForExportFromPreferences(JabRefPreferences preferences) {
Boolean saveInOriginalOrder = preferences.getBoolean(JabRefPreferences.EXPORT_IN_ORIGINAL_ORDER);
SaveOrderConfig saveOrder = null;
if (!saveInOriginalOrder) {
if (preferences.getBoolean(JabRefPreferences.EXPORT_IN_SPECIFIED_ORDER)) {
saveOrder = preferences.loadExportSaveOrder();
} else {
saveOrder = preferences.loadTableSaveOrder();
}
}
Charset encoding = preferences.getDefaultEncoding();
Boolean makeBackup = preferences.getBoolean(JabRefPreferences.BACKUP);
DatabaseSaveType saveType = DatabaseSaveType.ALL;
Boolean takeMetadataSaveOrderInAccount = false;
Boolean reformatFile = preferences.getBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT);
LatexFieldFormatterPreferences latexFieldFormatterPreferences = preferences.getLatexFieldFormatterPreferences();
GlobalBibtexKeyPattern globalCiteKeyPattern = preferences.getKeyPattern();
return new SavePreferences(saveInOriginalOrder, saveOrder, encoding, makeBackup, saveType,
takeMetadataSaveOrderInAccount, reformatFile, latexFieldFormatterPreferences, globalCiteKeyPattern);
}

public static SavePreferences loadForSaveFromPreferences(JabRefPreferences preferences) {
Boolean saveInOriginalOrder = false;
SaveOrderConfig saveOrder = null;
Charset encoding = preferences.getDefaultEncoding();
Boolean makeBackup = preferences.getBoolean(JabRefPreferences.BACKUP);
DatabaseSaveType saveType = DatabaseSaveType.ALL;
Boolean takeMetadataSaveOrderInAccount = true;
Boolean reformatFile = preferences.getBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT);
LatexFieldFormatterPreferences latexFieldFormatterPreferences = preferences.getLatexFieldFormatterPreferences();
GlobalBibtexKeyPattern globalCiteKeyPattern = preferences.getKeyPattern();
return new SavePreferences(saveInOriginalOrder, saveOrder, encoding, makeBackup, saveType,
takeMetadataSaveOrderInAccount, reformatFile, latexFieldFormatterPreferences, globalCiteKeyPattern);
}

public Boolean getTakeMetadataSaveOrderInAccount() {
return takeMetadataSaveOrderInAccount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.Objects;
import java.util.regex.Pattern;

import org.jabref.JabRefMain;
import org.jabref.logic.layout.Layout;
import org.jabref.logic.layout.LayoutFormatterPreferences;
import org.jabref.logic.layout.LayoutHelper;
Expand All @@ -43,7 +42,7 @@ public class TemplateExporter extends Exporter {
private static final Pattern BLANK_LINE_MATCHER = Pattern.compile("(?m)^\\s");

private static final Logger LOGGER = LoggerFactory.getLogger(TemplateExporter.class);

private final String lfFileName;
private final String directory;
private final LayoutFormatterPreferences layoutPreferences;
Expand Down Expand Up @@ -172,7 +171,7 @@ private Reader getReader(String filename) throws IOException {
String name = dir + filename;
Reader reader;
// Try loading as a resource first. This works for files inside the JAR:
URL reso = JabRefMain.class.getResource(name);
URL reso = TemplateExporter.class.getResource(name);

// If that did not work, try loading as a normal file URL:
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

import org.jabref.JabRefGUI;
import org.jabref.logic.bibtexkeypattern.BibtexKeyGenerator;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
Expand Down Expand Up @@ -202,13 +200,6 @@ public ParserResult importEntries(String text) {
// has to be done before label generation as label generation is dependent on entry type
e.setType(type);

// autogenerate label (BibTeX key)
if (JabRefGUI.getMainFrame() != null) {
// only possible in GUI mode
new BibtexKeyGenerator(JabRefGUI.getMainFrame().getCurrentBasePanel().getBibDatabaseContext(), importFormatPreferences.getBibtexKeyPatternPreferences())
.generateAndSetKey(e);
}

res.add(e);
}
parser.next();
Expand Down