-
Notifications
You must be signed in to change notification settings - Fork 288
/
build.gradle
186 lines (161 loc) · 4.64 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
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'maven-publish'
id 'biz.aQute.bnd.builder' version '6.0.0'
id 'signing'
}
dependencies {
compileOnly fileTree(dir: 'src/external', include: ['android*.jar'])
}
group = 'com.fazecast'
archivesBaseName = 'jSerialComm'
version = System.getenv("LIB_VERSION") ?: '2.11.1'
ext.moduleName = 'com.fazecast.jSerialComm'
sourceCompatibility = 6
targetCompatibility = 6
javadoc {
title archivesBaseName + ' ' + version + ' API'
options {
links 'https://docs.oracle.com/en/java/javase/12/docs/api/'
}
}
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
}
moduleInfo {
java {
srcDirs = ['src/moduleInfo/java']
}
}
}
compileModuleInfoJava {
sourceCompatibility = 9
targetCompatibility = 9
inputs.property("moduleName", moduleName)
doFirst {
classpath = files()
options.sourcepath = files(sourceSets.moduleInfo.java.srcDirs)
options.compilerArgs = [
'--module-path', classpath.asPath,
'-d', sourceSets.main.output.classesDirs.asPath
]
}
}
jar {
from sourceSets.main.output
from sourceSets.moduleInfo.output
bnd (
'-exportcontents': 'com.fazecast.jSerialComm;version="' + archiveVersion.get() + '"',
'Import-Package': '!android.*',
'Bundle-Name': 'jSerialComm',
'Bundle-SymbolicName': 'com.fazecast.jSerialComm',
'Bundle-Description': 'Java Serial Communications Library',
'Bundle-Vendor': 'Fazecast, Inc.',
'Require-Capability': 'osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.6))"',
'Implementation-Title': 'jSerialComm: Java Serial Communications Library',
'Implementation-Version': archiveVersion.get(),
'Implementation-Vendor': 'Fazecast, Inc.',
'Sealed': 'true'
)
}
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xlint:-options')
}
task testJar(type: Jar) {
archiveClassifier = 'test'
from sourceSets.test.output, sourceSets.main.output
manifest {
attributes 'Main-Class': 'com.fazecast.jSerialComm.SerialPortTest',
'Implementation-Title': 'jSerialComm: Java Serial Communications Library',
'Implementation-Version': archiveVersion.get(),
'Implementation-Vendor': 'Fazecast, Inc.',
'Sealed': 'true'
}
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives jar, javadocJar, sourcesJar, testJar
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
groupId = group
artifactId = archivesBaseName
version = version
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'jSerialComm'
description = 'A platform-independent serial communications library for Java.'
url = 'http://fazecast.github.io/jSerialComm/'
scm {
connection = 'scm:git:https://github.com/Fazecast/jSerialComm.git'
developerConnection = 'scm:git:https://github.com/Fazecast/jSerialComm.git'
url = 'https://github.com/Fazecast/jSerialComm'
}
licenses {
license {
name = 'GNU Lesser GPL, Version 3'
url = 'http://www.gnu.org/licenses/lgpl.html'
}
license {
name = 'Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0'
}
}
developers {
developer {
id = 'hedgecrw'
name = 'Will Hedgecock'
email = 'will.hedgecock@fazecast.com'
}
}
}
}
}
repositories {
maven {
name = "OSSRH"
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.findProperty("ossrhUsername") ?: System.getenv("MAVEN_USERNAME")
password = project.findProperty("ossrhPassword") ?: System.getenv("MAVEN_PASSWORD")
}
}
}
}
signing {
def signingKey = System.getenv("SIGNING_KEY")
def signingPassword = System.getenv("SIGNING_PASSWORD")
if (signingKey && signingPassword)
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}