Beispiel #1
0
        string [] GenerateCommandLineCommands()
        {
            var args = new List <string> ();

            if (RootDescriptorFiles != null)
            {
                foreach (var rootFile in RootDescriptorFiles)
                {
                    args.Add("-x");
                    args.Add(rootFile.ItemSpec);
                }
            }

            foreach (var assemblyItem in RootAssemblyNames)
            {
                args.Add("-a");
                args.Add(assemblyItem.ItemSpec);
            }

            HashSet <string> directories = new HashSet <string> ();

            foreach (var assembly in AssemblyPaths)
            {
                var assemblyPath = assembly.ItemSpec;
                var dir          = Path.GetDirectoryName(assemblyPath);
                if (!directories.Contains(dir))
                {
                    directories.Add(dir);
                    args.Add("-d");
                    args.Add(dir);
                }

                string action = assembly.GetMetadata("action");
                if ((action != null) && (action.Length > 0))
                {
                    args.Add("-p");
                    args.Add(action);
                    args.Add(Path.GetFileNameWithoutExtension(assemblyPath));
                }
            }

            if (OutputDirectory != null)
            {
                args.Add("-out");
                args.Add(OutputDirectory.ItemSpec);
            }

            if (ExtraArgs != null)
            {
                args.AddRange(ExtraArgs.Split(' '));
            }

            if (DumpDependencies)
            {
                args.Add("--dump-dependencies");
            }

            return(args.ToArray());
        }
        public IEnumerable <string> GetArgValidationErrors()
        {
            var errors = new List <string>();

            if (List)
            {
                return(errors);
            }

            if (!ShowDefaults && Account == ServiceAccount.User)
            {
                if (string.IsNullOrWhiteSpace(Username))
                {
                    errors.Add("user is required when account=User");
                }
                if (string.IsNullOrWhiteSpace(Password))
                {
                    errors.Add("pwd is required when account=User");
                }
            }

            if (string.IsNullOrWhiteSpace(CommandLine))
            {
                errors.Add("command is required");
            }
            else
            {
                if (ExtraArgs.Count > 0)
                {
                    CommandLine = CommandLine.TrimEnd() + " " + string.Join(" ", ExtraArgs);
                    ExtraArgs.Clear();
                }

                _commandRunData = CommandsOptions.Load(CommandLine);

                if (_commandRunData.Errors.Count > 0)
                {
                    errors.Add("errors with arguments for /command");
                    errors.AddRange(_commandRunData.Errors);
                }
                else
                {
                    _serviceCommand = _commandRunData.Command as ICanRunAsService;
                    if (_serviceCommand == null)
                    {
                        errors.Add(_commandRunData.Command.GetType().Name + " does not implement ICanRunAsService");
                    }
                    else
                    {
                        ServiceName = ServiceName ?? _serviceCommand.ServiceName;
                        DisplayName = DisplayName ?? _serviceCommand.DisplayName;
                        Description = Description ?? _serviceCommand.Description;
                    }
                }
            }
            return(errors);
        }
        public T TryGetExtraArg <T>(ExtraArgs arg, T defaultVal)
        {
            var index = (int)arg;

            if (ExtraArgs.Count > index && ExtraArgs[index] is T)
            {
                return((T)ExtraArgs[index]);
            }
            return(defaultVal);
        }
Beispiel #4
0
        public string GetConnectionString()
        {
            var connectionString = $"mongodb://{User}:{Password}@{Host}";

            connectionString += $"/{AuthenticatingDatabase}";

            if (ExtraArgs != null && ExtraArgs.Count > 0)
            {
                var args          = ExtraArgs.Select(t => $"{t.Name}={t.Value}");
                var argsDelimited = string.Join("&", args);
                connectionString += $"?{argsDelimited}";
            }

            return(connectionString);
        }
