1+ import static org.gradle.api.JavaVersion.*
2+
3+ [' biz.aQute.bnd.builder' , ' distribution' , ' maven-publish' , ' signing' ]. each { apply plugin : it }
4+ // Jacoco and a coveralls upload plugin needed for publishing coverage results
5+ [' jacoco' , ' com.github.kt3k.coveralls' ]. each { apply plugin : it }
6+ // Antlr is needed for the test grammar
7+ [' antlr' ]. each { apply plugin : it }
8+
9+ // We require building with JDK 8 or later. We turn off doclint since our
10+ // generated *TokenMakers have horrible documentation (see https://github.com/jflex-de/jflex/issues/182)
11+ assert current(). isJava8Compatible()
12+ allprojects {
13+ tasks. withType(Javadoc ) {
14+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
15+ }
16+ }
17+
18+ archivesBaseName = ' rstaantlr'
19+ ext. isReleaseVersion = ! project. version. endsWith(' SNAPSHOT' )
20+
121// Add coveralls plugin to this build's classpath
222buildscript {
323 repositories {
@@ -8,16 +28,6 @@ buildscript {
828 }
929}
1030
11- plugins {
12- id(" antlr" )
13- }
14-
15- // Jacoco and a coveralls upload plugin needed for publishing coverage results
16- [' jacoco' , ' com.github.kt3k.coveralls' ]. each { apply plugin : it }
17-
18- archivesBaseName = ' rstaantlr'
19-
20-
2131dependencies {
2232 implementation project(' :RSyntaxTextArea' )
2333 compile group : ' org.antlr' , name : ' antlr4-runtime' , version : ' 4.8-1'
@@ -33,6 +43,23 @@ jacocoTestReport {
3343 }
3444}
3545
46+ ext. sharedManifest = manifest {
47+ attributes(' Specification-Title' : ' RSyntaxTextArea' ,
48+ ' Specification-Version' : version,
49+ ' Implementation-Title' : ' org.fife.ui' ,
50+ ' Implementation-Version' : version,
51+ ' Bundle-License' : ' BSD-3-Clause' ,
52+ // Not sure why Require-Capability is not being added by the osgi plugin...
53+ ' Require-Capability' : ' osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=' + javaVersion + ' ))"' )
54+ }
55+
56+ java {
57+ withSourcesJar()
58+ withJavadocJar()
59+ }
60+ jar {
61+ manifest { from sharedManifest }
62+ }
3663test {
3764 testLogging {
3865 events ' failed' // , 'passed', 'skipped', 'standardOut', 'standardError'
@@ -44,4 +71,71 @@ test {
4471
4572 showStandardStreams = false
4673 }
47- }
74+ }
75+
76+ publishing {
77+ repositories {
78+ maven {
79+ def releasesRepoUrl = ' https://oss.sonatype.org/service/local/staging/deploy/maven2/'
80+ def snapshotsRepoUrl = ' https://oss.sonatype.org/content/repositories/snapshots/'
81+ url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
82+ credentials { // Credentials usually kept in user's .gradle/gradle.properties
83+ // We must defensively check for these properties so Travis CI build works
84+ username = project. hasProperty(' ossrhUsername' ) ? ossrhUsername : ' unknown'
85+ password = project. hasProperty(' ossrhPassword' ) ? ossrhPassword : ' unknown'
86+ }
87+ }
88+ }
89+ publications {
90+ maven(MavenPublication ) {
91+
92+ groupId = ' com.fifesoft'
93+ artifactId = ' rsyntaxtextarea-antlr'
94+ version = version
95+
96+ from components. java
97+
98+ pom {
99+ name = ' rsyntaxtextarea-antlr'
100+ description = ' RSyntaxTextArea is the syntax highlighting text editor for Swing applications. ' +
101+ ' Features include syntax highlighting for 40+ languages, code folding, code completion, ' +
102+ ' regex find and replace, macros, code templates, undo/redo, line numbering and bracket ' +
103+ ' matching. This package contains bindings to the ANTLR Lexer/Parser generator.'
104+ url = ' http://www.fifesoft.com/rsyntaxtextarea/'
105+ inceptionYear = ' 2020'
106+ packaging = ' jar'
107+ licenses {
108+ license {
109+ name = ' BSD-3-Clause'
110+ url = ' https://github.com/bobbylight/RSyntaxTextArea/tree/master/RSyntaxTextArea/src/main/resources/META-INF/LICENSE'
111+ }
112+ }
113+ developers {
114+ developer {
115+ name = ' Robert Futrell'
116+ }
117+ developer {
118+ name = ' Markus Heberling'
119+ }
120+ }
121+ scm {
122+ url = ' https://github.com/bobbylight/RSyntaxTextArea'
123+ connection = ' scm:git:git://github.com/bobbylight/RSyntaxTextArea'
124+ developerConnection
= ' scm:git:[email protected] :bobbylight/RSyntaxTextArea' 125+ if (isReleaseVersion) {
126+ tag = project. version
127+ }
128+ }
129+ }
130+ }
131+ }
132+ }
133+
134+ signing {
135+ // Don't require signing for e.g. ./gradlew install
136+ required { gradle. taskGraph. hasTask(' publish' ) && isReleaseVersion }
137+ sign publishing. publications. maven
138+ }
139+ tasks. withType(Sign ) {
140+ onlyIf { isReleaseVersion }
141+ }
0 commit comments