From a8ff9c3c6c41a1d3829521a00acc64f017f07ed6 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 2 Mar 2024 19:10:57 +0300 Subject: [PATCH] Move data out of resources. Deliver as separate directory. --- snark-gradle-plugin/build.gradle.kts | 2 +- .../src/main/kotlin/SnarkGradlePlugin.kt | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/snark-gradle-plugin/build.gradle.kts b/snark-gradle-plugin/build.gradle.kts index 24c4639..c48a321 100644 --- a/snark-gradle-plugin/build.gradle.kts +++ b/snark-gradle-plugin/build.gradle.kts @@ -11,7 +11,7 @@ repositories{ dependencies{ implementation(spclibs.kotlin.gradle) - implementation("com.github.mwiede:jsch:0.2.9") + implementation("com.github.mwiede:jsch:0.2.17") } gradlePlugin{ diff --git a/snark-gradle-plugin/src/main/kotlin/SnarkGradlePlugin.kt b/snark-gradle-plugin/src/main/kotlin/SnarkGradlePlugin.kt index 73d48f0..917ecb7 100644 --- a/snark-gradle-plugin/src/main/kotlin/SnarkGradlePlugin.kt +++ b/snark-gradle-plugin/src/main/kotlin/SnarkGradlePlugin.kt @@ -2,7 +2,9 @@ package space.kscience.snark.plugin import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.file.FileTree +import org.gradle.api.distribution.DistributionContainer +import org.gradle.kotlin.dsl.findByType +import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.withType import java.io.File import java.time.LocalDateTime @@ -43,10 +45,16 @@ public class SnarkGradlePlugin : Plugin { tasks.getByName("processResources").dependsOn(writeBuildDate) - extensions.configure("sourceSets") { - getByName("main") { - logger.info("Adding ${snarkExtension.dataDirectory} to resources") - resources.srcDir(snarkExtension.dataDirectory) + } + + plugins.withId("org.gradle.application"){ + extensions.findByType()?.apply{ + named("main"){ + contents { + from(snarkExtension.dataDirectory){ + into("data") + } + } } } }