Beispiel #5
0
        private string[] GenerateCommandLineCommands()
        {
            var args = new List <string>();

            if (RootDescriptorFiles != null)
            {
                foreach (var rootFile in RootDescriptorFiles)
                {
                    args.Add("-x");
                    args.Add(rootFile.ItemSpec);
                }
            }

            foreach (var assemblyItem in RootAssemblyNames)
            {
                args.Add("-a");
                args.Add(assemblyItem.ItemSpec);
            }

            var assemblyDirs = AssemblyPaths.Select(p => Path.GetDirectoryName(p.ItemSpec))
                               .GroupBy(d => d).Select(ds => ds.First());

            foreach (var dir in assemblyDirs)
            {
                args.Add("-d");
                args.Add(dir);
            }

            if (OutputDirectory != null)
            {
                args.Add("-out");
                args.Add(OutputDirectory.ItemSpec);
            }

            if (ExtraArgs != null)
            {
                args.AddRange(ExtraArgs.Split(' '));
            }

            if (DumpDependencies)
            {
                args.Add("--dump-dependencies");
            }

            return(args.ToArray());
        }
Beispiel #6
0
        public override bool MouseWheel(MouseEventArgs e, float xoff, float yoff, ExtraArgs args, ref Vector3 camTarget, ref float rot, ref float lookup, ref float zoom)
        {
            float delta = (float)(e.Delta * Math.Min(0.01f, args.pickingDepth / 500f));

            camTarget -= Vector3.UnitX * (float)Math.Sin(rot) * (float)Math.Cos(lookup) * delta;
            camTarget += Vector3.UnitY * (float)Math.Sin(lookup) * delta;
            camTarget += Vector3.UnitZ * (float)Math.Cos(rot) * (float)Math.Cos(lookup) * delta;

            float factoffX = (float)(-xoff * delta) * args.factorX;
            float factoffY = (float)(-yoff * delta) * args.factorY;

            camTarget += Vector3.UnitX * (float)Math.Cos(rot) * factoffX;
            camTarget -= Vector3.UnitX * (float)Math.Sin(rot) * (float)Math.Sin(lookup) * factoffY;
            camTarget -= Vector3.UnitY * (float)Math.Cos(lookup) * factoffY;
            camTarget += Vector3.UnitZ * (float)Math.Sin(rot) * factoffX;
            camTarget += Vector3.UnitZ * (float)Math.Cos(rot) * (float)Math.Sin(lookup) * factoffY;
            return(true);
        }
