From 3ba1e56aa003eac6e63e29c5a9cb89efcc97f69c Mon Sep 17 00:00:00 2001 From: Nikita Stroganov Date: Fri, 1 Jul 2022 11:45:54 +0300 Subject: [PATCH] Put utbot-instrumentation.jar into the gradle plugin jar (#365) --- utbot-gradle/build.gradle | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/utbot-gradle/build.gradle b/utbot-gradle/build.gradle index a397bb313c..b115420101 100644 --- a/utbot-gradle/build.gradle +++ b/utbot-gradle/build.gradle @@ -6,11 +6,16 @@ plugins { apply from: "${parent.projectDir}/gradle/include/jvm-project.gradle" +configurations { + fetchInstrumentationJar +} + dependencies { shadow gradleApi() shadow localGroovy() implementation project(":utbot-framework") + fetchInstrumentationJar project(path: ':utbot-instrumentation', configuration: 'instrumentationArchive') implementation group: 'io.github.microutils', name: 'kotlin-logging', version: kotlin_logging_version } @@ -30,9 +35,22 @@ jar { } } +/** + * Shadow plugin unpacks the nested `utbot-instrumentation-.jar`. + * But we need it to be packed. Workaround: double-nest the jar. + */ +task shadowBugWorkaround(type: Jar) { + destinationDir file('build/shadow-bug-workaround') + from(configurations.fetchInstrumentationJar) { + into "lib" + } +} + +// Documentation: https://imperceptiblethoughts.com/shadow/ shadowJar { archiveClassifier.set('') minimize() + from shadowBugWorkaround } // no module metadata => no dependency on the `utbot-framework`