jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] branch master updated: Fix buildPrintableDoc for Windows
Date Sat, 28 Sep 2019 20:27:25 GMT
This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 32f4a74  Fix buildPrintableDoc for Windows
32f4a74 is described below

commit 32f4a74d6a46501f19afa7d8e6d07cecfda91b2d
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Sat Sep 28 23:25:56 2019 +0300

    Fix buildPrintableDoc for Windows
    
    java.util.Properties escapes : as \: and Velocity does not decode that.
    So absolute paths do not work for Windows because it results in c\:..
    
    The solution is to avoid Java's Properties.
---
 src/dist/build.gradle.kts | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/dist/build.gradle.kts b/src/dist/build.gradle.kts
index 1e4acdc..c9ba111 100644
--- a/src/dist/build.gradle.kts
+++ b/src/dist/build.gradle.kts
@@ -16,12 +16,13 @@
  *
  */
 
-import com.github.vlsi.gradle.release.ReleaseExtension
 import com.github.vlsi.gradle.crlf.CrLfSpec
 import com.github.vlsi.gradle.crlf.LineEndings
-import com.github.vlsi.gradle.release.dsl.*
 import com.github.vlsi.gradle.git.FindGitAttributes
-import com.github.vlsi.gradle.git.dsl.*
+import com.github.vlsi.gradle.git.dsl.gitignore
+import com.github.vlsi.gradle.release.ReleaseExtension
+import com.github.vlsi.gradle.release.dsl.dependencyLicenses
+import com.github.vlsi.gradle.release.dsl.licensesCopySpec
 import org.gradle.api.internal.TaskOutputsInternal
 
 plugins {
@@ -197,6 +198,9 @@ fun createAnakiaTask(taskName: String,
         val outputProps = "$buildDir/docProps/$taskName/velocity.properties"
         outputs.file(outputProps)
         doLast {
+            // Unfortunately, Velocity does not use Java properties format.
+            // For instance, Properties escape : as \:, however Velocity does not understand
that.
+            // Thus it tries to use c\:\path\to\workspace which does not work
             val p = `java.util`.Properties()
             file(velocityProperties).reader().use {
                 p.load(it)
@@ -204,11 +208,18 @@ fun createAnakiaTask(taskName: String,
             p["resource.loader"] = "file"
             p["file.resource.loader.path"] = baseDir
             p["file.resource.loader.class"] = "org.apache.velocity.runtime.resource.loader.FileResourceLoader"
+            val specials = Regex("""([,\\])""")
+            val lines = p.entries
+                .map { (it.key as String) + "=" + ((it.value as String).replace(specials,
"""\\$1""")) }
+                .sorted()
             file(outputProps).apply {
                 parentFile.run { isDirectory || mkdirs() } || throw IllegalStateException("Unable
to create directory $parentFile")
 
                 writer().use {
-                    p.store(it, "Auto-generated from $velocityProperties to pass absolute
path to Velocity")
+                    it.appendln("# Auto-generated from $velocityProperties to pass absolute
path to Velocity")
+                    for(line in lines) {
+                        it.appendln(line)
+                    }
                 }
             }
         }


Mime
View raw message