Skip to content

Commit 4cc212f

Browse files
committed
Upgraded gradle to 8.11 and simplified gradle configuration
1 parent 52f0f8a commit 4cc212f

17 files changed

+264
-216
lines changed

.dnconfig

-76 KB
Binary file not shown.

build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Copyright (C) 2024 Document Node Pty Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
alias(libs.plugins.axion.release)
19+
}
20+
21+
allprojects {
22+
group = 'io.documentnode'
23+
project.version = rootProject.version
24+
}
25+
26+
subprojects {
27+
// Apply the java-library plugin for API and implementation separation.
28+
apply plugin: "java-library"
29+
apply plugin: "java"
30+
31+
repositories {
32+
// Use Maven Central for resolving dependencies.
33+
mavenCentral()
34+
}
35+
36+
def javaVersion = JavaVersion.VERSION_11
37+
java {
38+
toolchain {
39+
languageVersion = JavaLanguageVersion.of(javaVersion.toString())
40+
}
41+
}
42+
task enforceVersion {
43+
doLast {
44+
def foundVersion = JavaVersion.current()
45+
if (foundVersion != javaVersion)
46+
throw new IllegalStateException("Wrong Java version; required is "
47+
+ javaVersion + ", but found " + foundVersion)
48+
}
49+
}
50+
compileJava.dependsOn(enforceVersion)
51+
52+
dependencies {
53+
implementation libs.dn.minilog
54+
55+
// Don't use the traditional logging framework to make it easier
56+
// for creating a native shared library (smaller)
57+
// implementation("org.slf4j:slf4j-api:1.8.0-beta4")
58+
// implementation("org.slf4j:slf4j-simple:1.8.0-beta4")
59+
60+
// Use JUnit for testing
61+
testImplementation libs.junit4
62+
testImplementation libs.mockito.core
63+
}
64+
65+
tasks.named('test') {
66+
// Use JUnit for unit tests.
67+
useJUnit()
68+
}
69+
}

buildSrc/build.gradle.kts

Lines changed: 0 additions & 11 deletions
This file was deleted.

buildSrc/src/main/kotlin/io.documentnode.epub4j.java-application-conventions.gradle.kts

Lines changed: 0 additions & 9 deletions
This file was deleted.

buildSrc/src/main/kotlin/io.documentnode.epub4j.java-common-conventions.gradle.kts

Lines changed: 0 additions & 35 deletions
This file was deleted.

buildSrc/src/main/kotlin/io.documentnode.epub4j.java-library-conventions.gradle.kts

Lines changed: 0 additions & 11 deletions
This file was deleted.

epub4j-core/build.gradle

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* For more details on writing Custom Plugins, please refer to
3+
* https://docs.gradle.org/8.10.2/userguide/custom_plugins.html in the
4+
* Gradle documentation.
5+
*/
6+
7+
plugins {
8+
id 'signing'
9+
id 'maven-publish'
10+
11+
alias(libs.plugins.gversion)
12+
}
13+
14+
repositories {
15+
// Use Maven Central for resolving dependencies.
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
implementation libs.kxml2
21+
implementation libs.xmlpull
22+
api libs.zip4j
23+
}
24+
25+
gversion {
26+
// path is relative to the sub-project by default
27+
// Gradle variables can also be used
28+
// E.g. "${project.rootDir}/module/src/main/java"
29+
srcDir = "src/main/java/"
30+
classPackage = "io.documentnode.epub4j.util"
31+
// optional. If not specified GVersion is used
32+
className = "GVersion"
33+
// optional. This is the default
34+
dateFormat = "yyyy-MM-dd'T'HH:mm:ss z";
35+
// optional. UTC is default
36+
timeZone = "UTC"
37+
// optional. print out extra debug information
38+
debug = false
39+
// optional. Can be Java or Kotlin, case insensitive
40+
language = "java"
41+
// optional. Force types to be explicitly printed
42+
explicitType = false
43+
}
44+
project.compileJava.dependsOn(createVersionFile)
45+
46+
signing {
47+
sign publishing.publications
48+
}
49+
50+
// Disable signing tasks in CI
51+
tasks.withType(Sign).configureEach {
52+
onlyIf {
53+
// Skip signing if running in CI
54+
!System.getenv("CI")
55+
}
56+
}
57+
58+
def ossrU = project.hasProperty("ossrhToken") ? ossrhToken : ""
59+
def ossrP = project.hasProperty("ossrhTokenPassword") ? ossrhTokenPassword : ""
60+
61+
publishing {
62+
publications {
63+
mavenJava(MavenPublication) {
64+
from components.java
65+
groupId = 'io.documentnode'
66+
artifactId = 'epub4j'
67+
version = project.version
68+
pom {
69+
name = 'epub4j'
70+
description = 'A java library for reading/writing/manipulating EPUB files, with improvements based on epublib.'
71+
url = 'https://documentnode.io/epub4j'
72+
packaging = 'jar'
73+
licenses {
74+
license {
75+
name = 'The Apache License, Version 2.0'
76+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
77+
}
78+
}
79+
developers {
80+
developer {
81+
id = 'jiakuan'
82+
name = 'Jiakuan Wang'
83+
84+
organization = 'Document Node'
85+
organizationUrl = 'https://documentnode.io'
86+
}
87+
}
88+
89+
scm {
90+
connection = 'scm:git:[email protected]:documentnode/epub4j.git'
91+
developerConnection = 'scm:git:[email protected]:documentnode/epub4j.git'
92+
url = 'https://github.com/documentnode/epub4j'
93+
}
94+
}
95+
}
96+
}
97+
repositories {
98+
mavenLocal()
99+
maven {
100+
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
101+
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
102+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
103+
credentials {
104+
username = ossrU
105+
password = ossrP
106+
}
107+
}
108+
}
109+
}

epub4j-core/build.gradle.kts

Lines changed: 0 additions & 108 deletions
This file was deleted.

epub4j-core/gradle.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

epub4j-tools/build.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
plugins {
2+
id 'application'
3+
4+
alias(libs.plugins.shadow)
5+
}
6+
7+
dependencies {
8+
implementation project(':epub4j-core')
9+
10+
implementation(libs.htmlcleaner) {
11+
exclude group: 'org.jdom', module: 'jdom'
12+
exclude group: 'org.apache.ant', module: 'ant'
13+
}
14+
implementation(libs.commons.vfs)
15+
implementation(libs.commons.lang)
16+
implementation(libs.commons.io)
17+
}
18+
19+
application {
20+
mainClass = 'io.documentnode.epub4j.Fileset2Epub'
21+
}
22+
23+
// Required by the 'shadowJar' task
24+
project.ext.mainClassName = "io.documentnode.epub4j.Fileset2Epub"
25+
26+
tasks.withType(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
27+
manifest {
28+
attributes(
29+
"Implementation-Title": "Fileset2Epub Command Line Tool",
30+
// Uncomment and replace `version` with the actual version if needed
31+
// "Implementation-Version": version,
32+
"Main-Class": "io.documentnode.epub4j.Fileset2Epub"
33+
)
34+
}
35+
}

0 commit comments

Comments
 (0)