-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
145 lines (128 loc) · 4.9 KB
/
build.gradle
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
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'signing'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
}
group = "run.facet.agent.java"
archivesBaseName = "facet-agent"
version = 'master-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
def springVersion = '5.3.5'
def jacksonVersion = '2.12.2'
def log4JVersion = '2.14.1'
dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonVersion
implementation group: 'org.javassist', name: 'javassist', version: '3.27.0-GA'
implementation group: 'org.springframework', name: 'spring-context', version: springVersion
implementation group: 'org.springframework', name: 'spring-core', version: springVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4JVersion
}
repositories {
mavenCentral()
}
def shadedPackagePrefix = 'run.facet.dependencies.'
shadowJar {
archiveClassifier.set('')
project.configurations.implementation.canBeResolved(true);
manifest {
attributes 'Premain-Class': 'run.facet.agent.java.Agent',
'Can-Redefine-Classes': true,
'Can-Retransform-Classes': true
}
["com.fasterxml", "org.springframework", "javassist", "org.apache", "org.yaml", "org.aopalliance"].each {
relocate(it, "$shadedPackagePrefix$it")
}
//Needed for for log4j logging
mergeServiceFiles()
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
}
java {
withJavadocJar()
withSourcesJar()
}
artifacts {
archives shadowJar, javadocJar, sourcesJar
}
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign configurations.archives
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = archivesBaseName
packaging = 'jar'
description = 'An experimental low-code Java agent to enable and disable endpoints and methods. Not production ready.'
url = 'https://facet.run/documentation/java/'
scm {
connection = 'scm:git:https://github.com/facet-tech/agent-java'
developerConnection = 'scm:git:https://github.com/facet-tech/agent-java'
url = 'scm:git:https://github.com/facet-tech/agent-java'
}
licenses {
license {
name = 'The MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'Facet.Run'
name = 'Facet'
email = 'engineering@facet.run'
}
}
pom.withXml {
Node pomNode = asNode()
pomNode.remove(pomNode.get("dependencies"))
}
}
pom.withXml {
def pomFile = file("${project.buildDir}/pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = "engineering@facet.run"
password = findProperty("sonatypePassword")
}
}
}