Beispiel #7
0
        protected override string GenerateCommandLineCommands()
        {
            var args = new ProcessArgumentBuilder();
            TargetArchitecture architectures;
            bool msym;

            if (string.IsNullOrEmpty(Architectures) || !Enum.TryParse(Architectures, out architectures))
            {
                architectures = TargetArchitecture.Default;
            }

            if (architectures == TargetArchitecture.ARMv6)
            {
                Log.LogError("Target architecture ARMv6 is no longer supported in Xamarin.iOS. Please select a supported architecture.");
                return(null);
            }

            if (IsClassic && minimumOSVersion < IPhoneSdkVersion.V3_1 && architectures.HasFlag(TargetArchitecture.ARMv7))
            {
                Log.LogWarning(null, null, null, AppManifest.ItemSpec, 0, 0, 0, 0, "Deployment Target changed from iOS {0} to iOS 3.1 (minimum requirement for ARMv7)", minimumOSVersion);
                minimumOSVersion = IPhoneSdkVersion.V3_1;
            }

            if (!string.IsNullOrEmpty(IntermediateOutputPath))
            {
                Directory.CreateDirectory(IntermediateOutputPath);

                args.Add("--cache");
                args.AddQuoted(Path.GetFullPath(IntermediateOutputPath));
            }

            if (IsClassic || IPhoneSdks.MonoTouch.Version < new IPhoneSdkVersion(8, 5, 0))
            {
                args.Add("--nomanifest");
                args.Add("--nosign");
            }

            args.Add(SdkIsSimulator ? "--sim" : "--dev");
            args.AddQuoted(Path.GetFullPath(AppBundleDir));

            if (AppleSdkSettings.XcodeVersion.Major >= 5 && IPhoneSdks.MonoTouch.Version.CompareTo(new IPhoneSdkVersion(6, 3, 7)) < 0)
            {
                args.Add("--compiler", "clang");
            }

            args.Add("--executable");
            args.AddQuoted(ExecutableName);

            if (IsAppExtension)
            {
                args.Add("--extension");
            }

            if (Debug)
            {
                if (FastDev && IPhoneSdks.MonoTouch.SupportsFastDev)
                {
                    args.Add("--fastdev");
                }

                args.Add("--debug");
            }

            if (Profiling)
            {
                args.Add("--profiling");
            }

            if (LinkerDumpDependencies)
            {
                args.Add("--linkerdumpdependencies");
            }

            switch (LinkMode.ToLowerInvariant())
            {
            case "sdkonly": args.Add("--linksdkonly"); break;

            case "none":    args.Add("--nolink"); break;
            }

            if (!string.IsNullOrEmpty(I18n))
            {
                args.Add("--i18n");
                args.AddQuotedFormat(I18n);
            }

            args.Add("--sdkroot");
            args.AddQuoted(SdkRoot);

            args.Add("--sdk");
            args.AddQuoted(SdkVersion);

            if (!minimumOSVersion.IsUseDefault)
            {
                args.Add("--targetver");
                args.AddQuoted(minimumOSVersion.ToString());
            }

            if (UseFloat32 /* We want to compile 32-bit floating point code to use 32-bit floating point operations */)
            {
                args.Add("--aot-options=-O=float32");
            }

            if (IPhoneSdks.MonoTouch.SupportsGenericValueTypeSharing)
            {
                if (!EnableGenericValueTypeSharing)
                {
                    args.Add("--gsharedvt=false");
                }
            }

            if (LinkDescriptions != null)
            {
                foreach (var desc in LinkDescriptions)
                {
                    args.AddQuoted(string.Format("--xml={0}", desc.ItemSpec));
                }
            }

            if (EnableBitcode)
            {
                switch (Framework)
                {
                case PlatformFramework.WatchOS:
                    args.Add("--bitcode=full");
                    break;

                case PlatformFramework.TVOS:
                    args.Add("--bitcode=asmonly");
                    break;

                default:
                    throw new InvalidOperationException(string.Format("Bitcode is currently not supported on {0}.", Framework));
                }
            }

            if (!string.IsNullOrEmpty(HttpClientHandler))
            {
                args.Add(string.Format("--http-message-handler={0}", HttpClientHandler));
            }

            if (!string.IsNullOrEmpty(TLSProvider))
            {
                args.Add(string.Format("--tls-provider={0}", TLSProvider.ToLowerInvariant()));
            }

            string thumb = UseThumb && UseLlvm ? "+thumb2" : "";
            string llvm  = UseLlvm ? "+llvm" : "";
            string abi   = "";

            if (SdkIsSimulator)
            {
                if (architectures.HasFlag(TargetArchitecture.i386))
                {
                    abi += (abi.Length > 0 ? "," : "") + "i386";
                }

                if (architectures.HasFlag(TargetArchitecture.x86_64))
                {
                    abi += (abi.Length > 0 ? "," : "") + "x86_64";
                }

                if (string.IsNullOrEmpty(abi))
                {
                    architectures = TargetArchitecture.i386;
                    abi           = "i386";
                }
            }
            else
            {
                if (architectures == TargetArchitecture.Default)
                {
                    architectures = TargetArchitecture.ARMv7;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7" + llvm + thumb;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7s))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7s" + llvm + thumb;
                }

                if (architectures.HasFlag(TargetArchitecture.ARM64))
                {
                    // Note: ARM64 does not have thumb.
                    abi += (abi.Length > 0 ? "," : "") + "arm64" + llvm;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7k))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7k" + llvm;
                }

                if (string.IsNullOrEmpty(abi))
                {
                    abi = "armv7" + llvm + thumb;
                }
            }

            // Output the CompiledArchitectures
            CompiledArchitectures = architectures.ToString();

            args.Add("--abi=" + abi);

            // output symbols to preserve when stripping
            args.Add("--symbollist");
            args.AddQuoted(Path.GetFullPath(SymbolsList));

            // don't have mtouch generate the dsyms...
            args.Add("--dsym=no");

            if (!string.IsNullOrEmpty(ArchiveSymbols) && bool.TryParse(ArchiveSymbols.Trim(), out msym))
            {
                args.Add("--msym=" + (msym ? "yes" : "no"));
            }

            var gcc = new GccOptions();

            if (!string.IsNullOrEmpty(ExtraArgs))
            {
                var    extraArgs = ProcessArgumentBuilder.Parse(ExtraArgs);
                var    target    = MainAssembly.ItemSpec;
                string projectDir;

                if (ProjectDir.StartsWith("~/", StringComparison.Ordinal))
                {
                    // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host,
                    // it simply uses paths relative to "~/". Expand these paths to their full path equivalents.
                    var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

                    projectDir = Path.Combine(home, ProjectDir.Substring(2));
                }
                else
                {
                    projectDir = ProjectDir;
                }

                var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase)
                {
                    { "projectdir", projectDir },
                    // Apparently msbuild doesn't propagate the solution path, so we can't get it.
                    // { "solutiondir",  proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory },
                    { "appbundledir", AppBundleDir },
                    { "targetpath", Path.Combine(Path.GetDirectoryName(target), Path.GetFileName(target)) },
                    { "targetdir", Path.GetDirectoryName(target) },
                    { "targetname", Path.GetFileName(target) },
                    { "targetext", Path.GetExtension(target) },
                };

                for (int i = 0; i < extraArgs.Length; i++)
                {
                    if (extraArgs[i] == "-gcc_flags" || extraArgs[i] == "--gcc_flags")
                    {
                        // user-defined -gcc_flags argument
                        if (i + 1 < extraArgs.Length && !string.IsNullOrEmpty(extraArgs[i + 1]))
                        {
                            var gccArgs = ProcessArgumentBuilder.Parse(extraArgs[i + 1]);

                            for (int j = 0; j < gccArgs.Length; j++)
                            {
                                gcc.Arguments.Add(StringParserService.Parse(gccArgs[j], customTags));
                            }
                        }

                        i++;
                    }
                    else
                    {
                        // other user-defined mtouch arguments
                        args.AddQuoted(StringParserService.Parse(extraArgs[i], customTags));
                    }
                }
            }

            BuildNativeReferenceFlags(gcc);
            BuildEntitlementFlags(gcc);

            foreach (var framework in gcc.Frameworks)
            {
                args.Add("-framework");
                args.AddQuoted(framework);
            }

            foreach (var framework in gcc.WeakFrameworks)
            {
                args.Add("-weak-framework");
                args.AddQuoted(framework);
            }

            if (gcc.Cxx)
            {
                args.Add("--cxx");
            }

            if (gcc.Arguments.Length > 0)
            {
                args.Add("--gcc_flags");
                args.AddQuoted(gcc.Arguments.ToString());
            }

            foreach (var asm in References)
            {
                args.Add("-r");
                if (IsFrameworkItem(asm))
                {
                    args.AddQuoted(ResolveFrameworkFile(asm.ItemSpec));
                }
                else
                {
                    args.AddQuoted(Path.GetFullPath(asm.ItemSpec));
                }
            }

            foreach (var ext in AppExtensionReferences)
            {
                args.Add("--app-extension");
                args.AddQuoted(Path.GetFullPath(ext.ItemSpec));
            }

            args.Add("--target-framework");
            args.Add(TargetFrameworkIdentifier + "," + TargetFrameworkVersion);

            args.AddQuoted(MainAssembly.ItemSpec);

            // We give the priority to the ExtraArgs to set the mtouch verbosity.
            if (string.IsNullOrEmpty(ExtraArgs) || (!string.IsNullOrEmpty(ExtraArgs) && !ExtraArgs.Contains("-q") && !ExtraArgs.Contains("-v")))
            {
                args.Add(GetVerbosityLevel(Verbosity));
            }

            if (!string.IsNullOrWhiteSpace(License))
            {
                args.Add(string.Format("--license={0}", License));
            }

            return(args.ToString());
        }
