Home Download Buy Blog Forum Support

Capture errors in custom build

Capture errors in custom build

Postby Forward on Fri Apr 19, 2013 11:08 pm

I work with custom build system in ST3.
My compiler generates me errors something like this: MyFileName.cpp:413: error: expected ‘;’ before ‘return’
I want to capture them and navigate to corresponding file and line using F4.
My build system:
Code: Select all
{
    "shell_cmd": "gmake debug"
    ,"working_dir": "/Disk/PathToProject"
    ,"file_regex": "^(.*.cpp):(\\d*): error: (.*)$"
}

Everything works fine, ST3 highlights row with error message in the build log and navigates to corresponding file and row, but only if file is under /PathToProject. If file is for ex. under /PathToProject/Subfolder1 then row with error is highlighted, but ST3 doesn't navigate to correct file, instead of this it creates an empty file under /PathToProject.

According to doc I should use "line_regex"
If the file_regex doesn’t match on the current line, but there’s a line_regex specified, and it does match the current line, then walk backwards through the buffer until a line matching the file regex is found: use these two matches to determine the file and line to go to.

Ok, I have in my build log row like this: Entering directory `/Disk/PathToProject/Subfolder1'. And I can easy capture it in file_regex. So my build settings becomes:
Code: Select all
{
    "shell_cmd": "gmake debug"
    ,"working_dir": "/Disk/PathToProject"
    ,"file_regex": "^.*Entering directory `/Disk/PathToProject/(.*)'$"
    ,"line_regex": "^(.*.cpp):(\\d*): error: (.*)$"
}


My question is: what is the way to concatenate paths from file_regex and line_regex and tell ST3 correctly which file to open when I press F4?

Thank you for your time.
Forward
 
Posts: 3
Joined: Fri Apr 19, 2013 10:26 pm

Re: Capture errors in custom build

Postby Forward on Mon Apr 22, 2013 4:50 am

I found, that the only one way to do it - override exec function for my build system. From doc:
target - Optional. Sublime Text command to run. Defaults to exec (Packages/Default/exec.py). This command receives the configuration data specified in the .build-system file.
Used to override the default build system command. Note that if you choose to override the default command for build systems, you can add arbitrary variables in the .sublime-build file.

But this doc describes the way to do it only for ST2. ST3 has different arhitecture and it doesn't have exec.py file. Does anybody know the correct way to override default exec function for custom build system?
Forward
 
Posts: 3
Joined: Fri Apr 19, 2013 10:26 pm

Re: Capture errors in custom build

Postby Forward on Mon Apr 22, 2013 5:13 pm

I have the same problem as here: viewtopic.php?f=3&t=12028
So the only way to resolve the problem - external tool/script, that will change the output before it will be captured by sublime regex...
Forward
 
Posts: 3
Joined: Fri Apr 19, 2013 10:26 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 24 guests