Fixing some Gradle stuff
authorThiago H. de Paula Figueiredo <thiago@arsmachina.com.br>
Wed, 9 Jan 2019 22:16:21 +0000 (20:16 -0200)
committerThiago H. de Paula Figueiredo <thiago@arsmachina.com.br>
Wed, 9 Jan 2019 22:16:21 +0000 (20:16 -0200)
build.gradle
sha256.gradle [new file with mode: 0644]

index bf34b80..5e22057 100755 (executable)
@@ -6,7 +6,7 @@ apply plugin: "base"
 
 apply from: "ssh.gradle"
 apply from: "md5.gradle"
-//apply from: "sha256.gradle"
+apply from: "sha256.gradle"
 
 project.ext.versions = [
     jetty: "8.1.19.v20160209",
@@ -34,7 +34,7 @@ project.version = tapestryVersion()
 def tapestryVersion() {
 
     def major = "5.5.0"
-    def minor = "-SNAPSHOT"
+    def minor = ""
 
     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
     // When building normally, or for a release, no suffix is desired.
@@ -66,6 +66,12 @@ project.ext {
     archiveDeployFolder = { getProperty("apacheArchivesFolder") }
 }
 
+//println "Can deploy? $canDeploy"
+//println "Is snapshot? isSnapshot"
+//println "deployUsernameProperty $deployUsernameProperty"
+//println "deployPasswordProperty $deployPasswordProperty"
+//println "continuousIntegrationBuild? $continuousIntegrationBuild"
+
 allprojects {
 
     apply plugin: "eclipse"
diff --git a/sha256.gradle b/sha256.gradle
new file mode 100644 (file)
index 0000000..8abaec5
--- /dev/null
@@ -0,0 +1,25 @@
+import java.security.MessageDigest
+
+class GenSHA256 extends SourceTask {
+
+  def outputDir
+
+  @OutputDirectory
+  File getOutputDir() { project.file(outputDir) }
+
+  @TaskAction
+  void writeSHA256s() {
+
+    source.each { file ->
+      MessageDigest digest = MessageDigest.getInstance("SHA-256")
+
+      digest.update(file.bytes)
+
+      def checksum = new BigInteger(1, digest.digest()).toString(16).padLeft(32, "0")
+
+      new File(outputDir, file.name + ".sha256").text = checksum
+    }
+  }
+}
+
+project.ext.GenSHA256 = GenSHA256.class
\ No newline at end of file