You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val oldFiles = fileTree("build/libs") { include { fileTreeElement ->!fileTreeElement.isDirectory &&!versionRegex.containsMatchIn(fileTreeElement.name) } } //Get the old files.
37
+
if (oldFiles.isEmpty) return@task //If there are no old files, return.
38
+
from(oldFiles) //From the old files.
39
+
into("build/libs/other") //Into the other libs folder.
40
+
doLast { delete(oldFiles) } //Delete the old files.
41
+
}
42
+
43
+
//The publishing task.
44
+
task("publishEverything") {
45
+
println("Publishing everything...")
46
+
dependsOn("publish", "githubRelease") //Depend on publishing and github release (to publish everything).
47
+
println("Publishing everything!")
48
+
}
49
+
32
50
//The without dependencies jar creation task.
33
51
task("withoutDepends", type =Jar::class) {
52
+
dependsOn("moveOldFiles") //Depend on moving old files.
53
+
delete("${project.name}-${project.version}-without-depends.jar") //Delete the old jar (if it exists).
34
54
from(sourceSets.main.get().allSource) //Add the main sources.
35
55
archiveClassifier.set("withoutDepends") //Set the classifier.
36
56
archiveFileName.set("${project.name}-${project.version}-without-depends.jar") //Set the file name.
37
57
}
38
58
39
59
//The with dependencies jar creation task.
40
60
task("withDepends", type =ShadowJar::class) {
61
+
dependsOn("moveOldFiles") //Depend on moving old files.
62
+
delete("${project.name}-${project.version}-with-depends.jar") //Delete the old jar (if it exists).
41
63
from(sourceSets.main.get().allSource) //Add the main sources.
42
64
archiveClassifier.set("withDepends") //Set the classifier.
43
65
configurations =listOf(project.configurations.runtimeClasspath.get()) //Set the configurations.
@@ -49,6 +71,22 @@ tasks {
49
71
50
72
}
51
73
74
+
//The github release.
75
+
githubRelease {
76
+
token(findProperty("githubToken") asString?) //Set the token.
77
+
releaseName ="${project.version}"//Set the release name.
78
+
tagName ="${project.version}"//Set the tag name.
79
+
targetCommitish ="master"//Set the target commitish.
80
+
body ="The release of version ${project.version}."//Set the body.
81
+
releaseAssets.setFrom(tasks["withDepends"], tasks["withoutDepends"]) //Set the release assets.
0 commit comments