/
build.gradle
133 lines (104 loc) · 3.8 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
plugins {
id 'org.starchartlabs.flare.multi-module-library' version '2.0.2'
id 'com.autonomousapps.dependency-analysis' version '0.46.0'
}
allprojects {
apply plugin: 'eclipse'
// Always download sources, to allow debugging
eclipse {
classpath {
downloadSources = true
}
}
repositories {
mavenCentral()
}
check.dependsOn buildHealth
}
// Exclude the platform project from generalized setup
configure(subprojects.findAll { it.name != 'gradle-platform' }) {
apply plugin: 'java-library'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'signing'
dependencies {
implementation platform(project(':gradle-platform'))
}
projectMetaData {
github {
repository 'StarChart-Labs', 'alloy'
}
licenses {
mit()
}
}
checkstyle {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
configProperties = [ 'checkstyle.config.dir' : rootProject.file('config/checkstyle') ]
toolVersion = '8.31'
}
task checkstyleAll{}
tasks.withType(Checkstyle).all { checkstyleTask -> checkstyleAll.dependsOn checkstyleTask }
check.dependsOn checkstyleAll
// Setup default test behavior, including failure logging
test {
useTestNG() {
useDefaultListeners = true
}
}
// Apply module naming to all projects
// Add LICENSE so it is included in all JARs, as well as dependent licenses, fulfilling the "distributions include license" requirement
jar {
manifest {
attributes("Automatic-Module-Name": "${project.group}.${project.name - 'alloy-'}".replaceAll("-", "."))
}
}
tasks.withType(Jar).all {
from("${rootDir}"){
include 'LICENSE'
}
from("${rootDir}/dependent-licenses")
}
publishing {
publications {
maven(MavenPublication) {
from components.java
repositories {
// If not a remote run, publish to local only
if(!project.hasProperty('remoteDeploy')){
mavenLocal()
project.logger.lifecycle('Configured for local publishing')
}else{
maven {
if(!version.endsWith("SNAPSHOT")){
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
project.logger.lifecycle('Configured for release publishing')
}else{
url "https://oss.sonatype.org/content/repositories/snapshots/"
project.logger.lifecycle('Configured for snapshot publishing')
}
credentials {
username System.getenv("OSSRH_USERNAME")
password System.getenv("OSSRH_PASSWORD")
}
}
}
}
}
}
}
signing {
required { project.hasProperty('remoteDeploy') || project.hasProperty('sign') }
useInMemoryPgpKeys(System.getenv("OSSRH_SIGNING_KEY"), System.getenv("OSSRH_SIGNING_PASSWORD"))
sign publishing.publications.maven
}
// If not a remote run, publish to local only
if(!project.hasProperty('remoteDeploy')){
publishing {
repositories {
mavenLocal()
}
}
}
}