-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Add centralized build configuration #13719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| name: Build Config | ||
| description: Read build toolchain versions from .github/build-config.json | ||
|
|
||
| outputs: | ||
| qt_version: | ||
| description: Qt version | ||
| value: ${{ steps.read.outputs.qt_version }} | ||
| qt_minimum_version: | ||
| description: Qt minimum supported version | ||
| value: ${{ steps.read.outputs.qt_minimum_version }} | ||
| qt_modules: | ||
| description: Qt modules (desktop) | ||
| value: ${{ steps.read.outputs.qt_modules }} | ||
| qt_modules_ios: | ||
| description: Qt modules (iOS, excludes qtserialport/qtscxml) | ||
| value: ${{ steps.read.outputs.qt_modules_ios }} | ||
| gstreamer_version: | ||
| description: GStreamer version (macOS/Linux) | ||
| value: ${{ steps.read.outputs.gstreamer_version }} | ||
| gstreamer_android_version: | ||
| description: GStreamer version (Android) | ||
| value: ${{ steps.read.outputs.gstreamer_android_version }} | ||
| gstreamer_windows_version: | ||
| description: GStreamer version (Windows) | ||
| value: ${{ steps.read.outputs.gstreamer_windows_version }} | ||
| ndk_version: | ||
| description: Android NDK version (short form) | ||
| value: ${{ steps.read.outputs.ndk_version }} | ||
| ndk_full_version: | ||
| description: Android NDK version (full form for sdkmanager) | ||
| value: ${{ steps.read.outputs.ndk_full_version }} | ||
| java_version: | ||
| description: Java version | ||
| value: ${{ steps.read.outputs.java_version }} | ||
| android_platform: | ||
| description: Android platform/API level | ||
| value: ${{ steps.read.outputs.android_platform }} | ||
| android_min_sdk: | ||
| description: Android minimum SDK version | ||
| value: ${{ steps.read.outputs.android_min_sdk }} | ||
| android_build_tools: | ||
| description: Android build tools version | ||
| value: ${{ steps.read.outputs.android_build_tools }} | ||
| android_cmdline_tools: | ||
| description: Android command line tools version | ||
| value: ${{ steps.read.outputs.android_cmdline_tools }} | ||
| xcode_version: | ||
| description: Xcode version (macOS) | ||
| value: ${{ steps.read.outputs.xcode_version }} | ||
| xcode_ios_version: | ||
| description: Xcode version (iOS) | ||
| value: ${{ steps.read.outputs.xcode_ios_version }} | ||
| cmake_minimum_version: | ||
| description: CMake minimum version | ||
| value: ${{ steps.read.outputs.cmake_minimum_version }} | ||
| ccache_version: | ||
| description: ccache version | ||
| value: ${{ steps.read.outputs.ccache_version }} | ||
| ccache_max_size: | ||
| description: ccache max cache size | ||
| value: ${{ steps.read.outputs.ccache_max_size }} | ||
| clang_format_version: | ||
| description: clang-format version | ||
| value: ${{ steps.read.outputs.clang_format_version }} | ||
| node_version: | ||
| description: Node.js version | ||
| value: ${{ steps.read.outputs.node_version }} | ||
| flatpak_gnome_version: | ||
| description: GNOME version for Flatpak | ||
| value: ${{ steps.read.outputs.flatpak_gnome_version }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Validate and read build config | ||
| id: read | ||
| shell: bash | ||
| run: | | ||
| CONFIG_FILE="${GITHUB_WORKSPACE}/.github/build-config.json" | ||
| if [[ ! -f "$CONFIG_FILE" ]]; then | ||
| echo "::error::Build config not found: $CONFIG_FILE" | ||
| exit 1 | ||
| fi | ||
| if ! jq empty "$CONFIG_FILE" 2>/dev/null; then | ||
| echo "::error::Invalid JSON in $CONFIG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Read all values (no fallbacks - config is authoritative) | ||
| QT_VERSION=$(jq -r '.qt_version' "$CONFIG_FILE") | ||
| QT_MIN_VERSION=$(jq -r '.qt_minimum_version' "$CONFIG_FILE") | ||
| QT_MODULES=$(jq -r '.qt_modules' "$CONFIG_FILE") | ||
| QT_MODULES_IOS=$(echo "$QT_MODULES" | sed 's/qtserialport//g; s/qtscxml//g; s/ */ /g; s/^ *//; s/ *$//') | ||
| GST_VERSION=$(jq -r '.gstreamer_version' "$CONFIG_FILE") | ||
| GST_ANDROID_VERSION=$(jq -r '.gstreamer_android_version' "$CONFIG_FILE") | ||
| GST_WIN_VERSION=$(jq -r '.gstreamer_windows_version' "$CONFIG_FILE") | ||
| NDK_VERSION=$(jq -r '.ndk_version' "$CONFIG_FILE") | ||
| NDK_FULL_VERSION=$(jq -r '.ndk_full_version' "$CONFIG_FILE") | ||
| JAVA_VERSION=$(jq -r '.java_version' "$CONFIG_FILE") | ||
| ANDROID_PLATFORM=$(jq -r '.android_platform' "$CONFIG_FILE") | ||
| ANDROID_MIN_SDK=$(jq -r '.android_min_sdk' "$CONFIG_FILE") | ||
| ANDROID_BUILD_TOOLS=$(jq -r '.android_build_tools' "$CONFIG_FILE") | ||
| ANDROID_CMDLINE_TOOLS=$(jq -r '.android_cmdline_tools' "$CONFIG_FILE") | ||
| XCODE_VERSION=$(jq -r '.xcode_version' "$CONFIG_FILE") | ||
| XCODE_IOS_VERSION=$(jq -r '.xcode_ios_version' "$CONFIG_FILE") | ||
| CMAKE_MIN_VERSION=$(jq -r '.cmake_minimum_version' "$CONFIG_FILE") | ||
| CCACHE_VERSION=$(jq -r '.ccache_version' "$CONFIG_FILE") | ||
| CCACHE_MAX_SIZE=$(jq -r '.ccache_max_size' "$CONFIG_FILE") | ||
| CLANG_FORMAT_VERSION=$(jq -r '.clang_format_version' "$CONFIG_FILE") | ||
| NODE_VERSION=$(jq -r '.node_version' "$CONFIG_FILE") | ||
| FLATPAK_GNOME_VERSION=$(jq -r '.flatpak_gnome_version' "$CONFIG_FILE") | ||
|
|
||
| { | ||
| echo "qt_version=$QT_VERSION" | ||
| echo "qt_minimum_version=$QT_MIN_VERSION" | ||
| echo "qt_modules=$QT_MODULES" | ||
| echo "qt_modules_ios=$QT_MODULES_IOS" | ||
| echo "gstreamer_version=$GST_VERSION" | ||
| echo "gstreamer_android_version=$GST_ANDROID_VERSION" | ||
| echo "gstreamer_windows_version=$GST_WIN_VERSION" | ||
| echo "ndk_version=$NDK_VERSION" | ||
| echo "ndk_full_version=$NDK_FULL_VERSION" | ||
| echo "java_version=$JAVA_VERSION" | ||
| echo "android_platform=$ANDROID_PLATFORM" | ||
| echo "android_min_sdk=$ANDROID_MIN_SDK" | ||
| echo "android_build_tools=$ANDROID_BUILD_TOOLS" | ||
| echo "android_cmdline_tools=$ANDROID_CMDLINE_TOOLS" | ||
| echo "xcode_version=$XCODE_VERSION" | ||
| echo "xcode_ios_version=$XCODE_IOS_VERSION" | ||
| echo "cmake_minimum_version=$CMAKE_MIN_VERSION" | ||
| echo "ccache_version=$CCACHE_VERSION" | ||
| echo "ccache_max_size=$CCACHE_MAX_SIZE" | ||
| echo "clang_format_version=$CLANG_FORMAT_VERSION" | ||
| echo "node_version=$NODE_VERSION" | ||
| echo "flatpak_gnome_version=$FLATPAK_GNOME_VERSION" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| # Only set commonly-used variables as environment variables to avoid polluting the env. | ||
| # All values are available as step outputs (e.g., steps.config.outputs.ndk_version). | ||
| - name: Set environment variables | ||
| shell: bash | ||
| run: | | ||
| echo "QT_VERSION=${{ steps.read.outputs.qt_version }}" >> "$GITHUB_ENV" | ||
| echo "GSTREAMER_VERSION=${{ steps.read.outputs.gstreamer_version }}" >> "$GITHUB_ENV" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "qt_version": "6.10.1", | ||
| "qt_minimum_version": "6.10.0", | ||
| "qt_modules": "qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors qtscxml", | ||
|
|
||
| "gstreamer_version": "1.24.13", | ||
| "gstreamer_android_version": "1.22.12", | ||
| "gstreamer_windows_version": "1.22.12", | ||
|
|
||
| "ndk_version": "r27c", | ||
| "ndk_full_version": "27.2.12829759", | ||
| "java_version": "17", | ||
| "android_platform": "35", | ||
| "android_min_sdk": "28", | ||
| "android_build_tools": "35.0.0", | ||
| "android_cmdline_tools": "13114758", | ||
|
|
||
| "xcode_version": "16.x", | ||
| "xcode_ios_version": "latest-stable", | ||
|
|
||
| "cmake_minimum_version": "3.25", | ||
|
|
||
| "ccache_version": "4.11.3", | ||
| "ccache_max_size": "2G", | ||
| "clang_format_version": "17", | ||
| "node_version": "22", | ||
|
|
||
| "flatpak_gnome_version": "47" | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||||
| # ============================================================================ | ||||||
| # BuildConfig.cmake - Read .github/build-config.json | ||||||
| # ============================================================================ | ||||||
|
|
||||||
| set(QGC_BUILD_CONFIG_FILE "${CMAKE_SOURCE_DIR}/.github/build-config.json") | ||||||
|
|
||||||
| if(NOT EXISTS "${QGC_BUILD_CONFIG_FILE}") | ||||||
| message(FATAL_ERROR "BuildConfig: Config file not found: ${QGC_BUILD_CONFIG_FILE}") | ||||||
| endif() | ||||||
|
|
||||||
| # Read the JSON file | ||||||
| file(READ "${QGC_BUILD_CONFIG_FILE}" QGC_BUILD_CONFIG_CONTENT) | ||||||
|
|
||||||
| # Extract value from JSON (simple regex for flat JSON) | ||||||
| # NOTE: All values in build-config.json must be quoted strings for this parser | ||||||
| macro(qgc_config_get_value VAR_NAME JSON_KEY) | ||||||
| string(REGEX MATCH "\"${JSON_KEY}\"[ \t\n]*:[ \t\n]*\"([^\"]*)\"" _match "${QGC_BUILD_CONFIG_CONTENT}") | ||||||
|
||||||
| string(REGEX MATCH "\"${JSON_KEY}\"[ \t\n]*:[ \t\n]*\"([^\"]*)\"" _match "${QGC_BUILD_CONFIG_CONTENT}") | |
| string(REGEX MATCH "\"${JSON_KEY}\"[ \t\n]*:[ \t\n]*\"?([^\",}]*)\"?" _match "${QGC_BUILD_CONFIG_CONTENT}") |
Uh oh!
There was an error while loading. Please reload this page.