Beispiel #8
0
        protected override string GenerateCommandLineCommands()
        {
            var           args          = new CommandLineArgumentBuilder();
            List <string> unescapedArgs = new List <string> ();

            TargetArchitecture architectures;
            bool msym;

            if (string.IsNullOrEmpty(Architectures) || !Enum.TryParse(Architectures, out architectures))
            {
                architectures = TargetArchitecture.Default;
            }

            if (architectures == TargetArchitecture.ARMv6)
            {
                Log.LogError("Target architecture ARMv6 is no longer supported in Xamarin.iOS. Please select a supported architecture.");
                return(null);
            }

            if (!string.IsNullOrEmpty(IntermediateOutputPath))
            {
                Directory.CreateDirectory(IntermediateOutputPath);

                args.AddQuotedLine($"--cache={Path.GetFullPath (IntermediateOutputPath)}");
            }

            args.AddQuotedLine((SdkIsSimulator ? "--sim=" : "--dev=") + Path.GetFullPath(AppBundleDir));

            if (AppleSdkSettings.XcodeVersion.Major >= 5 && IPhoneSdks.MonoTouch.Version.CompareTo(new IPhoneSdkVersion(6, 3, 7)) < 0)
            {
                args.AddLine("--compiler=clang");
            }

            args.AddQuotedLine($"--executable={ExecutableName}");

            if (IsAppExtension)
            {
                args.AddLine("--extension");
            }

            if (Debug)
            {
                if (FastDev && !SdkIsSimulator)
                {
                    args.AddLine("--fastdev");
                }

                args.AddLine("--debug");
            }

            if (Profiling)
            {
                args.AddLine("--profiling");
            }

            if (LinkerDumpDependencies)
            {
                args.AddLine("--linkerdumpdependencies");
            }

            if (EnableSGenConc)
            {
                args.AddLine("--sgen-conc");
            }

            if (!string.IsNullOrEmpty(Interpreter))
            {
                args.Add($"--interpreter={Interpreter}");
            }

            switch (LinkMode.ToLowerInvariant())
            {
            case "sdkonly": args.AddLine("--linksdkonly"); break;

            case "none":    args.AddLine("--nolink"); break;
            }

            if (!string.IsNullOrEmpty(I18n))
            {
                args.AddQuotedLine($"--i18n={I18n}");
            }

            args.AddQuotedLine($"--sdkroot={SdkRoot}");

            args.AddQuotedLine($"--sdk={SdkVersion}");

            if (!minimumOSVersion.IsUseDefault)
            {
                args.AddQuotedLine($"--targetver={minimumOSVersion.ToString ()}");
            }

            if (UseFloat32 /* We want to compile 32-bit floating point code to use 32-bit floating point operations */)
            {
                args.AddLine("--aot-options=-O=float32");
            }
            else
            {
                args.AddLine("--aot-options=-O=-float32");
            }

            if (!EnableGenericValueTypeSharing)
            {
                args.AddLine("--gsharedvt=false");
            }

            if (LinkDescriptions != null)
            {
                foreach (var desc in LinkDescriptions)
                {
                    args.AddQuotedLine($"--xml={desc.ItemSpec}");
                }
            }

            if (EnableBitcode)
            {
                switch (Framework)
                {
                case PlatformFramework.WatchOS:
                    args.AddLine("--bitcode=full");
                    break;

                case PlatformFramework.TVOS:
                    args.AddLine("--bitcode=asmonly");
                    break;

                default:
                    throw new InvalidOperationException(string.Format("Bitcode is currently not supported on {0}.", Framework));
                }
            }

            if (!string.IsNullOrEmpty(HttpClientHandler))
            {
                args.AddLine($"--http-message-handler={HttpClientHandler}");
            }

            string thumb = UseThumb && UseLlvm ? "+thumb2" : "";
            string llvm  = UseLlvm ? "+llvm" : "";
            string abi   = "";

            if (SdkIsSimulator)
            {
                if (architectures.HasFlag(TargetArchitecture.i386))
                {
                    abi += (abi.Length > 0 ? "," : "") + "i386";
                }

                if (architectures.HasFlag(TargetArchitecture.x86_64))
                {
                    abi += (abi.Length > 0 ? "," : "") + "x86_64";
                }

                if (string.IsNullOrEmpty(abi))
                {
                    architectures = TargetArchitecture.i386;
                    abi           = "i386";
                }
            }
            else
            {
                if (architectures == TargetArchitecture.Default)
                {
                    architectures = TargetArchitecture.ARMv7;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7" + llvm + thumb;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7s))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7s" + llvm + thumb;
                }

                if (architectures.HasFlag(TargetArchitecture.ARM64))
                {
                    // Note: ARM64 does not have thumb.
                    abi += (abi.Length > 0 ? "," : "") + "arm64" + llvm;
                }

                if (architectures.HasFlag(TargetArchitecture.ARMv7k))
                {
                    abi += (abi.Length > 0 ? "," : "") + "armv7k" + llvm;
                }

                if (string.IsNullOrEmpty(abi))
                {
                    abi = "armv7" + llvm + thumb;
                }
            }

            // Output the CompiledArchitectures
            CompiledArchitectures = architectures.ToString();

            args.AddLine($"--abi={abi}");

            // output symbols to preserve when stripping
            args.AddQuotedLine($"--symbollist={Path.GetFullPath (SymbolsList)}");

            // don't have mtouch generate the dsyms...
            args.AddLine("--dsym=no");

            if (!string.IsNullOrEmpty(ArchiveSymbols) && bool.TryParse(ArchiveSymbols.Trim(), out msym))
            {
                args.AddLine($"--msym={(msym ? "yes" : "no")}");
            }

            var gcc = new GccOptions();

            if (!string.IsNullOrEmpty(ExtraArgs))
            {
                var    extraArgs = CommandLineArgumentBuilder.Parse(ExtraArgs);
                var    target    = MainAssembly.ItemSpec;
                string projectDir;

                if (ProjectDir.StartsWith("~/", StringComparison.Ordinal))
                {
                    // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host,
                    // it simply uses paths relative to "~/". Expand these paths to their full path equivalents.
                    var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

                    projectDir = Path.Combine(home, ProjectDir.Substring(2));
                }
                else
                {
                    projectDir = ProjectDir;
                }

                var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase)
                {
                    { "projectdir", projectDir },
                    // Apparently msbuild doesn't propagate the solution path, so we can't get it.
                    // { "solutiondir",  proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory },
                    { "appbundledir", AppBundleDir },
                    { "targetpath", Path.Combine(Path.GetDirectoryName(target), Path.GetFileName(target)) },
                    { "targetdir", Path.GetDirectoryName(target) },
                    { "targetname", Path.GetFileName(target) },
                    { "targetext", Path.GetExtension(target) },
                };

                for (int i = 0; i < extraArgs.Length; i++)
                {
                    var argument   = extraArgs[i];
                    int startIndex = 0;

                    while (argument.Length > startIndex && argument[startIndex] == '-')
                    {
                        startIndex++;
                    }

                    int endIndex = startIndex;
                    while (endIndex < argument.Length && argument[endIndex] != '=')
                    {
                        endIndex++;
                    }

                    int length = endIndex - startIndex;

                    if (length == 9 && string.CompareOrdinal(argument, startIndex, "gcc_flags", 0, 9) == 0)
                    {
                        // user-defined -gcc_flags argument
                        string flags = null;

                        if (endIndex < extraArgs[i].Length)
                        {
                            flags = Unquote(argument, endIndex + 1);
                        }
                        else if (i + 1 < extraArgs.Length)
                        {
                            flags = extraArgs[++i];
                        }

                        if (!string.IsNullOrEmpty(flags))
                        {
                            var gccArgs = CommandLineArgumentBuilder.Parse(flags);

                            for (int j = 0; j < gccArgs.Length; j++)
                            {
                                gcc.Arguments.Add(StringParserService.Parse(gccArgs[j], customTags));
                            }
                        }
                    }
                    else
                    {
                        // other user-defined mtouch arguments
                        unescapedArgs.Add(StringParserService.Parse(argument, customTags));
                    }
                }
            }

            BuildNativeReferenceFlags(gcc);
            BuildEntitlementFlags(gcc);

            foreach (var framework in gcc.Frameworks)
            {
                args.AddQuotedLine($"--framework={framework}");
            }

            foreach (var framework in gcc.WeakFrameworks)
            {
                args.AddQuotedLine($"--weak-framework={framework}");
            }

            if (gcc.Cxx)
            {
                args.AddLine("--cxx");
            }

            if (gcc.Arguments.Length > 0)
            {
                unescapedArgs.Add($"--gcc_flags={gcc.Arguments.ToString ()}");
            }

            foreach (var asm in References)
            {
                if (IsFrameworkItem(asm))
                {
                    args.AddQuotedLine($"-r={ResolveFrameworkFile (asm.ItemSpec)}");
                }
                else
                {
                    args.AddQuotedLine($"-r={Path.GetFullPath (asm.ItemSpec)}");
                }
            }

            foreach (var ext in AppExtensionReferences)
            {
                args.AddQuotedLine($"--app-extension={Path.GetFullPath (ext.ItemSpec)}");
            }

            args.AddLine($"--target-framework={TargetFrameworkIdentifier},{TargetFrameworkVersion}");

            args.AddQuotedLine($"--root-assembly={Path.GetFullPath (MainAssembly.ItemSpec)}");

            // We give the priority to the ExtraArgs to set the mtouch verbosity.
            if (string.IsNullOrEmpty(ExtraArgs) || (!string.IsNullOrEmpty(ExtraArgs) && !ExtraArgs.Contains("-q") && !ExtraArgs.Contains("-v")))
            {
                args.AddLine(GetVerbosityLevel(Verbosity));
            }

            if (!string.IsNullOrWhiteSpace(License))
            {
                args.AddLine($"--license={License}");
            }

            // Generate a response file
            var responseFile = Path.GetFullPath(ResponseFilePath);

            if (File.Exists(responseFile))
            {
                File.Delete(responseFile);
            }

            try {
                using (var fs = File.Create(responseFile)) {
                    using (var writer = new StreamWriter(fs))
                        writer.Write(args);
                }
            } catch (Exception ex) {
                Log.LogWarning("Failed to create response file '{0}': {1}", responseFile, ex);
            }

            // Some arguments can not safely go in the response file and are
            // added separately. They must go _after_ the response file
            // as they may override options passed in the response file
            var actualArgs = new CommandLineArgumentBuilder();

            actualArgs.AddQuoted($"@{responseFile}");

            foreach (var arg in unescapedArgs)
            {
                actualArgs.AddQuoted(arg);
            }

            return(actualArgs.ToString());
        }
