Fix watch command (resolves haxelime/hxp#23)

This commit is contained in:
Joshua Granick
2020-12-21 12:50:14 -08:00
parent a22d55762a
commit 79e21c8312
9 changed files with 81 additions and 17 deletions

View File

@@ -215,7 +215,7 @@ class AndroidPlatform extends PlatformTarget
}
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -520,7 +520,15 @@ class AndroidPlatform extends PlatformTarget
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -243,7 +243,7 @@ class EmscriptenPlatform extends PlatformTarget
}
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";

View File

@@ -108,7 +108,7 @@ class FlashPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -263,7 +263,15 @@ class FlashPlatform extends PlatformTarget
}*/
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -139,7 +139,7 @@ class HTML5Platform extends PlatformTarget
}
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -502,7 +502,15 @@ class HTML5Platform extends PlatformTarget
{
// TODO: Use a custom live reload HTTP server for test/run instead
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -379,7 +379,7 @@ class IOSPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
@@ -813,7 +813,15 @@ class IOSPlatform extends PlatformTarget
}*/
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -267,7 +267,7 @@ class LinuxPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -445,7 +445,15 @@ class LinuxPlatform extends PlatformTarget
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -243,7 +243,7 @@ class MacPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -413,7 +413,15 @@ class MacPlatform extends PlatformTarget
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -304,7 +304,7 @@ class TVOSPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
@@ -612,7 +612,15 @@ class TVOSPlatform extends PlatformTarget
}*/
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}

View File

@@ -509,7 +509,7 @@ class WindowsPlatform extends PlatformTarget
return context;
}
private function getDisplayHXML():String
private function getDisplayHXML():HXML
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -1014,7 +1014,15 @@ class WindowsPlatform extends PlatformTarget
public override function watch():Void
{
var dirs = []; // WatchHelper.processHXML (getDisplayHXML (), project.app.path);
var hxml = getDisplayHXML();
var dirs = hxml.getClassPaths(true);
var outputPath = Path.combine(Sys.getCwd(), project.app.path);
dirs = dirs.filter(function(dir)
{
return (!Path.startsWith(dir, outputPath));
});
var command = ProjectHelper.getCurrentCommand();
System.watch(command, dirs);
}