private void AddCompilerConstants(MxmlcOptions options, bool debugMode) { WriteDefine("CONFIG::debug", debugMode ? "true" : "false"); WriteDefine("CONFIG::release", debugMode ? "false" : "true"); WriteDefine("CONFIG::timeStamp", "'" + DateTime.Now.ToString("d") + "'"); var isMobile = project.MovieOptions.Platform == "AIR Mobile"; var isDesktop = project.MovieOptions.Platform == "AIR"; WriteDefine("CONFIG::air", isMobile || isDesktop ? "true" : "false"); WriteDefine("CONFIG::mobile", isMobile ? "true" : "false"); WriteDefine("CONFIG::desktop", isDesktop ? "true" : "false"); if (options.CompilerConstants != null) { foreach (string define in options.CompilerConstants) { int p = define.IndexOf(','); if (p < 0) { continue; } WriteDefine(define.Substring(0, p), define.Substring(p + 1)); } } }
private void AddNamespaces(MxmlcOptions options) { if (options.Namespaces == null || options.Namespaces.Length == 0) { return; } WriteStartElement("namespaces"); foreach (var ns in options.Namespaces) { string path = ns.Manifest.Trim(); string uri = ns.Uri.Trim(); if (path.Length == 0 || uri.Length == 0) { continue; } path = project.GetAbsolutePath(path); if (!File.Exists(path)) { continue; } WriteStartElement("namespace"); WriteElementString("uri", uri); WriteElementString("manifest", path); WriteEndElement(); } WriteEndElement(); }
private void AddTargetPlayer(MxmlcOptions options) { int majorVersion = project.MovieOptions.MajorVersion; int minorVersion = project.MovieOptions.MinorVersion; string version; if (options.MinorVersion.Length > 0) { version = majorVersion + "." + options.MinorVersion; } else { version = majorVersion + "." + minorVersion; } string platform = project.MovieOptions.Platform; if (platform != PluginCore.PlatformData.FLASHPLAYER_PLATFORM && project.MovieOptions.HasPlatformSupport && project.MovieOptions.PlatformSupport.IsFlashPlatform) { version = PluginCore.PlatformData.ResolveFlashPlayerVersion(project.Language, platform, version); } WriteElementString("target-player", version); }
private void AddLibraries() { MxmlcOptions options = project.CompilerOptions; string absPath; if (options.IncludeLibraries.Length > 0) { WriteStartElement("include-libraries"); foreach (string path in options.IncludeLibraries) { absPath = project.GetAbsolutePath(path); if (File.Exists(absPath)) { WriteElementPathString("library", absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { WriteElementPathString("library", lib); } } } WriteEndElement(); } if (options.ExternalLibraryPaths.Length > 0) { WriteStartElement("external-library-path"); WriteAttributeString("append", "true"); foreach (string path in options.ExternalLibraryPaths) { absPath = project.GetAbsolutePath(path); if (File.Exists(absPath) || Directory.Exists(absPath)) { WriteElementPathString("path-element", absPath); } } WriteEndElement(); } if (options.LibraryPaths.Length > 0) { WriteStartElement("library-path"); WriteAttributeString("append", "true"); foreach (string path in options.LibraryPaths) { absPath = project.GetAbsolutePath(path); if (File.Exists(absPath) || Directory.Exists(absPath)) { WriteElementPathString("path-element", absPath); } } WriteEndElement(); } }
public void AddConfig(string path) { Add("-load-config+=" + path); MxmlcOptions options = project.CompilerOptions; if (options.LoadConfig != "") { Add("-load-config+=" + options.LoadConfig); } }
private void AddRSLs() { MxmlcOptions options = project.CompilerOptions; if (options.RSLPaths.Length > 0) { foreach (string path in options.RSLPaths) { string[] parts = path.Split(','); if (parts.Length < 2) { continue; } if (parts[0].Trim().Length == 0) { continue; } string absPath = project.GetAbsolutePath(parts[0]); if (File.Exists(absPath)) { WriteStartElement("runtime-shared-library-path"); WriteElementString("path-element", absPath); WriteElementString("rsl-url", parts[1]); if (parts.Length > 2) { WriteElementString("policy-file-url", parts[2]); } if (parts.Length > 3) { WriteElementString("rsl-url", parts[3]); } if (parts.Length > 4) { WriteElementString("policy-file-url", parts[4]); } WriteEndElement(); } } } }
private void InternalWriteConfig(string[] extraClasspaths, bool debugMode) { MxmlcOptions options = project.CompilerOptions; WriteStartDocument(); WriteComment("This Adobe Flex compiler configuration file was generated by a tool."); WriteComment("Any modifications you make may be lost."); WriteStartElement("flex-config"); AddTargetPlayer(options); AddBaseOptions(options); // TODO add metadatas WriteStartElement("compiler"); AddCompilerConstants(options, debugMode); AddCompilerOptions(options, debugMode); AddClassPaths(extraClasspaths); AddLibraries(); WriteEndElement(); AddRSLs(); AddCompileTargets(); AddMovieOptions(); WriteEndElement(); }
private void AddBaseOptions(MxmlcOptions options) { if (!asc2) { if (!options.Benchmark) { WriteElementString("benchmark", "false"); } else { WriteElementString("benchmark", "true"); } WriteElementString("static-link-runtime-shared-libraries", options.StaticLinkRSL ? "true" : "false"); } if (!options.UseNetwork) { WriteElementString("use-network", "false"); } if (!options.Warnings) { WriteElementString("warnings", "false"); } }
private void AddTargetPlayer(MxmlcOptions options) { int majorVersion = project.MovieOptions.MajorVersion; int minorVersion = project.MovieOptions.MinorVersion; if (project.MovieOptions.Platform == AS3MovieOptions.AIR_PLATFORM || project.MovieOptions.Platform == AS3MovieOptions.AIR_MOBILE_PLATFORM) { PluginCore.PlatformData.GuessFlashPlayerForAIR(ref majorVersion, ref minorVersion); } string version; if (options.MinorVersion.Length > 0) { version = majorVersion + "." + options.MinorVersion; } else { version = majorVersion + "." + minorVersion; } WriteElementString("target-player", version); }
public void AddOptions(bool releaseMode, bool incremental) { if (!releaseMode) { AddEq("-debug", true); } if (!asc2 && incremental) { AddEq("-incremental", true); } MxmlcOptions options = project.CompilerOptions; if (asc2 && options.AdvancedTelemetry) { AddEq("-advanced-telemetry", true); if (!string.IsNullOrEmpty(options.AdvancedTelemetryPassword)) { AddEq("-advanced-telemetry-password", options.AdvancedTelemetryPassword); } } if (asc2 && options.InlineFunctions) { AddEq("-inline", true); } if (options.LinkReport.Length > 0) { Add("-link-report", options.LinkReport); } if (options.LoadExterns.Length > 0) { Add("-load-externs", options.LoadExterns); } bool hasConfig = false; bool hasVersion = false; if (options.Additional != null) { string all = String.Join(" ", options.Additional); if (all.IndexOf("configname") > 0) { hasConfig = true; } if (all.IndexOf("swf-version") > 0) { hasVersion = true; } } bool isAIR = false; if (!hasConfig) { if (project.MovieOptions.Platform == "AIR") { isAIR = true; AddEq("+configname", "air"); } else if (project.MovieOptions.Platform == "AIR Mobile") { isAIR = true; AddEq("+configname", "airmobile"); } } if ((asc2 || flex45) && !hasVersion) { string version = project.MovieOptions.Version; if (isAIR) { version = PluginCore.PlatformData.GuessFlashPlayerForAIR(version); } string swfVersion = (project.MovieOptions as AS3MovieOptions).GetSWFVersion(version); if (swfVersion != null) { AddEq("-swf-version", swfVersion); } } if (options.Additional != null) { Add(options.Additional, releaseMode); } }
private void AddCompilerOptions(MxmlcOptions options, bool debugMode) { if (options.Locale.Length > 0) { WriteStartElement("locale"); WriteElementString("locale-element", options.Locale); WriteEndElement(); } if (options.Accessible) { WriteElementString("accessible", "true"); } if (options.AllowSourcePathOverlap) { WriteElementString("allow-source-path-overlap", "true"); } if (options.ES) { WriteElementString("es", "true"); WriteElementString("as3", "false"); } if (!options.Strict) { WriteElementString("strict", "false"); } if (!options.ShowActionScriptWarnings) { WriteElementString("show-actionscript-warnings", "false"); } if (!options.ShowBindingWarnings) { WriteElementString("show-binding-warnings", "false"); } if (!options.ShowInvalidCSS) { WriteElementString("show-invalid-css-property-warnings", "false"); } if (!options.ShowDeprecationWarnings) { WriteElementString("show-deprecation-warnings", "false"); } if (!options.ShowUnusedTypeSelectorWarnings) { WriteElementString("show-unused-type-selector-warnings", "false"); } if (!options.UseResourceBundleMetadata) { WriteElementString("use-resource-bundle-metadata", "false"); } if (!debugMode && options.Optimize) { WriteElementString("optimize", "true"); } if (!debugMode && flex4) { WriteElementString("omit-trace-statements", options.OmitTraces ? "true" : "false"); } if (debugMode) { WriteElementString("verbose-stacktraces", "true"); } else { WriteElementString("verbose-stacktraces", options.VerboseStackTraces ? "true" : "false"); } }
public void AddOptions(bool noTrace, bool incremental) { if (!noTrace) { AddEq("-debug", "true"); } if (incremental) { AddEq("-incremental", "true"); } MxmlcOptions options = project.CompilerOptions; if (options.Locale.Length > 0) { AddEq("-locale", options.Locale); } if (options.Accessible) { AddEq("-accessible", "true"); } if (options.AllowSourcePathOverlap) { AddEq("-allow-source-path-overlap", "true"); } if (!options.Benchmark) { AddEq("-benchmark", "false"); } else { AddEq("-benchmark", "true"); } if (options.ES) { AddEq("-es", "true"); AddEq("-as3", "false"); } if (noTrace && options.Optimize) { AddEq("-optimize", "true"); } if (!options.ShowActionScriptWarnings) { AddEq("-show-actionscript-warnings", "false"); } if (!options.ShowBindingWarnings) { AddEq("-show-binding-warnings", "false"); } if (!options.ShowInvalidCSS) { AddEq("-show-invalid-css-property-warnings", "false"); } if (!options.ShowDeprecationWarnings) { AddEq("-show-deprecation-warnings", "false"); } if (!options.ShowUnusedTypeSelectorWarnings) { AddEq("-show-unused-type-selector-warnings", "false"); } if (!options.Strict) { AddEq("-strict", "false"); } if (!options.UseNetwork) { AddEq("-use-network", "false"); } if (!options.UseResourceBundleMetadata) { AddEq("-use-resource-bundle-metadata", "false"); } if (!options.Warnings) { AddEq("-warnings", "false"); } AddEq("-static-link-runtime-shared-libraries", options.StaticLinkRSL ? "true" : "false"); if (!noTrace && options.VerboseStackTraces) { AddEq("-verbose-stacktraces", "true"); } if (options.LinkReport.Length > 0) { AddEq("-link-report", options.LinkReport); } if (options.LoadExterns.Length > 0) { AddEq("-load-externs", options.LoadExterns); } if (options.Additional != null) { Add(options.Additional, noTrace); } }
public void UpdateASCompletion(IMainForm mainForm, Project project) { List <string> classPaths = new List <string>(); List <string> hiddenPaths = new List <string>(); string version; string platform = ""; if (project != null) { BuildActions.GetCompilerPath(project); // refresh project's SDK project.UpdateVars(true); // platform/version platform = project.MovieOptions.Platform; version = project.MovieOptions.Version; if (platform != PlatformData.FLASHPLAYER_PLATFORM && project.MovieOptions.HasPlatformSupport && project.MovieOptions.PlatformSupport.IsFlashPlatform) { version = PlatformData.ResolveFlashPlayerVersion(project.Language, platform, version); } // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } // add AS3 libraries string absPath; if (project is AS3Project) { MxmlcOptions options = (project as AS3Project).CompilerOptions; foreach (string relPath in options.IntrinsicPaths) { absPath = PathHelper.ResolvePath(relPath); if (absPath == null) { absPath = project.GetAbsolutePath(relPath); } if (absPath == null) { continue; } if (Directory.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.LibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { classPaths.Add(lib); } } } foreach (string relPath in options.IncludeLibraries) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.ExternalLibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.RSLPaths) { string[] parts = relPath.Split(','); if (parts.Length < 2) { continue; } absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } } } string dir = project.Directory; foreach (string hidPath in project.HiddenPaths) { absPath = Path.Combine(dir, hidPath); foreach (string cp in classPaths) { if (absPath.StartsWithOrdinal(cp)) { hiddenPaths.Add(absPath); break; } } } } else if (PlatformData.SupportedLanguages.ContainsKey("as3")) { var targets = PlatformData.SupportedLanguages["as3"].Platforms; var flashPlatform = targets[PlatformData.FLASHPLAYER_PLATFORM]; version = flashPlatform.LastVersion.Value; } else { version = "11.0"; } DataEvent de; Hashtable info = new Hashtable(); // release old classpath if (currentLang != null && project == null) { info["lang"] = currentLang; info["platform"] = ""; info["targetBuild"] = ""; info["version"] = "0.0"; info["classpath"] = null; info["hidden"] = null; de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); } // set new classpath if (project != null) { currentLang = project.Language; info["platform"] = platform; info["version"] = version; info["targetBuild"] = project.TargetBuild; info["lang"] = currentLang; info["classpath"] = classPaths.ToArray(); info["hidden"] = hiddenPaths.ToArray(); de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); project.AdditionalPaths = info.ContainsKey("additional") ? info["additional"] as string[] : null; } else { currentLang = null; } }
public void UpdateASCompletion(IMainForm mainForm, Project project) { List <string> classPaths = new List <string>(); List <string> hiddenPaths = new List <string>(); int majorVersion = 0; int minorVersion = 0; string platform = ""; if (project != null) { BuildActions.GetCompilerPath(project); // refresh project's SDK project.UpdateVars(true); // platform/version platform = project.MovieOptions.Platform; majorVersion = project.MovieOptions.MajorVersion; minorVersion = project.MovieOptions.MinorVersion; if (project.MovieOptions.Platform == AS3MovieOptions.AIR_PLATFORM || project.MovieOptions.Platform == AS3MovieOptions.AIR_MOBILE_PLATFORM) { PlatformData.GuessFlashPlayerForAIR(ref majorVersion, ref minorVersion); } // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } // add AS3 libraries string absPath; if (project is AS3Project) { MxmlcOptions options = (project as AS3Project).CompilerOptions; foreach (string relPath in options.IntrinsicPaths) { absPath = PathHelper.ResolvePath(relPath); if (absPath == null) { absPath = project.GetAbsolutePath(relPath); } if (absPath == null) { continue; } if (Directory.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.LibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { classPaths.Add(lib); } } } foreach (string relPath in options.IncludeLibraries) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.ExternalLibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.RSLPaths) { string[] parts = relPath.Split(','); if (parts.Length < 2) { continue; } absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } } } string dir = project.Directory; foreach (string hidPath in project.HiddenPaths) { absPath = Path.Combine(dir, hidPath); foreach (string cp in classPaths) { if (absPath.StartsWith(cp)) { hiddenPaths.Add(absPath); break; } } } } DataEvent de; Hashtable info = new Hashtable(); // release old classpath if (currentLang != null && project == null) { info["lang"] = currentLang; info["platform"] = ""; info["targetBuild"] = ""; info["version"] = "0.0"; info["classpath"] = null; info["hidden"] = null; de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); } // set new classpath if (project != null) { currentLang = project.Language; info["platform"] = platform; info["version"] = majorVersion + "." + minorVersion; info["targetBuild"] = project.TargetBuild; info["lang"] = currentLang; info["classpath"] = classPaths.ToArray(); info["hidden"] = hiddenPaths.ToArray(); de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); project.AdditionalPaths = info.ContainsKey("additional") ? info["additional"] as string[] : null; } else { currentLang = null; } }
public void UpdateASCompletion(IMainForm mainForm, Project project) { List <string> classPaths = new List <string>(); if (project != null) { // add player version classPaths.Add(project.MovieOptions.Version.ToString()); // add special features if (project is AS3Project) { string[] additional = (project.CompilerOptions as MxmlcOptions).Additional; if (additional != null) { foreach (string param in additional) { if (param.IndexOf("configname=air") >= 0) { classPaths.Add("AIR"); } } } } // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } // add AS3 libraries if (project is AS3Project) { MxmlcOptions options = (project as AS3Project).CompilerOptions; foreach (string relPath in options.IntrinsicPaths) { string absPath = PathHelper.ResolvePath(relPath, project.Directory); if (Directory.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.LibraryPaths) { string absPath = project.GetAbsolutePath(relPath); if (File.Exists(absPath)) { classPaths.Add(absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { classPaths.Add(lib); } } } foreach (string relPath in options.IncludeLibraries) { string absPath = project.GetAbsolutePath(relPath); if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.ExternalLibraryPaths) { string absPath = project.GetAbsolutePath(relPath); if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.RSLPaths) { string[] parts = relPath.Split(','); if (parts.Length < 2) { continue; } string absPath = project.GetAbsolutePath(parts[0]); if (File.Exists(absPath)) { classPaths.Add(absPath); } } } } // release old classpath DataEvent de; if (currentLang != null && (project == null || currentLang != project.Language)) { de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", currentLang + ";"); EventManager.DispatchEvent(this, de); } // set new classpath if (project != null) { currentLang = project.Language; string cps = currentLang + ";" + string.Join(";", classPaths.ToArray()); de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", cps); EventManager.DispatchEvent(this, de); } else { currentLang = null; } }