How to setup and use lua squish? - lua

I know it can be a dumb question , but how i can setup and use squish to compile my lua scripts.
I'm tired searching google and i can't find anything to explain me how to use
Someone can point me on right direction
I use lua 5.1 on windows OS
Thank you

First download and unpack the archive containing Squish's code. Alternatively, you may clone the repository. The change into the directory containing the squish.lua file. You will also need a Lua 5.1 executable (which I'll assume is called lua51.exe in the commands below).
The Unix Makefile in the archive contains roughly the following commands (translated to Windows) to build the squish tool:
bootstrap squish tool (without gzip compression or debug support for now)
lua51.exe squish.lua -q --with-minify --with-uglify --with-compile --with-virtual-io
prepare gzip compression modules
lua51.exe squish -q gzip
prepare debug support
lua51.exe squish -q debug
build final tool (with gzip compression and debug support)
lua51.exe squish -q --with-minify --with-uglify --with-compile --with-virtual-io --with-gzip --with-debug
The result is a Lua script squish (without the .lua extension) in the current directory. To use it you have to write a squishy file for your project and execute a command line similar to the last one above in the directory containing your squishy file.

Related

How to make gcov and gcovr pick up source and header files

I am trying to generate coverage report for project using .bat file as detailed below.
I see very few .gcov files. Also, when I click on link on generated html output, I am not able to see file details (file not found error). How do I fix it?
After I execute .bat file, I see output like ‘parsing coverage data for QString.h’ (QT library files). Is it expected?
I have seen many related questions but I am not able to figure out
(in report_coverage.bat)
set GCovrpath= C:\python37\script\lib\
set GCovpath= C:\abc\ghj\bin\
set datafiles= C:\source\mywork\root\testing\unittests\rose\build\debug\
set gcovr_src= C:\source\mywork\root\
%GCovpath%gcov.exe %datafiles% >> output.log
gcovr %datafiles% -s -p --html --html-details --gcov-executable %GCovpath%gcov.exe -o Test.html –verbose
Here are details….
Compile and execute code using
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
QMAKE_LFLAGS += --coverage
.GCNO and .GCDA files are generated as expected
It seems simple directory structure
Root
Header
Rose
Marigold
Jasmin
Source
Rose
Marigold
Jasmin
Testing
UnitTests
Rose
build
debug
Marigold
build
debug
Jasmin
build
debug
Thank you.
Update:
See answer below
I can not emphasis enough "\" for windows.
run this command from debug folder(because test.exe is here)
gcov -b -l -s C:\source\mywork\root\ debug\*.gcno
run this command from Unit tests folder (this will exclude .h files and files containing test)
gcovr -g -k -v --root C:\source\mywork\root\ -e ".*\.h" -e ".*test[_-|A-Z|a-z|0-9]*\.cpp" --html --html-details -o report.html
If you invoke gcov yourself, you need to run it from the same directory where the compiler was executed, and you need to give it either the path to the gcno, gcda, or source file. Gcov can only handle one input file at a time.
When gcov runs in the correct place, it can look at compilation metadata to find the correct source file. If there are errors about missing source files, that indicates that you didn't use the correct directory.
Gcovr runs gcov automatically, and has heuristics to figure out the correct directory. However, you should still run it from the directory where you started the compilation (typically, a build directory).
And gcovr will exclude coverage data if it doesn't belong to your project. If you have a separate build directory, you will need to set the --root argument to the directory containing your source code. Gcov processes coverage data for all files that were compiled, which makes this post-processing by gcovr necessary.
In verbose mode, gcovr will output “Parsing coverage data for <file>” when opening a gcov report. It will then use data within the file to decide whether it belongs to your project, and output “Filtering coverage data” if the source code is part of your project, “Excluding coverage data” otherwise.
There are multiple reasons why the coverage report might not be complete:
There is a problem with filtering.
Gcovr's heuristics can get confused when multiple files have the same name, e.g. two files called util.h in different directories.
Gcovr's --html-details report consists of multiple .html files, so make sure that they are all available.
In your BAT file, this invocation might work better:
gcovr --root ../src --print-summary --sort-percentage --html-details --gcov-executable %GCovpath%gcov.exe --output Test.html --verbose
assuming the following directory structure, and that you run gcovr from within build/:
your-project/
src/
Header/
...
Source/
...
Testing/
...
build/
...
If there are problems with a root path like ../src, consider using an absolute path like C:/path/to/the/src.

How does AOSP build system produce .rsp files and how to get them?

According to How does AOSP 9.0 build system link the executable? and What does # mean in this clang command in AOSP build log? , when linking a module, AOSP seems to produce a .rsp file that contains all the obj files that the module need,and pass the file name as a parameter to the link command, for example:
prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ /OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/bionic/libc/crtbegin_so/android_x86_64_core/crtbegin_so.o #/OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/frameworks/base/libs/hwui/libhwui/android_x86_64_core_shared/libhwui.so.rsp ......
But the .rsp files seems to be removed after build.
The question is, how are these file generated and how to get these files? This may require to learn and modify the build scripts which is out of reach for me.
There maybe the answer for you, read the ninja build manual , in that manual .rsp file mentioned.
https://ninja-build.org/manual.html
the following is info that I copy out.
rspfile, rspfile_content
if present (both), Ninja will use a response file for the given command, i.e. write the selected string (rspfile_content) to the given file (rspfile) before calling the command and delete the file after successful execution of the command.
This is particularly useful on Windows OS, where the maximal length of a command line is limited and response files must be used instead.

cmake: Download easylogging++ and use sources directly

