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

Add graal info to module file #6010

Merged
merged 9 commits into from
Feb 27, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where changing entry type doesn't always work when biblatex source is shown. [#5905](https://github.com/JabRef/jabref/issues/5905)
- We fixed an issue where the group and the link column were not updated after changing the entry in the main table. [#5985](https://github.com/JabRef/jabref/issues/5985)
- We fixed an issue where reordering the groups was not possible after inserting an article. [#6008](https://github.com/JabRef/jabref/issues/6008)
- We fixed an issue where citation styles except the default "Preview" could not be used. [#56220](https://github.com/JabRef/jabref/issues/5622)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the default preview mode based on our export filter capability? See https://docs.jabref.org/setup/preview

I would suggest to remove "except..." or reword to: "citation styles stopped working"


### Removed

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ dependencies {
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'

implementation 'de.undercouch:citeproc-java:2.0.0'
implementation 'de.undercouch:citeproc-java:2.1.0-SNAPSHOT'

implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1'
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2'
Expand Down Expand Up @@ -546,7 +546,7 @@ task deleteInstallerTemp(type: Delete) {

jpackage.dependsOn deleteInstallerTemp
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
options = ['--strip-debug','--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'JabRef'
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@
requires jbibtex;
requires citeproc.java;
requires antlr.runtime;
requires org.graalvm.js;
requires org.graalvm.truffle;
requires org.graalvm.sdk;
requires transitive org.graalvm.js;
requires java.scripting;
Copy link
Member

Choose a reason for hiding this comment

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

I thought that 2.1.0-SNAPSHOT does not require JavaScript anymore (see also michel-kraemer/citeproc-java#92). @tobiasdiez Do you remember why you had to add these dependencies?

requires jdk.internal.vm.compiler;
requires org.apache.xmpbox;
requires de.saxsys.mvvmfx.validation;
requires com.google.gson;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jabref.model.strings.LatexToUnicodeAdapter;

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.DefaultAbbreviationProvider;
import de.undercouch.citeproc.ItemDataProvider;
import de.undercouch.citeproc.bibtex.BibTeXConverter;
import de.undercouch.citeproc.csl.CSLItemData;
Expand Down Expand Up @@ -66,7 +67,8 @@ public synchronized List<String> makeBibliography(List<BibEntry> bibEntries, Str
private void initialize(String newStyle, CitationStyleOutputFormat newFormat) throws IOException {
if ((cslInstance == null) || !Objects.equals(newStyle, style)) {
// lang and forceLang are set to the default values of other CSL constructors
cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(), newStyle, "en-US", false);
cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(),
new DefaultAbbreviationProvider(), null, newStyle, "en-US", false, true);
style = newStyle;
}

Expand Down
30 changes: 9 additions & 21 deletions src/main/java/org/jabref/logic/citationstyle/CitationStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
Expand All @@ -25,6 +22,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.jabref.JabRefMain;
import org.jabref.logic.util.StandardFileType;

import de.undercouch.citeproc.helper.CSLUtils;
Expand Down Expand Up @@ -138,28 +136,18 @@ public static List<CitationStyle> discoverCitationStyles() {
return STYLES;
}

URL url = CitationStyle.class.getResource(STYLES_ROOT);
if (url == null) {
return Collections.emptyList();
}
URL url = JabRefMain.class.getResource(STYLES_ROOT + "/acm-siggraph.csl");
Objects.requireNonNull(url);

try {
URI uri = url.toURI();
if ("jar".equals(uri.getScheme())) {
try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
Path path = fs.getPath(STYLES_ROOT);
STYLES.addAll(discoverCitationStylesInPath(path));
} catch (FileSystemAlreadyExistsException e) {
try (FileSystem fs = FileSystems.getFileSystem(uri)) {
Path path = fs.getPath(STYLES_ROOT);
STYLES.addAll(discoverCitationStylesInPath(path));
}
}
} else {
STYLES.addAll(discoverCitationStylesInPath(Paths.get(uri)));
}
Path path = Path.of(uri).getParent();

STYLES.addAll(discoverCitationStylesInPath(path));

return STYLES;
} catch (URISyntaxException | IOException e) {
LOGGER.error("something went wrong while searching available CitationStyles. Are you running directly from source code?", e);
LOGGER.error("something went wrong while searching available CitationStyles", e);
return Collections.emptyList();
}
}
Expand Down