Ejemplo n.º 1
0
        public BuildScript Analyse(Autobuilder builder, bool auto)
        {
            if (builder.Options.BuildCommand == null)
            {
                return(BuildScript.Failure);
            }

            // Custom build commands may require a specific .NET Core version
            return(withDotNet(builder, environment =>
            {
                var command = new CommandBuilder(builder.Actions, null, environment);

                // Custom build commands may require a specific Visual Studio version
                var vsTools = MsBuildRule.GetVcVarsBatFile(builder);
                if (vsTools != null)
                {
                    command.CallBatFile(vsTools.Path);
                }
                builder.MaybeIndex(command, builder.Options.BuildCommand);

                return command.Script;
            }));
        }
Ejemplo n.º 2
0
        public BuildScript Analyse(Autobuilder builder, bool auto)
        {
            builder.Log(Severity.Info, "Attempting to locate build script");

            var extensions = builder.Actions.IsWindows() ? winExtensions : linuxExtensions;
            var scripts    = buildScripts.SelectMany(s => extensions.Select(e => s + e));
            var scriptPath = builder.Paths.Where(p => scripts.Any(p.Item1.ToLower().EndsWith)).OrderBy(p => p.Item2).Select(p => p.Item1).FirstOrDefault();

            if (scriptPath == null)
            {
                return(BuildScript.Failure);
            }

            var chmod = new CommandBuilder(builder.Actions);

            chmod.RunCommand("/bin/chmod", $"u+x {scriptPath}");
            var chmodScript = builder.Actions.IsWindows() ? BuildScript.Success : BuildScript.Try(chmod.Script);

            string?dir = Path.GetDirectoryName(scriptPath);

            // A specific .NET Core version may be required
            return(chmodScript & withDotNet(builder, environment =>
            {
                var command = new CommandBuilder(builder.Actions, dir, environment);

                // A specific Visual Studio version may be required
                var vsTools = MsBuildRule.GetVcVarsBatFile(builder);
                if (vsTools != null)
                {
                    command.CallBatFile(vsTools.Path);
                }

                builder.MaybeIndex(command, scriptPath);
                return command.Script;
            }));
        }