-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathbuild.gradle
197 lines (173 loc) · 4.34 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
plugins {
// Apply the java and library plugin to add support for Java
id 'java-library-distribution'
// Apply the maven plugin to add support for publications
id 'maven-publish'
// Sign packages before sending them to Maven central
id 'signing'
// Apply yWorks coding style with editorconfig
id 'org.ec4j.editorconfig' version '0.0.3'
}
allprojects {
apply plugin: 'org.ec4j.editorconfig'
version = String.format("%s.%s", VERSION_MAJOR, VERSION_MINOR)
group = 'com.yworks'
}
repositories {
mavenCentral()
}
configurations {
annotation
dependents.extendsFrom implementation
}
dependencies {
annotation project(':annotation')
implementation project(':annotation')
implementation 'org.ow2.asm:asm:9.6'
implementation 'org.apache.ant:ant:1.10.14'
testImplementation 'junit:junit:4.13.2'
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
source = "$buildDir/generated-src"
}
task generateSources(type: Copy) {
from 'src/main/java'
into "$buildDir/generated-src"
filter {
line -> line.replaceAll('@VERSION@', version)
}
}
// Use generated sources
compileJava.dependsOn generateSources
def LIBRARIES = ["asm-9.6.jar"]
def LIBRARY_JARS = configurations.dependents.filter {
file -> file.name in LIBRARIES
}
jar {
manifest {
attributes(
'Class-Path': String.join(" ", *LIBRARY_JARS.collect {
file -> file.name
}),
'Main-Class': 'com.yworks.yguard.YGuardLogParser'
)
}
}
distributions {
bundle {
baseName = "yguard-bundle"
contents {
from file("$projectDir/LICENSE")
from file("$projectDir/README.md")
into("examples") {
from "$projectDir/examples"
}
into("lib") {
from LIBRARY_JARS
from configurations.annotation
from jar
}
if (project.hasProperty("copy-docs")) {
into("docs") {
from "$projectDir/site"
}
}
}
}
}
editorconfig {
includes = ['src/**', 'build.gradle']
excludes = ['**/*.properties', '**/*.bits', '**/resources', '**/dist']
}
check.dependsOn editorconfigCheck
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
}
task yguardSourceJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}
task yguardJavaDoc(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
publishing {
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username SONATYPE_NEXUS_USERNAME
password SONATYPE_NEXUS_PASSWORD
}
}
}
publications {
yguard(MavenPublication) {
artifactId = 'yguard'
pom {
name = 'yguard'
description = POM_DESCRIPTION
url = POM_URL
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
}
from project.components.java
artifact yguardSourceJar
artifact yguardJavaDoc
}
annotation(MavenPublication) {
artifactId = 'annotation'
pom {
name = 'annotation'
description = POM_DESCRIPTION
url = POM_URL
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
}
from project(':annotation').components.java
artifact project(':annotation').annotationSourceJar
artifact project(':annotation').annotationJavaDoc
}
}
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.yguard
sign publishing.publications.annotation
}