Skip to content

Commit

Permalink
lower min gradle version to 4.6;
Browse files Browse the repository at this point in the history
use gradle with sources;
  • Loading branch information
esaulpaugh committed Feb 3, 2025
1 parent 9336dc6 commit b04fc44
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
import java.text.SimpleDateFormat

plugins {
id("java-library")
Expand All @@ -13,7 +11,12 @@ version = "12.3.4-SNAPSHOT"
final String versionStr = getProject().getGradle().getGradleVersion()
final int gradleMajorVersion = Integer.parseUnsignedInt(versionStr.substring(0, versionStr.indexOf((int)".".charAt(0))))

java {
if (gradleMajorVersion >= 5) {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
} else {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Expand Down Expand Up @@ -45,7 +48,11 @@ task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}

final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("MMMM d yyyy", Locale.ENGLISH).withZone(ZoneOffset.UTC)
static String todayUTC() {
SimpleDateFormat sdf = new SimpleDateFormat("MMMMM d yyyy")
sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
return sdf.format(new Date())
}

jar {
manifest {
Expand All @@ -54,7 +61,7 @@ jar {
"Implementation-Version": project.version,
"Automatic-Module-Name": "com.esaulpaugh.headlong",
"Created-By": "Gradle",
"Build-Date": dateFormatter.format(Instant.now())
"Build-Date": todayUTC()
)
}
finalizedBy(sourcesJar)
Expand Down Expand Up @@ -90,10 +97,7 @@ final String jmhVersion = "1.37"
final String bcVersion = "1.80"

dependencies {
implementation("com.google.code.gson:gson:") {
version {
require("[2.1, 2.12.0]") // published in "dependencies"
}
implementation("com.google.code.gson:gson:[2.1, 2.12.0]") {
exclude(group: "com.google.errorprone", module: "error_prone_annotations")
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=8d97a97984f6cbd2b85fe4c60a743440a347544bf18818048e611f5288d46c94
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionSha256Sum=296742a352f0b20ec14b143fb684965ad66086c7810b7b255dee216670716175
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit b04fc44

Please sign in to comment.