From cb06be54f3ca94d27306c504b970a414df79a929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schalk=20W=2E=20Cronj=C3=A9?= Date: Thu, 14 Jul 2016 19:38:58 +0100 Subject: [PATCH] ISSUE #6. Quote key-value pairs for variables --- CHANGELOG.adoc | 6 +++++- .../org/ysb33r/gradle/gnumake/internal/TaskUtils.groovy | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 15cb448..a5c5ee5 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,6 +1,10 @@ = CHANGELOG -== Version 1.1 Roadmap +== Version 1.2 Roadmap + +* https://github.com/ysb33r/gnumake-gradle-plugin/issues/6[#6] - Variables should be quoted under Windows. + +== Version 1.1 * https://github.com/ysb33r/gnumake-gradle-plugin/issues/5[#5] - Gradle upgrade to v 2.12 * Upgradle plugin to be built by Gradle 2.14 diff --git a/src/main/groovy/org/ysb33r/gradle/gnumake/internal/TaskUtils.groovy b/src/main/groovy/org/ysb33r/gradle/gnumake/internal/TaskUtils.groovy index 9cde910..70cda2c 100644 --- a/src/main/groovy/org/ysb33r/gradle/gnumake/internal/TaskUtils.groovy +++ b/src/main/groovy/org/ysb33r/gradle/gnumake/internal/TaskUtils.groovy @@ -15,6 +15,7 @@ package org.ysb33r.gradle.gnumake.internal import org.gradle.api.Project +import org.gradle.internal.os.OperatingSystem import org.gradle.process.ExecResult import org.ysb33r.gradle.gnumake.GnuMakeBuild import org.ysb33r.gradle.gnumake.GnuMakeExtension @@ -23,6 +24,8 @@ import org.ysb33r.gradle.gnumake.GnuMakeExtension * @author Schalk W. Cronjé */ class TaskUtils { + static final boolean IS_WINDOWS = OperatingSystem.current().isWindows() + static List buildCmdArgs(Project project,GnuMakeBuild task,List targets) { List execArgs = [] @@ -43,7 +46,9 @@ class TaskUtils { def includes = (task.includeDirs.files.collectMany { ['-I', "${it.absolutePath}"] }) - def flags = task.flags.collect { k, v -> "$k=$v" } + def flags = task.flags.collect { k, v -> + IS_WINDOWS ? "\"$k=$v\"": "$k=$v" + } execArgs + switches + includes + targets + flags + task.switches }