This repository has been archived by the owner on Jan 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
136 lines (113 loc) · 4.16 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
plugins {
id 'io.codearte.nexus-staging' version '0.21.2'
}
allprojects {
apply plugin: "java"
apply plugin: 'maven'
apply plugin: 'signing'
version = "${project_version}" + getBuildNumber() + (isSnapshot() ? "-snapshot" : '')
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}
artifacts {
archives sourcesJar
archives javadocJar
}
jar {
manifest {
attributes([
'Timestamp' : System.currentTimeMillis(),
'Specification-Title' : "${archivesBaseName}",
'Specification-Vendor' : "Diluv",
'Specification-Version' : "${archiveVersion.getOrNull()}",
'Implementation-Title' : "${archivesBaseName}",
'Implementation-Version' : "${archiveVersion.getOrNull()}",
'Implementation-Vendor' : "Diluv",
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})"
])
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (System.getenv("GPG_KEYNAME")) {
println "Configuring GPG KEY NAME"
ext."signing.gnupg.keyName" = System.getenv("GPG_KEYNAME");
}
}
signing {
useGpgCmd()
sign configurations.archives
}
tasks.withType(Sign) {
onlyIf { !isSnapshot() }
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: System.getenv("OSSRH_USERNAME"), password: System.getenv("OSSRH_PASSWORD"))
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: System.getenv("OSSRH_USERNAME"), password: System.getenv("OSSRH_PASSWORD"))
}
pom.project {
name "${archivesBaseName}"
packaging 'jar'
description project.description
url 'https://github.com/Diluv/Inquisitor/'
scm {
connection 'scm:git:git://github.com/Diluv/Inquisitor.git'
developerConnection 'scm:git:ssh://github.com/Diluv/Inquisitor.git'
url 'https://github.com/Diluv/Inquisitor'
}
licenses {
license {
name 'GNU Lesser General Public License v2.1'
url 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
}
}
developers {
developer {
id 'lclc98'
name 'lclc98'
email '[email protected]'
}
}
}
}
}
}
}
group = "${project_group}"
archivesBaseName = "${project_name}"
description = 'A Java library for interacting with multiple malware engines.'
dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.6'
}
nexusStaging {
stagingProfileId = '1282c5e0d73bd2'
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
static String getBuildNumber() {
return System.getenv("BUILD_NUMBER") ?: "0"
}
static boolean isSnapshot() {
String ref = System.getenv("GITHUB_REF");
if (ref != null && ref.startsWith("refs/tags/v")) {
return false
}
return true
}