Skip to content

Commit

Permalink
Upgraded gradle to 8.11 and simplified gradle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jiakuan committed Dec 5, 2024
1 parent 52f0f8a commit 4cc212f
Show file tree
Hide file tree
Showing 17 changed files with 264 additions and 216 deletions.
Binary file removed .dnconfig
Binary file not shown.
69 changes: 69 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright (C) 2024 Document Node Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
alias(libs.plugins.axion.release)
}

allprojects {
group = 'io.documentnode'
project.version = rootProject.version
}

subprojects {
// Apply the java-library plugin for API and implementation separation.
apply plugin: "java-library"
apply plugin: "java"

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

def javaVersion = JavaVersion.VERSION_11
java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion.toString())
}
}
task enforceVersion {
doLast {
def foundVersion = JavaVersion.current()
if (foundVersion != javaVersion)
throw new IllegalStateException("Wrong Java version; required is "
+ javaVersion + ", but found " + foundVersion)
}
}
compileJava.dependsOn(enforceVersion)

dependencies {
implementation libs.dn.minilog

// Don't use the traditional logging framework to make it easier
// for creating a native shared library (smaller)
// implementation("org.slf4j:slf4j-api:1.8.0-beta4")
// implementation("org.slf4j:slf4j-simple:1.8.0-beta4")

// Use JUnit for testing
testImplementation libs.junit4
testImplementation libs.mockito.core
}

tasks.named('test') {
// Use JUnit for unit tests.
useJUnit()
}
}
11 changes: 0 additions & 11 deletions buildSrc/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

109 changes: 109 additions & 0 deletions epub4j-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* For more details on writing Custom Plugins, please refer to
* https://docs.gradle.org/8.10.2/userguide/custom_plugins.html in the
* Gradle documentation.
*/

plugins {
id 'signing'
id 'maven-publish'

alias(libs.plugins.gversion)
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
implementation libs.kxml2
implementation libs.xmlpull
api libs.zip4j
}

gversion {
// path is relative to the sub-project by default
// Gradle variables can also be used
// E.g. "${project.rootDir}/module/src/main/java"
srcDir = "src/main/java/"
classPackage = "io.documentnode.epub4j.util"
// optional. If not specified GVersion is used
className = "GVersion"
// optional. This is the default
dateFormat = "yyyy-MM-dd'T'HH:mm:ss z";
// optional. UTC is default
timeZone = "UTC"
// optional. print out extra debug information
debug = false
// optional. Can be Java or Kotlin, case insensitive
language = "java"
// optional. Force types to be explicitly printed
explicitType = false
}
project.compileJava.dependsOn(createVersionFile)

signing {
sign publishing.publications
}

// Disable signing tasks in CI
tasks.withType(Sign).configureEach {
onlyIf {
// Skip signing if running in CI
!System.getenv("CI")
}
}

def ossrU = project.hasProperty("ossrhToken") ? ossrhToken : ""
def ossrP = project.hasProperty("ossrhTokenPassword") ? ossrhTokenPassword : ""

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = 'io.documentnode'
artifactId = 'epub4j'
version = project.version
pom {
name = 'epub4j'
description = 'A java library for reading/writing/manipulating EPUB files, with improvements based on epublib.'
url = 'https://documentnode.io/epub4j'
packaging = 'jar'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'jiakuan'
name = 'Jiakuan Wang'
email = '[email protected]'
organization = 'Document Node'
organizationUrl = 'https://documentnode.io'
}
}

scm {
connection = 'scm:git:[email protected]:documentnode/epub4j.git'
developerConnection = 'scm:git:[email protected]:documentnode/epub4j.git'
url = 'https://github.com/documentnode/epub4j'
}
}
}
}
repositories {
mavenLocal()
maven {
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
credentials {
username = ossrU
password = ossrP
}
}
}
}
108 changes: 0 additions & 108 deletions epub4j-core/build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion epub4j-core/gradle.properties

This file was deleted.

35 changes: 35 additions & 0 deletions epub4j-tools/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
id 'application'

alias(libs.plugins.shadow)
}

dependencies {
implementation project(':epub4j-core')

implementation(libs.htmlcleaner) {
exclude group: 'org.jdom', module: 'jdom'
exclude group: 'org.apache.ant', module: 'ant'
}
implementation(libs.commons.vfs)
implementation(libs.commons.lang)
implementation(libs.commons.io)
}

application {
mainClass = 'io.documentnode.epub4j.Fileset2Epub'
}

// Required by the 'shadowJar' task
project.ext.mainClassName = "io.documentnode.epub4j.Fileset2Epub"

tasks.withType(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
manifest {
attributes(
"Implementation-Title": "Fileset2Epub Command Line Tool",
// Uncomment and replace `version` with the actual version if needed
// "Implementation-Version": version,
"Main-Class": "io.documentnode.epub4j.Fileset2Epub"
)
}
}
Loading

0 comments on commit 4cc212f

Please sign in to comment.