Giter VIP home page Giter VIP logo

qmake-sorting-script's Introduction

qmake_sorting_script.py

Script for sorting qmake files.

Usage

If you want to resort all qmake project files found recursively in /path/to/my/project, just run the script with:

./qmake_sorting_script.py -r /path/to/my/project

If you also want to move all inl files to the HEADERS, you can additionally use the flag --move-inl-to-headers

./qmake_sorting_script.py --move-inl-to-headers -r /path/to/my/project

Overview over all possible arguments

usage: qmake_sorting_script.py [-h] [-v] [-p] [-i INDENTATION]
                               [--move-inl-to-headers] [--move-inl-to-sources]
                               [--files FILE [FILE ...]] [-r PATH [PATH ...]]
                               [-e PATH [PATH ...]] [-n]

Resorts a qmake project file as a heuristic to reduce the risk of merge
conflicts.

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Add more verbose output for more easy debuggability
  -p, --print-resorted-files
                        Print the filenames of the files, which were resorted
  -i INDENTATION, --indentation INDENTATION
                        How much spaces to add before each line break (default
                        4)
  --move-inl-to-headers
                        If set, all inl files are moved to the HEADERS list
                        (if existant)
  --move-inl-to-sources
                        If set, all inl files are moved to the SOURCES list
                        (if existant)
  --files FILE [FILE ...]
                        A list of files to resort
  -r PATH [PATH ...], --include-recursive PATH [PATH ...]
                        A list of directories to search for *.pro and *.pri
                        files to resort
  -e PATH [PATH ...], --exclude-recursive PATH [PATH ...]
                        A list of directories to exclude from the search for
                        *.pro and *.pri files to resort
  -n, --dry-run         Don't change anything, just print the project files,
                        which would be resorted

Execute from qmake

You can call this function automatically everytime you run qmake, by using the qmake command system. Example:

system(./path/to/qmake_sorting_script.py --move-inl-to-headers -r .)

Contributing

When contributing, you have to accept to submit your patch under the unlicense. See unlicense.org for more informations about that.

qmake-sorting-script's People

Contributors

robert42 avatar

Watchers

 avatar  avatar

qmake-sorting-script's Issues

Test

  • Create shell script
    • which creates the test files (see below)
    • which executes the python script for each test file (verbose of course)
    • validates the result
    • also make sure, that after running the script on the same file a second time, no changes are made

  • handle all in the first line

    SOURCES += bbb ccc aaa
    CONFIG= x y z
    
  • handle all in the second line

    SOURCES+=\
    bbb ccc aaa
    CONFIG= x y z
    
  • handle first line empty

    SOURCES+=\
    bbb\
    ccc \
    aaa
    CONFIG= x y z
    
  • handle first line non empty

    SOURCES+=bbb \
    ccc \
    aaa
    CONFIG= x y z
    
  • handle multiple per line

    SOURCES+=ddd aaa \
    bbb fff \
    eee ccc
    CONFIG= x y z
    
  • handle empty following lines

    SOURCES+=bbb \
    \
    ccc \
    \
    aaa \
    \
    
    CONFIG= x y z
    

Move inl files

move *.inl files from SOURCES to HEADERS? (to avoid weird linking issues)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.