Skip to content

Commit

Permalink
Improve plugin jar-in-jar
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskarth committed Sep 14, 2023
1 parent 875763c commit f6cbc14
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.jetbrains.java.decompiler.build.JasmCompile

plugins {
id 'jacoco'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id("io.github.gradle-nexus.publish-plugin") version '1.3.0'
}
Expand All @@ -17,6 +17,7 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
ext.isArm = System.getProperty('os.arch') == 'aarch64'

Expand Down Expand Up @@ -253,7 +254,12 @@ def allJar = tasks.register('allJar', Jar) {allJar ->
}

subprojects.each {
allJar.from(it.tasks.named(it.plugins.hasPlugin('com.github.johnrengelman.shadow') ? 'shadowJar' : 'jar').get().outputs) {
// Check if gradle.properties has 'does_shadow=true', and use the shadowJar configuration if so
Task buildTask = it.tasks.named("true".equals(it.does_shadow) ? 'shadowJar' : 'jar').get()
// Make sure the task is defined as a dependency
dependsOn buildTask
// Relocate the jar into META-INF/plugins
allJar.from(buildTask.outputs) {
into 'META-INF/plugins/'
}
}
Expand Down
1 change: 1 addition & 0 deletions plugins/idea-not-null/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
does_shadow=false
3 changes: 2 additions & 1 deletion plugins/kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
plugins {
id 'com.github.johnrengelman.shadow'
id 'java'
id 'org.jetbrains.kotlin.jvm'
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'maven-publish'

group = 'org.vineflower'
Expand Down
1 change: 1 addition & 0 deletions plugins/kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
does_shadow=true
1 change: 1 addition & 0 deletions plugins/scala/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
does_shadow=false

0 comments on commit f6cbc14

Please sign in to comment.