I would like to download easylogging++ package, extract the content and then directly use easylogging++.h and easylogging++.cc in my sources.
I started with this:
ExternalProject_Add(
easyloggingpp
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/downloads
URL https://github.com/muflihun/easyloggingpp/archive/v9.96.4.tar.gz
INSTALL_COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/external/easyloggingpp && cp src/easyloggingpp-9.96.4/src/* ${CMAKE_CURRENT_BINARY_DIR}/external/easyloggingpp/)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/external/easyloggingpp)
set(easylogging ${CMAKE_CURRENT_BINARY_DIR}/external/easyloggingpp/easylogging++.cc)
..
add_dependencies(myproject easyloggingpp)
This creates downloads/ directory in my project, but it's empty and no files appear in external/ directory, even the directory itself is not created.
How can I achieve downloading this package and directly merging its sources with mine? I would like to achieve something similar to bazel's new_http_archive.
It seems that ExternalProject_Add is not for the use case I am trying to implement. It looks like the download is only executed during compilation step, not the configuration step. That's a bummer.
I was able to achieve similar result by coding this manually and it works fairly well:
file(MAKE_DIRECTORY downloads external)
################################################################################
# Easylogging++
################################################################################
if(EXISTS "external/easyloggingpp")
else()
file(MAKE_DIRECTORY external/easyloggingpp)
file(DOWNLOAD
https://github.com/muflihun/easyloggingpp/archive/v9.96.4.zip
downloads/easyloggingpp.zip)
execute_process(COMMAND unzip downloads/easyloggingpp.zip -d downloads)
file(GLOB easyloggingpp_files downloads/easyloggingpp-9.96.4/src/easylogging++.*)
file(COPY ${easyloggingpp_files} DESTINATION external/easyloggingpp)
endif()
include_directories(external/easyloggingpp)
set(easyloggingpp external/easyloggingpp/easylogging++.cc)
This works perfectly fine for me and I adtually understand what is happening during the process. The cool things are that cmake . step doesn't download unless it is necessary.

How to install waf?

I have cloned and built the waf script using:
./waf-light configure
Then to build my project (provided by Gomspace) I need to add waf and the eclipse.py to my path. So far I haven't found better than this setenv script:
WAFROOT=~/git/waf/
export PYTHONPATH=$WAFROOT/waflib/extras/:$PYTHONPATH
export PATH=~/git/waf/:$PATH
Called with:
source setenv
This is somehow a pretty ugly solution. Is there a more elegant way to install waf?
You don't install waf. The command you found correctly builds waf: /waf-light configure build Then for each project you create, you put the built waf script into that projects root directory. I can't find a reference, but this is the way in which waf:s primary author Thomas Nagy wants the tool to be used. Projects that repackage waf to make the tool installable aren't "officially sanctioned."
There are advantages and disadvantages with non-installation:
Disadvantages:
You have to add the semi-binary 100kb large waf file to your repository.
Because the file contains binary code, people can have legal objections to distributing it.
Advantages:
It doesn't matter if new versions of waf break the old API.
Users don't need to install waf before compiling the project -- having Python on the system is enough.
Fedora (at least Fedora 22) has a yum package for waf, so you could see that it's possible to do a system install of waf, albeit with a hack.
After you run something like python3 ./waf-light configure build, you'll get a file called waf that's actually a Python script with some binary data at the end. If you put it into /usr/bin and run it as non-root, you'll get an error because it fails to create a directory in /usr/bin. If you run it as root, you'll get the new directory and /usr/bin/waf runs normally.
Here's the trick that I learned from examining the find_lib() function in the waf Python script.
Copy the waf to /usr/bin/waf
As root, run /usr/bin/waf. Notice that it creates a directory. You'll see something like /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18
mv that directory to /usr/lib, dropping the . in the directory name, e.g. mv /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18 /usr/lib/waf-2.0.19-b2f63c807a4215294bf6005410c74c18
If you want to use waf with Python3, repeat Steps 2-3 running the Python script /usr/bin/waf under Python3. Under Python3, the directory names will start with .waf3-/waf3- instead instead of .waf-/waf-.
(Optional) Remove the binary data at the end of /usr/bin/waf.
Now, non-root should be able to just use /usr/bin/waf.
That said, here's something to consider, like what another answer said: I believe waf's author intended waf to be embedded in projects so that each project can use its own version of waf without fear that a project will fail to build when there are newer versions of waf. Thus, the one-global-version use case seems to be not officially supported.

Convert iOS project to 64 bit using ConvertCocoa64 script

I need to convert my iOS project to 64-bit friendly (to get rid of compiler warnings, as in this question. The solution apparently is to run ConvertCocoa64.
I've managed to locate ConvertCocoa64 (which is no longer included in /Developer/Extras/64BitConversion/ConvertCocoa64) as the Apple docs suggest, but here (search for Auxiliary Tools)
So I've download the script. But my question is, how do I run this on my project? Please assume a total newbie level of knowledge here when it comes to the terminal and running scripts. Do I drop the script inside my project folder and just double click it? Or do I access it from the terminal? The docs say run this command:
/Developer/Extras/64BitConversion/ConvertCocoa64 `find . -name '*.[hm]' | xargs`
But since that folder doesn't exist, where do I run it?. I tried dropping the script in the Developer folder, but when I type ConvertCocoa64 it says command not found.
Find where the command is located now. You'll want to run it in the terminal using the full path to the command, as in your example, just with the real path.
A good way to get the full path is to locate the command in the Finder and drag it to an open terminal window - this also "escapes" any spaces in the path for you. The easiest way to hit all your files as arguments to the command is to cd (change directory) to your project first (in the terminal).
This should get you set up to follow the directions you have.
If I'm not mistaking, to run script, you should place dot . before command. Doesn't really matters, where script is situated as long, as it doesn't rely on it heavily
> cd ~/path/to/script/dir/
> ./ConvertCocoa64 ...

Resources