-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (108 loc) · 3.58 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'org.ajoberstar.grgit' version '1.7.2'
id 'org.ajoberstar.release-opinion' version '1.7.2'
}
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven {
url "https://dl.bintray.com/ppanda-beta/maven"
}
}
group 'com.ppanda'
version '0.0.1'
ext {
artifactName = 'cassandra-java-driver-reactive-mapper-reactor-core'
binTrayUserName = findProperty("bintrayUserName")
bintrayApiToken = findProperty("bintrayApiToken")
signingKey = findProperty("signingKey")
signingPassword = findProperty("signingPassword")
}
dependencies {
annotationProcessor 'ppanda.sharpie:interface-wrapper:0.0.1'
annotationProcessor 'com.datastax.oss:java-driver-mapper-processor:4.5.1'
api 'ppanda.sharpie:interface-wrapper-runtime:0.0.1'
api 'com.datastax.oss:java-driver-mapper-runtime:4.5.1'
api 'io.projectreactor:reactor-core:3.0.1.RELEASE'
testAnnotationProcessor 'ppanda.sharpie:interface-wrapper:0.0.1'
testAnnotationProcessor 'com.datastax.oss:java-driver-mapper-processor:4.5.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.10.0'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.23.4'
testCompile 'org.jeasy:easy-random-core:4.2.0'
testCompile group: 'org.cassandraunit', name: 'cassandra-unit', version: '4.3.1.0'
testCompile 'io.projectreactor:reactor-test:3.1.0.RELEASE'
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = artifactName
pom {
name = 'Interface Wrapper'
description = 'A small library to wrap interfaces with custom needs'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/pPanda-beta/cassandra-java-driver-reactive-mapper/blob/master/LICENSE'
}
}
developers {
developer {
id = 'ppanda-beta'
name = 'Palash Das'
email = 'dpalash.new@gmail.com'
}
}
}
}
}
repositories {
maven {
name "jCenter"
url = "https://api.bintray.com/maven/${binTrayUserName}/maven/${artifactName}/;publish=1"
credentials {
username = binTrayUserName
password = bintrayApiToken
}
}
}
}
private void deleteArtifactVersion(versionId, stopOnFail = true) {
def artifactLocation = "https://api.bintray.com/packages/${binTrayUserName}/maven/${artifactName}/versions/${versionId}"
def basicAuthHeader = "Basic " + Base64.getEncoder().encodeToString((binTrayUserName + ":" + bintrayApiToken).getBytes())
def deleteConnection = new URL(artifactLocation).openConnection();
deleteConnection.setRequestMethod("DELETE")
deleteConnection.setRequestProperty("Authorization", basicAuthHeader)
deleteConnection.setDoOutput(true)
deleteConnection.getOutputStream().flush()
if (deleteConnection.getResponseCode().equals(200)) {
println("Successfully deleted artifact " + deleteConnection.getInputStream().getText())
} else if (stopOnFail) {
throw new StopActionException("Failed to delete artifact " + deleteConnection.getInputStream().getText())
}
}
task removeCurrentVersionIfExists {
doFirst {
deleteArtifactVersion(version, false)
}
}
publishMavenJavaPublicationToJCenterRepository.dependsOn(removeCurrentVersionIfExists)
task removePoisonousMavenMetadataBasedFakeVersion {
doLast {
deleteArtifactVersion(artifactName)
}
}
publishMavenJavaPublicationToJCenterRepository.finalizedBy(removePoisonousMavenMetadataBasedFakeVersion)
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}