Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 22935dc

Browse files
authored
Merge pull request #2 from nextflow-io/1-update-plugin-build-template-using-latest-best-practice
feature: apply latest best practice in build template
2 parents 8057677 + c13f6b8 commit 22935dc

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

plugins/build.gradle

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ subprojects {
7272
* Creates plugin zip and json meta file in plugin `build/libs` directory
7373
*/
7474
task makeZip(type: Jar) {
75+
group 'nextflow'
7576
into('classes') { with jar }
7677
into('lib') { from configurations.compile }
7778
manifest.from file('src/resources/META-INF/MANIFEST.MF')
@@ -93,24 +94,42 @@ subprojects {
9394
}
9495
""".stripIndent()
9596
}
97+
outputs.file("$buildDir/libs/${project.name}-${project.version}.zip")
9698
}
9799

100+
/*
101+
* Copy the plugin dependencies in the subproject `build/target/libs` directory
102+
*/
98103
task copyPluginLibs(type: Sync) {
104+
group 'nextflow'
99105
from configurations.compile
100106
into 'build/target/libs'
101107
}
102108

103-
task copyPluginZip(type: Copy) {
104-
from makeZip
109+
/*
110+
* Copy the plugin in the project root build/plugins directory
111+
*/
112+
task copyPluginZip(type: Copy, dependsOn: project.tasks.findByName('makeZip')) {
113+
group 'nextflow'
114+
from project.tasks.findByName('makeZip')
105115
into "$rootProject.buildDir/plugins"
116+
outputs.file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip")
117+
doLast {
118+
ant.unzip(
119+
src: "$rootProject.buildDir/plugins/${project.name}-${project.version}.zip",
120+
dest: "$rootProject.buildDir/plugins/${project.name}-${project.version}"
121+
)
122+
}
106123
}
107124

108-
task unzipPlugin(type: Copy, dependsOn: copyPluginZip) {
109-
from zipTree("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip")
110-
into "$rootProject.buildDir/plugins/${project.name}-${project.version}"
111-
}
125+
/*
126+
* "install" the plugin the project root build/plugins directory
127+
*/
128+
project.parent.tasks.getByName("assemble").dependsOn << copyPluginZip
129+
112130

113131
task uploadPlugin(type: io.nextflow.gradle.tasks.GithubUploader, dependsOn: makeZip) {
132+
group 'nextflow'
114133
assets = providers.provider {["$buildDir/libs/${project.name}-${project.version}.zip",
115134
"$buildDir/libs/${project.name}-${project.version}-meta.json" ]}
116135
release = providers.provider { project.version }
@@ -121,10 +140,9 @@ subprojects {
121140
skipExisting = true
122141
}
123142

124-
task upload(dependsOn: [uploadPlugin] ) { }
125143
}
126144

127-
task upload(dependsOn: [subprojects.upload]) { }
145+
task upload(dependsOn: [subprojects.uploadPlugin]) { }
128146

129147
classes.dependsOn subprojects.copyPluginLibs
130-
assemble.dependsOn subprojects.unzipPlugin
148+

0 commit comments

Comments
 (0)