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] Jabrefonline apollo #7798

Closed
wants to merge 13 commits into from
37 changes: 35 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.gradle.internal.os.OperatingSystem
import org.jabref.build.JournalAbbreviationConverter
import org.jabref.build.xjc.XjcPlugin
import org.jabref.build.xjc.XjcTask

import com.apollographql.apollo.gradle.internal.DefaultCompilationUnit
// to update the gradle wrapper, execute
// ./gradlew wrapper --gradle-version=6.0 --distribution-type=bin

Expand Down Expand Up @@ -33,6 +33,8 @@ plugins {
id 'project-report'

id 'idea'

id "com.apollographql.apollo" version '2.5.8'
}

// Enable following for debugging
Expand Down Expand Up @@ -64,6 +66,7 @@ application {
modularity.patchModule("test", "fastparse_2.12-1.0.0.jar")
modularity.patchModule("test2", "fastparse-utils_2.12-1.0.0.jar")
modularity.patchModule("test3", "sourcecode_2.12-0.1.4.jar")
modularity.patchModule("apollo.runtime", "apollo-api-jvm-2.5.8.jar")
koppor marked this conversation as resolved.
Show resolved Hide resolved

// Workaround for https://github.com/openjfx/javafx-gradle-plugin/issues/89
// See also https://github.com/java9-modularity/gradle-modules-plugin/issues/165
Expand Down Expand Up @@ -211,6 +214,14 @@ dependencies {
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.62.2'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.62.2'

// GraphQL integration
implementation ("com.apollographql.apollo:apollo-runtime:2.5.8"){
exclude module: "apollo-api"
exclude module: "apollo-normalized-cache"
}



testImplementation 'io.github.classgraph:classgraph:4.8.108'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.2'
Expand Down Expand Up @@ -387,6 +398,26 @@ task generateJournalAbbreviationList(type: JournalAbbreviationConverter) {
outputDir = file("src/main/resources/journals")
}

apollo {

schemaFile.set(file("src/main/java/org/jabref/jabrefonline/graphql/schema.json"))
graphqlSourceDirectorySet.srcDir("src/main/java/org/jabref/jabrefonline/graphql/")
graphqlSourceDirectorySet.exclude("schema.json")
customTypeMapping = [
"DateTime" : "java.time.LocalDateTime"
]
generateKotlinModels.set(false)
nullableValueType.set("javaOptional")
useJavaBeansSemanticNaming.set(true)
rootPackageName.set("org.jabref.jabrefonline")

onCompilationUnit {
outputDir.set(file("src-gen/main/java/")) // TODO not working yet
// Overwrite some options here for single CompilationUnit if needed
}

}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
Expand All @@ -401,7 +432,9 @@ compileJava {
// TODO: Remove access to internal api
addExports = [
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref'
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref',
'apollo.runtime/com.apollographql.apollo.api': 'org.jabref',
'apollo.runtime/com.apollographql.apollo.api.internal': 'org.jabref'
]
}
}
Expand Down
6 changes: 6 additions & 0 deletions eclipse.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ eclipse {
def javafxfxml = entries.find { isJavafxFXML(it) };
javafxfxml.entryAttributes['add-opens'] = 'javafx.fxml/javafx.fxml=org.jabref';

def apollo = entries.find { isApollo(it) };
apollo.entryAttributes['add-exports'] = 'apollo.runtime/com.apollographql.apollo.api=org.jabref:apollo.runtime/com.apollographql.apollo.api.internal=org.jabref'


entries.findAll { isLibrary(it) && isTestScope(it) }.each { //mark test source files
it.entryAttributes['test'] = 'true'
}
Expand Down Expand Up @@ -63,6 +67,8 @@ boolean isJavafxGraphics(entry) { return entry.properties.path.contains('javafx-

boolean isJavafxFXML(entry) { return entry.properties.path.contains('javafx-fxml'); }

boolean isApollo(entry) { return entry.properties.path.contains('apollo-runtime'); }

// add formatter and cleanup settings to Eclipse settings
// see http://stackoverflow.com/a/27461890/873282

Expand Down
Binary file added lib/apollo-api-jvm-2.5.8.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,8 @@
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.dataformat.yaml;
requires com.fasterxml.jackson.datatype.jsr310;
requires okio;
requires annotations;
requires apollo.runtime;
requires kotlin.stdlib;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query getDocumentById($id: ID!) {
getUserDocumentRaw(id: $id) {
type
citationKey
fields { field, value }
}
}
1 change: 1 addition & 0 deletions src/main/java/org/jabref/jabrefonline/graphql/schema.json

Large diffs are not rendered by default.