-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
110 lines (92 loc) · 3.42 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
plugins {
id 'eu.xenit.amp' version "0.2.0"
id 'signing'
id 'maven-publish'
id "io.codearte.nexus-staging" version "0.20.0"
}
wrapper {
gradleVersion = "5.4.1"
}
group = 'eu.xenit.alfresco'
description = 'Hotfix for MNT-20557'
def baseVersion = "1.0.2"
def branchName = System.env.BRANCH_NAME
def isRelease = branchName != null && branchName.startsWith("release")
if (isRelease)
version = "$baseVersion"
else
version = "$baseVersion-SNAPSHOT"
jar.enabled = false // Disable default jar task
task jsr250Jar(type: Jar) {
baseName = "jsr250-api"
version = "1.0"
}
task geronimoAnnotationJar(type: Jar) {
baseName = "geronimo-annotation_1.0_spec"
version = "1.1.1"
}
tasks.getByName("amp") {
libs.from(jsr250Jar, geronimoAnnotationJar)
}
nexusStaging {
username = project.hasProperty('de_publish_username') ? project.de_publish_username : ''
password = project.hasProperty('de_publish_password') ? project.de_publish_password : ''
packageGroup = project.group
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact amp
pom {
url = 'https://github.com/xenit-eu/alfresco-hotfix-MNT-20557'
name = project.name
description = project.description
scm {
connection = 'scm:git:git@github.com:xenit-eu/alfresco-hotfix-MNT-20557.git'
developerConnection = 'scm:git:git@github.com:xenit-eu/alfresco-hotfix-MNT-20557.git'
url = 'https://github.com/xenit-eu/alfresco-hotfix-MNT-20557'
}
developers {
developer {
id = "xenit"
name = "Xenit Solutions NV"
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.hasProperty('de_publish_username') ? project.de_publish_username : ''
password = project.hasProperty('de_publish_password') ? project.de_publish_password : ''
}
}
}
}
signing {
required { !version.endsWith('SNAPSHOT') && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(publish)) {
if (!project.hasProperty('keyId') || !project.hasProperty('secretKeyRingFile') || !project.hasProperty('password')) {
throw new GradleException('You need to provide signing params in order to sign artifacts')
}
def id = project.hasProperty('keyId') ? project.keyId : ''
def file = project.hasProperty('secretKeyRingFile') ? project.secretKeyRingFile : ''
def password = project.hasProperty('password') ? project.password : ''
ext."signing.keyId" = id
ext."signing.secretKeyRingFile" = file
ext."signing.password" = password
}
}