-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
164 lines (143 loc) · 4.9 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
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'idea'
id "com.github.ben-manes.versions" version "0.51.0"
id 'signing'
id 'maven-publish'
id 'checkstyle'
id "com.autonomousapps.dependency-analysis" version "2.1.4"
}
version = '0.1.2-SNAPSHOT'
sourceCompatibility = 11
targetCompatibility = 11
rootProject.description = 'Read and Write Podcast feeds from Java.'
group = 'co.ntbl'
tasks.register('createProperties') {
doLast {
new File("$projectDir/src/main/resources/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
jar {
manifest {
attributes(
"Class-Path": "co.ntbl.podcastfeedhandler",
"Main-Class": "PodcastFeedHandler",
"Implementation-Title": project.name,
"Implementation-Version": version,
"Implementation-Vendor": "Daniel Berkowitz",
"Build-Jdk": org.gradle.internal.jvm.Jvm.current(),
"Gradle-Version": GradleVersion.current().toString()
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
java {
withJavadocJar()
withSourcesJar()
}
ext.admin = System.getenv("MAVEN_USERNAME")
signing {
required { admin }
def signingKey = System.getenv("GPG_SIGNING_KEY")
def signingPassword = System.getenv("GPG_SIGNING_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingPassword)
// sign configurations.archives
sign publishing.publications
}
test {
// minHeapSize = "256m" // initial heap size
// maxHeapSize = "1024m" // maximum heap size
testLogging {
// Make sure output from
// standard out or error is shown
// in Gradle output.
showStandardStreams = true
// Or we use events method:
// events 'standard_out', 'standard_error'
// Or set property events:
// events = ['standard_out', 'standard_error']
// Instead of string values we can
// use enum values:
// events org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT,
// org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
}
}
repositories {
mavenCentral()
}
dependencies {
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.2'
testImplementation group: 'com.icosillion.podengine', name: 'podengine', version: '2.4.1'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
// To accept gradle scans and publish them
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}
//
// MAVEN
//
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'PodcastFeedHandler'
description = rootProject.description
url = 'https://github.com/daberkow/PodcastFeedHandler'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/daberkow/PodcastFeedHandler/blob/main/LICENSE'
distribution = 'repo'
}
}
developers {
developer {
id = 'daberkow'
name = 'Daniel Berkowitz'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/daberkow/PodcastFeedHandler.git'
developerConnection = 'scm:git:ssh://[email protected]:daberkow/PodcastFeedHandler.git'
url = 'https://github.com/daberkow/PodcastFeedHandler'
}
}
}
}
repositories {
maven {
name = "OSSRH"
if (admin) {
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}