-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathbuild.gradle
More file actions
169 lines (151 loc) · 5.66 KB
/
Copy pathbuild.gradle
File metadata and controls
169 lines (151 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'groovy'
id 'idea'
alias(libs.plugins.axionRelease)
}
group = 'org.rundeck.plugins'
ext.publishName = "EC2 Nodes Plugin ${project.version}"
ext.publishDescription = project.description ?: 'Produces Rundeck Nodes from AWS EC2'
ext.githubSlug = 'rundeck-plugins/rundeck-ec2-nodes-plugin'
ext.developers = [
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com']
]
java {
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add("-Xlint:deprecation")
}
}
}
defaultTasks 'clean', 'build'
ext.rundeckPluginVersion = '1.1'
scmVersion {
ignoreUncommittedChanges = false
tag {
prefix = '' // NO "v" prefix - see PLUGIN_TAGGING_ARCHITECTURE.md
versionSeparator = ''
}
versionCreator 'simple' // Use simple version creator (just tag name)
}
project.version = scmVersion.version
configurations{
//declare custom pluginLibs configuration to include only libs for this plugin
pluginLibs {
}
//declare compile to extend from pluginLibs so it inherits the dependencies
implementation {
extendsFrom pluginLibs
}
}
repositories {
mavenLocal()
maven {
name = 'Central Portal Snapshots'
url = 'https://central.sonatype.com/repository/maven-snapshots/'
content {
includeGroup('org.rundeck')
}
}
mavenCentral()
}
dependencies {
implementation libs.slf4jApi
compileOnly(libs.rundeckCore) {
exclude group: "com.google.guava"
}
testImplementation(libs.rundeckCore) {
exclude group: "com.google.guava"
}
// AWS SDK v2 BOM manages module versions for the pluginLibs + compile classpath
implementation platform(libs.awsSdkBom)
pluginLibs platform(libs.awsSdkBom)
implementation libs.jacksonDatabind
// Add secure commons-lang3 to provide alternative to vulnerable commons-lang 2.6
implementation(libs.commonsLang3)
// AWS SDK v2 modules bundled into the plugin lib/ dir. The Apache HTTP client (4.x) is
// bundled so HTTP proxy configuration keeps working and is set explicitly on every client,
// so the other default HTTP clients the service modules pull in (Netty async + Apache 5.x)
// are excluded to keep the plugin jar small. httpclient (4.x) must NOT be excluded because
// apache-client depends on it at runtime.
pluginLibs(libs.awsSdkEc2) {
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.jackson.dataformat"
exclude group: "software.amazon.awssdk", module: "netty-nio-client"
exclude group: "software.amazon.awssdk", module: "apache5-client"
}
pluginLibs(libs.awsSdkSts) {
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.jackson.dataformat"
exclude group: "software.amazon.awssdk", module: "netty-nio-client"
exclude group: "software.amazon.awssdk", module: "apache5-client"
}
pluginLibs libs.awsSdkApacheClient
testImplementation libs.bundles.testLibs
}
configurations.all {
resolutionStrategy {
// Replace vulnerable commons-lang with secure commons-lang3
dependencySubstitution {
substitute module('commons-lang:commons-lang') using module("org.apache.commons:commons-lang3:${libs.versions.commonsLang3.get()}")
}
}
}
// task to copy plugin libs to output/lib dir
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.pluginLibs
}
jar {
//include contents of output dir
from "$buildDir/output"
manifest {
attributes 'Rundeck-Plugin-Name': 'EC2 Nodes Plugin'
attributes 'Rundeck-Plugin-Description': 'Resource Model Source plugin that provides Amazon EC2 Instances as nodes.'
attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '2.2.2+'
attributes 'Rundeck-Plugin-Tags': 'java,aws,ec2,resource model'
attributes 'Rundeck-Plugin-License': 'Apache 2.0'
attributes 'Rundeck-Plugin-Author': 'Rundeck, Inc.'
attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck-plugins/rundeck-ec2-nodes-plugin'
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true', 'Rundeck-Plugin-Libs-Load-First':'false'
//create space-separated list of pluginLibs
def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ')
attributes 'Rundeck-Plugin-Classnames': 'com.dtolabs.rundeck.plugin.resources.ec2.EC2ResourceModelSourceFactory', 'Rundeck-Plugin-Libs': "${libList}"
attributes 'Rundeck-Plugin-File-Version': version
}
}
test {
useJUnitPlatform()
// Java 17 requires these for cglib/Spock mocking
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED'
}
//set jar task to depend on copyToLib
jar.dependsOn(copyToLib)
apply from: "${rootDir}/gradle/publishing.gradle"
def pkgcldRepoUrl = (System.getenv("PKGCLD_REPO_URL") ?: "https://packagecloud.io/pagerduty/rundeck-plugins/maven2").trim()
publishing {
repositories {
maven {
name = "PackageCloud"
url = uri(pkgcldRepoUrl)
authentication {
header(HttpHeaderAuthentication)
}
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "Bearer " + (System.getenv("PKGCLD_WRITE_TOKEN") ?: project.findProperty("pkgcldWriteToken"))
}
}
}
}