예제 #1
0
        private void BuildGameImpl(IEnumerable <Type> typesToInclude, IEnumerable <string> additionalOptions)
        {
            _steps = GetFinalSteps(typesToInclude, additionalOptions);

            var registry = new OptionsRegistry();

            registry.Collect(_steps);

            var cmdOptions = registry.ProcessOptions(additionalOptions);
            var envOptions = registry.ProcessEnvironment();

            var optionsStr = string.Join("\n", cmdOptions.Concat(envOptions).Select(t => $"    '{t.Item1}' = '{t.Item2}'"));

            Debug.Log($"Running build with options:\n{optionsStr}");

            DumpBuildParameters();

            foreach (var a in _steps.OfType <IRunPreBuild>())
            {
                a.OnPreBuild(this);
            }

            foreach (var a in _steps.OfType <IRunPostBuild>().Reverse())
            {
                a.OnPostBuild(this);
            }
        }
예제 #2
0
        public IEnumerable <object> ParseMultipleMethodTest(object[] valuesToTest)
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { $"-mlt_values_step={string.Join( ",", valuesToTest )}" });
            return(s.MultipleValues);
        }
예제 #3
0
        public void ParseFloatProp()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { "-flt=1.5" });

            Assert.That(s.FloatProp, Is.EqualTo(1.5f));
        }
예제 #4
0
        public void ParseIntMethod()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { "-intm=123" });

            Assert.That(s.IntProp, Is.EqualTo(123));
        }
예제 #5
0
        public void ParseStringMethod()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { "-strm=value" });

            Assert.That(s.StringProp, Is.EqualTo("value"));
        }
예제 #6
0
        public void ParseEnumMethod()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { "-enmm=webgl" });

            Assert.That(s.EnumProp, Is.EqualTo(BuildTarget.WebGL));
        }
예제 #7
0
        public void ParseBoolMethod()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            r.ProcessOptions(new[] { "-bolm=true" });

            Assert.That(s.BoolProp, Is.EqualTo(true));
        }
예제 #8
0
        public void CollectPrivateOpts()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag2();

            r.Collect(new[] { s });
            var names = r.AvailableOptions.Select(o => o.Name);

            Assert.That(names, Contains.Item("private_prop"));
            Assert.That(names, Contains.Item("private_mthd"));
        }
예제 #9
0
        public void ParseEnvVariableOptionValueCurlyBraces()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });
            Environment.SetEnvironmentVariable("STR_VALUE", "value");
            r.ProcessOptions(new[] { "-str=${STR_VALUE}" });

            Assert.That(s.StringProp, Is.EqualTo("value"));
        }
예제 #10
0
        public void CollectPublicOpts()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag2();

            r.Collect(new[] { s });
            var names = r.Select(o => o.Item1);

            Assert.That(names, Contains.Item("public_prop"));
            Assert.That(names, Contains.Item("public_mthd"));
        }
예제 #11
0
        public void ParseEnvVariableOption()
        {
            var r = new OptionsRegistry();
            var s = new OptionsBag();

            r.Collect(new[] { s });

            Environment.SetEnvironmentVariable("str", "value");
            r.ProcessEnvironment();

            Assert.That(s.StringProp, Is.EqualTo("value"));
        }
        private Exception ValidateCommandLine()
        {
            var tmpOptions = new OptionsRegistry();

            tmpOptions.Collect(_steps);

            try
            {
                tmpOptions.ProcessOptions(_selectedOptions.Select(o => $"-{o.Name}={o.Value}"));
                return(null);
            }
            catch (Exception e)
            {
                return(e);
            }
        }
        private void OnEnable()
        {
            titleContent = new GUIContent("CLI.Build Inspector");
            minSize      = new Vector2(700, 500);

            _steps = Builder.BuildStepsList();

            try
            {
                var options = new OptionsRegistry();
                options.Collect(_steps);

                _optionsList = options.AvailableOptions.OrderBy(option => option.Name).ToList();
            }
            catch (Exception e)
            {
                _collectException = e;
                Debug.LogException(e);
            }
        }