forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.gradle
103 lines (91 loc) · 3.29 KB
/
lib.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
import org.apache.tools.ant.taskdefs.condition.Os
String findCommand(String dir, String command) {
def extension = Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""
def cmd = "$dir/$command$extension"
if (! new File(cmd).exists()) {
throw new Exception("Command $command not found in dir $dir")
}
cmd
}
String findJavaCommand(String command) {
def jh = System.getenv("JAVA8_HOME")
if (jh == null) {
throw new Exception("Environment variable JAVA8_HOME not set")
}
findCommand("$jh/bin", command)
}
Boolean doSigning(String signingAllowed, Boolean doModule) {
def b = signingAllowed.trim() == "true" && doModule
// println("signModule: ${project.name} signingEnabled: $signingAllowed module: $doModule")
b
}
void performSigning(String signingAllowed, Boolean doModule) {
signing {
required { doSigning(signingAllowed, doModule) }
sign configurations.archives
}
}
void configureUpload(String signingEnabled, Boolean signModule) {
uploadArchives {
enabled = false
repositories {
mavenDeployer {
if (doSigning(signingEnabled, signModule)) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: sonatypeUploadUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom {
groupId = project.group
project {
name pomProjectName
packaging 'jar'
description projectDescription
url projectUrl
organization {
name pomOrganisation
url projectUrl
}
scm {
url scmUrl
}
licenses {
license {
name "The BSD3 License"
url "https://github.com/functionaljava/functionaljava/blob/master/etc/LICENCE"
distribution 'repo'
}
}
developers {
developer {
email primaryEmail
}
}
}
}
}
}
}
}
void configureAllRetroLambda() {
configureRetroLambda(useRetroLambda, newJdkEnvVar, oldJdkEnvVar, retroLambdaTarget)
}
void configureRetroLambda(boolean useRetroLambda, String newJdkEnvVar, String oldJdkEnvVar, JavaVersion retroLambdaTarget) {
if (useRetroLambda) {
apply plugin: 'me.tatarka.retrolambda'
retrolambda {
jdk System.getenv(newJdkEnvVar)
oldJdk System.getenv(oldJdkEnvVar)
javaVersion retroLambdaTarget
}
}
}
ext {
findJavaCommand = this.&findJavaCommand
doSigning = this.&doSigning
performSigning = this.&performSigning
configureUpload = this.&configureUpload
configureRetroLambda = this.&configureRetroLambda
configureAllRetroLambda = this.&configureAllRetroLambda
}