Beispiel #9
0
        string [] GenerateCommandLineCommands()
        {
            var args = new List <string> ();

            if (RootDescriptorFiles != null)
            {
                foreach (var rootFile in RootDescriptorFiles)
                {
                    args.Add("-x");
                    args.Add(rootFile.ItemSpec);
                }
            }

            foreach (var assemblyItem in RootAssemblyNames)
            {
                args.Add("-a");
                args.Add(assemblyItem.ItemSpec);
            }

            HashSet <string> directories = new HashSet <string> ();

            foreach (var assembly in AssemblyPaths)
            {
                var assemblyPath = assembly.ItemSpec;
                var dir          = Path.GetDirectoryName(assemblyPath);
                if (!directories.Contains(dir))
                {
                    directories.Add(dir);
                    args.Add("-d");
                    args.Add(dir);
                }

                string action = assembly.GetMetadata("action");
                if ((action != null) && (action.Length > 0))
                {
                    args.Add("-p");
                    args.Add(action);
                    args.Add(Path.GetFileNameWithoutExtension(assemblyPath));
                }
            }

            if (OutputDirectory != null)
            {
                args.Add("-out");
                args.Add(OutputDirectory.ItemSpec);
            }

            if (ClearInitLocals)
            {
                args.Add("-s");
                // Version of ILLink.CustomSteps is passed as a workaround for msbuild issue #3016
                args.Add("ILLink.CustomSteps.ClearInitLocalsStep,ILLink.CustomSteps,Version=0.0.0.0:OutputStep");
                if ((ClearInitLocalsAssemblies != null) && (ClearInitLocalsAssemblies.Length > 0))
                {
                    args.Add("-m");
                    args.Add("ClearInitLocalsAssemblies");
                    args.Add(ClearInitLocalsAssemblies);
                }
            }

            if (ExtraArgs != null)
            {
                args.AddRange(ExtraArgs.Split(' '));
            }

            if (DumpDependencies)
            {
                args.Add("--dump-dependencies");
            }

            return(args.ToArray());
        }
