diff --git a/PawnMake/MakeFile.cs b/PawnMake/MakeFile.cs index af76641..936653a 100644 --- a/PawnMake/MakeFile.cs +++ b/PawnMake/MakeFile.cs @@ -2,6 +2,7 @@ { public class MakeFile { + public string ProjectName { get; set; } = "project"; public BuildFolder[] BuildFolders { get; set; } public string[] IncludeFolders { get; set; } public string[] Files { get; set; } diff --git a/PawnMake/Program.cs b/PawnMake/Program.cs index 3b23ac7..f47dd10 100644 --- a/PawnMake/Program.cs +++ b/PawnMake/Program.cs @@ -61,6 +61,12 @@ public static void Main(string[] args) Console.WriteLine("\n----- Starting build... -----"); #endif + int succeeded = 0; + int failed = 0; + int skipped = 0; + + Console.WriteLine($"------ Build started - Project: {makeFile.ProjectName} ------"); + foreach (string file in makeFile.Files) { foreach (BuildFolder build in makeFile.BuildFolders) @@ -69,15 +75,27 @@ public static void Main(string[] args) if (File.Exists(srcPath)) { string outPath = Path.Combine(build.OutputFolder, Path.GetFileNameWithoutExtension(file) + ".amx"); + + // check last compile time + DateTime srcTime = File.GetLastWriteTime(srcPath); + DateTime outTime = File.GetLastWriteTime(outPath); + + if (srcTime < outTime) + { + Console.WriteLine($"* Skipping {srcPath}"); + skipped++; + continue; + } + string compilerArgs = $"\"{srcPath}\" -o\"{outPath}\" "; foreach (string incPath in makeFile.IncludeFolders) compilerArgs += $"-i\"{incPath}\" "; - if(!string.IsNullOrWhiteSpace(makeFile.Args)) + if (!string.IsNullOrWhiteSpace(makeFile.Args)) compilerArgs += $"{makeFile.Args} "; - Console.WriteLine($"\nCompiling {srcPath} ..."); + Console.WriteLine($"* Compiling {srcPath} -> {outPath}"); var pawnccOutput = new StringBuilder(); var startInfo = new ProcessStartInfo() @@ -105,13 +123,31 @@ public static void Main(string[] args) process.WaitForExit(5000); - Console.WriteLine(pawnccOutput.ToString()); + string finalOutput = pawnccOutput + .ToString() + .Insert(0, " ") + .Replace("\n", "\n ") + .TrimEnd() + ; + + if (finalOutput.Contains(" Error.") || finalOutput.Contains(" Errors.")) + failed++; + else + succeeded++; + + if (finalOutput.Contains(" Error.") || finalOutput.Contains(" Errors.") + || finalOutput.Contains(" Warning.") || finalOutput.Contains(" Warnings.")) + { + Console.WriteLine(finalOutput + "\n"); + } } } } } - if(args.Length > 1) + Console.WriteLine($"========== Build: {succeeded} succeeded, {failed} failed, {skipped} skipped =========="); + + if (args.Length > 1) { string parameter = args[1]; if(parameter == "-r") diff --git a/PawnMake/Properties/AssemblyInfo.cs b/PawnMake/Properties/AssemblyInfo.cs index 460fcdb..7b9bb02 100644 --- a/PawnMake/Properties/AssemblyInfo.cs +++ b/PawnMake/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PawnMake")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyCopyright("Copyright © 2019 - 2020 Sasinosoft")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")]