|
1 | 1 | plugins { |
2 | | - id 'java-library' |
3 | | - id 'maven-publish' |
4 | | - id 'signing' |
5 | | - id 'checkstyle' |
6 | | - id 'org.gradlex.extra-java-module-info' version '1.13' |
| 2 | + id 'java-library' |
| 3 | + id 'maven-publish' |
| 4 | + id 'signing' |
| 5 | + id 'checkstyle' |
| 6 | + id 'org.gradlex.extra-java-module-info' version '1.13' |
7 | 7 | } |
8 | 8 |
|
9 | | -apply plugin: 'maven-publish' |
10 | | - |
11 | 9 | repositories { |
12 | | - // Access the Central Repository with Gradle via HTTPS |
13 | | - // Ref: https://central.sonatype.org/consume/consume-gradle/ |
14 | | - maven { |
15 | | - url = uri('https://repo.maven.apache.org/maven2/') |
16 | | - } |
| 10 | + maven { |
| 11 | + url = uri('https://repo.maven.apache.org/maven2/') |
| 12 | + } |
17 | 13 | } |
18 | 14 |
|
19 | 15 | // JAXB configuration holds classpath for running the JAXB XJC compiler |
20 | 16 | configurations { |
21 | | - jaxb |
| 17 | + jaxb |
22 | 18 | } |
23 | 19 |
|
24 | 20 | dependencies { |
25 | | - jaxb "org.glassfish.jaxb:jaxb-xjc:4.0.5" |
26 | | - jaxb "org.glassfish.jaxb:jaxb-runtime:4.0.5" |
| 21 | + jaxb "org.glassfish.jaxb:jaxb-xjc:4.0.5" |
| 22 | + jaxb "org.glassfish.jaxb:jaxb-runtime:4.0.5" |
27 | 23 |
|
28 | | - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core |
29 | | - implementation 'org.apache.logging.log4j:log4j-core:2.23.1' |
| 24 | + // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core |
| 25 | + implementation 'org.apache.logging.log4j:log4j-core:2.23.1' |
30 | 26 |
|
31 | | - // JAXB API only |
32 | | - implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0' |
33 | | - // JAXB RI, Jakarta XML Binding (do not change to runtimeOnly) |
34 | | - implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.5' |
| 27 | + // JAXB API only |
| 28 | + implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0' |
| 29 | + // JAXB RI, Jakarta XML Binding (do not change to runtimeOnly) |
| 30 | + implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.5' |
35 | 31 |
|
36 | | - // JUnit Jupiter using Gradle's native JUnit Platform |
37 | | - testImplementation platform('org.junit:junit-bom:5.13.4') |
38 | | - testImplementation 'org.junit.jupiter:junit-jupiter' |
39 | | - testImplementation 'org.junit.jupiter:junit-jupiter-params' |
40 | | - testRuntimeOnly 'org.junit.platform:junit-platform-reporting' |
| 32 | + // JUnit Jupiter using Gradle's native JUnit Platform |
| 33 | + testImplementation platform('org.junit:junit-bom:5.13.4') |
| 34 | + testImplementation 'org.junit.jupiter:junit-jupiter' |
| 35 | + testImplementation 'org.junit.jupiter:junit-jupiter-params' |
| 36 | + testRuntimeOnly 'org.junit.platform:junit-platform-reporting' |
41 | 37 |
|
42 | | - // PLIST implementation |
43 | | - implementation 'com.googlecode.plist:dd-plist:1.28' |
| 38 | + // PLIST implementation |
| 39 | + implementation 'com.googlecode.plist:dd-plist:1.28' |
44 | 40 |
|
45 | | - // Required to read InputStream with BOM-field |
46 | | - // https://mvnrepository.com/artifact/commons-io/commons-io |
47 | | - implementation 'commons-io:commons-io:2.20.0' |
| 41 | + // Required to read InputStream with BOM-field |
| 42 | + // https://mvnrepository.com/artifact/commons-io/commons-io |
| 43 | + implementation 'commons-io:commons-io:2.20.0' |
48 | 44 |
|
49 | | - // Testing: Used to load MIME-types from JSON |
50 | | - // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations |
51 | | - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.19.2' |
| 45 | + // Testing: Used to load MIME-types from JSON |
| 46 | + // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations |
| 47 | + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.19.0' |
52 | 48 |
|
53 | | - // Runtime: Used for JSPF playlists (de)serializiation |
54 | | - // Testing: Used to load MIME-types from JSON |
55 | | - // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind |
56 | | - implementation 'com.fasterxml.jackson.core:jackson-databind:2.19.2' |
| 49 | + // Runtime: Used for JSPF playlists (de)serializiation |
| 50 | + // Testing: Used to load MIME-types from JSON |
| 51 | + // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind |
| 52 | + implementation 'com.fasterxml.jackson.core:jackson-databind:2.19.0' |
57 | 53 | } |
58 | 54 |
|
59 | 55 | // Convert legacy dependency to named Java module |
60 | 56 | extraJavaModuleInfo { |
61 | | - module('com.googlecode.plist:dd-plist', 'dd.plist') { |
62 | | - exports('com.dd.plist') |
63 | | - requires('java.xml') |
64 | | - } |
| 57 | + module('com.googlecode.plist:dd-plist', 'dd.plist') { |
| 58 | + exports('com.dd.plist') |
| 59 | + requires('java.xml') |
| 60 | + } |
65 | 61 | } |
66 | 62 |
|
67 | 63 | task javadocJar(type: Jar) { |
68 | | - from javadoc |
69 | | - archiveClassifier.set('javadoc') |
| 64 | + from javadoc |
| 65 | + archiveClassifier.set('javadoc') |
70 | 66 | } |
71 | 67 |
|
72 | 68 | task sourcesJar(type: Jar) { |
73 | | - archiveClassifier.set('sources') |
74 | | - from sourceSets.main.allSource |
75 | | - duplicatesStrategy = DuplicatesStrategy.INCLUDE |
| 69 | + archiveClassifier.set('sources') |
| 70 | + from sourceSets.main.allSource |
| 71 | + duplicatesStrategy = DuplicatesStrategy.INCLUDE |
76 | 72 | } |
77 | 73 |
|
78 | 74 | java { |
79 | | - withSourcesJar() |
80 | | - withJavadocJar() |
| 75 | + withSourcesJar() |
| 76 | + withJavadocJar() |
81 | 77 | } |
82 | 78 |
|
83 | 79 | def generated_dir = "build/generated/sources/xjc/java" |
84 | 80 | sourceSets { |
85 | | - main { |
86 | | - java.srcDirs += generated_dir |
87 | | - } |
| 81 | + main { |
| 82 | + java.srcDirs += generated_dir |
| 83 | + } |
88 | 84 | } |
89 | 85 |
|
90 | | - |
91 | 86 | group = 'io.github.borewit' |
92 | 87 | version = '4.1.2' |
93 | 88 | description = 'Lizzy' |
94 | 89 | java.sourceCompatibility = JavaVersion.VERSION_1_9 |
95 | 90 |
|
96 | 91 | publishing { |
97 | | - publications { |
98 | | - |
99 | | - mavenJava(MavenPublication) { |
100 | | - from(components.java) |
101 | | - pom { |
102 | | - name = 'Lizzy' |
103 | | - description = 'Multimedia playlist parser, supporting a wide range of playlist file formats.' |
104 | | - url = 'https://github.com/Borewit/lizzy' |
105 | | - licenses { |
106 | | - license { |
107 | | - name = 'MIT' |
108 | | - url = 'https://github.com/Borewit/lizzy/blob/main/LICENSE.txt' |
109 | | - } |
110 | | - } |
111 | | - developers { |
112 | | - developer { |
113 | | - id = 'Borewit' |
114 | | - name = 'Borewit' |
115 | | - timezone = 'Europe/Amsterdam' |
116 | | - url = 'https://github.com/Borewit' |
117 | | - } |
118 | | - } |
119 | | - contributors { |
120 | | - contributor { |
121 | | - name = 'Borewit' |
122 | | - timezone = 'Europe/Amsterdam' |
123 | | - url = 'https://github.com/Borewit' |
124 | | - } |
125 | | - contributor { |
126 | | - name = 'Christophe Delory' |
127 | | - } |
128 | | - } |
129 | | - scm { |
130 | | - connection = 'scm:git:https://github.com/Borewit/lizzy.git' |
131 | | - url = 'https://github.com/Borewit/lizzy' |
132 | | - } |
133 | | - } |
| 92 | + publications { |
| 93 | + mavenJava(MavenPublication) { |
| 94 | + from(components.java) |
| 95 | + artifactId = 'lizzy' |
| 96 | + |
| 97 | + pom { |
| 98 | + name = 'Lizzy' |
| 99 | + description = 'Multimedia playlist parser, supporting a wide range of playlist file formats.' |
| 100 | + url = 'https://github.com/Borewit/lizzy' |
| 101 | + packaging = 'jar' |
| 102 | + licenses { |
| 103 | + license { |
| 104 | + name = 'MIT' |
| 105 | + url = 'https://github.com/Borewit/lizzy/blob/main/LICENSE.txt' |
| 106 | + } |
134 | 107 | } |
135 | | - } |
136 | | - repositories { |
137 | | - maven { |
138 | | - name = "OSSRH" |
139 | | - def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' |
140 | | - def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' |
141 | | - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
142 | | - |
143 | | - credentials { |
144 | | - username = ossrhUsername |
145 | | - password = ossrhPassword |
146 | | - } |
| 108 | + developers { |
| 109 | + developer { |
| 110 | + id = 'Borewit' |
| 111 | + name = 'Borewit' |
| 112 | + timezone = 'Europe/Amsterdam' |
| 113 | + url = 'https://github.com/Borewit' |
| 114 | + } |
147 | 115 | } |
| 116 | + contributors { |
| 117 | + contributor { |
| 118 | + name = 'Borewit' |
| 119 | + timezone = 'Europe/Amsterdam' |
| 120 | + url = 'https://github.com/Borewit' |
| 121 | + } |
| 122 | + } |
| 123 | + scm { |
| 124 | + connection = 'scm:git:https://github.com/Borewit/lizzy.git' |
| 125 | + url = 'https://github.com/Borewit/lizzy' |
| 126 | + } |
| 127 | + } |
| 128 | + } |
| 129 | + } |
| 130 | + repositories { |
| 131 | + maven { |
| 132 | + name = "OSSRH" |
| 133 | + def releasesRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/' |
| 134 | + def snapshotsRepoUrl = 'https://central.sonatype.com/repository/maven-snapshots/' |
| 135 | + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
| 136 | + |
| 137 | + credentials { |
| 138 | + username = findProperty('ossrhUsername') ?: "" |
| 139 | + password = findProperty('ossrhPassword') ?: "" |
| 140 | + } |
148 | 141 | } |
| 142 | + } |
149 | 143 | } |
150 | 144 |
|
151 | 145 | task checkStyle(type: DefaultTask, dependsOn: [checkstyleMain, checkstyleTest]) { |
152 | | - group = 'verification' |
| 146 | + group = 'verification' |
153 | 147 | } |
154 | 148 |
|
155 | 149 | signing { |
156 | | - useGpgCmd() |
157 | | - sign publishing.publications.mavenJava |
| 150 | + useGpgCmd() |
| 151 | + sign publishing.publications.mavenJava |
158 | 152 | } |
159 | 153 |
|
160 | 154 | tasks.withType(Test).configureEach { |
161 | | - useJUnitPlatform() |
| 155 | + useJUnitPlatform() |
162 | 156 | } |
163 | 157 |
|
164 | 158 | javadoc { |
165 | | - options.addBooleanOption("Xdoclint:none", true) |
166 | | - options.addStringOption("Xmaxwarns", "1") |
| 159 | + options.addBooleanOption("Xdoclint:none", true) |
| 160 | + options.addStringOption("Xmaxwarns", "1") |
167 | 161 | } |
168 | 162 |
|
169 | 163 | task checkJavaSources(type: SourceTask) { |
170 | | - source 'src/main/java' |
| 164 | + source 'src/main/java' |
171 | 165 | } |
172 | 166 |
|
173 | | -// Prevent generated Java sources are checked |
| 167 | +// Prevent generated Java sources from being checkstyled |
174 | 168 | tasks.checkstyleMain.source = fileTree(dir: 'src/main/java').include('**/*.java') |
175 | 169 |
|
176 | | - |
177 | | -// Cookie cutter function for defining multiple XJC tasks |
| 170 | +// JAXB XJC generation tasks |
178 | 171 | def addXjcTask(taskName, schema, binding, dest) { |
| 172 | + file(dest).mkdirs() |
179 | 173 |
|
180 | | - // If you haven't already, create the generated output dir before running XJC or it will fail |
181 | | - file(dest).mkdirs() |
182 | | - |
183 | | - // The main XJC task, calls XJCFacade which is the entry point of the XJC JAR |
184 | | - tasks.create(name: taskName, type: JavaExec) { |
185 | | - group = 'xjc' |
186 | | - classpath configurations.jaxb |
187 | | - mainClass = 'com.sun.tools.xjc.XJCFacade' |
188 | | - |
189 | | - // To explore available args, download the XJC JAR and run java -jar jaxb-xjc.jar --help |
190 | | - // or see https://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html |
191 | | - args "-extension", schema, "-b", binding, "-d", dest, "-no-header" |
192 | | - |
193 | | - tasks.findByName('build').mustRunAfter 'clean' |
194 | | - } |
195 | | -} |
196 | | - |
197 | | -addXjcTask("xjc-asx", |
198 | | - "src/main/schema/asx/asx-3.0.xsd", |
199 | | - "src/main/schema/asx/binding.xjb", |
200 | | - "$generated_dir") |
201 | | - |
202 | | -addXjcTask("xjc-atom", |
203 | | - "src/main/schema/atom/atom.xsd", |
204 | | - "src/main/schema/atom/binding.xjb", |
205 | | - "$generated_dir") |
206 | | - |
207 | | -addXjcTask("xjc-b4s", |
208 | | - "src/main/schema/b4s/b4s.xsd", |
209 | | - "src/main/schema/b4s/binding.xjb", |
210 | | - "$generated_dir") |
211 | | - |
212 | | -addXjcTask("xjc-rmp", |
213 | | - "src/main/schema/rmp/rmp.xsd", |
214 | | - "src/main/schema/rmp/binding.xjb", |
215 | | - "$generated_dir") |
216 | | - |
217 | | -addXjcTask("xjc-rss", |
218 | | - "src/main/schema/rss/rss-2.0.xsd", |
219 | | - "src/main/schema/rss/binding.xjb", |
220 | | - "$generated_dir") |
221 | | - |
222 | | -addXjcTask("xjc-smil", |
223 | | - "src/main/schema/smil20/smil20.xsd", |
224 | | - "src/main/schema/smil20/binding.xjb", |
225 | | - "$generated_dir") |
226 | | - |
227 | | -addXjcTask("xjc-xspf", |
228 | | - "src/main/schema/xspf/xspf-1_0.2.xsd", |
229 | | - "src/main/schema/xspf/binding.xjb", |
230 | | - "$generated_dir") |
231 | | - |
232 | | -task xjc(type: GradleBuild) { |
| 174 | + tasks.create(name: taskName, type: JavaExec) { |
233 | 175 | group = 'xjc' |
234 | | - tasks = ['xjc-asx', 'xjc-atom', 'xjc-b4s', 'xjc-b4s', 'xjc-rmp', 'xjc-rss', 'xjc-smil', 'xjc-xspf'] |
| 176 | + classpath configurations.jaxb |
| 177 | + mainClass = 'com.sun.tools.xjc.XJCFacade' |
| 178 | + args "-extension", schema, "-b", binding, "-d", dest, "-no-header" |
| 179 | + tasks.findByName('build').mustRunAfter 'clean' |
| 180 | + } |
| 181 | +} |
| 182 | + |
| 183 | +addXjcTask("xjc-asx", "src/main/schema/asx/asx-3.0.xsd", "src/main/schema/asx/binding.xjb", "$generated_dir") |
| 184 | +addXjcTask("xjc-atom", "src/main/schema/atom/atom.xsd", "src/main/schema/atom/binding.xjb", "$generated_dir") |
| 185 | +addXjcTask("xjc-b4s", "src/main/schema/b4s/b4s.xsd", "src/main/schema/b4s/binding.xjb", "$generated_dir") |
| 186 | +addXjcTask("xjc-rmp", "src/main/schema/rmp/rmp.xsd", "src/main/schema/rmp/binding.xjb", "$generated_dir") |
| 187 | +addXjcTask("xjc-rss", "src/main/schema/rss/rss-2.0.xsd", "src/main/schema/rss/binding.xjb", "$generated_dir") |
| 188 | +addXjcTask("xjc-smil", "src/main/schema/smil20/smil20.xsd", "src/main/schema/smil20/binding.xjb", "$generated_dir") |
| 189 | +addXjcTask("xjc-xspf", "src/main/schema/xspf/xspf-1_0.2.xsd", "src/main/schema/xspf/binding.xjb", "$generated_dir") |
| 190 | + |
| 191 | +task xjc { |
| 192 | + group = 'xjc' |
| 193 | + dependsOn 'xjc-asx', 'xjc-atom', 'xjc-b4s', 'xjc-rmp', 'xjc-rss', 'xjc-smil', 'xjc-xspf' |
235 | 194 | } |
236 | 195 |
|
237 | 196 | tasks.compileJava.dependsOn(tasks.xjc) |
0 commit comments