Co-authored-by: mwilsnd <mwilsnd@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
359 lines
8.5 KiB
Python
359 lines
8.5 KiB
Python
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library", "js_run_binary")
|
|
load(
|
|
"@build_bazel_rules_swift//swift:swift.bzl",
|
|
"swift_library",
|
|
)
|
|
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
|
load(
|
|
"bazel/files.bzl",
|
|
"MLN_DARWIN_OBJCPP_HEADERS",
|
|
"MLN_DARWIN_OBJC_HEADERS",
|
|
"MLN_DARWIN_PRIVATE_HEADERS",
|
|
"MLN_DARWIN_PUBLIC_OBJCPP_CUSTOM_DRAWABLE_SOURCE",
|
|
"MLN_DARWIN_PUBLIC_OBJCPP_SOURCE",
|
|
"MLN_DARWIN_PUBLIC_OBJC_SOURCE",
|
|
"MLN_GENERATED_DARWIN_STYLE_HEADERS",
|
|
"MLN_GENERATED_DARWIN_STYLE_PUBLIC_HEADERS",
|
|
"MLN_GENERATED_DARWIN_STYLE_SOURCE",
|
|
"MLN_GENERATED_DARWIN_TEST_CODE",
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_private_hdrs",
|
|
srcs = MLN_DARWIN_PRIVATE_HEADERS,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_objc_hdrs",
|
|
srcs = MLN_DARWIN_OBJC_HEADERS,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_objcpp_hdrs",
|
|
srcs = MLN_DARWIN_OBJCPP_HEADERS,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_objcpp_srcs",
|
|
srcs = MLN_DARWIN_PUBLIC_OBJCPP_SOURCE,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_objcpp_custom_drawable_srcs",
|
|
srcs = MLN_DARWIN_PUBLIC_OBJCPP_CUSTOM_DRAWABLE_SOURCE,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "darwin_objc_srcs",
|
|
srcs = MLN_DARWIN_PUBLIC_OBJC_SOURCE,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "generated_style_srcs",
|
|
srcs = MLN_GENERATED_DARWIN_STYLE_SOURCE,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "generated_style_hdrs",
|
|
srcs = MLN_GENERATED_DARWIN_STYLE_HEADERS,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "generated_style_public_hdrs",
|
|
srcs = MLN_GENERATED_DARWIN_STYLE_PUBLIC_HEADERS,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "generated_test_srcs",
|
|
srcs = MLN_GENERATED_DARWIN_TEST_CODE,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "test_ejs_templates",
|
|
srcs = [
|
|
"test/MLNDocumentationGuideTests.swift",
|
|
"test/MLNLightTest.mm.ejs",
|
|
"test/MLNStyleLayerTests.mm.ejs",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "docs_ejs_templates",
|
|
srcs = [
|
|
"docs/guides/For_Style_Authors.md.ejs",
|
|
"docs/guides/Migrating_to_Expressions.md.ejs",
|
|
"docs/guides/Tile_URL_Templates.md.ejs",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "generator_data",
|
|
srcs = [
|
|
"src/MLNLight.h.ejs",
|
|
"src/MLNLight.mm.ejs",
|
|
"src/MLNStyleLayer.h.ejs",
|
|
"src/MLNStyleLayer.mm.ejs",
|
|
"src/MLNStyleLayer_Private.h.ejs",
|
|
],
|
|
)
|
|
|
|
js_run_binary(
|
|
name = "generated_code",
|
|
srcs = [
|
|
":docs_ejs_templates",
|
|
":generator_data",
|
|
":test_ejs_templates",
|
|
],
|
|
outs = MLN_GENERATED_DARWIN_STYLE_SOURCE +
|
|
MLN_GENERATED_DARWIN_STYLE_HEADERS + MLN_GENERATED_DARWIN_TEST_CODE,
|
|
tool = ":generate-style-code-script",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
objc_library(
|
|
name = "test_utility",
|
|
srcs = [
|
|
"test/MLNTestUtility.h",
|
|
],
|
|
includes = ["test"],
|
|
visibility = [
|
|
"//platform/ios/test:__pkg__",
|
|
],
|
|
)
|
|
|
|
objc_library(
|
|
name = "shared_tests_objc_srcs",
|
|
srcs = glob(
|
|
[
|
|
"test/*.m",
|
|
"test/*.h",
|
|
],
|
|
),
|
|
copts = MAPLIBRE_FLAGS + WARNING_FLAGS["ios"],
|
|
data = glob(
|
|
["test/Media.xcassets/**"],
|
|
),
|
|
sdk_frameworks = [
|
|
"MapKit",
|
|
],
|
|
visibility = [
|
|
"//platform/ios/test:__pkg__",
|
|
],
|
|
deps = [
|
|
"test_utility",
|
|
"//platform:ios-sdk",
|
|
],
|
|
)
|
|
|
|
objc_library(
|
|
name = "shared_tests_objcpp_srcs",
|
|
srcs = glob(
|
|
[
|
|
"test/*.h",
|
|
"test/*.mm",
|
|
],
|
|
exclude = [
|
|
"test/MLNOfflineStorageTests.mm",
|
|
],
|
|
),
|
|
copts = CPP_FLAGS + MAPLIBRE_FLAGS + WARNING_FLAGS["ios"] + ["-Wno-deprecated-declarations"],
|
|
visibility = [
|
|
"//platform/ios/test:__pkg__",
|
|
],
|
|
deps = [
|
|
"//platform:ios-sdk",
|
|
],
|
|
)
|
|
|
|
swift_library(
|
|
name = "shared_tests_swift_srcs",
|
|
testonly = True,
|
|
srcs = glob(["test/*.swift"]),
|
|
data = [
|
|
"test/amsterdam.geojson",
|
|
"test/one-liner.json",
|
|
],
|
|
visibility = [
|
|
"//platform/ios/test:__pkg__",
|
|
],
|
|
deps = [
|
|
"//platform:ios-sdk",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "darwin-generated-style-artifacts",
|
|
srcs = [
|
|
":darwin_objc_hdrs",
|
|
":darwin_objcpp_hdrs",
|
|
":darwin_private_hdrs",
|
|
":generated_code",
|
|
],
|
|
hdrs = [
|
|
":generated_style_hdrs",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Objc files for the iOS source
|
|
objc_library(
|
|
name = "darwin-objc",
|
|
srcs = [
|
|
"src/native_apple_interface.m",
|
|
],
|
|
hdrs = [
|
|
"include/mbgl/interface/native_apple_interface.h",
|
|
"include/mbgl/storage/reachability.h",
|
|
"include/mbgl/util/image+MLNAdditions.hpp",
|
|
],
|
|
copts = WARNING_FLAGS["ios"] + MAPLIBRE_FLAGS + [
|
|
"-fmodules",
|
|
],
|
|
defines = [
|
|
"GLES_SILENCE_DEPRECATION=1",
|
|
"GL_SILENCE_DEPRECATION=1",
|
|
],
|
|
includes = [
|
|
"include",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//:mbgl-core",
|
|
"//platform/default:mbgl-default",
|
|
],
|
|
)
|
|
|
|
# Objcpp files for the iOS source
|
|
objc_library(
|
|
name = "darwin-objcpp",
|
|
srcs = [
|
|
"src/CFHandle.hpp",
|
|
"src/collator.mm",
|
|
"src/http_file_source.mm",
|
|
"src/image.mm",
|
|
"src/local_glyph_rasterizer.mm",
|
|
"src/logging_nslog.mm",
|
|
"src/nsthread.mm",
|
|
"src/number_format.mm",
|
|
"src/string_nsstring.mm",
|
|
] + select({
|
|
"//:metal_renderer": [],
|
|
"//conditions:default": ["src/headless_backend_eagl.mm"],
|
|
}),
|
|
hdrs = [
|
|
"include/mbgl/interface/native_apple_interface.h",
|
|
"include/mbgl/storage/reachability.h",
|
|
"include/mbgl/util/image+MLNAdditions.hpp",
|
|
],
|
|
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
|
|
"-fcxx-modules",
|
|
"-fmodules",
|
|
"-Wno-vla-extension",
|
|
"-Wno-gnu-conditional-omitted-operand",
|
|
],
|
|
includes = [
|
|
"include",
|
|
],
|
|
sdk_frameworks = [
|
|
"CoreText",
|
|
"ImageIO",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"darwin-objc",
|
|
"//:mbgl-core",
|
|
"//platform/default:mbgl-default",
|
|
],
|
|
)
|
|
|
|
# Loop files for iOS.
|
|
objc_library(
|
|
name = "darwin-loop",
|
|
srcs = [
|
|
"src/async_task.cpp",
|
|
"src/run_loop.cpp",
|
|
"src/timer.cpp",
|
|
] + select({
|
|
"//:metal_renderer": [],
|
|
"//conditions:default": ["src/gl_functions.cpp"],
|
|
}),
|
|
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
|
defines = [
|
|
"GLES_SILENCE_DEPRECATION=1",
|
|
"GL_SILENCE_DEPRECATION=1",
|
|
],
|
|
sdk_frameworks = [
|
|
"SystemConfiguration",
|
|
] + select({
|
|
"//:metal_renderer": ["Metal"],
|
|
"//conditions:default": ["OpenGLES"],
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//:mbgl-core",
|
|
],
|
|
)
|
|
|
|
exports_files(
|
|
[
|
|
"test/amsterdam.geojson",
|
|
"test/MLNSDKTestHelpers.swift",
|
|
"app/CustomStyleLayerExample.h",
|
|
"app/CustomStyleLayerExample.m",
|
|
"app/ExampleCustomDrawableStyleLayer.h",
|
|
"app/ExampleCustomDrawableStyleLayer.mm",
|
|
"include/mbgl/util/image+MLNAdditions.hpp",
|
|
] + MLN_DARWIN_PUBLIC_OBJC_SOURCE +
|
|
MLN_DARWIN_PUBLIC_OBJCPP_SOURCE +
|
|
MLN_DARWIN_PUBLIC_OBJCPP_CUSTOM_DRAWABLE_SOURCE +
|
|
MLN_DARWIN_PRIVATE_HEADERS +
|
|
MLN_DARWIN_OBJC_HEADERS +
|
|
MLN_DARWIN_OBJCPP_HEADERS,
|
|
)
|
|
|
|
js_binary(
|
|
name = "generate-style-code-script",
|
|
data = [
|
|
"scripts/style-spec-cocoa-conventions-v8.json",
|
|
"scripts/style-spec-overrides-v8.json",
|
|
"//:node_modules/argparse",
|
|
"//:node_modules/csscolorparser",
|
|
"//:node_modules/lodash",
|
|
"//:style-code",
|
|
"//:style-spec",
|
|
],
|
|
entry_point = "scripts/generate-style-code.js",
|
|
)
|
|
|
|
js_library(
|
|
name = "symbols-to-check",
|
|
srcs = [
|
|
":darwin_objc_hdrs",
|
|
":darwin_objc_srcs",
|
|
":darwin_objcpp_hdrs",
|
|
":darwin_objcpp_srcs",
|
|
":darwin_private_hdrs",
|
|
":generated_code",
|
|
":generated_style_hdrs",
|
|
":generated_style_srcs",
|
|
] + select({
|
|
"//:legacy_renderer": [],
|
|
"//conditions:default": [
|
|
":darwin_objcpp_custom_drawable_srcs",
|
|
],
|
|
}),
|
|
visibility = ["//platform:__pkg__"],
|
|
)
|