project: build/update scripts tuned to support home paths with spaces

This commit is contained in:
Roman Shevchenko
2014-07-16 16:42:28 +02:00
parent b9eb20d5d6
commit 099423280e
3 changed files with 12 additions and 9 deletions
Binary file not shown.
+5 -4
View File
@@ -88,7 +88,7 @@ private String require(String key) {
this[key]
}
catch (MissingPropertyException ignored) {
projectBuilder.error("Property $key is required")
projectBuilder.error("Property '$key' is required")
}
}
@@ -97,7 +97,7 @@ private String require(String key, String defaultValue) {
this[key]
}
catch (MissingPropertyException ignored) {
projectBuilder.info("$key is not defined. Defaulting to $defaultValue")
projectBuilder.info("'$key' is not defined. Defaulting to '$defaultValue'")
this[key] = defaultValue
}
}
@@ -112,8 +112,9 @@ binding.setVariable("requireProperty", {String key, String defaultValue = null -
})
binding.setVariable("guessHome", {
// Current file is supposed to be at build/scripts/release.gant path
new File(requireProperty("gant.file").substring("file:".length())).getParentFile().getParentFile().getParent()
// current file is supposed to be at build/scripts/*.gant path
String uri = requireProperty("gant.file")
new File(new URI(uri).getSchemeSpecificPart()).getParentFile().getParentFile().getParent()
})
binding.setVariable("loadProject", {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,21 +14,23 @@
* limitations under the License.
*/
package org.jetbrains.jps.idea
/**
* @author max
*/
public class IdeaProjectLoader {
public static String guessHome(Script script) {
File home = new File(script["gant.file"].substring("file:".length()))
String uri = script["gant.file"]
File home = new File(new URI(uri).getSchemeSpecificPart())
while (home != null) {
if (home.isDirectory()) {
if (new File(home, ".idea").exists()) return home.getCanonicalPath()
if (home.isDirectory() && new File(home, ".idea").exists()) {
return home.getCanonicalPath()
}
home = home.getParentFile()
}
return null
throw new IllegalArgumentException("Cannot guess project home from '" + uri + "'")
}
}