1- buildscript {
2- repositories {
3- mavenCentral()
4- }
5- }
61plugins {
7- id ' pl.allegro.tech.build.axion-release' version ' 1.7.0'
2+ id ' java'
3+ id ' pl.allegro.tech.build.axion-release' version ' 1.18.11'
4+ id ' maven-publish'
5+ }
6+
7+ repositories {
8+ mavenCentral()
89}
910
11+ // Plugin metadata
1012ext. pluginName = ' YAML Test Source'
1113ext. pluginDescription = " Define a set of static Nodes"
1214ext. sopsCopyright = " © 2017, Rundeck, Inc."
1315ext. sopsUrl = " http://rundeck.com"
14- ext. buildDateString= new Date (). format(" yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
16+ ext. buildDateString = new Date (). format(" yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
1517ext. archivesBaseName = " yaml-text-source"
1618ext. pluginBaseFolder = " ."
1719
20+ // No Java dependencies needed - this is a script-based plugin
1821
1922scmVersion {
2023 ignoreUncommittedChanges = true
2124 tag {
2225 prefix = ' '
2326 versionSeparator = ' '
24- def origDeserialize= deserialize
25- // apend .0 to satisfy semver if the tag version is only X.Y
26- deserialize = { config , position , tagName ->
27- def orig = origDeserialize(config, position, tagName)
28- if (orig. split(' \\ .' ). length < 3 ) {
29- orig + = " .0"
27+ }
28+ }
29+
30+ project. version = scmVersion. version
31+ ext. archiveFilename = ext. archivesBaseName + ' -' + version
32+
33+ // Plugin ZIP task (modernized from the external script)
34+ tasks. register(' pluginZip' , Jar ) {
35+ archiveBaseName = project. ext. archivesBaseName
36+ archiveVersion = project. version
37+ archiveClassifier = ' '
38+ archiveExtension = ' zip'
39+ destinationDirectory = file(" build/libs" )
40+
41+ from(" ${ project.buildDir} /zip-contents" ) {
42+ include(" *.yaml" )
43+ include(" resources/**" )
44+ include(" contents/*" )
45+ into(archiveFilename)
46+ }
47+
48+ manifest {
49+ attributes(
50+ ' Rundeck-Plugin-Name' : pluginName. toString(),
51+ ' Rundeck-Plugin-Description' : pluginDescription. toString(),
52+ ' Rundeck-Plugin-Archive' : ' true' ,
53+ ' Rundeck-Plugin-File-Version' : version,
54+ ' Rundeck-Plugin-Author' : sopsCopyright,
55+ ' Rundeck-Plugin-URL' : sopsUrl,
56+ ' Rundeck-Plugin-Date' : buildDateString
57+ )
58+ }
59+
60+ doFirst {
61+ def assetsMap = new Properties ()
62+ def tokens = assetsMap + [
63+ version : version,
64+ date : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssX" ). toString(),
65+ author : sopsCopyright,
66+ url : sopsUrl,
67+ title : pluginName,
68+ description : pluginDescription,
69+ name : archivesBaseName. toString(),
70+ ]
71+
72+ copy {
73+ from(" ${ project.projectDir} /resources" ) {
74+ include ' **/*'
75+ into " resources"
76+ }
77+ from(" ${ project.projectDir} /contents" ) {
78+ into " contents"
3079 }
31- orig
80+ from(" ${ project.projectDir} /plugin.yaml" ) {
81+ filter(org.apache.tools.ant.filters.ReplaceTokens , tokens : tokens)
82+ exclude ' **/*.png'
83+ }
84+ into " ${ project.buildDir} /zip-contents"
3285 }
3386 }
3487}
3588
36- project. version = scmVersion. version
37- ext. archiveFilename = ext. archivesBaseName + ' -' + version
89+ publishing {
90+ publications {
91+ mavenZip(MavenPublication ) {
92+ artifact pluginZip
93+ }
94+ }
95+ }
96+
97+ build {
98+ dependsOn ' pluginZip'
99+ }
100+
101+ tasks. register(' install' ) {
102+ dependsOn ' build' , ' publishToMavenLocal'
103+ }
38104
39- apply from : ' https://raw.githubusercontent.com/rundeck-plugins/ build-zip/master/build.gradle '
105+ defaultTasks ' clean ' , ' build' , ' pluginZip '
0 commit comments