Commit f1510156 authored by Evan W. Patton's avatar Evan W. Patton

Fix buildserver paths on Windows

The buildserver should return an error if Kawa cannot compile the YAIL
file. However, on Windows we end up always pointing at the classes
directory, which always exists, and therefore we continue compiling an
app even though the class files are missing. On Mac/Linux the same
project results in a Kawa compilation error. The logic error is
introduced by the hard coding of the path "/../src/" in
Compiler.java. On Windows the path uses the conventional Windows
separator "\\", so the substring of interest is "\\..\\src\\". This
commit adjusts the lookup string to use File.separator so that the
lookup path will be correct regardless of platform.

Change-Id: Id066cad6710e7fe8c6710b40465c87992f547854
parent 3385ac09
......@@ -888,14 +888,10 @@ public final class Compiler {
for (Project.SourceDescriptor source : sources) {
String sourceFileName = source.getFile().getAbsolutePath();
LOG.log(Level.INFO, "source file: " + sourceFileName);
int srcIndex = sourceFileName.indexOf("/../src/");
int srcIndex = sourceFileName.indexOf(File.separator + ".." + File.separator + "src" + File.separator);
String sourceFileRelativePath = sourceFileName.substring(srcIndex + 8);
String classFileName = (classesDir.getAbsolutePath() + "/" + sourceFileRelativePath)
.replace(YoungAndroidConstants.YAIL_EXTENSION, ".class");
if (System.getProperty("os.name").startsWith("Windows")) {
classFileName = classesDir.getAbsolutePath()
.replace(YoungAndroidConstants.YAIL_EXTENSION, ".class");
}
.replace(YoungAndroidConstants.YAIL_EXTENSION, ".class");
// Check whether user code exists by seeing if a left parenthesis exists at the beginning of
// a line in the file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment