Skip to content

Commit dfed29c

Browse files
authored
Merge pull request #2 from rundeck-plugins/build-modernization
Build Modernization
2 parents e21a64e + b3f0d7b commit dfed29c

5 files changed

Lines changed: 425 additions & 17 deletions

File tree

build.gradle

Lines changed: 83 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,105 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
}
5-
}
61
plugins {
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
1012
ext.pluginName = 'YAML Test Source'
1113
ext.pluginDescription = "Define a set of static Nodes"
1214
ext.sopsCopyright = "© 2017, Rundeck, Inc."
1315
ext.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'")
1517
ext.archivesBaseName = "yaml-text-source"
1618
ext.pluginBaseFolder = "."
1719

20+
// No Java dependencies needed - this is a script-based plugin
1821

1922
scmVersion {
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'

gradle/wrapper/gradle-wrapper.jar

60.2 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4+
networkTimeout=10000
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

gradlew

Lines changed: 244 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)