Unify PlatformTarget.watch().
The implementation was copy-pasted, so it makes more sense to have only a single copy. `HTML5Platform` added a comment about possible future changes, so I kept that. Future changes will still be possible by overriding the function.
This commit is contained in:
@@ -173,7 +173,25 @@ class PlatformTarget
|
|||||||
|
|
||||||
@ignore public function update():Void {}
|
@ignore public function update():Void {}
|
||||||
|
|
||||||
@ignore public function watch():Void {}
|
public function watch():Void
|
||||||
|
{
|
||||||
|
var hxml = getDisplayHXML();
|
||||||
|
if (hxml == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
// Common functionality used by subclasses
|
// Common functionality used by subclasses
|
||||||
|
|
||||||
@@ -217,6 +235,8 @@ class PlatformTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getDisplayHXML():HXML { return null; }
|
||||||
|
|
||||||
// Functions to track and delete stale files
|
// Functions to track and delete stale files
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -392,4 +392,6 @@ class AIRPlatform extends FlashPlatform
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ignore public override function rebuild():Void {}
|
@ignore public override function rebuild():Void {}
|
||||||
|
|
||||||
|
@ignore public override function watch():Void {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class AndroidPlatform extends PlatformTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -630,19 +630,4 @@ class AndroidPlatform extends PlatformTarget
|
|||||||
|
|
||||||
copyProjectAssets(destination, sourceSet + "/assets/");
|
copyProjectAssets(destination, sourceSet + "/assets/");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class FlashPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -333,20 +333,6 @@ class FlashPlatform extends PlatformTarget
|
|||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class HTML5Platform extends PlatformTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -583,17 +583,7 @@ class HTML5Platform extends PlatformTarget
|
|||||||
{
|
{
|
||||||
// TODO: Use a custom live reload HTTP server for test/run instead
|
// TODO: Use a custom live reload HTTP server for test/run instead
|
||||||
|
|
||||||
var hxml = getDisplayHXML();
|
super.watch();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ class IOSPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
||||||
|
|
||||||
@@ -873,20 +873,6 @@ class IOSPlatform extends PlatformTarget
|
|||||||
context.HAS_LAUNCH_IMAGE = has_launch_image;
|
context.HAS_LAUNCH_IMAGE = has_launch_image;
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class LinuxPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -598,21 +598,6 @@ class LinuxPlatform extends PlatformTarget
|
|||||||
copyProjectAssets(applicationDirectory);
|
copyProjectAssets(applicationDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
@ignore public override function trace():Void {}
|
@ignore public override function trace():Void {}
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ class MacPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -576,21 +576,6 @@ class MacPlatform extends PlatformTarget
|
|||||||
copyProjectAssets(targetDirectory, contentDirectory);
|
copyProjectAssets(targetDirectory, contentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
@ignore public override function trace():Void {}
|
@ignore public override function trace():Void {}
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ class TVOSPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
||||||
|
|
||||||
@@ -644,20 +644,6 @@ class TVOSPlatform extends PlatformTarget
|
|||||||
context.HAS_LAUNCH_IMAGE = has_launch_image;
|
context.HAS_LAUNCH_IMAGE = has_launch_image;
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
|
|||||||
@@ -261,4 +261,6 @@ class TizenPlatform extends PlatformTarget
|
|||||||
@ignore public override function install():Void {}
|
@ignore public override function install():Void {}
|
||||||
|
|
||||||
@ignore public override function uninstall():Void {}
|
@ignore public override function uninstall():Void {}
|
||||||
|
|
||||||
|
@ignore public override function watch():Void {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ class WebAssemblyPlatform extends PlatformTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -484,4 +484,6 @@ class WebAssemblyPlatform extends PlatformTarget
|
|||||||
@ignore public override function trace():Void {}
|
@ignore public override function trace():Void {}
|
||||||
|
|
||||||
@ignore public override function uninstall():Void {}
|
@ignore public override function uninstall():Void {}
|
||||||
|
|
||||||
|
@ignore public override function watch():Void {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ class WindowsPlatform extends PlatformTarget
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisplayHXML():HXML
|
private override function getDisplayHXML():HXML
|
||||||
{
|
{
|
||||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||||
|
|
||||||
@@ -1235,21 +1235,6 @@ class WindowsPlatform extends PlatformTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function watch():Void
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ignore public override function install ():Void {}
|
// @ignore public override function install ():Void {}
|
||||||
override public function install():Void
|
override public function install():Void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user