qmake: execute command at the very end - qmake

How can I execute a command in qmake after everything is finished?
QMAKE_POST_LINK doesn't do the trick because it is executed after linking, but before qmake moves the binary to the defined directory. I need it executed when everything is already in place.

Try using QMake's INSTALLS variable. It creates an 'install' step in the makefile that will need to be run manually (make install), but it can both move files and execute arbitrary commands.

Based on your comment and with no knowledge of qmake, my suggestion would be to simply write a short (two lines should be enough) script that runs qmake as desired and then executes your shell script.

Related

What is the role of "py_binary"?

py_binary finally generates an executable file or an alias for a py script? What are its benefits? If it is an executable file, it will lose the meaning of python.
Making something executable can be just adding a chmod +x and slapping a #!/foo/bar line on top, the thing itself is still whatever interpreter code it was before.
In the case of bazel, it will add a wrapper script that will set up an execution environment before dispatching to the Python code. Consider e.g. Bazel's runfiles, but also other py_library targets.
In addition, you can use the target in places where an executable is required as attribute for another target. A single Python file doesn't have any dependencies Bazel knows about, so that would technically fit there but would not integrate well with Bazel.

How do I debug an annotation processor in a bazel java_library rule?

I have added an annotation processor as a java_plugin and have added this into the plugins section of my java_library rule. I was wondering what are the bazel options to step through the annotation processor code and the javac compiler's code?
One way to do this is to run bazel build with --subcommands. Bazel will then print out all the commands it executes during a build. You can then find the javac invocation you're interested in, copy the command line (including the cd part so you're in the correct directory), modify the command line to include the debugging options, and run it manually. Then you can debug it like you would any java program.
One thing to note is that bazel will print only the commands that it actually runs in that build, so if the action you're interested in is already up-to-date, you may have to delete one of its outputs (e.g. the jar output of that library) to get bazel to re-run the action.

Explain the reason of a test restart in bazel

I have a test that restarts every time without any change in the code.
I use
bazel test --explain ~/bazel-explain.log --verbose_explanations <test-target-name>
to start the test.
Build options: <truncated>
Executing action 'BazelWorkspaceStatusAction stable-status.txt': unconditional execution is requested.
Executing action 'FileWrite build-info-volatile.h': unconditional execution is requested.
Executing action 'Testing <test-name>': One of the files has changed.
So the only useful information here is "One of the files has changed".
How to understand what file specifically has changed?
What does "file changed" means in bazel? Does bazel compare a hash of the file (or directory)? Does file change in terms of bazel if only the file's attributes are changed (such as the editing time)?
I found the cause. I use Zeppelin notebook as an external dependency. When Zeppelin runs, it changes the files inside its directory: it adds logs and modifies interpreters.json config. Every next run of the test the zeppelin directory is different from the previous snapshot. That's why bazel restarts the test every time.
When I remove the logs and revert the changes in the interpreters.json file, bazel does not restart the test. Now I will try to find out how to configure Zeppelin to use another directory for the files changing in run-time.
Unfortunately, I have not found bazel's tools or options that would help me to find the cause of the issue. I had to manually diff the zeppelin directory's snapshots.

Netbeans build.xml to execute when using Ant

I'm relatively new to using build files and Ant to compile and execute from a command line so i wanted to know how it would be possible to modify the build-impl.xml file auto generated from netbeans so that after it compiles it also executes the program.
Currently when i type just "ant" in the command window where the build.xml file is listed it compiles and etc but then says
-do-jar-copylibs:
[copylibs] Nothing to copy.
[echo] To run this application from the command line without Ant, try:
[echo] java -jar "C:\Users\Eric\Documents\Word Documents\Java Test Code\NetbeansVersion\Cops\dist\Cops.jar"
I can run that command and it will run fine, but i want the program to execute by just typing ant.
The build.xml file - Pastebin
Build-impl.xml file - Pastebin
There are a couple "tasks" available in ant that you could use to accomplish this.
You can use either of these:
Java Task,
Exec Task
Those documentation pages provide examples as well. Before you go there though, you might want to start at the basic manual to get an idea of the structure of an ant build file to determine where and how you want to add this execution step in.
It feels a little "off" to me to have your build script executing the program, but I'm sure you've got a reason, so I might suggest adding a new target that does the build steps and then also runs this command to kick off the program. That way you've still got the option of running the build without running the program.

How can I run custom tools from a premake build script?

I'm using protocol buffers for data serialization in my C++ application. I would like to add the invokation of the protoc code generator in my premake build script (thus ensure the up-to-date state of the generated classes and avoid the need to store generated source under version control).
Even their FAQ has a question and answer about this, but the answer is very incomplete for me. Having the ability to call any lua function is great, but where exactly do I put that call? I need to run the protoc compiler before building either the application or the unit tests.
You can certainly call outside code from Premake scripts. But remember: Premake scripts are used to generate build files: Makefiles, C++ projects, etc. The Premake script is run before building the project.
If you want this preprocess to be run outside of the actual build files (and not by make, VC++, Code::Blocks, etc), then it's easy. Lua's os.execute will execute a command-line.
Premake scripts are still Lua scripts. All of the Premake commands are just Lua calls into functions that Premake defines. Premake executes the scripts, then uses the data from them to generate the build files. So all of your Lua code is run during the execution of the script. Where you put this command in your script is irrelevant; wherever it is, it will execute before your build files are generated.
And if you want to run the protoc step during the build (from VC++, makefile, etc.) you can set up a prebuild command. See http://industriousone.com/prebuildcommands for more info and an example.

Resources