From e22ccad29ad319812b6de218af2cf97c58ba1cf5 Mon Sep 17 00:00:00 2001 From: gambas Date: Fri, 28 May 2021 01:59:07 +0200 Subject: [PATCH] Correctly handle compiler output now it compiles several files at the same time. [DEVELOPMENT ENVIRONMENT] * BUG: Correctly handle compiler output now it compiles several files at the same time. --- app/src/gambas3/.src/Debug/FDebugInfo.class | 9 +++-- app/src/gambas3/.src/Project.module | 37 +++++++++++---------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/app/src/gambas3/.src/Debug/FDebugInfo.class b/app/src/gambas3/.src/Debug/FDebugInfo.class index b68a7b0d3..9e3cd5634 100644 --- a/app/src/gambas3/.src/Debug/FDebugInfo.class +++ b/app/src/gambas3/.src/Debug/FDebugInfo.class @@ -940,7 +940,7 @@ Public Sub OnProjectChange() $aTask = Null UpdateTask - SetCompilation + SetCompilation() CloseSearch trmVersionControl.Clear trmTest.Clear @@ -960,22 +960,21 @@ Public Sub ShowError(sMsg As String) End -Public Sub SetCompilation(Optional sOutput As String) +Public Sub SetCompilation(Optional aOutput As String[]) - Dim aOutput As String[] Dim sLine As String Dim aLine As String[] Dim I As Integer Dim aPos As String[] gvwCompilation.Clear - If Not sOutput Then + If Not aOutput Or If aOutput.Count = 0 Then HideTab(TAB_COMPILATION) 'GotoConsole Return Endif - aOutput = Split(Trim(sOutput), "\n").Sort(gb.Natural) + aOutput.Sort(gb.Natural) gvwCompilation.Rows.Count = aOutput.Count For Each sLine In aOutput diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index 70ee64673..5adb6063c 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -358,7 +358,7 @@ Public Sub Main() 'Print Application.Theme - OUTPUT_FILE = Temp$() + OUTPUT_FILE = Temp$("output") EXAMPLES_DIR = System.Path &/ "share/gambas" & Split(System.Version, ".")[0] & "/examples" Application.ShowTooltips = Settings["/ShowTooltip", True] @@ -2574,7 +2574,6 @@ End Public Function Compile(Optional bAll As Boolean, Optional bNoDebug As Boolean, Optional bNoMessage As Boolean, Optional bMakeExecutable As Boolean) As Boolean Dim sExec As String - Dim sOutput As String Dim sRes As String Dim sDir As String Dim sPath As String @@ -2583,6 +2582,10 @@ Public Function Compile(Optional bAll As Boolean, Optional bNoDebug As Boolean, Dim sBefore, sAfter As String Dim bGotError As Boolean Dim fTimer As Float + Dim aOutput As String[] + Dim I As Integer + Dim sLine As String + Dim sError As String If Project.ReadOnly Then Return If Project.Running Then Return 'TRUE @@ -2631,26 +2634,26 @@ Public Function Compile(Optional bAll As Boolean, Optional bNoDebug As Boolean, bGotError = Process.LastValue - sOutput = Trim(File.Load(OUTPUT_FILE)) - - iPos = RInStr(sOutput, "\n") - If iPos Then - sRes = Mid$(sOutput, iPos + 1) - sOutput = Left(sOutput, iPos - 1) - Else - If sOutput <> "OK" Then - sRes = sOutput + aOutput = Split(File.Load(OUTPUT_FILE), "\n", "", True) + + I = 0 + While I < aOutput.Count + sLine = aOutput[I] + If sLine Like "*: warning: *" Then + Inc I + Continue Endif - sOutput = "" - Endif - - FDebugInfo.SetCompilation(sOutput) + If sLine Like "*: error: *" Then sError = sLine + aOutput.Remove(I) + Wend + + FDebugInfo.SetCompilation(aOutput) 'FDebugInfo.GotoFirstWarning() - If bGotError And If sRes Then + If bGotError And If sError Then UnlockIt() - If Not bNoMessage Then CompileError(sRes) + If Not bNoMessage Then CompileError(sError) Return True Else