From 1148fe50c66895c5024f7ce93a4f207e4f3cff61 Mon Sep 17 00:00:00 2001 From: Frank Becker Date: Sat, 3 Apr 2021 22:47:02 +0200 Subject: [PATCH 1/3] produce reproducible archives (distribution zip and jar files) use commit time for build timestamp --- build.gradle | 5 +++++ gradle.properties | 2 +- gradle/application.gradle | 26 +------------------------- gradle/maven-publishing.gradle | 8 ++++---- jbake-core/build.gradle | 4 ++-- jbake-dist/build.gradle | 2 ++ 6 files changed, 15 insertions(+), 32 deletions(-) diff --git a/build.gradle b/build.gradle index f8c7dbde2..224fcb260 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ plugins { id "org.sonarqube" version "3.1.1" apply false id 'com.github.ben-manes.versions' version '0.38.0' id "nebula.optional-base" version "5.0.3" apply false + id 'org.ajoberstar.grgit' version "$grgitVersion" } // common variables @@ -56,6 +57,10 @@ allprojects { toolVersion = jacocoVersion } + tasks.withType(AbstractArchiveTask) { + preserveFileTimestamps = false + reproducibleFileOrder = true + } } /** diff --git a/gradle.properties b/gradle.properties index 325bdaae0..b63cd3c50 100644 --- a/gradle.properties +++ b/gradle.properties @@ -37,7 +37,7 @@ mockitoVersion = 3.8.0 # build dependencies jacocoVersion = 0.8.6 -grgitVersion = 1.6.0 +grgitVersion = 4.1.0 bintrayDryRun = false bintrayOrg = jbake diff --git a/gradle/application.gradle b/gradle/application.gradle index ed28737e0..522ecd86a 100644 --- a/gradle/application.gradle +++ b/gradle/application.gradle @@ -1,22 +1,8 @@ -import org.ajoberstar.grgit.Grgit - -import java.text.SimpleDateFormat - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath "org.ajoberstar:grgit:$grgitVersion" - } -} - apply plugin: 'application' mainClassName = "org.jbake.launcher.Main" applicationName = "jbake" - def examplesBase = "$project.buildDir/examples" def exampleRepositories = [ @@ -27,16 +13,6 @@ def exampleRepositories = [ "example_project_jade" : "git://github.com/jbake-org/jbake-example-project-jade.git" ] -processResources { - from("src/main/resources"){ - include 'default.properties' - expand jbakeVersion: project.version, - timestamp: new SimpleDateFormat("yyyy-MM-dd HH:mm:ssa").format( new Date() ) - } -} - - - //create clone and Zip Task for each repository exampleRepositories.each { name, repository -> @@ -49,7 +25,7 @@ exampleRepositories.each { name, repository -> outputs.dir repositoryName doLast { - Grgit.clone(dir: repositoryName, uri: repository) + grgit.clone(dir: repositoryName, uri: repository) } } diff --git a/gradle/maven-publishing.gradle b/gradle/maven-publishing.gradle index a1a518be0..e82810c86 100644 --- a/gradle/maven-publishing.gradle +++ b/gradle/maven-publishing.gradle @@ -1,11 +1,11 @@ -import java.text.SimpleDateFormat +import java.time.format.DateTimeFormatter apply plugin: 'maven-publish' -Date buildTimeAndDate = new Date() +def buildTimeAndDate = grgit.head().dateTime ext { - buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate) - buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate) + buildDate = buildTimeAndDate.format(DateTimeFormatter.ofPattern('yyyy-MM-dd')) + buildTime = buildTimeAndDate.format(DateTimeFormatter.ofPattern('HH:mm:ss.SSSZ')) isReleaseVersion = !version.endsWith("SNAPSHOT") } diff --git a/jbake-core/build.gradle b/jbake-core/build.gradle index d7f886ee7..740541c5b 100644 --- a/jbake-core/build.gradle +++ b/jbake-core/build.gradle @@ -1,4 +1,5 @@ import java.text.SimpleDateFormat +import java.time.format.DateTimeFormatter apply from: "$rootDir/gradle/sonarqube.gradle" apply plugin: 'java-library' @@ -36,7 +37,6 @@ processResources { from("src/main/resources") { include 'default.properties' expand jbakeVersion: project.version, - timestamp: new SimpleDateFormat("yyyy-MM-dd HH:mm:ssa").format(new Date()) + timestamp: grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss'['VV']'")) } } - diff --git a/jbake-dist/build.gradle b/jbake-dist/build.gradle index 51349a738..96f629bae 100644 --- a/jbake-dist/build.gradle +++ b/jbake-dist/build.gradle @@ -52,3 +52,5 @@ smokeTest { } check.dependsOn smokeTest + +jar.enabled=false From 7166029cd95cb6834d84ecdc62523b9ee6cc60dc Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Tue, 13 Apr 2021 00:18:30 +0100 Subject: [PATCH 2/3] Fixed spacing. --- build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 3ddeda897..048062d58 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ plugins { id "eclipse" id "idea" - id "io.sdkman.vendors" version "2.0.0" apply false - id "com.github.kt3k.coveralls" version "2.10.2" apply false - id "org.sonarqube" version "3.1.1" apply false - id 'com.github.ben-manes.versions' version '0.38.0' - id "nebula.optional-base" version "5.0.3" apply false - id 'org.ajoberstar.grgit' version "$grgitVersion" + id "io.sdkman.vendors" version "2.0.0" apply false + id "com.github.kt3k.coveralls" version "2.10.2" apply false + id "org.sonarqube" version "3.1.1" apply false + id 'com.github.ben-manes.versions' version '0.38.0' + id "nebula.optional-base" version "5.0.3" apply false + id 'org.ajoberstar.grgit' version "$grgitVersion" id "io.github.gradle-nexus.publish-plugin" version "1.0.0" id "com.github.breadmoirai.github-release" version "2.2.12" } From e0f16f4e7472f29de9ce92d7d22eac798d739723 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Tue, 13 Apr 2021 13:11:47 +0100 Subject: [PATCH 3/3] Excluded OrientDB class from JaCoCo instrumentation. --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 048062d58..84a164676 100644 --- a/build.gradle +++ b/build.gradle @@ -96,6 +96,10 @@ subprojects { events "passed", "skipped", "failed" exceptionFormat "full" } + + jacoco { + excludes = ["**/*OrientSqlTokenManager*"] + } } dependencies {