Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ plugins {

repositories {
gradlePluginPortal()
maven { url = uri("https://jitpack.io") }
}

dependencies {
implementation("com.adarshr:gradle-test-logger-plugin:4.0.0")
implementation("com.autonomousapps:dependency-analysis-gradle-plugin:3.5.1")
implementation("com.github.andygoossens:gradle-modernizer-plugin:1.12.0")
implementation("com.github.koppor:jbang-gradle-plugin:jitpack-SNAPSHOT")
Copy link
Member

Choose a reason for hiding this comment

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

Pinned commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Raises error when gradlew runs - plugin says jitpack-SNAPSHOT, but outputs commit id.

implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.6.0")
implementation("org.gradlex:extra-java-module-info:1.13.1")
implementation("org.gradlex:java-module-dependencies:1.11")
implementation("org.gradlex:java-module-packaging:1.2")
Expand Down
1 change: 1 addition & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootProject.name = "build-logic"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("de.undercouch.download")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ plugins {
id("org.jabref.gradle.base.dependency-rules")
id("org.jabref.gradle.base.repositories")
id("org.jabref.gradle.base.targets")
id("org.jabref.gradle.check.checkstyle")
id("org.jabref.gradle.check.modernizer")
id("org.jabref.gradle.feature.compile")
id("org.jabref.gradle.feature.javadoc")
id("org.jabref.gradle.feature.test")
id("org.jabref.gradle.check.checkstyle")
id("org.jabref.gradle.check.modernizer")
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ org.gradle.vfs.watch=true
org.gradle.jvmargs=-Xmx6g

# hint by https://docs.gradle.org/current/userguide/performance.html#enable_configuration_cache
# Blocked by https://github.com/jbangdev/jbang-gradle-plugin/issues/7
org.gradle.configuration-cache=false
# org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

# hint by https://docs.gradle.org/current/userguide/performance.html#enable_the_build_cache
org.gradle.caching=true
Expand Down
49 changes: 14 additions & 35 deletions jablib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import dev.jbang.gradle.tasks.JBangTask
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import java.net.URI
import java.util.*

plugins {
id("org.jabref.gradle.module")
id("org.jabref.gradle.feature.download")
id("java-library")

id("antlr")
Expand All @@ -17,10 +17,9 @@ plugins {

id("com.vanniktech.maven.publish") version "0.35.0"

// id("dev.jbang") version "0.2.0"
// id("dev.jbang") version "0.3.0"
// Workaround for https://github.com/jbangdev/jbang-gradle-plugin/issues/7
// Build state at https://jitpack.io/#koppor/jbang-gradle-plugin/fix-7-SNAPSHOT
id("com.github.koppor.jbang-gradle-plugin") version "8a85836163"
id("com.github.koppor.jbang-gradle-plugin")

id("net.ltgt.errorprone") version "4.3.0"
id("net.ltgt.nullaway") version "2.3.0"
Expand Down Expand Up @@ -260,7 +259,8 @@ var taskGenerateJournalListMV = tasks.register<JBangTask>("generateJournalListMV

inputs.dir(abbrvJabRefOrgDir)
outputs.file(generatedJournalFile)
onlyIf {!generatedJournalFile.get().asFile.exists()}
val generatedJournalFileProv = generatedJournalFile
onlyIf { !generatedJournalFileProv.get().asFile.exists() }
}

var taskGenerateCitationStyleCatalog = tasks.register<JBangTask>("generateCitationStyleCatalog") {
Expand All @@ -272,37 +272,16 @@ var taskGenerateCitationStyleCatalog = tasks.register<JBangTask>("generateCitati
inputs.dir(layout.projectDirectory.dir("src/main/resources/csl-styles"))
val cslCatalogJson = layout.buildDirectory.file("generated/resources/citation-style-catalog.json")
outputs.file(cslCatalogJson)
onlyIf {!cslCatalogJson.get().asFile.exists()}
val cslCatalogJsonProv = cslCatalogJson
onlyIf { !cslCatalogJsonProv.get().asFile.exists() }
}

var ltwaCsvFile = layout.buildDirectory.file("tmp/ltwa_20210702.csv")
val ltwaCsvFile = layout.buildDirectory.file("tmp/ltwa_20210702.csv")

tasks.register("downloadLtwaFile") {
group = "JabRef"
description = "Downloads the LTWA file for journal abbreviations"

val ltwaUrl = "https://www.issn.org/wp-content/uploads/2021/07/ltwa_20210702.csv"
val ltwaDir = layout.buildDirectory.dir("resources/main/journals")

outputs.file(ltwaCsvFile)

// Ensure that the task really is not run if the file already exists (otherwise, the task could also run if gradle's cache is cleared, ...)
onlyIf {!ltwaCsvFile.get().asFile.exists()}

doLast {
val dir = ltwaDir.get().asFile
val file = ltwaCsvFile.get().asFile

dir.mkdirs()

URI(ltwaUrl).toURL().openStream().use { input ->
file.outputStream().use { output ->
input.copyTo(output)
}
}

logger.debug("Downloaded LTWA file to $file")
}
tasks.register<de.undercouch.gradle.tasks.download.Download>("downloadLtwaFile") {
src("https://www.issn.org/wp-content/uploads/2021/07/ltwa_20210702.csv")
dest(ltwaCsvFile)
onlyIfModified(true)
}

var taskGenerateLtwaListMV = tasks.register<JBangTask>("generateLtwaListMV") {
Expand All @@ -315,15 +294,15 @@ var taskGenerateLtwaListMV = tasks.register<JBangTask>("generateLtwaListMV") {
inputs.file(ltwaCsvFile)
val ltwaListMv = layout.buildDirectory.file("generated/resources/journals/ltwa-list.mv");
outputs.file(ltwaListMv)
onlyIf {!ltwaListMv.get().asFile.exists()}
val ltwaListMvProv = ltwaListMv
onlyIf { !ltwaListMvProv.get().asFile.exists() }
}

// Adds ltwa, journal-list.mv, and citation-style-catalog.json to the resources directory
sourceSets["main"].resources {
srcDir(layout.buildDirectory.dir("generated/resources"))
}


// region processResources
abstract class JoinNonCommentedLines : DefaultTask() {

Expand Down
9 changes: 3 additions & 6 deletions jabls-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ tasks.test {
}

tasks.named<JavaExec>("run") {
doFirst {
application.applicationDefaultJvmArgs =
listOf(
"--enable-native-access=com.sun.jna"
)
}
// "assert" statements in the code should activated when running using gradle
enableAssertions = true
jvmArgs("--enable-native-access=com.sun.jna")
}

javaModulePackaging {
Expand Down
9 changes: 3 additions & 6 deletions jabsrv-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ tasks.test {
}

tasks.named<JavaExec>("run") {
doFirst {
application.applicationDefaultJvmArgs =
listOf(
"--enable-native-access=com.sun.jna"
)
}
// "assert" statements in the code should activated when running using gradle
enableAssertions = true
jvmArgs("--enable-native-access=com.sun.jna")
}

javaModulePackaging {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pluginManagement {
maven("https://jitpack.io")
}
}

plugins {
id("org.jabref.gradle.build")
}
Expand Down