forked from jfrog/artifactory-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
172 lines (148 loc) · 5.82 KB
/
build.gradle.kts
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
170
171
172
val groupVal = "org.jfrog.buildinfo"
val pluginDescription = "JFrog Gradle plugin publishes artifacts to Artifactory and handles the collection and publishing of Build Info."
val functionalTest by sourceSets.creating
group = groupVal
plugins {
id("com.gradle.plugin-publish") version "1.2.0"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("signing")
}
repositories {
mavenCentral()
}
val buildInfoVersion = "2.39.8"
val fileSpecsVersion = "1.1.2"
val commonsLangVersion = "3.12.0"
val commonsIoVersion = "2.11.0"
val commonsTxtVersion = "1.10.0"
val testNgVersion = "7.7.1"
val httpclientVersion = "4.5.14"
tasks.compileJava {
sourceCompatibility = "11"
targetCompatibility = "11"
}
java {
withJavadocJar()
withSourcesJar()
}
dependencies {
implementation("org.jfrog.buildinfo", "build-info-extractor", buildInfoVersion)
implementation("org.jfrog.buildinfo", "build-info-api", buildInfoVersion)
implementation("org.jfrog.buildinfo", "build-info-client", buildInfoVersion)
implementation("org.jfrog.filespecs", "file-specs-java", fileSpecsVersion)
implementation("org.apache.commons", "commons-lang3", commonsLangVersion)
implementation("org.apache.ivy", "ivy", "2.5.1")
implementation("com.google.guava", "guava", "32.0.1-jre")
// Dependencies that are used by the build-info dependencies and need to be included in the UberJar
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.14.1")
implementation("commons-io", "commons-io", commonsIoVersion)
implementation("org.apache.httpcomponents", "httpclient", httpclientVersion)
testImplementation("org.testng", "testng", testNgVersion)
testImplementation("org.mockito", "mockito-core", "3.+")
"functionalTestImplementation"("org.jfrog.buildinfo", "build-info-extractor", buildInfoVersion)
"functionalTestImplementation"("org.jfrog.buildinfo", "build-info-api", buildInfoVersion)
"functionalTestImplementation"("org.jfrog.filespecs", "file-specs-java", fileSpecsVersion)
"functionalTestImplementation"("org.testng", "testng", testNgVersion)
"functionalTestImplementation"("org.apache.commons", "commons-lang3", commonsLangVersion)
"functionalTestImplementation"("org.apache.commons", "commons-text", commonsTxtVersion)
"functionalTestImplementation"("commons-io", "commons-io", commonsIoVersion)
"functionalTestImplementation"("org.apache.httpcomponents", "httpclient", httpclientVersion)
"functionalTestImplementation"(project(mapOf("path" to ":")))
}
pluginBundle {
website = "https://github.com/jfrog/artifactory-gradle-plugin"
vcsUrl = "https://github.com/jfrog/artifactory-gradle-plugin"
gradlePlugin {
plugins {
create("artifactoryGradlePlugin") {
id = "com.jfrog.artifactory"
implementationClass = "org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin"
displayName = "JFrog Artifactory Gradle Plugin"
description = pluginDescription
tags = listOf("JFrog", "publication", "Artifactory", "build-info")
}
}
testSourceSets(functionalTest)
}
}
val uberJar by tasks.register<Jar>("uberJar") {
archiveClassifier.set("uber")
// Include the project classes
from(sourceSets.main.get().output)
// Include all dependencies
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter {
it.name.endsWith(".jar")
&& !it.name.contains("gradle") && !it.name.contains("groovy")
}.map { zipTree(it) }
})
// Exclude META-INF files from dependencies
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
}
tasks.named<Jar>("jar") {
dependsOn(uberJar)
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
}
tasks.matching{ task -> task.name.contains("PluginMarker") }.configureEach {
enabled = false
}
publishing.publications.withType<MavenPublication>().configureEach {
artifact(uberJar)
pom {
name.set(rootProject.name)
description.set(pluginDescription)
url.set("https://github.com/jfrog/artifactory-gradle-plugin")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("JFrog")
name.set("JFrog")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/jfrog/artifactory-gradle-plugin.git")
developerConnection.set("scm:git:[email protected]/jfrog/artifactory-gradle-plugin.git")
url.set("https://github.com/jfrog/artifactory-gradle-plugin")
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}
signing {
isRequired = project.hasProperty("sign")
val signingKey = findProperty("signingKey") as String?
val signingPassword = findProperty("signingPassword") as String?
useInMemoryPgpKeys(signingKey, signingPassword)
}
// Tests configurations
tasks.withType<Test>().configureEach {
useTestNG {
useDefaultListeners(true)
}
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events("started", "passed", "skipped", "failed", "standardOut", "standardError")
minGranularity = 0
}
}
val functionalTestTask = tasks.register<Test>("functionalTest") {
description = "Runs the functional tests."
group = "verification"
testClassesDirs = functionalTest.output.classesDirs
classpath = functionalTest.runtimeClasspath
mustRunAfter(tasks.test)
}
tasks.check {
dependsOn(functionalTestTask)
}