diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-03-04 16:49:02 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-03-04 17:49:02 +0200 |
commit | 17ce9bc0e536067cfa1a05cb057014e3b1c2c449 (patch) | |
tree | d27c56f2802a188fda822a4c77b0f2f5402899fa | |
parent | 760d1bff9cf7db9886aedb02226e5a7105d5d454 (diff) | |
download | meson-17ce9bc0e536067cfa1a05cb057014e3b1c2c449.zip meson-17ce9bc0e536067cfa1a05cb057014e3b1c2c449.tar.gz meson-17ce9bc0e536067cfa1a05cb057014e3b1c2c449.tar.bz2 |
docs: Define sorting in Style-guide.md [skip ci]
-rw-r--r-- | docs/markdown/Style-guide.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/markdown/Style-guide.md b/docs/markdown/Style-guide.md index 9008592..30d30cf 100644 --- a/docs/markdown/Style-guide.md +++ b/docs/markdown/Style-guide.md @@ -34,3 +34,35 @@ Try to keep cross compilation arguments away from your build files as much as possible. Keep them in the cross file instead. This adds portability, since all changes needed to compile to a different platform are isolated in one place. + +# Sorting source paths + +The source file arrays should all be sorted. This makes it easier to spot +errors and often reduces merge conflicts. Furthermore, the paths should be +sorted with a natural sorting algorithm, so that numbers are sorted in an +intuitive way (`1, 2, 3, 10, 20` instead of `1, 10, 2, 20, 3`). + +Numbers should also be sorted before characters (`a111` before `ab0`). +Furthermore, strings should be sorted case insensitive. + +Additionally, if a path contains a directory it should be sorted before +normal files. This rule also applies recursively for subdirectories. + +The following example shows correct source list definition: + +```meson +sources = files([ + 'aaa/a1.c', + 'aaa/a2.c', + 'bbb/subdir1/b1.c', + 'bbb/subdir2/b2.c', + 'bbb/subdir10/b3.c', + 'bbb/subdir20/b4.c', + 'bbb/b5.c', + 'bbb/b6.c', + 'f1.c', + 'f2.c', + 'f10.c, + 'f20.c' +]) +``` |