From 8c97a5c6763d78ebfea60434c3614c51e2465f16 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Sat, 14 Jan 2017 17:00:59 -0800 Subject: [PATCH] Add support for --no-output (resolve #525) --- lime/project/PlatformTarget.hx | 11 +++++++++++ lime/tools/platforms/AndroidPlatform.hx | 5 +++++ lime/tools/platforms/BlackBerryPlatform.hx | 2 ++ lime/tools/platforms/EmscriptenPlatform.hx | 3 +++ lime/tools/platforms/HTML5Platform.hx | 2 ++ lime/tools/platforms/IOSPlatform.hx | 2 ++ lime/tools/platforms/LinuxPlatform.hx | 8 ++++++++ lime/tools/platforms/MacPlatform.hx | 18 ++++++++++++++++++ lime/tools/platforms/TVOSPlatform.hx | 2 ++ lime/tools/platforms/TizenPlatform.hx | 2 ++ lime/tools/platforms/WebOSPlatform.hx | 3 +++ lime/tools/platforms/WindowsPlatform.hx | 14 ++++++++++++++ 12 files changed, 72 insertions(+) diff --git a/lime/project/PlatformTarget.hx b/lime/project/PlatformTarget.hx index 9d7b0a3c1..41ac1529b 100644 --- a/lime/project/PlatformTarget.hx +++ b/lime/project/PlatformTarget.hx @@ -13,6 +13,7 @@ class PlatformTarget { public var additionalArguments:Array; public var buildType:String; public var command:String; + public var noOutput:Bool; public var project:HXProject; public var targetDirectory:String; public var targetFlags:Map; @@ -41,6 +42,16 @@ class PlatformTarget { } + for (haxeflag in project.haxeflags) { + + if (haxeflag == "--no-output") { + + noOutput = true; + + } + + } + } diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx index 40724322b..8369de636 100644 --- a/lime/tools/platforms/AndroidPlatform.hx +++ b/lime/tools/platforms/AndroidPlatform.hx @@ -112,6 +112,9 @@ class AndroidPlatform extends PlatformTarget { } ProcessHelper.runCommand ("", "haxe", haxeParams); + + if (noOutput) return; + CPPHelper.compile (project, targetDirectory + "/obj", cppParams); FileHelper.copyIfNewer (targetDirectory + "/obj/libApplicationMain" + (project.debug ? "-debug" : "") + suffix, path + "/libApplicationMain.so"); @@ -138,6 +141,8 @@ class AndroidPlatform extends PlatformTarget { } + if (noOutput) return; + AndroidHelper.build (project, destination); } diff --git a/lime/tools/platforms/BlackBerryPlatform.hx b/lime/tools/platforms/BlackBerryPlatform.hx index afaa21151..5d1c14cbc 100644 --- a/lime/tools/platforms/BlackBerryPlatform.hx +++ b/lime/tools/platforms/BlackBerryPlatform.hx @@ -71,6 +71,8 @@ class BlackBerryPlatform extends PlatformTarget { } + if (project.targetFlags.exists ("no-output")) return; + if (!project.targetFlags.exists ("html5")) { var destination = targetDirectory + "/bin/"; diff --git a/lime/tools/platforms/EmscriptenPlatform.hx b/lime/tools/platforms/EmscriptenPlatform.hx index c920a476b..d9b9c7b47 100644 --- a/lime/tools/platforms/EmscriptenPlatform.hx +++ b/lime/tools/platforms/EmscriptenPlatform.hx @@ -41,6 +41,9 @@ class EmscriptenPlatform extends PlatformTarget { var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link" ] ); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", [ "-Demscripten", "-Dwebgl", "-Dstatic_link" ]); if (project.environment.exists ("EMSCRIPTEN_SDK")) { diff --git a/lime/tools/platforms/HTML5Platform.hx b/lime/tools/platforms/HTML5Platform.hx index 6efe77783..518ebe27d 100644 --- a/lime/tools/platforms/HTML5Platform.hx +++ b/lime/tools/platforms/HTML5Platform.hx @@ -56,6 +56,8 @@ class HTML5Platform extends PlatformTarget { var hxml = targetDirectory + "/haxe/" + type + ".hxml"; ProcessHelper.runCommand ("", "haxe", [ hxml ] ); + if (project.targetFlags.exists ("no-output")) return; + if (project.targetFlags.exists ("webgl")) { FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain.js", outputFile); diff --git a/lime/tools/platforms/IOSPlatform.hx b/lime/tools/platforms/IOSPlatform.hx index 0a93d98d6..d31da9fc5 100644 --- a/lime/tools/platforms/IOSPlatform.hx +++ b/lime/tools/platforms/IOSPlatform.hx @@ -54,6 +54,8 @@ class IOSPlatform extends PlatformTarget { IOSHelper.build (project, targetDirectory); + if (project.targetFlags.exists ("no-output")) return; + if (!project.targetFlags.exists ("simulator")) { var entitlements = targetDirectory + "/" + project.app.file + "/" + project.app.file + "-Entitlements.plist"; diff --git a/lime/tools/platforms/LinuxPlatform.hx b/lime/tools/platforms/LinuxPlatform.hx index 194a26932..742e403b1 100644 --- a/lime/tools/platforms/LinuxPlatform.hx +++ b/lime/tools/platforms/LinuxPlatform.hx @@ -107,6 +107,8 @@ class LinuxPlatform extends PlatformTarget { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + if (project.targetFlags.exists ("no-output")) return; + if (isRaspberryPi) { NekoHelper.createExecutable (project.templatePaths, "rpi", targetDirectory + "/obj/ApplicationMain.n", executablePath); @@ -141,6 +143,9 @@ class LinuxPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static")) { ProcessHelper.runCommand ("", "haxe", haxeArgs); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags); FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), executablePath); @@ -148,6 +153,9 @@ class LinuxPlatform extends PlatformTarget { } else { ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml"); diff --git a/lime/tools/platforms/MacPlatform.hx b/lime/tools/platforms/MacPlatform.hx index 11f2008c1..893f9ca9e 100644 --- a/lime/tools/platforms/MacPlatform.hx +++ b/lime/tools/platforms/MacPlatform.hx @@ -103,6 +103,9 @@ class MacPlatform extends PlatformTarget { if (targetType == "neko") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + + if (project.targetFlags.exists ("no-output")) return; + NekoHelper.createExecutable (project.templatePaths, "mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory); @@ -111,6 +114,9 @@ class MacPlatform extends PlatformTarget { var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/"); ProcessHelper.runCommand ("", "haxe", [ hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar" ]); + + if (project.targetFlags.exists ("no-output")) return; + ProcessHelper.runCommand (targetDirectory + "/obj", "haxelib", [ "run", "hxjava", "hxjava_build.txt", "--haxe-version", "3103" ]); FileHelper.recursiveCopy (targetDirectory + "/obj/lib", PathHelper.combine (executableDirectory, "lib")); FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", PathHelper.combine (executableDirectory, project.app.file + ".jar")); @@ -119,12 +125,18 @@ class MacPlatform extends PlatformTarget { } else if (targetType == "nodejs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + + if (project.targetFlags.exists ("no-output")) return; + //NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory); } else if (targetType == "cs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + + if (project.targetFlags.exists ("no-output")) return; + CSHelper.copySourceFiles (project.templatePaths, targetDirectory + "/obj/src"); var txtPath = targetDirectory + "/obj/hxcs_build.txt"; CSHelper.addSourceFiles (txtPath, CSHelper.ndllSourceFiles); @@ -149,6 +161,9 @@ class MacPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static")) { ProcessHelper.runCommand ("", "haxe", haxeArgs); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags); FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), executablePath); @@ -156,6 +171,9 @@ class MacPlatform extends PlatformTarget { } else { ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml"); diff --git a/lime/tools/platforms/TVOSPlatform.hx b/lime/tools/platforms/TVOSPlatform.hx index 090e3facf..8cb7a8199 100644 --- a/lime/tools/platforms/TVOSPlatform.hx +++ b/lime/tools/platforms/TVOSPlatform.hx @@ -54,6 +54,8 @@ class TVOSPlatform extends PlatformTarget { TVOSHelper.build (project, targetDirectory); + if (project.targetFlags.exists ("no-output")) return; + if (!project.targetFlags.exists ("simulator")) { var entitlements = targetDirectory + "/" + project.app.file + "/" + project.app.file + "-Entitlements.plist"; diff --git a/lime/tools/platforms/TizenPlatform.hx b/lime/tools/platforms/TizenPlatform.hx index 0fd23b431..89f00a8db 100644 --- a/lime/tools/platforms/TizenPlatform.hx +++ b/lime/tools/platforms/TizenPlatform.hx @@ -56,6 +56,8 @@ class TizenPlatform extends PlatformTarget { ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "tizen" ] ); + if (project.targetFlags.exists ("no-output")) return; + var args = [ "-Dtizen", "-DAPP_ID=" + TizenHelper.getUUID (project) ]; if (project.targetFlags.exists ("simulator")) { diff --git a/lime/tools/platforms/WebOSPlatform.hx b/lime/tools/platforms/WebOSPlatform.hx index 0f60d3019..7727bddb5 100644 --- a/lime/tools/platforms/WebOSPlatform.hx +++ b/lime/tools/platforms/WebOSPlatform.hx @@ -43,6 +43,9 @@ class WebOSPlatform extends PlatformTarget { } ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "webos", "-D", "HXCPP_LOAD_DEBUG", "-D", "HXCPP_RTLD_LAZY" ] ); + + if (project.targetFlags.exists ("no-output")) return; + CPPHelper.compile (project, targetDirectory + "/obj", [ "-Dwebos", "-DHXCPP_LOAD_DEBUG", "-DHXCPP_RTLD_LAZY" ]); FileHelper.copyIfNewer (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), targetDirectory + "/bin/" + project.app.file); diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx index e861e2a31..bf7b152aa 100644 --- a/lime/tools/platforms/WindowsPlatform.hx +++ b/lime/tools/platforms/WindowsPlatform.hx @@ -105,6 +105,8 @@ class WindowsPlatform extends PlatformTarget { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + if (noOutput) return; + var iconPath = PathHelper.combine (applicationDirectory, "icon.ico"); if (!IconHelper.createWindowsIcon (icons, iconPath)) { @@ -119,12 +121,18 @@ class WindowsPlatform extends PlatformTarget { } else if (targetType == "nodejs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + + if (noOutput) return; + //NekoHelper.createExecutable (project.templatePaths, "windows", targetDirectory + "/obj/ApplicationMain.n", executablePath); NekoHelper.copyLibraries (project.templatePaths, "windows", applicationDirectory); } else if (targetType == "cs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); + + if (noOutput) return; + CSHelper.copySourceFiles (project.templatePaths, targetDirectory + "/obj/src"); var txtPath = targetDirectory + "/obj/hxcs_build.txt"; CSHelper.addSourceFiles (txtPath, CSHelper.ndllSourceFiles); @@ -149,6 +157,9 @@ class WindowsPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static")) { ProcessHelper.runCommand ("", "haxe", haxeArgs); + + if (noOutput) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags); FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : "") + ".exe", executablePath); @@ -156,6 +167,9 @@ class WindowsPlatform extends PlatformTarget { } else { ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); + + if (noOutput) return; + CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml");