diff --git a/src/lime/tools/AIRHelper.hx b/src/lime/tools/AIRHelper.hx index 4aba3f209..55cf414bc 100644 --- a/src/lime/tools/AIRHelper.hx +++ b/src/lime/tools/AIRHelper.hx @@ -8,7 +8,7 @@ import sys.FileSystem; class AIRHelper { - public static function build (project:Project, workingDirectory:String, targetPlatform:Platform, targetPath:String, applicationXML:String, files:Array, fileDirectory:String = null):String { + public static function build (project:HXProject, workingDirectory:String, targetPlatform:Platform, targetPath:String, applicationXML:String, files:Array, fileDirectory:String = null):String { //var airTarget = "air"; //var extension = ".air"; @@ -207,7 +207,7 @@ class AIRHelper { } - public static function getExtDirs(project:Project):Array { + public static function getExtDirs(project:HXProject):Array { var extDirs:Array = []; @@ -228,7 +228,7 @@ class AIRHelper { } - public static function run (project:Project, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null):Void { + public static function run (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null):Void { if (targetPlatform == ANDROID) { @@ -315,7 +315,7 @@ class AIRHelper { } - public static function trace (project:Project, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { + public static function trace (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { if (targetPlatform == ANDROID) { @@ -344,7 +344,7 @@ class AIRHelper { } - public static function uninstall (project:Project, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { + public static function uninstall (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { if (targetPlatform == ANDROID) { diff --git a/src/lime/tools/AndroidHelper.hx b/src/lime/tools/AndroidHelper.hx index cdd20112e..b22274e60 100644 --- a/src/lime/tools/AndroidHelper.hx +++ b/src/lime/tools/AndroidHelper.hx @@ -17,7 +17,7 @@ class AndroidHelper { private static var emulatorPath:String; - public static function build (project:Project, projectDirectory:String):Void { + public static function build (project:HXProject, projectDirectory:String):Void { if (project.environment.exists ("ANDROID_SDK")) { @@ -79,7 +79,7 @@ class AndroidHelper { } - public static function getBuildToolsVersion (project:Project):String { + public static function getBuildToolsVersion (project:HXProject):String { var buildToolsPath = Path.combine (project.environment.get ("ANDROID_SDK"), "build-tools/"); @@ -186,7 +186,7 @@ class AndroidHelper { } - public static function initialize (project:Project):Void { + public static function initialize (project:HXProject):Void { adbPath = project.environment.get ("ANDROID_SDK") + "/tools/"; androidPath = project.environment.get ("ANDROID_SDK") + "/tools/"; @@ -227,7 +227,7 @@ class AndroidHelper { } - public static function install (project:Project, targetPath:String, deviceID:String = null):String { + public static function install (project:HXProject, targetPath:String, deviceID:String = null):String { if (project.targetFlags.exists ("emulator") || project.targetFlags.exists ("simulator")) { @@ -410,7 +410,7 @@ class AndroidHelper { } - public static function trace (project:Project, debug:Bool, deviceID:String = null, customFilter:String = null):Void { + public static function trace (project:HXProject, debug:Bool, deviceID:String = null, customFilter:String = null):Void { // Use -DFULL_LOGCAT or if you do not want to filter log messages diff --git a/src/lime/tools/AssetHelper.hx b/src/lime/tools/AssetHelper.hx index 98961afb5..db98311db 100644 --- a/src/lime/tools/AssetHelper.hx +++ b/src/lime/tools/AssetHelper.hx @@ -6,7 +6,7 @@ import haxe.Unserializer; import hxp.*; import lime.tools.AssetType; import lime.tools.Asset; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Library; import lime.utils.AssetManifest; import lime.utils.Bytes; @@ -161,7 +161,7 @@ class AssetHelper { } - public static function createManifest (project:Project, library:String = null, targetPath:String = null):AssetManifest { + public static function createManifest (project:HXProject, library:String = null, targetPath:String = null):AssetManifest { var manifest = new AssetManifest (); var pathGroups = new Map> (); @@ -202,7 +202,7 @@ class AssetHelper { } - public static function createManifests (project:Project, targetDirectory:String = null):Array { + public static function createManifests (project:HXProject, targetDirectory:String = null):Array { var libraryNames = new Map (); var hasManifest = new Map (); @@ -266,7 +266,7 @@ class AssetHelper { } - private static function getAssetData (project:Project, pathGroups:Map>, libraries:Map, library:String, asset:Asset):Dynamic { + private static function getAssetData (project:HXProject, pathGroups:Map>, libraries:Map, library:String, asset:Asset):Dynamic { if ((asset.library != null && asset.library != library) || asset.type == TEMPLATE) return null; if (asset.library == null && library != DEFAULT_LIBRARY_NAME) return null; @@ -369,7 +369,7 @@ class AssetHelper { } - private static function getPackedAssetData (project:Project, output:FileOutput, pathGroups:Map>, libraries:Map, library:Library, asset:Asset):Dynamic { + private static function getPackedAssetData (project:HXProject, output:FileOutput, pathGroups:Map>, libraries:Map, library:Library, asset:Asset):Dynamic { if (project.target == HTML5 && (asset.type == MUSIC || asset.type == SOUND || asset.type == FONT)) { @@ -480,7 +480,7 @@ class AssetHelper { } - private static function isPackedLibrary (project:Project, library:Library) { + private static function isPackedLibrary (project:HXProject, library:Library) { if (project.target == FLASH && library.embed != false) return false; @@ -494,7 +494,7 @@ class AssetHelper { } - public static function processLibraries (project:Project, targetDirectory:String = null):Void { + public static function processLibraries (project:HXProject, targetDirectory:String = null):Void { var hasManifest = new Map (); var libraryMap = new Map (); @@ -619,7 +619,7 @@ class AssetHelper { try { var output = File.getContent (outputFile); - var data:Project = Unserializer.run (output); + var data:HXProject = Unserializer.run (output); project.merge (data); } catch (e:Dynamic) { @@ -708,7 +708,7 @@ class AssetHelper { } - public static function processPackedLibraries (project:Project, targetDirectory:String = null):Void { + public static function processPackedLibraries (project:HXProject, targetDirectory:String = null):Void { var type, asset, cacheAvailable, cacheDirectory, filename; var output, manifest, position, assetData:Dynamic, input; diff --git a/src/lime/tools/CPPHelper.hx b/src/lime/tools/CPPHelper.hx index d2e2bb5c9..c47456124 100644 --- a/src/lime/tools/CPPHelper.hx +++ b/src/lime/tools/CPPHelper.hx @@ -2,7 +2,7 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; import sys.io.File; import sys.FileSystem; @@ -15,7 +15,7 @@ class CPPHelper { private static var rebuiltPaths = new Map (); - public static function compile (project:Project, path:String, flags:Array = null, buildFile:String = "Build.xml"):Void { + public static function compile (project:HXProject, path:String, flags:Array = null, buildFile:String = "Build.xml"):Void { if (project.config.getBool ("cpp.requireBuild", true)) { @@ -143,7 +143,7 @@ class CPPHelper { } - public static function rebuild (project:Project, commands:Array>, path:String = null, buildFile:String = null):Void { + public static function rebuild (project:HXProject, commands:Array>, path:String = null, buildFile:String = null):Void { var buildRelease = (!project.targetFlags.exists ("debug")); var buildDebug = (project.targetFlags.exists ("debug") || @@ -159,11 +159,11 @@ class CPPHelper { var defines = MapTools.copy (project.defines); defines.set ("rebuild", "1"); - var haxelibProject = Project.fromHaxelib (haxelib, defines); + var haxelibProject = HXProject.fromHaxelib (haxelib, defines); if (haxelibProject == null) { - haxelibProject = new Project (); + haxelibProject = new HXProject (); haxelibProject.config.set ("project.rebuild.path", Path.combine (Haxelib.getPath (haxelib), "project")); } @@ -227,7 +227,7 @@ class CPPHelper { } - public static function rebuildSingle (project:Project, flags:Array = null, path:String = null, buildFile:String = null):Void { + public static function rebuildSingle (project:HXProject, flags:Array = null, path:String = null, buildFile:String = null):Void { if (path == null) { diff --git a/src/lime/tools/CSHelper.hx b/src/lime/tools/CSHelper.hx index e71a1615a..bda4aa39c 100644 --- a/src/lime/tools/CSHelper.hx +++ b/src/lime/tools/CSHelper.hx @@ -3,7 +3,7 @@ package lime.tools; import hxp.*; import lime.tools.Architecture; -import lime.tools.Project; +import lime.tools.HXProject; import sys.io.File; import sys.FileSystem; using StringTools; @@ -255,7 +255,7 @@ class CSHelper { } - public static function compile (project:Project, path:String, outPath:String, arch:String, platform:String, buildFile:String = "hxcs_build.txt", noCompile:Bool = false) { + public static function compile (project:HXProject, path:String, outPath:String, arch:String, platform:String, buildFile:String = "hxcs_build.txt", noCompile:Bool = false) { var args = [ "run", project.config.getString ("cs.buildLibrary", "hxcs"), buildFile, "--arch", arch, "--platform", platform, "--out", outPath, "--unsafe" ]; if (noCompile) diff --git a/src/lime/tools/ConfigHelper.hx b/src/lime/tools/ConfigHelper.hx index 7c0daf468..b5e0cf34b 100644 --- a/src/lime/tools/ConfigHelper.hx +++ b/src/lime/tools/ConfigHelper.hx @@ -2,7 +2,7 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; import lime.tools.ProjectXMLParser; import sys.io.File; @@ -16,7 +16,7 @@ class ConfigHelper { private static var configPath:String = null; - public static function getConfig ():Project { + public static function getConfig ():HXProject { var config = getConfigPath (); diff --git a/src/lime/tools/DeploymentHelper.hx b/src/lime/tools/DeploymentHelper.hx index c3ebd6f17..33c79cbbd 100644 --- a/src/lime/tools/DeploymentHelper.hx +++ b/src/lime/tools/DeploymentHelper.hx @@ -2,13 +2,13 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; class DeploymentHelper { - public static function deploy (project:Project, targetFlags:Map, targetDirectory:String, targetName:String) { + public static function deploy (project:HXProject, targetFlags:Map, targetDirectory:String, targetName:String) { var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ") (" + targetName + ").zip"; var targetPath = Path.combine (targetDirectory + "/dist", name); diff --git a/src/lime/tools/ElectronHelper.hx b/src/lime/tools/ElectronHelper.hx index abe343e42..f5feab0bf 100644 --- a/src/lime/tools/ElectronHelper.hx +++ b/src/lime/tools/ElectronHelper.hx @@ -2,13 +2,13 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; class ElectronHelper { - public static function launch (project:Project, path:String):Void { + public static function launch (project:HXProject, path:String):Void { var electronPath = project.defines.get ("ELECTRON_PATH"); diff --git a/src/lime/tools/FlashHelper.hx b/src/lime/tools/FlashHelper.hx index 6da0bfa6c..815869a85 100644 --- a/src/lime/tools/FlashHelper.hx +++ b/src/lime/tools/FlashHelper.hx @@ -8,7 +8,7 @@ import hxp.*; import lime.tools.Asset; import lime.tools.AssetEncoding; import lime.tools.AssetType; -import lime.tools.Project; +import lime.tools.HXProject; #if (lime && lime_cffi && !macro) import lime.text.Font; #end @@ -614,7 +614,7 @@ class FlashHelper { } - private static function compileSWC (project:Project, assets:Array, id:Int, destination:String):Void { + private static function compileSWC (project:HXProject, assets:Array, id:Int, destination:String):Void { #if format destination = destination + "/obj"; @@ -726,7 +726,7 @@ class FlashHelper { } - /*private static function compileSWC (project:Project, embed:String, id:Int):Void { + /*private static function compileSWC (project:HXProject, embed:String, id:Int):Void { var destination = project.app.path + "/flash/obj"; System.mkdir (destination); @@ -773,7 +773,7 @@ class FlashHelper { }*/ - public static function embedAssets (project:Project, targetDirectory:String):Bool { + public static function embedAssets (project:HXProject, targetDirectory:String):Bool { var embed = ""; var assets = []; @@ -958,7 +958,7 @@ class FlashHelper { } - public static function run (project:Project, workingDirectory:String, targetPath:String):Void { + public static function run (project:HXProject, workingDirectory:String, targetPath:String):Void { var player:String = null; diff --git a/src/lime/tools/HTML5Helper.hx b/src/lime/tools/HTML5Helper.hx index c7f5133cd..68c7127a0 100644 --- a/src/lime/tools/HTML5Helper.hx +++ b/src/lime/tools/HTML5Helper.hx @@ -4,7 +4,7 @@ package lime.tools; import hxp.*; import lime.tools.Architecture; import lime.tools.Asset; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; import sys.FileSystem; import sys.io.File; @@ -44,7 +44,7 @@ class HTML5Helper { } - // public static function generateFontData (project:Project, font:Asset):String { + // public static function generateFontData (project:HXProject, font:Asset):String { // var sourcePath = font.sourcePath; @@ -60,7 +60,7 @@ class HTML5Helper { // } - public static function generateWebfonts (project:Project, font:Asset):Void { + public static function generateWebfonts (project:HXProject, font:Asset):Void { var suffix = switch (System.hostPlatform) { @@ -106,7 +106,7 @@ class HTML5Helper { } - public static function launch (project:Project, path:String, port:Int = 3000):Void { + public static function launch (project:HXProject, path:String, port:Int = 3000):Void { if (project.app.url != null && project.app.url != "") { @@ -187,7 +187,7 @@ class HTML5Helper { } - public static function minify (project:Project, sourceFile:String):Bool { + public static function minify (project:HXProject, sourceFile:String):Bool { if (FileSystem.exists (sourceFile)) { diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index f235f9c05..e52e95a83 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -7,7 +7,9 @@ import haxe.Json; import haxe.Serializer; import haxe.Unserializer; import hxp.*; +import lime.tools.Architecture; import lime.tools.AssetType; +import lime.tools.Platform; import sys.FileSystem; import sys.io.File; import sys.io.Process; @@ -18,16 +20,16 @@ import lime.text.Font; #end -class Project { +class HXProject extends Script { public var app:ApplicationData; public var architectures:Array; public var assets:Array; - public var command:String; + // public var command:String; public var config:ConfigData; public var debug:Bool; - public var defines:Map; + // public var defines:Map; public var dependencies:Array; public var environment:Map; public var haxedefs:Map; @@ -87,13 +89,13 @@ class Project { var inputData = Unserializer.run (File.getContent (args[0])); var outputFile = args[1]; - Project._command = inputData.command; - Project._target = cast inputData.target; - Project._debug = inputData.debug; - Project._targetFlags = inputData.targetFlags; - Project._templatePaths = inputData.templatePaths; - Project._userDefines = inputData.userDefines; - Project._environment = inputData.environment; + HXProject._command = inputData.command; + HXProject._target = cast inputData.target; + HXProject._debug = inputData.debug; + HXProject._targetFlags = inputData.targetFlags; + HXProject._templatePaths = inputData.templatePaths; + HXProject._userDefines = inputData.userDefines; + HXProject._environment = inputData.environment; Log.verbose = inputData.logVerbose; Log.enableColor = inputData.logEnableColor; @@ -119,6 +121,8 @@ class Project { public function new () { + super (); + initialize (); command = _command; @@ -229,7 +233,13 @@ class Project { } else { - architectures = [ System.hostArchitecture ]; + switch (System.hostArchitecture) { + case ARMV6: architectures = [ ARMV6 ]; + case ARMV7: architectures = [ ARMV7 ]; + case X86: architectures = [ X86 ]; + case X64: architectures = [ X64 ]; + default: architectures = []; + } } @@ -238,7 +248,13 @@ class Project { case MAC, LINUX: platformType = PlatformType.DESKTOP; - architectures = [ System.hostArchitecture ]; + switch (System.hostArchitecture) { + case ARMV6: architectures = [ ARMV6 ]; + case ARMV7: architectures = [ ARMV7 ]; + case X86: architectures = [ X86 ]; + case X64: architectures = [ X64 ]; + default: architectures = []; + } defaultWindow.allowHighDPI = false; @@ -269,7 +285,7 @@ class Project { } else { - defines = new Map (); + defines = new Map (); } @@ -305,9 +321,9 @@ class Project { } - public function clone ():Project { + public function clone ():HXProject { - var project = new Project (); + var project = new HXProject (); ObjectTools.copyFields (app, project.app); project.architectures = architectures.copy (); @@ -493,9 +509,9 @@ class Project { } - public static function fromFile (projectFile:String, userDefines:Map = null, includePaths:Array = null):Project { + public static function fromFile (projectFile:String, userDefines:Map = null, includePaths:Array = null):HXProject { - var project:Project = null; + var project:HXProject = null; var path = FileSystem.fullPath (Path.withoutDirectory (projectFile)); var name = Path.withoutDirectory (Path.withoutExtension (projectFile)); @@ -508,9 +524,9 @@ class Project { System.copyFile (path, classFile); #if lime - var args = [ name, "-main", "lime.tools.Project", "-cp", tempDirectory, "-neko", nekoOutput, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src"), "-lib", "hxp" ]; + var args = [ name, "-main", "lime.tools.HXProject", "-cp", tempDirectory, "-neko", nekoOutput, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src"), "-lib", "lime", "-lib", "hxp" ]; #else - var args = [ name, "--interp", "-main", "lime.tools.Project", "-cp", tempDirectory, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src") ]; + var args = [ name, "--interp", "-main", "lime.tools.HXProject", "-cp", tempDirectory, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src") ]; #end var input = File.read (classFile, false); var tag = "@:compiler("; @@ -545,14 +561,14 @@ class Project { var inputData = Serializer.run ({ - command: Project._command, + command: HXProject._command, name: name, - target: Project._target, - debug: Project._debug, - targetFlags: Project._targetFlags, - templatePaths: Project._templatePaths, - userDefines: Project._userDefines, - environment: Project._environment, + target: HXProject._target, + debug: HXProject._debug, + targetFlags: HXProject._targetFlags, + templatePaths: HXProject._templatePaths, + userDefines: HXProject._userDefines, + environment: HXProject._environment, logVerbose: Log.verbose, logEnableColor: Log.enableColor, processDryRun: cacheDryRun, @@ -615,7 +631,7 @@ class Project { } - var defines = MapTools.copy (userDefines); + var defines = MapTools.copyDynamic (userDefines); MapTools.copyKeys (project.defines, defines); processHaxelibs (project, defines); @@ -629,7 +645,7 @@ class Project { } - public static function fromHaxelib (haxelib:Haxelib, userDefines:Map = null, clearCache:Bool = false):Project { + public static function fromHaxelib (haxelib:Haxelib, userDefines:Map = null, clearCache:Bool = false):HXProject { if (haxelib.name == null || haxelib.name == "") { @@ -651,12 +667,12 @@ class Project { // //} - return Project.fromPath (path, userDefines); + return HXProject.fromPath (path, userDefines); } - public static function fromPath (path:String, userDefines:Map = null):Project { + public static function fromPath (path:String, userDefines:Map = null):HXProject { if (!FileSystem.exists (path) || !FileSystem.isDirectory (path)) { @@ -823,7 +839,7 @@ class Project { if (_target == null) { - _target = System.hostPlatform; + _target = cast System.hostPlatform; } @@ -846,7 +862,7 @@ class Project { } - public function merge (project:Project):Void { + public function merge (project:HXProject):Void { if (project != null) { @@ -869,7 +885,7 @@ class Project { MapTools.copyUniqueKeys (project.defines, defines); MapTools.copyUniqueKeys (project.environment, environment); - MapTools.copyUniqueKeys (project.haxedefs, haxedefs); + MapTools.copyUniqueKeysDynamic (project.haxedefs, haxedefs); MapTools.copyUniqueKeys (project.libraryHandlers, libraryHandlers); MapTools.copyUniqueKeys (project.targetHandlers, targetHandlers); @@ -963,7 +979,7 @@ class Project { // #if lime - @:noCompletion private static function processHaxelibs (project:Project, userDefines:Map):Void { + @:noCompletion private static function processHaxelibs (project:HXProject, userDefines:Map):Void { var haxelibs = project.haxelibs.copy (); project.haxelibs = []; @@ -973,7 +989,7 @@ class Project { var validatePath = Haxelib.getPath (haxelib, true); project.haxelibs.push (haxelib); - var includeProject = Project.fromHaxelib (haxelib, userDefines); + var includeProject = HXProject.fromHaxelib (haxelib, userDefines); if (includeProject != null) { @@ -1002,7 +1018,7 @@ class Project { if (type == null) { - return Project; + return HXProject; } else { @@ -1070,7 +1086,7 @@ class Project { private function get_host ():Platform { - return System.hostPlatform; + return cast System.hostPlatform; } diff --git a/src/lime/tools/IOSHelper.hx b/src/lime/tools/IOSHelper.hx index cf9d10eea..bf71d9cd0 100644 --- a/src/lime/tools/IOSHelper.hx +++ b/src/lime/tools/IOSHelper.hx @@ -3,7 +3,7 @@ package lime.tools; import hxp.*; import lime.tools.Platform; -import lime.tools.Project; +import lime.tools.HXProject; import sys.io.Process; import sys.FileSystem; @@ -14,7 +14,7 @@ class IOSHelper { private static var initialized = false; - public static function build (project:Project, workingDirectory:String, additionalArguments:Array = null):Void { + public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array = null):Void { initialize (project); @@ -48,7 +48,7 @@ class IOSHelper { } - public static function deploy (project:Project, workingDirectory:String):Void { + public static function deploy (project:HXProject, workingDirectory:String):Void { initialize (project); @@ -97,7 +97,7 @@ class IOSHelper { } - private static function getXCodeArgs (project:Project):Array { + private static function getXCodeArgs (project:HXProject):Array { var platformName = "iphoneos"; var iphoneVersion = project.environment.get ("IPHONE_VER"); @@ -177,7 +177,7 @@ class IOSHelper { } - public static function getSDKDirectory (project:Project):String { + public static function getSDKDirectory (project:HXProject):String { initialize (project); @@ -205,7 +205,7 @@ class IOSHelper { } - public static function getIOSVersion (project:Project):Void { + public static function getIOSVersion (project:HXProject):Void { if (!project.environment.exists ("IPHONE_VER") || project.environment.get ("IPHONE_VER") == "4.2") { @@ -265,7 +265,7 @@ class IOSHelper { } - public static function getProvisioningFile (project:Project = null):String { + public static function getProvisioningFile (project:HXProject = null):String { if (project != null && project.config.exists ("ios.provisioning-profile")) { @@ -303,7 +303,7 @@ class IOSHelper { } - private static function initialize (project:Project):Void { + private static function initialize (project:HXProject):Void { if (!initialized) { @@ -316,7 +316,7 @@ class IOSHelper { } - public static function launch (project:Project, workingDirectory:String):Void { + public static function launch (project:HXProject, workingDirectory:String):Void { initialize (project); @@ -388,7 +388,7 @@ class IOSHelper { } - public static function sign (project:Project, workingDirectory:String):Void { + public static function sign (project:HXProject, workingDirectory:String):Void { initialize (project); diff --git a/src/lime/tools/ModuleHelper.hx b/src/lime/tools/ModuleHelper.hx index f9dcaf860..4a3240e6a 100644 --- a/src/lime/tools/ModuleHelper.hx +++ b/src/lime/tools/ModuleHelper.hx @@ -3,7 +3,7 @@ package lime.tools; #if !macro import hxp.*; import lime.tools.Dependency; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ModuleData; import sys.io.File; import sys.FileSystem; @@ -36,7 +36,7 @@ class ModuleHelper { } - public static function buildModules (project:Project, tempDirectory:String, outputDirectory:String):Void { + public static function buildModules (project:HXProject, tempDirectory:String, outputDirectory:String):Void { tempDirectory = Path.combine (tempDirectory, "lib"); outputDirectory = Path.combine (outputDirectory, "lib"); @@ -210,7 +210,7 @@ class ModuleHelper { } - public static function updateProject (project:Project):Void { + public static function updateProject (project:HXProject):Void { var excludeTypes = []; var suffix = (project.targetFlags.exists ("final") ? ".min" : "") + ".js"; diff --git a/src/lime/tools/NodeJSHelper.hx b/src/lime/tools/NodeJSHelper.hx index fd7aa9f74..8725b20e1 100644 --- a/src/lime/tools/NodeJSHelper.hx +++ b/src/lime/tools/NodeJSHelper.hx @@ -3,14 +3,14 @@ package lime.tools; import hxp.*; import lime.tools.Architecture; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; class NodeJSHelper { - public static function run (project:Project, modulePath:String, args:Array = null):Void { + public static function run (project:HXProject, modulePath:String, args:Array = null):Void { /*var suffix = switch (System.hostPlatform) { diff --git a/src/lime/tools/PlatformTarget.hx b/src/lime/tools/PlatformTarget.hx index 17a12a411..a4f94f8a8 100644 --- a/src/lime/tools/PlatformTarget.hx +++ b/src/lime/tools/PlatformTarget.hx @@ -14,13 +14,13 @@ class PlatformTarget { public var buildType:String; public var command:String; public var noOutput:Bool; - public var project:Project; + public var project:HXProject; public var targetDirectory:String; public var targetFlags:Map; public var traceEnabled = true; - public function new (command:String = null, project:Project = null, targetFlags:Map = null) { + public function new (command:String = null, project:HXProject = null, targetFlags:Map = null) { this.command = command; this.project = project; diff --git a/src/lime/tools/PlatformTargetMain.hx b/src/lime/tools/PlatformTargetMain.hx index 033565e6a..3d87eb14d 100644 --- a/src/lime/tools/PlatformTargetMain.hx +++ b/src/lime/tools/PlatformTargetMain.hx @@ -4,7 +4,7 @@ package lime.tools; import haxe.Unserializer; import hxp.*; import lime.tools.Architecture; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; import sys.io.File; import sys.io.Process; @@ -136,7 +136,7 @@ class PlatformTargetMain { var unserializer = new Unserializer (projectData); unserializer.setResolver (cast { resolveEnum: Type.resolveEnum, resolveClass: resolveClass }); - var project:Project = unserializer.unserialize (); + var project:HXProject = unserializer.unserialize (); var platform = Type.createInstance (classRef, [ command, project, project.targetFlags ]); platform.traceEnabled = traceEnabled; @@ -159,7 +159,7 @@ class PlatformTargetMain { if (result == null) { - result = Project; + result = HXProject; } diff --git a/src/lime/tools/Project.hx b/src/lime/tools/Project.hx deleted file mode 100644 index e3c7e4ccb..000000000 --- a/src/lime/tools/Project.hx +++ /dev/null @@ -1,1588 +0,0 @@ -package lime.tools; - - -import haxe.io.Eof; -import haxe.xml.Fast; -import haxe.Json; -import haxe.Serializer; -import haxe.Unserializer; -import hxp.*; -import lime.tools.Architecture; -import lime.tools.AssetType; -import lime.tools.Platform; -import sys.FileSystem; -import sys.io.File; -import sys.io.Process; - -#if (lime && lime_cffi && !macro) -import lime.text.Font; -@:access(lime.text.Font) -#end - - -class Project extends Script { - - - public var app:ApplicationData; - public var architectures:Array; - public var assets:Array; - // public var command:String; - public var config:ConfigData; - public var debug:Bool; - // public var defines:Map; - public var dependencies:Array; - public var environment:Map; - public var haxedefs:Map; - public var haxeflags:Array; - public var haxelibs:Array; - public var host (get_host, null):Platform; - public var icons:Array; - public var javaPaths:Array; - public var keystore:Keystore; - public var languages:Array; - public var libraries:Array; - public var libraryHandlers:Map; - public var meta:MetaData; - public var modules:Map; - public var ndlls:Array; - public var platformType:PlatformType; - public var postBuildCallbacks:Array; - public var preBuildCallbacks:Array; - public var samplePaths:Array; - public var sources:Array; - public var splashScreens:Array; - public var target:Platform; - public var targetFlags:Map; - public var targetHandlers:Map; - public var templateContext (get_templateContext, null):Dynamic; - public var templatePaths:Array; - @:isVar public var window (get, set):WindowData; - public var windows:Array; - - private var defaultApp:ApplicationData; - private var defaultArchitectures:Array; - private var defaultMeta:MetaData; - private var defaultWindow:WindowData; - private var needRerun:Bool; - - public static var _command:String; - public static var _debug:Bool; - public static var _environment:Map; - public static var _target:Platform; - public static var _targetFlags:Map; - public static var _templatePaths:Array; - public static var _userDefines:Map; - - private static var initialized:Bool; - - - public static function main () { - - var args = Sys.args (); - - if (args.length < 2) { - - return; - - } - - var inputData = Unserializer.run (File.getContent (args[0])); - var outputFile = args[1]; - - Project._command = inputData.command; - Project._target = cast inputData.target; - Project._debug = inputData.debug; - Project._targetFlags = inputData.targetFlags; - Project._templatePaths = inputData.templatePaths; - Project._userDefines = inputData.userDefines; - Project._environment = inputData.environment; - Log.verbose = inputData.logVerbose; - Log.enableColor = inputData.logEnableColor; - - #if lime - System.dryRun = inputData.processDryRun; - #end - - Haxelib.debug = inputData.haxelibDebug; - - initialize (); - - var classRef = Type.resolveClass (inputData.name); - var instance = Type.createInstance (classRef, []); - - var serializer = new Serializer (); - serializer.useCache = true; - serializer.serialize (instance); - - File.saveContent (outputFile, serializer.toString ()); - - } - - - public function new () { - - super (); - - initialize (); - - command = _command; - config = new ConfigData (); - debug = _debug; - target = _target; - targetFlags = MapTools.copy (_targetFlags); - templatePaths = _templatePaths.copy (); - - defaultMeta = { title: "MyApplication", description: "", packageName: "com.example.myapp", version: "1.0.0", company: "", companyUrl: "", buildNumber: null, companyId: "" } - defaultApp = { main: "Main", file: "MyApplication", path: "bin", preloader: "", swfVersion: 17, url: "", init: null } - defaultWindow = { width: 800, height: 600, parameters: "{}", background: 0xFFFFFF, fps: 30, hardware: true, display: 0, resizable: true, borderless: false, orientation: Orientation.AUTO, vsync: false, fullscreen: false, allowHighDPI: true, alwaysOnTop: false, antialiasing: 0, allowShaders: true, requireShaders: false, depthBuffer: true, stencilBuffer: true, colorDepth: 32, maximized: false, minimized: false, hidden: false } - - platformType = PlatformType.DESKTOP; - architectures = []; - - switch (target) { - - case AIR: - - if (targetFlags.exists ("ios") || targetFlags.exists ("android")) { - - platformType = PlatformType.MOBILE; - - defaultWindow.width = 0; - defaultWindow.height = 0; - - } else { - - platformType = PlatformType.DESKTOP; - - } - - architectures = []; - - case FLASH: - - platformType = PlatformType.WEB; - architectures = []; - - case HTML5, FIREFOX: - - platformType = PlatformType.WEB; - architectures = []; - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - defaultWindow.allowHighDPI = false; - - case EMSCRIPTEN: - - platformType = PlatformType.WEB; - architectures = []; - - defaultWindow.fps = 60; - defaultWindow.allowHighDPI = false; - - case ANDROID, BLACKBERRY, IOS, TIZEN, WEBOS, TVOS: - - platformType = PlatformType.MOBILE; - - if (target == Platform.IOS) { - - architectures = [ Architecture.ARMV7, Architecture.ARM64 ]; - - } else if (target == Platform.ANDROID) { - - if (targetFlags.exists ("simulator") || targetFlags.exists ("emulator")) { - - architectures = [ Architecture.X86 ]; - - } else { - - architectures = [ Architecture.ARMV7 ]; - - } - - } else if (target == Platform.TVOS) { - - architectures = [ Architecture.ARM64 ]; - - } else { - - architectures = [ Architecture.ARMV6 ]; - - } - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fullscreen = true; - defaultWindow.requireShaders = true; - - case WINDOWS: - - platformType = PlatformType.DESKTOP; - - if (targetFlags.exists ("uwp") || targetFlags.exists ("winjs")) { - - architectures = []; - - targetFlags.set ("uwp", ""); - targetFlags.set ("winjs", ""); - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - - } else { - - switch (System.hostArchitecture) { - case ARMV6: architectures = [ ARMV6 ]; - case ARMV7: architectures = [ ARMV7 ]; - case X86: architectures = [ X86 ]; - case X64: architectures = [ X64 ]; - default: architectures = []; - } - - } - - defaultWindow.allowHighDPI = false; - - case MAC, LINUX: - - platformType = PlatformType.DESKTOP; - switch (System.hostArchitecture) { - case ARMV6: architectures = [ ARMV6 ]; - case ARMV7: architectures = [ ARMV7 ]; - case X86: architectures = [ X86 ]; - case X64: architectures = [ X64 ]; - default: architectures = []; - } - - defaultWindow.allowHighDPI = false; - - default: - - // TODO: Better handling of platform type for pluggable targets - - platformType = PlatformType.CONSOLE; - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - defaultWindow.fullscreen = true; - - } - - defaultArchitectures = architectures.copy (); - - meta = ObjectTools.copyFields (defaultMeta, {}); - app = ObjectTools.copyFields (defaultApp, {}); - window = ObjectTools.copyFields (defaultWindow, {}); - windows = [ window ]; - assets = new Array (); - - if (_userDefines != null) { - - defines = MapTools.copy (_userDefines); - - } else { - - defines = new Map (); - - } - - dependencies = new Array (); - - if (_environment != null) { - - environment = _environment; - - } else { - - environment = Sys.environment (); - - } - - haxedefs = new Map (); - haxeflags = new Array (); - haxelibs = new Array (); - icons = new Array (); - javaPaths = new Array (); - languages = new Array (); - libraries = new Array (); - libraryHandlers = new Map (); - modules = new Map (); - ndlls = new Array (); - postBuildCallbacks = new Array (); - preBuildCallbacks = new Array (); - sources = new Array (); - samplePaths = new Array (); - splashScreens = new Array (); - targetHandlers = new Map (); - - } - - - public function clone ():Project { - - var project = new Project (); - - ObjectTools.copyFields (app, project.app); - project.architectures = architectures.copy (); - project.assets = assets.copy (); - - for (i in 0...assets.length) { - - project.assets[i] = assets[i].clone (); - - } - - project.command = command; - project.config = config.clone (); - project.debug = debug; - - for (key in defines.keys ()) { - - project.defines.set (key, defines.get (key)); - - } - - for (dependency in dependencies) { - - project.dependencies.push (dependency.clone ()); - - } - - for (key in environment.keys ()) { - - project.environment.set (key, environment.get (key)); - - } - - for (key in haxedefs.keys ()) { - - project.haxedefs.set (key, haxedefs.get (key)); - - } - - project.haxeflags = haxeflags.copy (); - - for (haxelib in haxelibs) { - - project.haxelibs.push (haxelib.clone ()); - - } - - for (icon in icons) { - - project.icons.push (icon.clone ()); - - } - - project.javaPaths = javaPaths.copy (); - - if (keystore != null) { - - project.keystore = keystore.clone (); - - } - - project.languages = languages.copy (); - - for (library in libraries) { - - project.libraries.push (library.clone ()); - - } - - for (key in libraryHandlers.keys ()) { - - project.libraryHandlers.set (key, libraryHandlers.get (key)); - - } - - ObjectTools.copyFields (meta, project.meta); - - for (key in modules.keys ()) { - - project.modules.set (key, modules.get (key).clone ()); - - } - - for (ndll in ndlls) { - - project.ndlls.push (ndll.clone ()); - - } - - project.platformType = platformType; - project.postBuildCallbacks = postBuildCallbacks.copy (); - project.preBuildCallbacks = preBuildCallbacks.copy (); - project.samplePaths = samplePaths.copy (); - project.sources = sources.copy (); - - for (splashScreen in splashScreens) { - - project.splashScreens.push (splashScreen.clone ()); - - } - - project.target = target; - - for (key in targetFlags.keys ()) { - - project.targetFlags.set (key, targetFlags.get (key)); - - } - - for (key in targetHandlers.keys ()) { - - project.targetHandlers.set (key, targetHandlers.get (key)); - - } - - project.templatePaths = templatePaths.copy (); - - for (i in 0...windows.length) { - - project.windows[i] = (ObjectTools.copyFields (windows[i], {})); - - } - - return project; - - } - - - private function filter (text:String, include:Array = null, exclude:Array = null):Bool { - - if (include == null) { - - include = [ "*" ]; - - } - - if (exclude == null) { - - exclude = []; - - } - - for (filter in exclude) { - - if (filter != "") { - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter + "$", "i"); - - if (regexp.match (text)) { - - return false; - - } - - } - - } - - for (filter in include) { - - if (filter != "") { - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter, "i"); - - if (regexp.match (text)) { - - return true; - - } - - } - - } - - return false; - - } - - - public static function fromFile (projectFile:String, userDefines:Map = null, includePaths:Array = null):Project { - - var project:Project = null; - - var path = FileSystem.fullPath (Path.withoutDirectory (projectFile)); - var name = Path.withoutDirectory (Path.withoutExtension (projectFile)); - name = name.substr (0, 1).toUpperCase () + name.substr (1); - - var tempDirectory = System.getTemporaryDirectory (); - var classFile = Path.combine (tempDirectory, name + ".hx"); - var nekoOutput = Path.combine (tempDirectory, name + ".n"); - - System.copyFile (path, classFile); - - #if lime - var args = [ name, "-main", "lime.tools.Project", "-cp", tempDirectory, "-neko", nekoOutput, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src"), "-lib", "hxp" ]; - #else - var args = [ name, "--interp", "-main", "lime.tools.Project", "-cp", tempDirectory, "-cp", Path.combine (Haxelib.getPath (new Haxelib ("hxp")), "src") ]; - #end - var input = File.read (classFile, false); - var tag = "@:compiler("; - - try { - - while (true) { - - var line = input.readLine (); - - if (StringTools.startsWith (line, tag)) { - - args.push (line.substring (tag.length + 1, line.length - 2)); - - } - - } - - } catch (ex:Eof) {} - - input.close (); - - var cacheDryRun = System.dryRun; - System.dryRun = false; - - #if lime - System.runCommand ("", "haxe", args); - #end - - var inputFile = Path.combine (tempDirectory, "input.dat"); - var outputFile = Path.combine (tempDirectory, "output.dat"); - - var inputData = Serializer.run ({ - - command: Project._command, - name: name, - target: Project._target, - debug: Project._debug, - targetFlags: Project._targetFlags, - templatePaths: Project._templatePaths, - userDefines: Project._userDefines, - environment: Project._environment, - logVerbose: Log.verbose, - logEnableColor: Log.enableColor, - processDryRun: cacheDryRun, - haxelibDebug: Haxelib.debug - - }); - - File.saveContent (inputFile, inputData); - - try { - - #if lime - System.runCommand ("", "neko", [ FileSystem.fullPath (nekoOutput), inputFile, outputFile ]); - #else - System.runCommand ("", "haxe", args.concat ([ "--", inputFile, outputFile ])); - #end - - } catch (e:Dynamic) { - - FileSystem.deleteFile (inputFile); - Sys.exit (1); - - } - - System.dryRun = cacheDryRun; - - var tPaths:Array = []; - - try { - - FileSystem.deleteFile (inputFile); - - var outputPath = Path.combine (tempDirectory, "output.dat"); - - if (FileSystem.exists (outputPath)) { - - var output = File.getContent (outputPath); - var unserializer = new Unserializer (output); - unserializer.setResolver (cast { resolveEnum: Type.resolveEnum, resolveClass: resolveClass }); - project = unserializer.unserialize (); - - //Because the project file template paths need to take priority, - //Add them after loading template paths from haxelibs below - tPaths = project.templatePaths; - project.templatePaths = []; - - FileSystem.deleteFile (outputPath); - - } - - } catch (e:Dynamic) {} - - System.removeDirectory (tempDirectory); - - if (project != null) { - - for (key in project.environment.keys ()) { - - Sys.putEnv (key, project.environment[key]); - - } - - var defines = MapTools.copyDynamic (userDefines); - MapTools.copyKeys (project.defines, defines); - - processHaxelibs (project, defines); - - //Adding template paths from the Project file - project.templatePaths = ArrayTools.concatUnique (project.templatePaths, tPaths, true); - } - - return project; - - } - - - public static function fromHaxelib (haxelib:Haxelib, userDefines:Map = null, clearCache:Bool = false):Project { - - if (haxelib.name == null || haxelib.name == "") { - - return null; - - } - - var path = Haxelib.getPath (haxelib, false, clearCache); - - if (path == null || path == "") { - - return null; - - } - - //if (!userDefines.exists (haxelib.name)) { - // - //userDefines.set (haxelib.name, Haxelib.getVersion (haxelib)); - // - //} - - return Project.fromPath (path, userDefines); - - } - - - public static function fromPath (path:String, userDefines:Map = null):Project { - - if (!FileSystem.exists (path) || !FileSystem.isDirectory (path)) { - - return null; - - } - - var files = [ "include.lime", "include.nmml", "include.xml" ]; - var projectFile = null; - - for (file in files) { - - if (projectFile == null && FileSystem.exists (Path.combine (path, file))) { - - projectFile = Path.combine (path, file); - - } - - } - - if (projectFile != null) { - - var project = new ProjectXMLParser (projectFile, userDefines); - - if (project.config.get ("project.rebuild.path") == null) { - - project.config.set ("project.rebuild.path", Path.combine (path, "project")); - - } - - return project; - - } - - return null; - - } - - - private function getHaxelibVersion (haxelib:Haxelib):String { - - var version = haxelib.version; - - if (version == "" || version == null) { - - var haxelibPath = Haxelib.getPath (haxelib); - var jsonPath = Path.combine (haxelibPath, "haxelib.json"); - - try { - - if (FileSystem.exists (jsonPath)) { - - var json = Json.parse (File.getContent (jsonPath)); - version = json.version; - - } - - } catch (e:Dynamic) {} - - } - - return version; - - } - - - public function include (path:String):Void { - - // extend project file somehow? - - } - - - public function includeAssets (path:String, rename:String = null, include:Array = null, exclude:Array = null):Void { - - if (include == null) { - - include = [ "*" ]; - - } - - if (exclude == null) { - - exclude = []; - - } - - exclude = exclude.concat ([ ".*", "cvs", "thumbs.db", "desktop.ini", "*.hash" ]); - - if (path == "") { - - return; - - } - - var targetPath = ""; - - if (rename != null) { - - targetPath = rename; - - } else { - - targetPath = path; - - } - - if (!FileSystem.exists (path)) { - - Log.error ("Could not find asset path \"" + path + "\""); - return; - - } - - var files = FileSystem.readDirectory (path); - - if (targetPath != "") { - - targetPath += "/"; - - } - - for (file in files) { - - if (FileSystem.isDirectory (path + "/" + file)) { - - if (filter (file, [ "*" ], exclude)) { - - includeAssets (path + "/" + file, targetPath + file, include, exclude); - - } - - } else { - - if (filter (file, include, exclude)) { - - assets.push (new Asset (path + "/" + file, targetPath + file)); - - } - - } - - } - - } - - - // #if lime - - public function includeXML (xml:String):Void { - - var projectXML = new ProjectXMLParser (); - @:privateAccess projectXML.parseXML (new Fast (Xml.parse (xml).firstElement ()), ""); - merge (projectXML); - - } - - // #end - - - private static function initialize ():Void { - - if (!initialized) { - - if (_target == null) { - - _target = cast System.hostPlatform; - - } - - if (_targetFlags == null) { - - _targetFlags = new Map (); - - } - - if (_templatePaths == null) { - - _templatePaths = new Array (); - - } - - initialized = true; - - } - - } - - - public function merge (project:Project):Void { - - if (project != null) { - - ObjectTools.copyUniqueFields (project.meta, meta, project.defaultMeta); - ObjectTools.copyUniqueFields (project.app, app, project.defaultApp); - - for (i in 0...project.windows.length) { - - if (i < windows.length) { - - ObjectTools.copyUniqueFields (project.windows[i], windows[i], project.defaultWindow); - - } else { - - windows.push (ObjectTools.copyFields (project.windows[i], {})); - - } - - } - - MapTools.copyUniqueKeys (project.defines, defines); - MapTools.copyUniqueKeys (project.environment, environment); - MapTools.copyUniqueKeysDynamic (project.haxedefs, haxedefs); - MapTools.copyUniqueKeys (project.libraryHandlers, libraryHandlers); - MapTools.copyUniqueKeys (project.targetHandlers, targetHandlers); - - config.merge (project.config); - - for (architecture in project.architectures) { - - if (defaultArchitectures.indexOf (architecture) == -1) { - - architectures.push (architecture); - - } - - } - - if (project.architectures.length > 0) { - - for (architecture in defaultArchitectures) { - - if (project.architectures.indexOf (architecture) == -1) { - - architectures.remove (architecture); - - } - - } - - } - - assets = ArrayTools.concatUnique (assets, project.assets); - dependencies = ArrayTools.concatUnique (dependencies, project.dependencies, true); - haxeflags = ArrayTools.concatUnique (haxeflags, project.haxeflags); - haxelibs = ArrayTools.concatUnique (haxelibs, project.haxelibs, true, "name"); - icons = ArrayTools.concatUnique (icons, project.icons); - javaPaths = ArrayTools.concatUnique (javaPaths, project.javaPaths, true); - - if (keystore == null) { - - keystore = project.keystore; - - } else { - - keystore.merge (project.keystore); - - } - - languages = ArrayTools.concatUnique (languages, project.languages, true); - libraries = ArrayTools.concatUnique (libraries, project.libraries, true); - - for (key in project.modules.keys ()) { - - if (modules.exists (key)) { - - modules.get (key).merge (project.modules.get (key)); - - } else { - - modules.set (key, project.modules.get (key)); - - } - - } - - ndlls = ArrayTools.concatUnique (ndlls, project.ndlls); - postBuildCallbacks = postBuildCallbacks.concat (project.postBuildCallbacks); - preBuildCallbacks = preBuildCallbacks.concat (project.preBuildCallbacks); - samplePaths = ArrayTools.concatUnique (samplePaths, project.samplePaths, true); - sources = ArrayTools.concatUnique (sources, project.sources, true); - splashScreens = ArrayTools.concatUnique (splashScreens, project.splashScreens); - templatePaths = ArrayTools.concatUnique (templatePaths, project.templatePaths, true); - - } - - } - - - public function path (value:String):Void { - - if (host == Platform.WINDOWS) { - - setenv ("PATH", value + ";" + Sys.getEnv ("PATH")); - - } else { - - setenv ("PATH", value + ":" + Sys.getEnv ("PATH")); - - } - - } - - - // #if lime - - @:noCompletion private static function processHaxelibs (project:Project, userDefines:Map):Void { - - var haxelibs = project.haxelibs.copy (); - project.haxelibs = []; - - for (haxelib in haxelibs) { - - var validatePath = Haxelib.getPath (haxelib, true); - project.haxelibs.push (haxelib); - - var includeProject = Project.fromHaxelib (haxelib, userDefines); - - if (includeProject != null) { - - for (ndll in includeProject.ndlls) { - - if (ndll.haxelib == null) { - - ndll.haxelib = haxelib; - - } - - } - - project.merge (includeProject); - - } - - } - - } - - - @:noCompletion private static function resolveClass (name:String):Class { - - var type = Type.resolveClass (name); - - if (type == null) { - - return Project; - - } else { - - return type; - - } - - } - - // #end - - - public function setenv (name:String, value:String):Void { - - if (value == null) { - - environment.remove (name); - value = ""; - - } - - if (name == "HAXELIB_PATH") { - - var currentPath = Haxelib.getRepositoryPath (); - Sys.putEnv (name, value); - var newPath = Haxelib.getRepositoryPath (true); - - if (currentPath != newPath) { - - var valid = try { (newPath != null && newPath != "" && FileSystem.exists (FileSystem.fullPath (newPath))); } catch (e:Dynamic) { false; } - - if (!valid) { - - Log.error ("The specified haxelib repository path \"" + value + "\" does not exist"); - - } else { - - needRerun = true; - - } - - } - - } else { - - Sys.putEnv (name, value); - - } - - if (value != "") { - - environment.set (name, value); - - } - - } - - - - - // Getters & Setters - - - - - private function get_host ():Platform { - - return cast System.hostPlatform; - - } - - - private function get_templateContext ():Dynamic { - - var context:Dynamic = {}; - - if (app == null) app = { }; - if (meta == null) meta = { }; - - if (window == null) { - - window = { }; - windows = [ window ]; - - } - - ObjectTools.copyMissingFields (defaultApp, app); - ObjectTools.copyMissingFields (defaultMeta, meta); - - for (item in windows) { - - ObjectTools.copyMissingFields (defaultWindow, item); - - } - - //config.populate (); - - for (field in Reflect.fields (app)) { - - Reflect.setField (context, "APP_" + StringTools.formatUppercaseVariable (field), Reflect.field (app, field)); - - } - - context.BUILD_DIR = app.path; - - for (key in environment.keys ()) { - - Reflect.setField (context, "ENV_" + key, environment.get (key)); - - } - - context.meta = meta; - - for (field in Reflect.fields (meta)) { - - Reflect.setField (context, "APP_" + StringTools.formatUppercaseVariable (field), Reflect.field (meta, field)); - Reflect.setField (context, "META_" + StringTools.formatUppercaseVariable (field), Reflect.field (meta, field)); - - } - - context.APP_PACKAGE = context.META_PACKAGE = meta.packageName; - - for (field in Reflect.fields (windows[0])) { - - Reflect.setField (context, "WIN_" + StringTools.formatUppercaseVariable (field), Reflect.field (windows[0], field)); - Reflect.setField (context, "WINDOW_" + StringTools.formatUppercaseVariable (field), Reflect.field (windows[0], field)); - - } - - if (windows[0].orientation == Orientation.LANDSCAPE || windows[0].orientation == Orientation.PORTRAIT) { - - context.WIN_ORIENTATION = Std.string (windows[0].orientation).toLowerCase (); - context.WINDOW_ORIENTATION = Std.string (windows[0].orientation).toLowerCase (); - - } else { - - context.WIN_ORIENTATION = ""; - context.WINDOW_ORIENTATION = ""; - - } - - context.windows = windows; - - for (i in 0...windows.length) { - - for (field in Reflect.fields (windows[i])) { - - Reflect.setField (context, "WINDOW_" + StringTools.formatUppercaseVariable (field) + "_" + i, Reflect.field (windows[i], field)); - - } - - if (windows[i].orientation == Orientation.LANDSCAPE || windows[i].orientation == Orientation.PORTRAIT) { - - Reflect.setField (context, "WINDOW_ORIENTATION_" + i, Std.string (windows[i].orientation).toLowerCase ()); - - } else { - - Reflect.setField (context, "WINDOW_ORIENTATION_" + i, ""); - - } - - windows[i].title = meta.title; - - } - - for (haxeflag in haxeflags) { - - if (StringTools.startsWith (haxeflag, "-lib")) { - - Reflect.setField (context, "LIB_" + StringTools.formatUppercaseVariable (haxeflag.substr (5)), "true"); - - } - - } - - context.assets = new Array (); - - for (asset in assets) { - - if (asset.type != AssetType.TEMPLATE) { - - var embeddedAsset:Dynamic = { }; - ObjectTools.copyFields (asset, embeddedAsset); - - embeddedAsset.sourcePath = Path.standardize (asset.sourcePath); - - if (asset.embed == null) { - - embeddedAsset.embed = (platformType == PlatformType.WEB || target == AIR); - - } - - embeddedAsset.type = Std.string (asset.type).toLowerCase (); - - #if (lime && lime_cffi && !macro) - if (asset.type == FONT) { - - try { - - var font = Font.fromFile (asset.sourcePath); - embeddedAsset.fontName = font.name; - - Log.info ("", " - \x1b[1mDetecting font name:\x1b[0m " + asset.sourcePath + " \x1b[3;37m->\x1b[0m \"" + font.name + "\""); - - } catch (e:Dynamic) {} - - } - #end - - context.assets.push (embeddedAsset); - - } - - } - - context.languages = (languages.length > 0) ? languages : null; - context.libraries = new Array (); - var embeddedLibraries = new Map (); - - for (library in libraries) { - - var embeddedLibrary:Dynamic = { }; - ObjectTools.copyFields (library, embeddedLibrary); - context.libraries.push (embeddedLibrary); - embeddedLibraries[library.name] = embeddedLibrary; - - } - - for (asset in assets) { - - if (asset.library != null && !embeddedLibraries.exists (asset.library)) { - - var embeddedLibrary:Dynamic = { }; - embeddedLibrary.name = asset.library; - context.libraries.push (embeddedLibrary); - embeddedLibraries[asset.library] = embeddedLibrary; - - } - - } - - context.ndlls = new Array (); - - for (ndll in ndlls) { - - var templateNDLL:Dynamic = { }; - ObjectTools.copyFields (ndll, templateNDLL); - templateNDLL.nameSafe = StringTools.replace (ndll.name, "-", "_"); - context.ndlls.push (templateNDLL); - - } - - //Reflect.setField (context, "ndlls", ndlls); - //Reflect.setField (context, "sslCaCert", sslCaCert); - context.sslCaCert = ""; - - var compilerFlags = []; - - for (haxelib in haxelibs) { - - var name = haxelib.name; - - // TODO: Handle real version when better/smarter haxelib available - var version = haxelib.version; - //var version = Haxelib.getVersion (haxelib); - - if (version != null && version != "") { - - name += ":" + version; - - } - - // #if lime - - if (Haxelib.pathOverrides.exists (name)) { - - var param = "-cp " + Haxelib.pathOverrides.get (name); - compilerFlags.remove (param); - compilerFlags.push (param); - - } else { - - var cache = Log.verbose; - Log.verbose = Haxelib.debug; - var output = ""; - - try { - - output = Haxelib.runProcess ("", [ "path", name ], true, true, true); - - } catch (e:Dynamic) { } - - Log.verbose = cache; - - var split = output.split ("\n"); - var haxelibName = null; - - for (arg in split) { - - arg = StringTools.trim (arg); - - if (arg != "") { - - if (StringTools.startsWith (arg, "Error: ")) { - - Log.error (arg.substr (7)); - - } else if (!StringTools.startsWith (arg, "-")) { - - var path = Path.standardize (arg); - - if (path != null && StringTools.trim (path) != "" && !StringTools.startsWith (StringTools.trim (path), "#")) { - - var param = "-cp " + path; - compilerFlags.remove (param); - compilerFlags.push (param); - - } - - var version = "0.0.0"; - var jsonPath = Path.combine (path, "haxelib.json"); - - try { - - if (FileSystem.exists (jsonPath)) { - - var json = Json.parse (File.getContent (jsonPath)); - haxelibName = json.name; - compilerFlags = ArrayTools.concatUnique (compilerFlags, [ "-D " + haxelibName + "=" + json.version ], true); - - } - - } catch (e:Dynamic) {} - - } else { - - if (StringTools.startsWith (arg, "-D ") && arg.indexOf ("=") == -1) { - - var name = arg.substr (3); - - if (name != haxelibName) { - - compilerFlags = ArrayTools.concatUnique (compilerFlags, [ "-D " + name ], true); - - } - - /*var haxelib = new Haxelib (arg.substr (3)); - var path = Haxelib.getPath (haxelib); - var version = getHaxelibVersion (haxelib); - - if (path != null) { - - CompatibilityHelper.patchProject (this, haxelib, version); - compilerFlags = ArrayTools.concatUnique (compilerFlags, [ "-D " + haxelib.name + "=" + version ], true); - - }*/ - - } else if (!StringTools.startsWith (arg, "-L")) { - - compilerFlags = ArrayTools.concatUnique (compilerFlags, [ arg ], true); - - } - - } - - } - - } - - } - - // #else - - // compilerFlags.push ("-lib " + name); - - // #end - - Reflect.setField (context, "LIB_" + StringTools.formatUppercaseVariable (haxelib.name), true); - - if (name == "nme") { - - context.EMBED_ASSETS = false; - - } - - } - - for (source in sources) { - - if (source != null && StringTools.trim (source) != "") { - - compilerFlags.push ("-cp " + source); - - } - - } - - for (key in defines.keys ()) { - - var value = defines.get (key); - - if (value == null || value == "") { - - Reflect.setField (context, "SET_" + StringTools.formatUppercaseVariable (key), true); - - } else { - - Reflect.setField (context, "SET_" + StringTools.formatUppercaseVariable (key), value); - - } - - } - - for (key in haxedefs.keys ()) { - - var value = haxedefs.get (key); - - if (value == null || value == "") { - - compilerFlags.push ("-D " + key); - - Reflect.setField (context, "DEFINE_" + StringTools.formatUppercaseVariable (key), true); - - } else { - - compilerFlags.push ("-D " + key + "=" + value); - - Reflect.setField (context, "DEFINE_" + StringTools.formatUppercaseVariable (key), value); - - } - - } - - if (target != Platform.FLASH) { - - compilerFlags.push ("-D " + Std.string (target).toLowerCase ()); - - } - - compilerFlags.push ("-D " + Std.string (platformType).toLowerCase ()); - compilerFlags = compilerFlags.concat (haxeflags); - - if (compilerFlags.length == 0) { - - context.HAXE_FLAGS = ""; - - } else { - - context.HAXE_FLAGS = "\n" + compilerFlags.join ("\n"); - - } - - var main = app.main; - - if (main == null) { - - main = defaultApp.main; - - } - - var indexOfPeriod = main.lastIndexOf ("."); - - context.APP_MAIN_PACKAGE = main.substr (0, indexOfPeriod + 1); - context.APP_MAIN_CLASS = main.substr (indexOfPeriod + 1); - - var type = "release"; - - if (debug) { - - type = "debug"; - - } else if (targetFlags.exists ("final")) { - - type = "final"; - - } - - var hxml = Std.string (target).toLowerCase () + "/hxml/" + type + ".hxml"; - - for (templatePath in templatePaths) { - - var path = Path.combine (templatePath, hxml); - - if (FileSystem.exists (path)) { - - context.HXML_PATH = path; - - } - - } - - context.RELEASE = (type == "release"); - context.DEBUG = debug; - context.FINAL = (type == "final"); - context.SWF_VERSION = app.swfVersion; - context.PRELOADER_NAME = app.preloader; - - if (keystore != null) { - - context.KEY_STORE = Path.tryFullPath (keystore.path); - - if (keystore.password != null) { - - context.KEY_STORE_PASSWORD = keystore.password; - - } - - if (keystore.alias != null) { - - context.KEY_STORE_ALIAS = keystore.alias; - - } else if (keystore.path != null) { - - context.KEY_STORE_ALIAS = Path.withoutExtension (Path.withoutDirectory (keystore.path)); - - } - - if (keystore.aliasPassword != null) { - - context.KEY_STORE_ALIAS_PASSWORD = keystore.aliasPassword; - - } else if (keystore.password != null) { - - context.KEY_STORE_ALIAS_PASSWORD = keystore.password; - - } - - } - - context.config = config; - - return context; - - } - - - private function get_window ():WindowData { - - if (windows != null) { - - return windows[0]; - - } else { - - return window; - - } - - } - - - private function set_window (value:WindowData):WindowData { - - if (windows != null) { - - return windows[0] = window = value; - - } else { - - return window = value; - - } - - } - - -} diff --git a/src/lime/tools/ProjectHelper.hx b/src/lime/tools/ProjectHelper.hx index fd3a53cc2..1b2ca0053 100644 --- a/src/lime/tools/ProjectHelper.hx +++ b/src/lime/tools/ProjectHelper.hx @@ -19,7 +19,7 @@ class ProjectHelper { private static var varMatch = new EReg ("{{(.*?)}}", ""); - public static function copyLibrary (project:Project, ndll:NDLL, directoryName:String, namePrefix:String, nameSuffix:String, targetDirectory:String, allowDebug:Bool = false, targetSuffix:String = null) { + public static function copyLibrary (project:HXProject, ndll:NDLL, directoryName:String, namePrefix:String, nameSuffix:String, targetDirectory:String, allowDebug:Bool = false, targetSuffix:String = null) { var path = NDLL.getLibraryPath (ndll, directoryName, namePrefix, nameSuffix, allowDebug); @@ -90,7 +90,7 @@ class ProjectHelper { } - public static function recursiveSmartCopyTemplate (project:Project, source:String, destination:String, context:Dynamic = null, process:Bool = true, warnIfNotFound:Bool = true) { + public static function recursiveSmartCopyTemplate (project:HXProject, source:String, destination:String, context:Dynamic = null, process:Bool = true, warnIfNotFound:Bool = true) { var destinations = []; var paths = System.findTemplateRecursive (project.templatePaths, source, warnIfNotFound, destinations); @@ -112,7 +112,7 @@ class ProjectHelper { } - public static function replaceVariable (project:Project, string:String):String { + public static function replaceVariable (project:HXProject, string:String):String { if (string.substr (0, 8) == "haxelib:") { @@ -207,7 +207,7 @@ class ProjectHelper { } - public static function substitutePath (project:Project, path:String):String { + public static function substitutePath (project:HXProject, path:String):String { var newString = path; diff --git a/src/lime/tools/ProjectXMLParser.hx b/src/lime/tools/ProjectXMLParser.hx index 00ba2666d..f92caa9fb 100644 --- a/src/lime/tools/ProjectXMLParser.hx +++ b/src/lime/tools/ProjectXMLParser.hx @@ -8,7 +8,7 @@ import lime.tools.ModuleHelper; import lime.tools.Asset; import lime.tools.AssetType; import lime.tools.Dependency; -import lime.tools.Project; +import lime.tools.HXProject; #if lime import lime.utils.AssetManifest; #end @@ -16,7 +16,7 @@ import sys.io.File; import sys.FileSystem; -class ProjectXMLParser extends Project { +class ProjectXMLParser extends HXProject { public var includePaths:Array; @@ -1440,7 +1440,7 @@ class ProjectXMLParser extends Project { haxelibs.push (haxelib); - var includeProject = Project.fromHaxelib (haxelib, defines); + var includeProject = HXProject.fromHaxelib (haxelib, defines); if (includeProject != null) { diff --git a/src/lime/tools/TVOSHelper.hx b/src/lime/tools/TVOSHelper.hx index 96c7160ba..1a0e91364 100644 --- a/src/lime/tools/TVOSHelper.hx +++ b/src/lime/tools/TVOSHelper.hx @@ -2,7 +2,7 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import sys.io.Process; import sys.FileSystem; @@ -13,7 +13,7 @@ class TVOSHelper { private static var initialized = false; - public static function build (project:Project, workingDirectory:String, additionalArguments:Array = null):Void { + public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array = null):Void { initialize (project); @@ -43,7 +43,7 @@ class TVOSHelper { } - public static function deploy (project:Project, workingDirectory:String):Void { + public static function deploy (project:HXProject, workingDirectory:String):Void { initialize (project); @@ -83,7 +83,7 @@ class TVOSHelper { } - private static function getXCodeArgs (project:Project):Array { + private static function getXCodeArgs (project:HXProject):Array { var platformName = "appletvos"; @@ -148,7 +148,7 @@ class TVOSHelper { } - private static function getIOSVersion (project:Project):Void { + private static function getIOSVersion (project:HXProject):Void { if (!project.environment.exists("TVOS_VER")) { @@ -226,7 +226,7 @@ class TVOSHelper { } - public static function getSDKDirectory (project:Project):String { + public static function getSDKDirectory (project:HXProject):String { initialize (project); @@ -265,7 +265,7 @@ class TVOSHelper { } - private static function initialize (project:Project):Void { + private static function initialize (project:HXProject):Void { if (!initialized) { @@ -278,7 +278,7 @@ class TVOSHelper { } - public static function launch (project:Project, workingDirectory:String):Void { + public static function launch (project:HXProject, workingDirectory:String):Void { initialize (project); @@ -417,7 +417,7 @@ class TVOSHelper { } - public static function sign (project:Project, workingDirectory:String):Void { + public static function sign (project:HXProject, workingDirectory:String):Void { initialize (project); diff --git a/src/lime/tools/TizenHelper.hx b/src/lime/tools/TizenHelper.hx index a602e8954..9a7221b5e 100644 --- a/src/lime/tools/TizenHelper.hx +++ b/src/lime/tools/TizenHelper.hx @@ -5,7 +5,7 @@ import haxe.crypto.Crc32; import haxe.io.Bytes; import haxe.io.Eof; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.Platform; import sys.FileSystem; @@ -17,7 +17,7 @@ class TizenHelper { private static var cacheUUID:String = null; - public static function createPackage (project:Project, workingDirectory:String, targetPath:String):Void { + public static function createPackage (project:HXProject, workingDirectory:String, targetPath:String):Void { var keystore = null; var password = null; @@ -73,7 +73,7 @@ class TizenHelper { } - public static function getUUID (project:Project):String { + public static function getUUID (project:HXProject):String { if (cacheID != project.meta.packageName) { @@ -98,7 +98,7 @@ class TizenHelper { } - public static function install (project:Project, workingDirectory:String):Void { + public static function install (project:HXProject, workingDirectory:String):Void { var packageName = getUUID (project) + "-" + project.meta.version + "-"; @@ -119,7 +119,7 @@ class TizenHelper { } - public static function launch (project:Project):Void { + public static function launch (project:HXProject):Void { runCommand (project, "", "native-run", [ "--package", getUUID (project) ]); @@ -151,7 +151,7 @@ class TizenHelper { } - private static function runCommand (project:Project, workingDirectory:String, command:String, args:Array):Void { + private static function runCommand (project:HXProject, workingDirectory:String, command:String, args:Array):Void { var sdkDirectory = ""; @@ -178,7 +178,7 @@ class TizenHelper { } - public static function trace (project:Project, follow:Bool = true):Void { + public static function trace (project:HXProject, follow:Bool = true):Void { /*var args = []; diff --git a/src/lime/tools/XCodeHelper.hx b/src/lime/tools/XCodeHelper.hx index f5e52637c..39e01a928 100644 --- a/src/lime/tools/XCodeHelper.hx +++ b/src/lime/tools/XCodeHelper.hx @@ -2,7 +2,7 @@ package lime.tools; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; class XCodeHelper { @@ -57,7 +57,7 @@ class XCodeHelper { } - public static function getSelectedSimulator (project:Project):SimulatorInfo { + public static function getSelectedSimulator (project:HXProject):SimulatorInfo { var output = getSimulators (); var lines = output.split ("\n"); @@ -117,14 +117,14 @@ class XCodeHelper { } - public static function getSimulatorID (project:Project):String { + public static function getSimulatorID (project:HXProject):String { return getSelectedSimulator (project).id; } - public static function getSimulatorName (project:Project):String { + public static function getSimulatorName (project:HXProject):String { return getSelectedSimulator (project).name; diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index b4aa899d7..cfc5896da 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -9,7 +9,7 @@ import haxe.Unserializer; import haxe.rtti.Meta; import hxp.*; import lime.system.CFFI; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.*; import sys.io.File; import sys.io.Process; @@ -19,7 +19,7 @@ import utils.CreateTemplate; import utils.JavaExternGenerator; import utils.PlatformSetup; -@:access(lime.tools.Project) +@:access(lime.tools.HXProject) class CommandLineTools { @@ -34,8 +34,8 @@ class CommandLineTools { private var debug:Bool; private var environment:Map; private var includePaths:Array; - private var overrides:Project; - private var project:Project; + private var overrides:HXProject; + private var project:HXProject; private var projectDefines:Map; private var runFromHaxelib:Bool; private var targetFlags:Map; @@ -58,7 +58,7 @@ class CommandLineTools { userDefines = new Map (); words = new Array (); - overrides = new Project (); + overrides = new HXProject (); overrides.architectures = []; //Haxelib.setOverridePath (new Haxelib ("lime-tools"), Path.combine (Haxelib.getPath (new Haxelib ("lime")), "tools")); @@ -365,23 +365,23 @@ class CommandLineTools { } else { - Project._command = command; - Project._environment = environment; - Project._debug = debug; - Project._target = target; - Project._targetFlags = targetFlags; - Project._userDefines = userDefines; + HXProject._command = command; + HXProject._environment = environment; + HXProject._debug = debug; + HXProject._target = target; + HXProject._targetFlags = targetFlags; + HXProject._userDefines = userDefines; var project = null; if (haxelib != null) { userDefines.set ("rebuild", 1); - project = Project.fromHaxelib (haxelib, userDefines); + project = HXProject.fromHaxelib (haxelib, userDefines); if (project == null) { - project = new Project (); + project = new HXProject (); project.config.set ("project.rebuild.path", Path.combine (Haxelib.getPath (haxelib), "project")); } else { @@ -392,11 +392,11 @@ class CommandLineTools { } else { - //project = Project.fromPath (path); + //project = HXProject.fromPath (path); if (project == null) { - project = new Project (); + project = new HXProject (); if (FileSystem.isDirectory (path)) { @@ -422,7 +422,7 @@ class CommandLineTools { for (haxelib in overrides.haxelibs) { - var includeProject = Project.fromHaxelib (haxelib, project.defines); + var includeProject = HXProject.fromHaxelib (haxelib, project.defines); if (includeProject != null) { @@ -596,7 +596,7 @@ class CommandLineTools { #end - private function buildProject (project:Project, command:String = "") { + private function buildProject (project:HXProject, command:String = "") { if (command == "") { @@ -798,7 +798,7 @@ class CommandLineTools { var sampleExists = false; var defines = new Map (); defines.set ("create", 1); - var project = Project.fromHaxelib (new Haxelib (defaultLibrary), defines); + var project = HXProject.fromHaxelib (new Haxelib (defaultLibrary), defines); for (samplePath in project.samplePaths) { @@ -1341,7 +1341,7 @@ class CommandLineTools { } - private function getBuildNumber (project:Project, increment:Bool = true):Void { + private function getBuildNumber (project:HXProject, increment:Bool = true):Void { var buildNumber = project.meta.buildNumber; @@ -1405,7 +1405,7 @@ class CommandLineTools { } - private function getBuildNumber_GIT (project:Project, increment:Bool = true):String { + private function getBuildNumber_GIT (project:HXProject, increment:Bool = true):String { var cache = Log.mute; Log.mute = true; @@ -1445,7 +1445,7 @@ class CommandLineTools { } - private function getBuildNumber_SVN (project:Project, increment:Bool = true):String { + private function getBuildNumber_SVN (project:HXProject, increment:Bool = true):String { var cache = Log.mute; Log.mute = true; @@ -1509,7 +1509,7 @@ class CommandLineTools { } - private function initializeProject (project:Project = null, targetName:String = ""):Project { + private function initializeProject (project:HXProject = null, targetName:String = ""):HXProject { Log.info ("", Log.accentColor + "Initializing project..." + Log.resetColor); @@ -1730,12 +1730,12 @@ class CommandLineTools { } - Project._command = command; - Project._debug = debug; - Project._environment = environment; - Project._target = target; - Project._targetFlags = targetFlags; - Project._userDefines = userDefines; + HXProject._command = command; + HXProject._debug = debug; + HXProject._environment = environment; + HXProject._target = target; + HXProject._targetFlags = targetFlags; + HXProject._userDefines = userDefines; var config = ConfigHelper.getConfig (); @@ -1855,12 +1855,12 @@ class CommandLineTools { if (project == null) { - Project._command = command; - Project._debug = debug; - Project._environment = environment; - Project._target = target; - Project._targetFlags = targetFlags; - Project._userDefines = userDefines; + HXProject._command = command; + HXProject._debug = debug; + HXProject._environment = environment; + HXProject._target = target; + HXProject._targetFlags = targetFlags; + HXProject._userDefines = userDefines; try { Sys.setCwd (Path.directory (projectFile)); } catch (e:Dynamic) {} @@ -1870,7 +1870,7 @@ class CommandLineTools { } else if (Path.extension (projectFile) == "hxp") { - project = Project.fromFile (projectFile, userDefines, includePaths); + project = HXProject.fromFile (projectFile, userDefines, includePaths); if (project != null) { diff --git a/tools/platforms/AIRPlatform.hx b/tools/platforms/AIRPlatform.hx index 2590e9910..bc6b2ae0d 100644 --- a/tools/platforms/AIRPlatform.hx +++ b/tools/platforms/AIRPlatform.hx @@ -16,7 +16,7 @@ import hxp.Path; import lime.tools.Platform; import hxp.System; import lime.tools.PlatformType; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.System; import sys.io.File; @@ -32,7 +32,7 @@ class AIRPlatform extends FlashPlatform { private var targetPlatformType:PlatformType; - public function new (command:String, _project:Project, targetFlags:Map) { + public function new (command:String, _project:HXProject, targetFlags:Map) { super (command, _project, targetFlags); diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 126a1f44a..48ba7d7b9 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -18,7 +18,7 @@ import hxp.Log; import hxp.Path; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.System; import sys.io.File; @@ -31,7 +31,7 @@ class AndroidPlatform extends PlatformTarget { private var deviceID:String; - public function new (command:String, _project:Project, targetFlags:Map) { + public function new (command:String, _project:HXProject, targetFlags:Map) { super (command, _project, targetFlags); diff --git a/tools/platforms/EmscriptenPlatform.hx b/tools/platforms/EmscriptenPlatform.hx index 43ff50f4c..3b844ff39 100644 --- a/tools/platforms/EmscriptenPlatform.hx +++ b/tools/platforms/EmscriptenPlatform.hx @@ -16,7 +16,7 @@ import hxp.Log; import hxp.Path; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import sys.io.File; import sys.FileSystem; @@ -28,7 +28,7 @@ class EmscriptenPlatform extends PlatformTarget { private var outputFile:String; - public function new (command:String, _project:Project, targetFlags:Map) { + public function new (command:String, _project:HXProject, targetFlags:Map) { super (command, _project, targetFlags); diff --git a/tools/platforms/FlashPlatform.hx b/tools/platforms/FlashPlatform.hx index 5ef6212f8..116c9062e 100644 --- a/tools/platforms/FlashPlatform.hx +++ b/tools/platforms/FlashPlatform.hx @@ -18,7 +18,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import hxp.System; import sys.io.File; import sys.FileSystem; @@ -35,7 +35,7 @@ class FlashPlatform extends PlatformTarget { private var logLength:Int = 0; - public function new (command:String, _project:Project, targetFlags:Map) { + public function new (command:String, _project:HXProject, targetFlags:Map) { super (command, _project, targetFlags); diff --git a/tools/platforms/HTML5Platform.hx b/tools/platforms/HTML5Platform.hx index d6336c60f..3f6f029b0 100644 --- a/tools/platforms/HTML5Platform.hx +++ b/tools/platforms/HTML5Platform.hx @@ -20,7 +20,7 @@ import lime.tools.ProjectHelper; import hxp.Path; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import hxp.System; import sys.io.File; import sys.FileSystem; @@ -33,7 +33,7 @@ class HTML5Platform extends PlatformTarget { private var outputFile:String; - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); @@ -146,7 +146,7 @@ class HTML5Platform extends PlatformTarget { } - private function initialize (command:String, project:Project):Void { + private function initialize (command:String, project:HXProject):Void { if (targetFlags.exists ("electron")) { diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 35b4ff368..1d048f558 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -25,7 +25,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.StringTools; import hxp.System; @@ -39,7 +39,7 @@ import sys.FileSystem; class IOSPlatform extends PlatformTarget { - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index 5a8d8a352..0c01d5e1e 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -20,7 +20,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.System; import sys.io.File; @@ -38,7 +38,7 @@ class LinuxPlatform extends PlatformTarget { private var targetType:String; - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 8c87a6976..f96028d4f 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -25,7 +25,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.System; import sys.io.File; @@ -43,7 +43,7 @@ class MacPlatform extends PlatformTarget { private var targetType:String; - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/platforms/TVOSPlatform.hx b/tools/platforms/TVOSPlatform.hx index 57051069e..0dd33a1d6 100644 --- a/tools/platforms/TVOSPlatform.hx +++ b/tools/platforms/TVOSPlatform.hx @@ -24,7 +24,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.StringTools; import lime.tools.TVOSHelper; @@ -39,7 +39,7 @@ import sys.FileSystem; class TVOSPlatform extends PlatformTarget { - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/platforms/TizenPlatform.hx b/tools/platforms/TizenPlatform.hx index 08fd321d4..3f48aad43 100644 --- a/tools/platforms/TizenPlatform.hx +++ b/tools/platforms/TizenPlatform.hx @@ -13,7 +13,7 @@ import lime.tools.IconHelper; import hxp.Path; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.TizenHelper; import sys.io.File; @@ -26,7 +26,7 @@ class TizenPlatform extends PlatformTarget { private static var uuid:String = null; - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 830fbb7fe..90f51591b 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -27,7 +27,7 @@ import lime.tools.Platform; import hxp.System; import lime.tools.PlatformTarget; import hxp.System; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import hxp.System; import sys.io.File; @@ -44,7 +44,7 @@ class WindowsPlatform extends PlatformTarget { private var outputFile:String; - public function new (command:String, _project:Project, targetFlags:Map ) { + public function new (command:String, _project:HXProject, targetFlags:Map ) { super (command, _project, targetFlags); diff --git a/tools/utils/CreateTemplate.hx b/tools/utils/CreateTemplate.hx index 218d62b74..ccc52e169 100644 --- a/tools/utils/CreateTemplate.hx +++ b/tools/utils/CreateTemplate.hx @@ -2,12 +2,11 @@ package utils; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import lime.tools.ProjectHelper; import sys.FileSystem; -@:access(lime.tools.Project) -@:access(lime.tools.Project.HXProject) +@:access(lime.tools.HXProject) class CreateTemplate { @@ -80,7 +79,7 @@ class CreateTemplate { } - public static function createProject (words:Array, userDefines:Map, overrides:Project):Void { + public static function createProject (words:Array, userDefines:Map, overrides:HXProject):Void { var colonIndex = words[0].indexOf (":"); @@ -139,7 +138,7 @@ class CreateTemplate { var defines = new Map (); defines.set ("create", 1); - var project = Project.fromHaxelib (new Haxelib (projectName), defines); + var project = HXProject.fromHaxelib (new Haxelib (projectName), defines); if (project != null) { @@ -359,14 +358,14 @@ class CreateTemplate { var defines = new Map (); defines.set ("create", 1); - var project = Project.fromHaxelib (new Haxelib (projectName), defines); + var project = HXProject.fromHaxelib (new Haxelib (projectName), defines); if (project == null && outputPath == null) { outputPath = sampleName; sampleName = projectName; projectName = CommandLineTools.defaultLibrary; - project = Project.fromHaxelib (new Haxelib (projectName), defines); + project = HXProject.fromHaxelib (new Haxelib (projectName), defines); } @@ -410,7 +409,7 @@ class CreateTemplate { var defines = new Map (); defines.set ("create", 1); - var project = Project.fromHaxelib (new Haxelib (projectName), defines); + var project = HXProject.fromHaxelib (new Haxelib (projectName), defines); if (project != null) { diff --git a/tools/utils/JavaExternGenerator.hx b/tools/utils/JavaExternGenerator.hx index 11c835ca4..a55abe649 100644 --- a/tools/utils/JavaExternGenerator.hx +++ b/tools/utils/JavaExternGenerator.hx @@ -7,7 +7,7 @@ import haxe.io.Input; import haxe.io.Output; import haxe.zip.Reader; import hxp.*; -import lime.tools.Project; +import lime.tools.HXProject; import sys.io.File; import sys.io.Process; import sys.FileSystem; @@ -30,7 +30,7 @@ class JavaExternGenerator private static var base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; private static var fmatch = ~/^\((.*)\)(.*)/; - private var config:Project; + private var config:HXProject; private var externPath:String; private var extractedAndroidClasses:Bool; private var extractedAndroidPaths:Array; @@ -46,7 +46,7 @@ class JavaExternGenerator private var retType:JNIType; - public function new(config:Project, javaPath:String, externPath:String) + public function new(config:HXProject, javaPath:String, externPath:String) { this.config = config; this.javaPath = javaPath; diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index b0a92d637..5807adb18 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -8,7 +8,7 @@ import hxp.*; import lime.tools.CLIHelper; import lime.tools.ConfigHelper; import lime.tools.Platform; -import lime.tools.Project; +import lime.tools.HXProject; import sys.io.File; import sys.io.Process; import sys.FileSystem; @@ -805,7 +805,7 @@ class PlatformSetup { } - var project = Project.fromHaxelib (haxelib, defines, true); + var project = HXProject.fromHaxelib (haxelib, defines, true); if (project != null && project.haxelibs.length > 0) { @@ -1206,7 +1206,7 @@ class PlatformSetup { try { - project = Project.fromHaxelib (new Haxelib ("openfl")); + project = HXProject.fromHaxelib (new Haxelib ("openfl")); } catch (e:Dynamic) {}