-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Prepare multi module build #3913
Conversation
- FreeCite does not generate a non-used BibtexKeyGenerator anymore - Introduce ExporterFactoryFactory - Introduce SavePreferenceFactory
# Conflicts: # src/main/java/org/jabref/preferences/JabRefPreferences.java
# Conflicts: # src/main/java/org/jabref/JabRefMain.java # src/main/java/org/jabref/gui/BasePanel.java
# Conflicts: # src/main/java/org/jabref/gui/BasePanel.java # src/main/java/org/jabref/preferences/SavePreferencesFactory.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only very minor remarks and the code looks good. The OO stuff has to work obviously before merge.
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now name
needs to be relative to org/jabref/logic/exporter/
and not org/jabref/
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don't really get what you want to say. You tested it and it worked although the changed code was never invoked?
jabref/src/main/java/org/jabref/logic/exporter/TemplateExporter.java
Lines 161 to 171 in 7844fcb
String dir; | |
if (customExport) { | |
dir = ""; | |
} else { | |
dir = LAYOUT_PREFIX + (directory == null ? "" : directory + '/'); | |
} | |
// Attempt to get a Reader for the file path given, either by | |
// loading it as a resource (from within JAR), or as a normal file. If | |
// unsuccessful (e.g. file not found), an IOException is thrown. | |
String name = dir + filename; |
Gives a name of the form
/resource/layout/<exporter name>.layout
. With the above change, I suspect that all layout files in src/main/resources/resource/layout
are no longer found and thus the corresponding exporter stop to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR: The given name is absolute, so it does not matter which class is used.
Longer reasoning (with debugging JabRef):
JabRefs main class is in org.jabref
, so the path changes from
file:/C:/git-repositories/jabref/jabref/out/production/resources/resource/layout/html.begin.layout
to
file:/C:/git-repositories/jabref/jabref/out/production/resources/resource/layout/html.begin.layout
So, no change when debugging JabRef.
I think, it is because the parameter directory
is given and thus the path is an absolute one. (Source: https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResource(java.lang.String))
I would like to change the path to enable the test files residing in the test resources
folder of "TemplateExporter".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if it works then the change is of course fine with me. I was only concerned that the exporter may break.
|
||
public class ExporterFactoryFactory { | ||
|
||
public static ExporterFactory create(JabRefPreferences preferences, JournalAbbreviationLoader abbreviationLoader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving this method to JabRefPreferences
as an instance method createExportFactory(abbrLoader)
?
@@ -1421,6 +1425,41 @@ public ImportFormatPreferences getImportFormatPreferences() { | |||
isKeywordSyncEnabled()); | |||
} | |||
|
|||
public static SavePreferences loadForExportFromPreferences(JabRefPreferences preferences) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert these two methods to instance methods and rename them to something like loadSavePreferencesForExport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems, I was too tired at JabCon to see the obvious.
@@ -18,7 +17,7 @@ | |||
|
|||
@Test | |||
public void containsReturnsTrueForEntryInAux() throws Exception { | |||
Path auxFile = Paths.get(AuxParserTest.class.getResource("paper.aux").toURI()); | |||
Path auxFile = Paths.get(TexGroupTest.class.getResource("paper.aux").toURI()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the reason for this change? The only "advantage" is that we now have a copy of the paper.aux
file...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the fear that maintainers of the AuxParserTest do not know that the TexGroupTest also relies on the aux file. What if another test is created? I would separate tests of different classes as much as possible even if files (.bib
, .aux
, ...) are duplicated.
…e-build # Conflicts: # src/main/java/org/jabref/cli/ArgumentProcessor.java # src/main/java/org/jabref/logic/exporter/ExporterFactory.java
OO fixed in 5c8e3e9. Tested in the UI. So, ready for review 😇 |
Since @Siedlerchr gave his "OK" and @tobiasdiez reviewed the intermediate steps, I'll fix the tests and merge to keep things moving. |
This is a follow-up to #3704. This PR separates logic and UI at more places. It cannot easily be based on
maintable-beta
(#3621). I propose following procedure:maintable-beta
([WIP] Main table JavaFX migration #3621)For the first step, just the following is open: