Custom Builder: exit code from script does not stop build process [message #1800729] |
Mon, 07 January 2019 13:22 |
Dan K. Messages: 2 Registered: January 2019 |
Junior Member |
|
|
Hi there,
I'm running Eclipse CDT on Windows and using projects with managed makefiles.
I have a *.c file in my project which is created using an external tool.
I needed a way to integrate the tool into my project's build process. As I can not edit the makefiles directly, I added a cmd batch script (which executes the tool) as the first Builder.
However, when the script aborts with an error (exits with code != 0), the build process continues. I expected the build process to abort so that the user can inspect the error messages on the console.
If you want to test this, just add to your project a "cmd.bat" file containing only the line "exit 1". Then in project settings, select Builders section. There click the "New" button. Then double click on "program". A new window opens. There, choose "Main location -> browse workspace" and select the "cmd.bat" file. Click "OK". Move the newly created Builder to the top and apply. If you build your program, the build does not stop after the "cmd.bat" has been executed.
Is this expected behaviour?
If so, how can I add a custom build step that can stop the build process?
Thanks
Dan
|
|
|
|
Re: Custom Builder: exit code from script does not stop build process [message #1801560 is a reply to message #1801504] |
Tue, 22 January 2019 14:48 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Happens under Linux too.
09:31:03 **** Incremental Build of configuration Debug for project Hello ****
make all
make --no-print-directory pre-build
bash -c "exit 1"
------------------------------------------------------------
make[1]: [makefile:62: pre-build] Error 1 (ignored) <<<<---------------------
------------------------------------------------------------
make --no-print-directory main-build
Building target: Hello
Invoking: GCC C++ Linker
g++ -lpthread -Wl,-rpath,/usr/lib64/openmpi/lib -o "Hello" ./src/Duplicate.o ./src/Florp.o ./src/Hello.o ./src/ParmTest.o /home/dvavra/proj/LOCALLIB/lib/locallib.a -lm `pkg-config --libs opencv`
Finished building target: Hello
Likely because the prebuild step and the actual make are really two separate calls to make
all:
$(MAKE) --no-print-directory pre-build
$(MAKE) --no-print-directory main-build
:
:
# Main-build Target
main-build: Hello
:
pre-build:
-bash -c "exit 1"
-@echo ' '
Probably should be something like
all:
$(MAKE) --no-print-directory main-build
:
main-build: pre-build Hello
You can use your own makefile in a Makefile Project as a workaround.
|
|
|
Powered by
FUDForum. Page generated in 0.03818 seconds