Esempio n. 1
0
        public Task <bool> Build(IConsole console, IProject project, string label = "", IEnumerable <string> definitions = null)
        {
            console.WriteLine($"Build Started - {project.Name}");
            //Make sure tools are available
            if (!PlatformSupport.CheckExecutableAvailability("tsc"))
            {
                //TypeScript compiler missing
                console.WriteLine("The TypeScript compiler `tsc` is not available on your path. Please install it with `npm install -g typescript`");
                //Check if they're also missing Node
                if (!PlatformSupport.CheckExecutableAvailability("node"))
                {
                    console.WriteLine("You seem to be missing Node.js. Please install Node.js and TypeScript globally.");
                }
                console.WriteLine("Build failed.");
                return(Task.FromResult(false)); //Fail build
            }
            var tscVersionResult = PlatformSupport.ExecuteShellCommand("tsc", "-v");

            //Run build
            console.WriteLine($"Using TypeScript compiler {tscVersionResult.Output}");

            console.WriteLine($"TypeScript compile started...");
            var compileExitCode = PlatformSupport.ExecuteShellCommand("tsc", $"-p {project.CurrentDirectory}", (s, a) => console.WriteLine(a.Data));

            if (compileExitCode != 0)
            {
                console.WriteLine($"Build completed with code {compileExitCode}");
            }
            else
            {
                console.WriteLine("Build completed successfully.");
            }

            return(Task.FromResult(compileExitCode == 0));
        }
Esempio n. 2
0
        private bool CheckFile(IConsole console, string file)
        {
            bool result = true;

            if (Platform.PlatformIdentifier != PlatformID.Unix && !PlatformSupport.CheckExecutableAvailability(file))
            {
                console.WriteLine("Unable to find tool (" + file + ") Please check project toolchain settings.");
                result = false;
            }

            return(result);
        }
Esempio n. 3
0
        public async Task <ProcessResult> ObjCopy(IConsole console, IProject project, LinkResult linkResult, AssemblyFormat format)
        {
            var result = new ProcessResult();

            var commandName = Path.Combine(BinDirectory, $"{SizePrefix}objcopy" + Platform.ExecutableExtension);

            if (PlatformSupport.CheckExecutableAvailability(commandName, BinDirectory))
            {
                string formatArg = "binary";

                switch (format)
                {
                case AssemblyFormat.Binary:
                    formatArg = "binary";
                    break;

                case AssemblyFormat.IntelHex:
                    formatArg = "ihex";
                    break;
                }

                string outputExtension = ".bin";

                switch (format)
                {
                case AssemblyFormat.Binary:
                    outputExtension = ".bin";
                    break;

                case AssemblyFormat.IntelHex:
                    outputExtension = ".hex";
                    break;

                case AssemblyFormat.Elf32:
                    outputExtension = ".elf";
                    break;
                }

                var arguments = $"-O {formatArg} {linkResult.Executable} {Path.GetDirectoryName(linkResult.Executable)}{Platform.DirectorySeperator}{Path.GetFileNameWithoutExtension(linkResult.Executable)}{outputExtension}";

                console.WriteLine($"Converting to {format.ToString()}");

                result.ExitCode = PlatformSupport.ExecuteShellCommand(commandName, arguments, (s, e) => console.WriteLine(e.Data), (s, e) => console.WriteLine(e.Data), false, string.Empty, false);
            }
            else
            {
                console.WriteLine("Unable to find tool (" + commandName + ") check project compiler settings.");
                result.ExitCode = -1;
            }

            return(result);
        }