public void PostBuildEvents(bool pDebug, Dictionary <string, string> pArguments, out string pOutput, out ICollection <Error> pErrors) { if (!pArguments.ContainsKey(@"FlexSdkPath")) { pOutput = string.Empty; pErrors = new Error[0]; return; } ProcessArguments process = new ProcessArguments(); As3ProjectBuilder builder = new As3ProjectBuilder(pArguments[@"FlexSdkPath"]); pArguments.Remove(@"FlexSdkPath"); process.AddArgument(Path.Combine(_outputFolder, MainClassName.Replace(".", "\\") + ".as")); process.AddArgument("source-path", _outputFolder); if (pDebug) { process.AddArgument(@"debug", "true"); process.AddArgument(@"omit-trace-statements", "false"); process.AddArgument(@"verbose-stacktraces", "true"); } foreach (var argument in pArguments) { process.AddArgument(argument.Key, argument.Value); } process.AddArgument("o", Path.Combine(_outputFolder, @"..\swf\file.swf")); pErrors = builder.Compile(_outputFolder, process.ToString(), false, out pOutput); }
/// <summary> /// Create a remote worker /// </summary> /// <param name="processArguments"></param> private MultiProcessWorkerClientBase(ProcessArguments processArguments) { HostedObjecType = processArguments.IpcRemoteType; m_WorkCommandResults = new ConcurrentDictionary <Guid, WorkResult>(); m_IpcCommunication = IpcCommunication <WorkCommand, WorkResult> .CreateServer(processArguments.IpcServerName, processArguments.IpcClientName); m_IpcCommunication.MessageRecived += OnIpcCommunicationMessageRecived; m_ProcessEventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, processArguments.IpcProcessName); m_WorkerProcess = CreateProcess(processArguments.ToString()); m_WorkerProcess.Exited += OnWorkerProcessExited; m_WorkerProcess.Disposed += OnWorkerProcessDisposed; m_WorkerProcess.Start(); }
protected override string GenerateCommandLineCommands() { ProcessArguments arguments = null; if (!InvokeLinkerUsingMono) { arguments = ProcessArguments.Create("--verbose"); } else { var toolsPath = GetPathToMonoLinker(); Log.LogMessage(MessageImportance.High, $"Running monolinker from {toolsPath}."); arguments = ProcessArguments.Create(toolsPath); arguments = arguments.Add("--verbose"); } // add exclude features arguments = arguments.AddRange("--exclude-feature", "remoting", "--exclude-feature", "com", "--exclude-feature", "etw"); string coremode, usermode; switch ((WasmLinkMode)Enum.Parse(typeof(WasmLinkMode), LinkMode)) { case WasmLinkMode.SdkOnly: coremode = "link"; usermode = "copy"; break; case WasmLinkMode.Full: coremode = "link"; usermode = "link"; break; default: coremode = "copyused"; usermode = "copy"; break; } arguments = arguments.AddRange("-c", coremode, "-u", usermode); //the linker doesn't consider these core by default arguments = arguments.AddRange("-p", coremode, "WebAssembly.Bindings"); arguments = arguments.AddRange("-p", coremode, "WebAssembly.Net.Http"); arguments = arguments.AddRange("-p", coremode, "WebAssembly.Net.WebSockets"); if (!string.IsNullOrEmpty(LinkSkip)) { var skips = LinkSkip.Split(new[] { ';', ',', ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var s in skips) { arguments = arguments.AddRange("-p", "copy", s); } } arguments = arguments.AddRange("-out", OutputDir); arguments = arguments.AddRange("-d", FrameworkDir); arguments = arguments.AddRange("-d", Path.Combine(FrameworkDir, "Facades")); arguments = arguments.AddRange("-b", Debug.ToString()); arguments = arguments.AddRange("-v", Debug.ToString()); arguments = arguments.AddRange("-a", RootAssembly[0].GetMetadata("FullPath")); //we'll normally have to check most of the because the SDK references most framework asm by default //so let's enumerate upfront var frameworkAssemblies = new HashSet <string> (StringComparer.OrdinalIgnoreCase); foreach (var f in Directory.EnumerateFiles(FrameworkDir)) { frameworkAssemblies.Add(Path.GetFileNameWithoutExtension(f)); } foreach (var f in Directory.EnumerateFiles(Path.Combine(FrameworkDir, "Facades"))) { frameworkAssemblies.Add(Path.GetFileNameWithoutExtension(f)); } //add references for non-framework assemblies if (Assemblies != null) { foreach (var asm in Assemblies) { var p = asm.GetMetadata("FullPath"); if (frameworkAssemblies.Contains(Path.GetFileNameWithoutExtension(p))) { continue; } arguments = arguments.AddRange("-r", p); } } if (string.IsNullOrEmpty(I18n)) { arguments = arguments.AddRange("-l", "none"); } else { var vals = I18n.Split(new[] { ',', ';', ' ', '\r', '\n', '\t' }); arguments = arguments.AddRange("-l", string.Join(",", vals)); } return(arguments.ToString()); }
protected override string GenerateCommandLineCommands() { ProcessArguments arguments = null; if (!InvokeLinkerUsingMono) { arguments = ProcessArguments.Create("--verbose"); } else { var toolsPath = GetPathToMonoLinker(); Log.LogMessage(MessageImportance.High, $"Running monolinker from {toolsPath}."); arguments = ProcessArguments.Create(toolsPath); arguments = arguments.Add("--verbose"); } arguments = arguments.AddRange("--deterministic"); // add exclude features arguments = arguments.AddRange("--exclude-feature", "remoting", "--exclude-feature", "com", "--exclude-feature", "etw"); string coremode, usermode; switch ((WasmLinkMode)Enum.Parse(typeof(WasmLinkMode), LinkMode)) { case WasmLinkMode.SdkOnly: coremode = "link"; usermode = "copy"; break; case WasmLinkMode.Full: coremode = "link"; usermode = "link"; break; default: coremode = "copyused"; usermode = "copy"; break; } arguments = arguments.AddRange("-c", coremode, "-u", usermode); //the linker doesn't consider these core by default foreach (var bn in bindingNames) { arguments = arguments.AddRange("-p", coremode, bn); } if (!string.IsNullOrEmpty(LinkSkip)) { var skips = LinkSkip.Split(new[] { ';', ',', ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var s in skips) { arguments = arguments.AddRange("-p", "copy", s); } } arguments = arguments.AddRange("-out", OutputDir); arguments = arguments.AddRange("-d", FrameworkDir); arguments = arguments.AddRange("-d", Path.Combine(FrameworkDir, "Facades")); arguments = arguments.AddRange("-b", Debug.ToString()); arguments = arguments.AddRange("-v", Debug.ToString()); // add custom link descriptions // to ensure the type, methods and/or fields are not eliminated from your application. if (LinkDescriptions != null) { foreach (var desc in LinkDescriptions) { var l = desc.GetMetadata("FullPath"); arguments = arguments.AddRange("-x", l); } } arguments = arguments.AddRange("-a", RootAssembly[0].GetMetadata("FullPath")); //we'll normally have to check most of the files because the SDK references most framework asm by default //so let's enumerate upfront var frameworkAssemblies = new HashSet <string> (StringComparer.OrdinalIgnoreCase); foreach (var f in Directory.EnumerateFiles(FrameworkDir)) { frameworkAssemblies.Add(Path.GetFileNameWithoutExtension(f)); } foreach (var f in Directory.EnumerateFiles(Path.Combine(FrameworkDir, "Facades"))) { frameworkAssemblies.Add(Path.GetFileNameWithoutExtension(f)); } // Load the runtime assemblies to be replaced in the references below var runtimeCopyLocal = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase); if (RuntimeCopyLocalAssemblies != null) { foreach (var copyAsm in RuntimeCopyLocalAssemblies) { var p = copyAsm.GetMetadata("FullPath"); if (frameworkAssemblies.Contains(Path.GetFileNameWithoutExtension(p))) { continue; } runtimeCopyLocal.Add(Path.GetFileNameWithoutExtension(p), p); } } //add references for non-framework assemblies if (Assemblies != null) { foreach (var asm in Assemblies) { var p = asm.GetMetadata("FullPath"); if (frameworkAssemblies.Contains(Path.GetFileNameWithoutExtension(p))) { continue; } if (runtimeCopyLocal.TryGetValue(Path.GetFileNameWithoutExtension(p), out var runtimePath)) { if (!string.IsNullOrEmpty(BindingsDir) && bindingNames.Contains(Path.GetFileNameWithoutExtension(p))) { runtimePath = Path.Combine(BindingsDir, Path.GetFileName(p)); } // Just in case if (File.Exists(runtimePath)) { p = runtimePath; } } arguments = arguments.AddRange("-r", p); } } if (string.IsNullOrEmpty(I18n)) { arguments = arguments.AddRange("-l", "none"); } else { var vals = I18n.Split(new[] { ',', ';', ' ', '\r', '\n', '\t' }); arguments = arguments.AddRange("-l", string.Join(",", vals)); } return(arguments.ToString()); }
public void PostBuildEvents(bool pDebug, Dictionary<string, string> pArguments, out string pOutput, out ICollection<Error> pErrors) { if (!pArguments.ContainsKey(@"FlexSdkPath")) { pOutput = string.Empty; pErrors = new List<Error>(); return; } ProcessArguments process = new ProcessArguments(); JsProjectBuilder builder = new JsProjectBuilder(pArguments[@"FlexSdkPath"]); pArguments.Remove(@"FlexSdkPath"); process.AddArgument(Path.Combine(_outputFolder, MainClassName.Replace(".", "\\")+".as")); process.AddArgument("source-path", _outputFolder); if (pDebug) { process.AddArgument(@"debug", "true"); process.AddArgument(@"omit-trace-statements", "false"); process.AddArgument(@"verbose-stacktraces", "true"); } foreach (var argument in pArguments) { process.AddArgument(argument.Key, argument.Value); } process.AddArgument("o", Path.Combine(_outputFolder, @"..\swf\file.swf")); pErrors = builder.Compile(_outputFolder, process.ToString(), false, out pOutput); }