From d52b8f338142f60cf86e4a674b6e700c77e217b7 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Thu, 24 Sep 2020 00:19:26 -0400 Subject: [PATCH] problem: jar and zip miss the version file --- build.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 43b1f3e7..65a14219 100644 --- a/build.gradle +++ b/build.gradle @@ -198,13 +198,19 @@ protobuf { } } +sourceSets { + main { + resources.srcDirs += project.buildDir.absolutePath + "/generated/version" + } +} + task generateVersion() { group = 'Build' description = 'Generate project version' doLast { def version = versionDetails() - def resourcesDir = sourceSets.main.output.resourcesDir + def resourcesDir = new File(project.buildDir.absolutePath + "/generated/version") resourcesDir.mkdirs() new File(resourcesDir, "version.properties").text = [ "# AUTOMATICALLY GENERATED", @@ -213,7 +219,6 @@ task generateVersion() { "version.tag=${version.lastTag}", "version.date=${DateTimeFormatter.ISO_LOCAL_DATE_TIME.withZone(ZoneId.of('UTC')).format(Instant.now().truncatedTo(ChronoUnit.SECONDS))} UTC" ].join("\n") - } }