Beispiel #10
0
        public override bool MouseMove(MouseEventArgs e, Point lastMouseLoc, float deltaX, float deltaY, ExtraArgs args, ref Vector3 camTarget, ref float rot, ref float lookup, ref float zoom)
        {
            if (e.Button == MouseButtons.Right)
            {
                rot    += deltaX * 0.002f;
                lookup += deltaY * 0.002f;
                return(true);
            }
            else if (e.Button == MouseButtons.Left)
            {
                //code from Whitehole

                deltaX *= Math.Min(0.1f, args.pickingDepth * args.factorX);
                deltaY *= Math.Min(0.1f, args.pickingDepth * args.factorY);

                camTarget += Vector3.UnitX * deltaX * (float)Math.Cos(rot);
                camTarget -= Vector3.UnitX * deltaY * (float)Math.Sin(rot) * (float)Math.Sin(lookup);
                camTarget -= Vector3.UnitY * deltaY * (float)Math.Cos(lookup);
                camTarget += Vector3.UnitZ * deltaX * (float)Math.Sin(rot);
                camTarget += Vector3.UnitZ * deltaY * (float)Math.Cos(rot) * (float)Math.Sin(lookup);

                return(true);
            }
            return(false);
        }
 public virtual bool MouseWheel(MouseEventArgs e, float xoff, float yoff, ExtraArgs args, float rot, float lookup)
 {
     return(false);
 }
 public virtual bool MouseMove(MouseEventArgs e, Point lastMouseLoc, float deltaX, float deltaY, ExtraArgs args, float rot, float lookup)
 {
     return(false);
 }
Beispiel #13
0
 public override bool MouseWheel(MouseEventArgs e, float xoff, float yoff, ExtraArgs args, ref Vector3 camTarget, ref float rot, ref float lookup, ref float zoom)
 {
     zoom *= 1f - e.Delta * 0.001f;
     return(true);
 }