Uncrustify: Difference between revisions
Line 17: | Line 17: | ||
* the sources for the installer are at https://github.com/openpetra/openpetra/tree/master/setup/tools/uncrustify | * the sources for the installer are at https://github.com/openpetra/openpetra/tree/master/setup/tools/uncrustify | ||
* usually we use the zip file released for Windows by the uncrustify project, from https://sourceforge.net/projects/uncrustify/files/ | |||
=== build installer from git master === | |||
* see https://github.com/uncrustify/uncrustify/blob/master/make_win32.sh | |||
* need a Ubuntu 14.04 64 bit virtual machine | |||
apt-get install mingw-w64 git automake g++ make zip python | |||
git clone https://github.com/uncrustify/uncrustify.git | |||
cd uncrustify | |||
chmod a+x *.sh | |||
./make_win32.sh | |||
Result in: /root/release/uncrustify-0.62.92-g5c059c9-dirty-win32.zip | |||
== Debugging uncrustify and adding tests == | == Debugging uncrustify and adding tests == |
Revision as of 19:46, 23 April 2016
about uncrustify
- homepage: http://uncrustify.sourceforge.net/
"Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA"
"The goals of this project are simple: Create a highly configurable, easily modifiable source code beautifier."
See sources at Github: https://github.com/uncrustify/uncrustify
current version used
- Currently we still use version 0.56.
our own installer for Windows
it is easier to have an installer for Windows, instead of the zip file provided by the uncrustify project.
- download from http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/Uncrustify-Setup-0.56.exe/download
- the sources for the installer are at https://github.com/openpetra/openpetra/tree/master/setup/tools/uncrustify
- usually we use the zip file released for Windows by the uncrustify project, from https://sourceforge.net/projects/uncrustify/files/
build installer from git master
- see https://github.com/uncrustify/uncrustify/blob/master/make_win32.sh
- need a Ubuntu 14.04 64 bit virtual machine
apt-get install mingw-w64 git automake g++ make zip python git clone https://github.com/uncrustify/uncrustify.git cd uncrustify chmod a+x *.sh ./make_win32.sh
Result in: /root/release/uncrustify-0.62.92-g5c059c9-dirty-win32.zip
Debugging uncrustify and adding tests
For C# 6 support we noticed that even version 0.62 did not support all new C# 6 features. see https://sourceforge.net/p/uncrustify/bugs/672/ for details.
On Linux, I cloned the git master of uncrustify, to see if those issues had already been fixed there.
git clone https://github.com/uncrustify/uncrustify.git cd uncrustify ./autogen.sh ./configure make
To run the tests:
./run_tests.sh c-sharp
You can add new tests with these steps:
- add an input file to https://github.com/uncrustify/uncrustify/tree/master/tests/input/cs
- add an expected output file to https://github.com/uncrustify/uncrustify/tree/master/tests/output/cs
- add the test in https://github.com/uncrustify/uncrustify/blob/master/tests/c-sharp.test
You can change the log_level to 7 in https://github.com/uncrustify/uncrustify/blob/master/tests/run_tests.py#L84 so that you see the difference of the result of uncrustify compared to your expected output, if the test fails.
If uncrustify has an exception, you only get message like this:
RUN: /home/timotheusp/dev/uncrustify.tpokorra/src/uncrustify -q -c config/ben.cfg -f input/cs/exception-filters.cs > results/cs/10160-exception-filters.cs FAILED: 10160
Then you should run this on the commandline, but without the -q:
cd tests /home/timotheusp/dev/uncrustify.tpokorra/src/uncrustify -c config/ben.cfg -f input/cs/exception-filters.cs > results/cs/10160-exception-filters.cs