-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
build.gradle
124 lines (108 loc) · 3.39 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
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "8.1.1"
}
dependencies {
implementation("net.bytebuddy:byte-buddy:1.14.12")
// graphql-java itself
implementation(rootProject)
}
repositories {
mavenCentral()
mavenLocal()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
shadowJar {
minimize()
archiveClassifier.set('')
configurations = [project.configurations.compileClasspath]
dependencies {
exclude(dependency(rootProject))
}
manifest {
attributes(
'Agent-Class': 'graphql.agent.GraphQLJavaAgent',
'Premain-Class': 'graphql.agent.GraphQLJavaAgent',
'Can-Redefine-Classes': 'true',
'Can-Retransform-Classes': 'true',
)
}
}
task sourcesJar(type: Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
agent(MavenPublication) {
version rootProject.version
group rootProject.group
artifactId 'graphql-java-agent'
from components.java
artifact sourcesJar {
archiveClassifier = "sources"
}
artifact javadocJar {
archiveClassifier = "javadoc"
}
pom.withXml {
// removing the shaded dependencies from the pom
def pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
it.artifactId.text() == 'graphql-java' || it.artifactId.text() == 'byte-buddy'
}.each() {
it.parent().remove(it)
}
pomNode.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'graphql-java-agent'
description 'GraphqL Java Agent'
url "https://github.com/graphql-java/graphql-java"
scm {
url "https://github.com/graphql-java/graphql-java"
connection "https://github.com/graphql-java/graphql-java"
developerConnection "https://github.com/graphql-java/graphql-java"
}
licenses {
license {
name 'MIT'
url 'https://github.com/graphql-java/graphql-java/blob/master/LICENSE.md'
distribution 'repo'
}
}
developers {
developer {
id 'andimarek'
name 'Andreas Marek'
}
}
}
}
}
}
}
signing {
required { !project.hasProperty('publishToMavenLocal') }
def signingKey = System.env.MAVEN_CENTRAL_PGP_KEY
useInMemoryPgpKeys(signingKey, "")
sign publishing.publications
}
// all publish tasks depend on the build task
tasks.withType(PublishToMavenRepository) {
dependsOn build
}
// Only publish Maven POM, disable default Gradle modules file
tasks.withType(GenerateModuleMetadata) {
enabled = false
}