Skip to content

Commit 6b92c7c

Browse files
meson: convert: add CI/CD + unit test
This adds CI/CD + unittest for 'meson convert'. Idea is simple: - have meson.build files - have "golden" Soong/Bazel files - run meson convert - compare with the goldens. Test command: - python3 run_unittests.py ConvertTests Regenerate goldens when needed: >> cd ~/meson/test cases/unit/hermetic/basic >> ~/meson/test cases/unit/hermetic/basic $ python3 ~/meson/meson.py convert test basic_soong >> ~/meson/test cases/unit/hermetic/basic $ python3 ~/meson/meson.py convert test basic_bazel
1 parent 81caf1a commit 6b92c7c

35 files changed

Lines changed: 733 additions & 0 deletions

‎.github/workflows/os_comp.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,18 @@ jobs:
153153
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
154154
155155
./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS
156+
157+
run-convert:
158+
name: 'Test build system conversion'
159+
runs-on: ubuntu-latest
160+
container:
161+
image: mesonbuild/ubuntu-rolling
162+
163+
steps:
164+
- name: Checkout code
165+
uses: actions/checkout@v4
166+
- name: Run convert unit tests
167+
shell: bash
168+
run: |
169+
source /ci/env_vars.sh
170+
python3 run_unittests.py ConvertTests
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (C) 2025-2026 The Magma GPU Project
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Generated via:
6+
* https://github.com/mesonbuild/meson/tree/master/mesonbuild/convert
7+
*
8+
* Submit patches, do not hand-edit.
9+
*
10+
*/
11+
12+
package {
13+
// See: http://go/android-license-faq
14+
default_applicable_licenses: ["test_license"],
15+
}
16+
17+
license {
18+
name: "test_license",
19+
visibility: [":__subpackages__"],
20+
license_kinds: [
21+
"SPDX-license-identifier-Apache-2.0",
22+
],
23+
license_text: [
24+
"LICENSE",
25+
],
26+
}
27+
28+
cc_library_static {
29+
name: "commonlib",
30+
vendor: true,
31+
host_supported: true,
32+
c_std: "c11",
33+
header_libs: [
34+
"inc",
35+
],
36+
srcs: [
37+
"common.c",
38+
],
39+
}
40+
41+
cc_library_shared {
42+
name: "simplelib",
43+
vendor: true,
44+
host_supported: true,
45+
c_std: "c11",
46+
header_libs: [
47+
"inc",
48+
],
49+
srcs: [
50+
"main.c",
51+
],
52+
static_libs: [
53+
"commonlib",
54+
],
55+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2025-2026 The Magma GPU Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Generated via:
5+
# https://github.com/mesonbuild/meson/tree/master/mesonbuild/convert
6+
#
7+
# Submit patches, do not hand-edit.
8+
9+
load("//bazel:meson_rules.bzl", "meson_cc_library")
10+
load("@rules_license//rules:license.bzl", "license")
11+
12+
license(
13+
name = "test_license",
14+
license_kinds = [
15+
"@rules_license//licenses/spdx:Apache-2.0",
16+
],
17+
)
18+
19+
package(
20+
default_applicable_licenses = ["//:test_license"],
21+
default_visibility = ["//visibility:public"],
22+
)
23+
24+
meson_cc_library(
25+
name = "commonlib",
26+
srcs = [
27+
"common.c",
28+
],
29+
deps = [
30+
"//include:inc",
31+
],
32+
)
33+
34+
meson_cc_library(
35+
name = "simplelib",
36+
srcs = [
37+
"main.c",
38+
],
39+
deps = [
40+
"//:commonlib",
41+
"//include:inc",
42+
],
43+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dummy License Content
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "common.h"
2+
#include <stdio.h>
3+
void common_func(void) { printf("common
4+
"); }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2026 The Meson Development Team
2+
# SPDX-License-Identifier: Apache-2.0
3+
[project]
4+
project_name = 'basic_convert'
5+
build_system = 'bazel'
6+
7+
[copyright]
8+
license_name = "test_license"
9+
licenses = ["Apache-2.0"]
10+
license_texts = ["LICENSE"]
11+
12+
[[config]]
13+
config_name = 'test_config'
14+
15+
[config.platforms]
16+
host_platforms = ["android_arm64"]
17+
build_platforms = ["android_arm64"]
18+
19+
[config.static_options]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2026 The Meson Development Team
2+
# SPDX-License-Identifier: Apache-2.0
3+
[project]
4+
project_name = 'basic_convert'
5+
build_system = 'soong'
6+
7+
[copyright]
8+
license_name = "test_license"
9+
licenses = ["Apache-2.0"]
10+
license_texts = ["LICENSE"]
11+
12+
[[config]]
13+
config_name = 'test_config'
14+
15+
[config.platforms]
16+
host_platforms = ["android_arm64"]
17+
build_platforms = ["android_arm64"]
18+
19+
[config.static_options]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2026 The Meson Development Team
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[shared_libraries]
5+
6+
[static_libraries]
7+
8+
[header_libraries]
9+
10+
[programs]
11+
python3 = { version = "3.11" }
12+
cp = { version = "1.0" }
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2026 The Meson Development Team
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[[wrap]]
5+
name = "android_ndk"
6+
source_url = "https://dl.google.com/android/repository/android-ndk-r29-linux.zip"
7+
source_filename = "android-ndk-r29.zip"
8+
source_hash = "4abbbcdc842f3d4879206e9695d52709603e52dd68d3c1fff04b3b5e7a308ecf"
9+
10+
[[toolchain]]
11+
name = "android_ndk_toolchain_aarch64"
12+
wrap_name = "android_ndk"
13+
ar = "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
14+
cc = "toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang"
15+
cpp = "toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang++"
16+
strip = "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip"
17+
18+
[[platform]]
19+
name = "android_arm64"
20+
21+
[platform.machine_info]
22+
cpu_family = "aarch64"
23+
cpu = "aarch64"
24+
system = "android"
25+
endian = "little"
26+
27+
[platform.c]
28+
compiler_id = "clang"
29+
linker_id = "ld.lld"
30+
version = "21.0.0"
31+
toolchain = "android_ndk_toolchain_aarch64"
32+
sysroot = { wrap_name = "android_ndk", path = "toolchains/llvm/prebuilt/linux-x86_64/sysroot" }
33+
34+
[platform.cpp]
35+
compiler_id = "clang"
36+
linker_id = "ld.lld"
37+
version = "21.0.0"
38+
toolchain = "android_ndk_toolchain_aarch64"
39+
sysroot = { wrap_name = "android_ndk", path = "toolchains/llvm/prebuilt/linux-x86_64/sysroot" }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (C) 2025-2026 The Magma GPU Project
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Generated via:
6+
* https://github.com/mesonbuild/meson/tree/master/mesonbuild/convert
7+
*
8+
* Submit patches, do not hand-edit.
9+
*
10+
*/
11+
12+
package {
13+
// See: http://go/android-license-faq
14+
default_applicable_licenses: ["test_license"],
15+
}
16+
17+
cc_library_headers {
18+
name: "inc",
19+
vendor: true,
20+
host_supported: true,
21+
export_include_dirs: [
22+
".",
23+
],
24+
}

0 commit comments

Comments
 (0)