[build] convert CMake file list generation code to JavaScript
Bash sorting is weird...
This commit is contained in:
@@ -1,30 +1,27 @@
|
||||
# Do not edit. Regenerate this with ./scripts/generate-benchmark-files.sh
|
||||
# This file is generated. Do not edit. Regenerate this with scripts/generate-cmake-files.js
|
||||
|
||||
set(MBGL_BENCHMARK_FILES
|
||||
# api
|
||||
benchmark/api/query.benchmark.cpp
|
||||
benchmark/api/render.benchmark.cpp
|
||||
|
||||
# benchmark
|
||||
benchmark/include/mbgl/benchmark.hpp
|
||||
benchmark/src/main.cpp
|
||||
benchmark/src/mbgl/benchmark/benchmark.cpp
|
||||
benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp
|
||||
|
||||
# function
|
||||
benchmark/function/camera_function.benchmark.cpp
|
||||
benchmark/function/composite_function.benchmark.cpp
|
||||
benchmark/function/source_function.benchmark.cpp
|
||||
|
||||
# include/mbgl
|
||||
benchmark/include/mbgl/benchmark.hpp
|
||||
|
||||
# parse
|
||||
benchmark/parse/filter.benchmark.cpp
|
||||
benchmark/parse/tile_mask.benchmark.cpp
|
||||
benchmark/parse/vector_tile.benchmark.cpp
|
||||
|
||||
# src
|
||||
benchmark/src/main.cpp
|
||||
|
||||
# src/mbgl/benchmark
|
||||
benchmark/src/mbgl/benchmark/benchmark.cpp
|
||||
benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp
|
||||
|
||||
# util
|
||||
benchmark/util/dtoa.benchmark.cpp
|
||||
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Do not edit. Regenerate this with ./scripts/generate-core-files.sh
|
||||
# This file is generated. Do not edit. Regenerate this with scripts/generate-cmake-files.js
|
||||
|
||||
set(MBGL_CORE_FILES
|
||||
# actor
|
||||
@@ -740,4 +740,5 @@ set(MBGL_CORE_FILES
|
||||
src/mbgl/util/version.cpp
|
||||
src/mbgl/util/version.hpp
|
||||
src/mbgl/util/work_request.cpp
|
||||
|
||||
)
|
||||
|
||||
13
cmake/files.cmake.ejs
Normal file
13
cmake/files.cmake.ejs
Normal file
@@ -0,0 +1,13 @@
|
||||
<%
|
||||
const name = locals.name;
|
||||
const groups = locals.groups;
|
||||
-%>
|
||||
# This file is generated. Do not edit. Regenerate this with scripts/generate-cmake-files.js
|
||||
|
||||
set(MBGL_<%- snakeCaseUpper(name) %>_FILES
|
||||
<% for (const key of Object.keys(groups).sort()) { -%>
|
||||
# <%- key %>
|
||||
<%- groups[key].sort().join('\n ') %>
|
||||
|
||||
<% } -%>
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Do not edit. Regenerate this with ./scripts/generate-test-files.sh
|
||||
# This file is generated. Do not edit. Regenerate this with scripts/generate-cmake-files.js
|
||||
|
||||
set(MBGL_TEST_FILES
|
||||
# actor
|
||||
@@ -29,9 +29,6 @@ set(MBGL_TEST_FILES
|
||||
test/gl/context.test.cpp
|
||||
test/gl/object.test.cpp
|
||||
|
||||
# include/mbgl
|
||||
test/include/mbgl/test.hpp
|
||||
|
||||
# map
|
||||
test/map/map.test.cpp
|
||||
test/map/prefetch.test.cpp
|
||||
@@ -55,7 +52,49 @@ set(MBGL_TEST_FILES
|
||||
test/sprite/sprite_loader.test.cpp
|
||||
test/sprite/sprite_parser.test.cpp
|
||||
|
||||
# src/mbgl/test
|
||||
# storage
|
||||
test/storage/asset_file_source.test.cpp
|
||||
test/storage/default_file_source.test.cpp
|
||||
test/storage/headers.test.cpp
|
||||
test/storage/http_file_source.test.cpp
|
||||
test/storage/local_file_source.test.cpp
|
||||
test/storage/offline.test.cpp
|
||||
test/storage/offline_database.test.cpp
|
||||
test/storage/offline_download.test.cpp
|
||||
test/storage/online_file_source.test.cpp
|
||||
test/storage/resource.test.cpp
|
||||
test/storage/sqlite.test.cpp
|
||||
|
||||
# style
|
||||
test/style/filter.test.cpp
|
||||
test/style/properties.test.cpp
|
||||
test/style/source.test.cpp
|
||||
test/style/style.test.cpp
|
||||
test/style/style_image.test.cpp
|
||||
test/style/style_layer.test.cpp
|
||||
test/style/style_parser.test.cpp
|
||||
|
||||
# style/conversion
|
||||
test/style/conversion/function.test.cpp
|
||||
test/style/conversion/geojson_options.test.cpp
|
||||
test/style/conversion/layer.test.cpp
|
||||
test/style/conversion/light.test.cpp
|
||||
test/style/conversion/stringify.test.cpp
|
||||
test/style/conversion/tileset.test.cpp
|
||||
|
||||
# style/expression
|
||||
test/style/expression/expression.test.cpp
|
||||
test/style/expression/util.test.cpp
|
||||
|
||||
# style/function
|
||||
test/style/function/camera_function.test.cpp
|
||||
test/style/function/composite_function.test.cpp
|
||||
test/style/function/exponential_stops.test.cpp
|
||||
test/style/function/interval_stops.test.cpp
|
||||
test/style/function/source_function.test.cpp
|
||||
|
||||
# test
|
||||
test/include/mbgl/test.hpp
|
||||
test/src/mbgl/test/fake_file_source.hpp
|
||||
test/src/mbgl/test/fixture_log_observer.cpp
|
||||
test/src/mbgl/test/fixture_log_observer.hpp
|
||||
@@ -72,49 +111,6 @@ set(MBGL_TEST_FILES
|
||||
test/src/mbgl/test/util.cpp
|
||||
test/src/mbgl/test/util.hpp
|
||||
|
||||
# storage
|
||||
test/storage/asset_file_source.test.cpp
|
||||
test/storage/default_file_source.test.cpp
|
||||
test/storage/headers.test.cpp
|
||||
test/storage/http_file_source.test.cpp
|
||||
test/storage/local_file_source.test.cpp
|
||||
test/storage/offline.test.cpp
|
||||
test/storage/offline_database.test.cpp
|
||||
test/storage/offline_download.test.cpp
|
||||
test/storage/online_file_source.test.cpp
|
||||
test/storage/resource.test.cpp
|
||||
test/storage/sqlite.test.cpp
|
||||
|
||||
# style/conversion
|
||||
test/style/conversion/function.test.cpp
|
||||
test/style/conversion/geojson_options.test.cpp
|
||||
test/style/conversion/layer.test.cpp
|
||||
test/style/conversion/light.test.cpp
|
||||
test/style/conversion/stringify.test.cpp
|
||||
test/style/conversion/tileset.test.cpp
|
||||
|
||||
# style/expression
|
||||
test/style/expression/expression.test.cpp
|
||||
test/style/expression/util.test.cpp
|
||||
|
||||
# style
|
||||
test/style/filter.test.cpp
|
||||
|
||||
# style/function
|
||||
test/style/function/camera_function.test.cpp
|
||||
test/style/function/composite_function.test.cpp
|
||||
test/style/function/exponential_stops.test.cpp
|
||||
test/style/function/interval_stops.test.cpp
|
||||
test/style/function/source_function.test.cpp
|
||||
|
||||
# style
|
||||
test/style/properties.test.cpp
|
||||
test/style/source.test.cpp
|
||||
test/style/style.test.cpp
|
||||
test/style/style_image.test.cpp
|
||||
test/style/style_layer.test.cpp
|
||||
test/style/style_parser.test.cpp
|
||||
|
||||
# text
|
||||
test/text/cross_tile_symbol_index.test.cpp
|
||||
test/text/glyph_manager.test.cpp
|
||||
@@ -156,4 +152,5 @@ set(MBGL_TEST_FILES
|
||||
test/util/token.test.cpp
|
||||
test/util/unique_any.test.cpp
|
||||
test/util/url.test.cpp
|
||||
|
||||
)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "# Do not edit. Regenerate this with ./scripts/generate-benchmark-files.sh" > cmake/benchmark-files.cmake
|
||||
echo "" >> cmake/benchmark-files.cmake
|
||||
echo "set(MBGL_BENCHMARK_FILES" >> cmake/benchmark-files.cmake
|
||||
PREFIX=
|
||||
for FILE in $(git ls-files "benchmark/*.hpp" "benchmark/*.cpp" "benchmark/*.h" "benchmark/*.c" | sort) ; do
|
||||
CURRENT_PREFIX=$(dirname ${FILE#benchmark/})
|
||||
if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then
|
||||
if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/benchmark-files.cmake ; fi
|
||||
echo " # ${CURRENT_PREFIX}" >> cmake/benchmark-files.cmake
|
||||
PREFIX="${CURRENT_PREFIX}"
|
||||
fi
|
||||
echo " ${FILE}" >> cmake/benchmark-files.cmake
|
||||
done
|
||||
echo ")" >> cmake/benchmark-files.cmake
|
||||
git diff cmake/benchmark-files.cmake
|
||||
32
scripts/generate-cmake-files.js
Executable file
32
scripts/generate-cmake-files.js
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const child_process = require('child_process');
|
||||
const fs = require('fs');
|
||||
const ejs = require('ejs');
|
||||
|
||||
require('./style-code');
|
||||
|
||||
function generateCMakeListFile(name, regex, patterns) {
|
||||
const files = child_process.execSync(`git ls-files ${patterns.map((p) => '"' + p + '"').join(' ')}`).toString().trim().split('\n');
|
||||
var groups = {};
|
||||
for (const file of files) {
|
||||
const match = file.match(regex);
|
||||
const group = match[1] || name;
|
||||
if (!groups[group]) {
|
||||
groups[group] = [];
|
||||
}
|
||||
groups[group].push(file);
|
||||
}
|
||||
|
||||
const fileListCmake = ejs.compile(fs.readFileSync('cmake/files.cmake.ejs', 'utf8'), {strict: true});
|
||||
writeIfModified(`cmake/${name}-files.cmake`, fileListCmake({ name: name, groups: groups }));
|
||||
}
|
||||
|
||||
generateCMakeListFile('core', /^(?:src|include)\/(?:mbgl\/)?(.+)\/[^\/]+$/,
|
||||
[ 'include/*.hpp', 'include/*.h', 'src/*.hpp', 'src/*.cpp', 'src/*.h', 'src/*.c' ]);
|
||||
|
||||
generateCMakeListFile('benchmark', /^benchmark\/(?:(?:src|include)\/)?(?:mbgl\/)?(?:(.+)\/)?[^\/]+$/,
|
||||
[ 'benchmark/*.hpp', 'benchmark/*.cpp', 'benchmark/*.h', 'benchmark/*.c' ]);
|
||||
|
||||
generateCMakeListFile('test', /^test\/(?:(?:src|include)\/)?(?:mbgl\/)?(?:(.+)\/)?[^\/]+$/,
|
||||
[ 'test/*.hpp', 'test/*.cpp', 'test/*.h', 'test/*.c' ]);
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "# Do not edit. Regenerate this with ./scripts/generate-core-files.sh" > cmake/core-files.cmake
|
||||
echo "" >> cmake/core-files.cmake
|
||||
echo "set(MBGL_CORE_FILES" >> cmake/core-files.cmake
|
||||
PREFIX=
|
||||
for FILE in $(git ls-files "include/*.hpp" "include/*.h" "src/*.hpp" "src/*.cpp" "src/*.h" "src/*.c" | perl -p -e "s/^((src|include)\/(mbgl\/)?(.+)\/\w+\.\w+)$/\$4#\$1/g" | sort) ; do
|
||||
CURRENT_PREFIX="${FILE%#*}"
|
||||
if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then
|
||||
if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/core-files.cmake ; fi
|
||||
echo " # ${CURRENT_PREFIX}" >> cmake/core-files.cmake
|
||||
PREFIX="${CURRENT_PREFIX}"
|
||||
fi
|
||||
echo " ${FILE#*#}" >> cmake/core-files.cmake
|
||||
done
|
||||
echo ")" >> cmake/core-files.cmake
|
||||
git diff cmake/core-files.cmake
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "# Do not edit. Regenerate this with ./scripts/generate-test-files.sh" > cmake/test-files.cmake
|
||||
echo "" >> cmake/test-files.cmake
|
||||
echo "set(MBGL_TEST_FILES" >> cmake/test-files.cmake
|
||||
PREFIX=
|
||||
for FILE in $(git ls-files "test/*.hpp" "test/*.cpp" "test/*.h" "test/*.c" | sort) ; do
|
||||
CURRENT_PREFIX=$(dirname ${FILE#test/})
|
||||
if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then
|
||||
if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/test-files.cmake ; fi
|
||||
echo " # ${CURRENT_PREFIX}" >> cmake/test-files.cmake
|
||||
PREFIX="${CURRENT_PREFIX}"
|
||||
fi
|
||||
echo " ${FILE}" >> cmake/test-files.cmake
|
||||
done
|
||||
echo ")" >> cmake/test-files.cmake
|
||||
git diff cmake/test-files.cmake
|
||||
Reference in New Issue
Block a user