[bazel] Run nodejs inside of bazel for genrules (#1948)
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
# @generated
|
||||||
|
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
|
||||||
|
# This file should be checked into version control along with the pnpm-lock.yaml file.
|
||||||
|
pnpm-lock.yaml=-214709846
|
||||||
|
package-lock.json=479094047
|
||||||
|
package.json=1266280293
|
||||||
3
.bazelignore
Normal file
3
.bazelignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
bazel-bin
|
||||||
|
bazel-out
|
||||||
|
bazel-testlogs
|
||||||
3
.bazelrc
3
.bazelrc
@@ -1,3 +1,6 @@
|
|||||||
|
# https://github.com/aspect-build/rules_js/issues/1408
|
||||||
|
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
|
||||||
|
|
||||||
# TODO: remove with bazel 7.x
|
# TODO: remove with bazel 7.x
|
||||||
common --enable_bzlmod
|
common --enable_bzlmod
|
||||||
|
|
||||||
|
|||||||
19
.github/workflows/ios-ci.yml
vendored
19
.github/workflows/ios-ci.yml
vendored
@@ -68,18 +68,6 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: /user/local/lib/node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Cache Bazel
|
- name: Cache Bazel
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@@ -88,13 +76,6 @@ jobs:
|
|||||||
${{ runner.os }}-bazel-
|
${{ runner.os }}-bazel-
|
||||||
path: ~/.cache/bazel
|
path: ~/.cache/bazel
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: npm install
|
|
||||||
run: npm ci --ignore-scripts
|
|
||||||
|
|
||||||
- run: cp bazel/example_config.bzl bazel/config.bzl
|
- run: cp bazel/example_config.bzl bazel/config.bzl
|
||||||
|
|
||||||
- name: Check debug symbols
|
- name: Check debug symbols
|
||||||
|
|||||||
89
BUILD.bazel
89
BUILD.bazel
@@ -1,4 +1,6 @@
|
|||||||
|
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library", "js_run_binary")
|
||||||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
||||||
|
load("@npm//:defs.bzl", "npm_link_all_packages")
|
||||||
load(
|
load(
|
||||||
"//bazel:core.bzl",
|
"//bazel:core.bzl",
|
||||||
"MLN_CORE_HEADERS",
|
"MLN_CORE_HEADERS",
|
||||||
@@ -20,62 +22,51 @@ load(
|
|||||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||||
|
|
||||||
# Generate code required by the core
|
# Generate code required by the core
|
||||||
filegroup(
|
|
||||||
name = "style_data",
|
|
||||||
srcs = glob(["**/*.ejs"]),
|
|
||||||
)
|
|
||||||
|
|
||||||
genrule(
|
js_run_binary(
|
||||||
name = "generated_style_code",
|
name = "generated_style_code",
|
||||||
srcs = ["style_data"],
|
srcs = glob(
|
||||||
|
["**/*.ejs"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
outs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
|
outs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
|
||||||
MLN_PRIVATE_GENERATED_STYLE_HEADERS +
|
MLN_PRIVATE_GENERATED_STYLE_HEADERS +
|
||||||
MLN_GENERATED_STYLE_SOURCE,
|
MLN_GENERATED_STYLE_SOURCE,
|
||||||
cmd = "node $(execpath scripts/generate-style-code.js) --root $(RULEDIR)",
|
tool = ":generate-style-code-script",
|
||||||
tools = ["scripts/generate-style-code.js"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
js_run_binary(
|
||||||
name = "shader_data",
|
|
||||||
srcs = ["shaders/manifest.json"] + glob(["shaders/*.glsl"]),
|
|
||||||
)
|
|
||||||
|
|
||||||
genrule(
|
|
||||||
name = "generated_shaders",
|
name = "generated_shaders",
|
||||||
srcs = ["shader_data"],
|
srcs = ["shaders/manifest.json"] + glob(
|
||||||
|
["shaders/*.glsl"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
outs = MLN_GENERATED_SHADER_HEADERS +
|
outs = MLN_GENERATED_SHADER_HEADERS +
|
||||||
MLN_GENERATED_OPENGL_SHADER_HEADERS,
|
MLN_GENERATED_OPENGL_SHADER_HEADERS,
|
||||||
cmd = "node $(execpath shaders/generate_shader_code.js) --root $(RULEDIR)",
|
tool = ":generate-shader-code-script",
|
||||||
tools = ["shaders/generate_shader_code.js"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# This header only target strips the __generated__ prefix for the compiler
|
# This header only target strips the __generated__ prefix for the compiler
|
||||||
# search paths, making the location of generated code transparent to the build
|
# search paths, making the location of generated code transparent to the build
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "mbgl-core-generated-public-artifacts",
|
name = "mbgl-core-generated-public-artifacts",
|
||||||
srcs = [],
|
hdrs = [
|
||||||
hdrs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
|
":generated_shaders",
|
||||||
|
":generated_style_code",
|
||||||
|
] + MLN_PUBLIC_GENERATED_STYLE_HEADERS +
|
||||||
MLN_GENERATED_SHADER_HEADERS +
|
MLN_GENERATED_SHADER_HEADERS +
|
||||||
select({
|
select({
|
||||||
"//:metal_renderer": [],
|
"//:metal_renderer": [],
|
||||||
"//conditions:default": MLN_GENERATED_OPENGL_SHADER_HEADERS,
|
"//conditions:default": MLN_GENERATED_OPENGL_SHADER_HEADERS,
|
||||||
}),
|
}),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
|
||||||
":generated_shaders",
|
|
||||||
":generated_style_code",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# ditto, but for private headers (under the src/ path)
|
# ditto, but for private headers (under the src/ path)
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "mbgl-core-generated-private-artifacts",
|
name = "mbgl-core-generated-private-artifacts",
|
||||||
srcs = [],
|
hdrs = [":generated_style_code"] + MLN_PRIVATE_GENERATED_STYLE_HEADERS,
|
||||||
hdrs = MLN_PRIVATE_GENERATED_STYLE_HEADERS,
|
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
deps = [
|
|
||||||
":generated_style_code",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generated source is inserted directly into the core target, no need to remove
|
# Generated source is inserted directly into the core target, no need to remove
|
||||||
@@ -207,3 +198,45 @@ exports_files(
|
|||||||
],
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
npm_link_all_packages(
|
||||||
|
name = "node_modules",
|
||||||
|
)
|
||||||
|
|
||||||
|
js_binary(
|
||||||
|
name = "generate-style-code-script",
|
||||||
|
data = [
|
||||||
|
":node_modules/argparse",
|
||||||
|
":node_modules/csscolorparser",
|
||||||
|
":style-code",
|
||||||
|
":style-spec",
|
||||||
|
],
|
||||||
|
entry_point = "scripts/generate-style-code.js",
|
||||||
|
)
|
||||||
|
|
||||||
|
js_binary(
|
||||||
|
name = "generate-shader-code-script",
|
||||||
|
data = [
|
||||||
|
":node_modules/argparse",
|
||||||
|
],
|
||||||
|
entry_point = "shaders/generate_shader_code.js",
|
||||||
|
)
|
||||||
|
|
||||||
|
js_library(
|
||||||
|
name = "style-spec",
|
||||||
|
srcs = ["scripts/style-spec.js"],
|
||||||
|
data = glob([
|
||||||
|
"scripts/style-spec-reference/*.js",
|
||||||
|
"scripts/style-spec-reference/*.json",
|
||||||
|
]),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
js_library(
|
||||||
|
name = "style-code",
|
||||||
|
srcs = ["scripts/style-code.js"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
":node_modules/ejs",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|||||||
14
MODULE.bazel
14
MODULE.bazel
@@ -1,10 +1,24 @@
|
|||||||
module(name = "maplibre")
|
module(name = "maplibre")
|
||||||
|
|
||||||
bazel_dep(name = "apple_support", version = "1.11.1", repo_name = "build_bazel_apple_support")
|
bazel_dep(name = "apple_support", version = "1.11.1", repo_name = "build_bazel_apple_support")
|
||||||
|
bazel_dep(name = "aspect_rules_js", version = "1.34.1")
|
||||||
bazel_dep(name = "bazel_skylib", version = "1.5.0")
|
bazel_dep(name = "bazel_skylib", version = "1.5.0")
|
||||||
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
|
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
|
||||||
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
|
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
|
||||||
bazel_dep(name = "rules_xcodeproj", version = "1.13.0")
|
bazel_dep(name = "rules_xcodeproj", version = "1.13.0")
|
||||||
|
|
||||||
|
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
|
||||||
|
npm.npm_translate_lock(
|
||||||
|
name = "npm",
|
||||||
|
data = ["package.json"],
|
||||||
|
npm_package_lock = "//:package-lock.json",
|
||||||
|
pnpm_lock = "//:pnpm-lock.yaml",
|
||||||
|
update_pnpm_lock = True,
|
||||||
|
)
|
||||||
|
use_repo(npm, "npm")
|
||||||
|
|
||||||
|
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
|
||||||
|
use_repo(pnpm, "pnpm")
|
||||||
|
|
||||||
provisioning_profile_repository = use_extension("@build_bazel_rules_apple//apple:apple.bzl", "provisioning_profile_repository_extension")
|
provisioning_profile_repository = use_extension("@build_bazel_rules_apple//apple:apple.bzl", "provisioning_profile_repository_extension")
|
||||||
provisioning_profile_repository.setup()
|
provisioning_profile_repository.setup()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
load("@aspect_rules_js//js:defs.bzl", "js_binary")
|
||||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
||||||
|
|
||||||
# Objcpp files for the iOS source
|
# Objcpp files for the iOS source
|
||||||
@@ -41,11 +42,11 @@ objc_library(
|
|||||||
"QuartzCore",
|
"QuartzCore",
|
||||||
] + select({
|
] + select({
|
||||||
"//:metal_renderer": [
|
"//:metal_renderer": [
|
||||||
"MetalKit"
|
"MetalKit",
|
||||||
],
|
],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"OpenGLES",
|
"OpenGLES",
|
||||||
"GLKit"
|
"GLKit",
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
deps = [
|
deps = [
|
||||||
@@ -169,8 +170,8 @@ objc_library(
|
|||||||
objc_library(
|
objc_library(
|
||||||
name = "app_custom_drawable_layer_objcpp_srcs",
|
name = "app_custom_drawable_layer_objcpp_srcs",
|
||||||
srcs = [
|
srcs = [
|
||||||
"//platform/darwin:app/ExampleCustomDrawableStyleLayer.h",
|
"//platform/darwin:app/ExampleCustomDrawableStyleLayer.h",
|
||||||
"//platform/darwin:app/ExampleCustomDrawableStyleLayer.mm",
|
"//platform/darwin:app/ExampleCustomDrawableStyleLayer.mm",
|
||||||
],
|
],
|
||||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS + WARNING_FLAGS["ios"] + [
|
copts = CPP_FLAGS + MAPLIBRE_FLAGS + WARNING_FLAGS["ios"] + [
|
||||||
"-fcxx-modules",
|
"-fcxx-modules",
|
||||||
@@ -183,8 +184,8 @@ objc_library(
|
|||||||
],
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//:mbgl-core",
|
|
||||||
":ios-sdk",
|
":ios-sdk",
|
||||||
|
"//:mbgl-core",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,13 +206,14 @@ objc_library(
|
|||||||
"darwin/src",
|
"darwin/src",
|
||||||
],
|
],
|
||||||
sdk_frameworks = [
|
sdk_frameworks = [
|
||||||
] + select({
|
] + select({
|
||||||
"//:metal_renderer": [
|
"//:metal_renderer": [
|
||||||
"MetalKit"
|
"MetalKit",
|
||||||
],
|
],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"GLKit", # needed for LimeGreenStyleLayer
|
"GLKit", # needed for LimeGreenStyleLayer
|
||||||
]}),
|
],
|
||||||
|
}),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":ios-sdk",
|
":ios-sdk",
|
||||||
@@ -225,9 +227,9 @@ objc_library(
|
|||||||
|
|
||||||
objc_library(
|
objc_library(
|
||||||
name = "ios-benchapp",
|
name = "ios-benchapp",
|
||||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
|
||||||
srcs = ["//platform/ios/benchmark:ios_benchmark_srcs"],
|
srcs = ["//platform/ios/benchmark:ios_benchmark_srcs"],
|
||||||
hdrs = ["//platform/ios/benchmark:ios_benchmark_hdrs"],
|
hdrs = ["//platform/ios/benchmark:ios_benchmark_hdrs"],
|
||||||
|
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||||
includes = [
|
includes = [
|
||||||
"darwin/app",
|
"darwin/app",
|
||||||
"darwin/src",
|
"darwin/src",
|
||||||
@@ -240,39 +242,17 @@ objc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
sh_binary(
|
js_binary(
|
||||||
name = "check-public-symbols",
|
name = "check-public-symbols",
|
||||||
srcs = ["//platform/darwin:scripts/check-public-symbols.sh"],
|
args = [
|
||||||
data = [
|
"macOS",
|
||||||
"//platform/darwin:darwin_objc_hdrs",
|
"iOS",
|
||||||
"//platform/darwin:darwin_objc_srcs",
|
|
||||||
"//platform/darwin:darwin_objcpp_hdrs",
|
|
||||||
"//platform/darwin:darwin_objcpp_srcs",
|
|
||||||
"//platform/darwin:darwin_private_hdrs",
|
|
||||||
"//platform/darwin:generated_style_hdrs",
|
|
||||||
"//platform/darwin:generated_style_srcs",
|
|
||||||
"//platform/darwin:scripts/check-public-symbols.js",
|
|
||||||
"//platform/ios:ios_objc_srcs",
|
|
||||||
"//platform/ios:ios_objcpp_srcs",
|
|
||||||
"//platform/ios:ios_private_hdrs",
|
|
||||||
"//platform/ios:ios_public_hdrs",
|
|
||||||
"//platform/ios:ios_sdk_hdrs",
|
|
||||||
"//platform/macos:macos_objc_srcs",
|
|
||||||
"//platform/macos:macos_objcpp_srcs",
|
|
||||||
"//platform/macos:macos_private_hdrs",
|
|
||||||
"//platform/macos:macos_public_hdrs",
|
|
||||||
] + select({
|
|
||||||
"//:metal_renderer": [],
|
|
||||||
"//conditions:default": [
|
|
||||||
"//platform/darwin:darwin_objcpp_opengl_srcs",
|
|
||||||
],
|
|
||||||
}) + select({
|
|
||||||
"//:legacy_renderer": [],
|
|
||||||
"//conditions:default": [
|
|
||||||
"//platform/darwin:darwin_objcpp_custom_drawable_srcs",
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
deps = [
|
|
||||||
"//platform/darwin:generated_code",
|
|
||||||
],
|
],
|
||||||
|
data = [
|
||||||
|
"//:node_modules/lodash",
|
||||||
|
"//platform/darwin:symbols-to-check",
|
||||||
|
"//platform/ios:symbols-to-check",
|
||||||
|
"//platform/macos:symbols-to-check",
|
||||||
|
],
|
||||||
|
entry_point = "scripts/check-public-symbols.js",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
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:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
||||||
load(
|
load(
|
||||||
"bazel/files.bzl",
|
"bazel/files.bzl",
|
||||||
@@ -13,10 +18,6 @@ load(
|
|||||||
"MLN_GENERATED_DARWIN_STYLE_SOURCE",
|
"MLN_GENERATED_DARWIN_STYLE_SOURCE",
|
||||||
"MLN_GENERATED_DARWIN_TEST_CODE",
|
"MLN_GENERATED_DARWIN_TEST_CODE",
|
||||||
)
|
)
|
||||||
load(
|
|
||||||
"@build_bazel_rules_swift//swift:swift.bzl",
|
|
||||||
"swift_library",
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "darwin_private_hdrs",
|
name = "darwin_private_hdrs",
|
||||||
@@ -32,7 +33,10 @@ filegroup(
|
|||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "darwin_objcpp_hdrs",
|
name = "darwin_objcpp_hdrs",
|
||||||
srcs = MLN_DARWIN_OBJCPP_HEADERS,
|
srcs = MLN_DARWIN_OBJCPP_HEADERS + select({
|
||||||
|
"//:metal_renderer": [],
|
||||||
|
"//conditions:default": ["src/MLNOpenGLStyleLayer.h"],
|
||||||
|
}),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -115,17 +119,16 @@ filegroup(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
genrule(
|
js_run_binary(
|
||||||
name = "generated_code",
|
name = "generated_code",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
":docs_ejs_templates",
|
||||||
":generator_data",
|
":generator_data",
|
||||||
":test_ejs_templates",
|
":test_ejs_templates",
|
||||||
":docs_ejs_templates",
|
|
||||||
],
|
],
|
||||||
outs = MLN_GENERATED_DARWIN_STYLE_SOURCE +
|
outs = MLN_GENERATED_DARWIN_STYLE_SOURCE +
|
||||||
MLN_GENERATED_DARWIN_STYLE_HEADERS + MLN_GENERATED_DARWIN_TEST_CODE,
|
MLN_GENERATED_DARWIN_STYLE_HEADERS + MLN_GENERATED_DARWIN_TEST_CODE,
|
||||||
cmd = "node $(execpath scripts/generate-style-code.js) --root $(RULEDIR)/../../",
|
tool = ":generate-style-code-script",
|
||||||
tools = ["scripts/generate-style-code.js"],
|
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -206,15 +209,12 @@ cc_library(
|
|||||||
":darwin_objc_hdrs",
|
":darwin_objc_hdrs",
|
||||||
":darwin_objcpp_hdrs",
|
":darwin_objcpp_hdrs",
|
||||||
":darwin_private_hdrs",
|
":darwin_private_hdrs",
|
||||||
":generated_style_hdrs",
|
":generated_code",
|
||||||
],
|
],
|
||||||
hdrs = [
|
hdrs = [
|
||||||
":generated_style_hdrs",
|
":generated_style_hdrs",
|
||||||
],
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
|
||||||
":generated_code",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Objc files for the iOS source
|
# Objc files for the iOS source
|
||||||
@@ -324,8 +324,6 @@ exports_files(
|
|||||||
"app/ExampleCustomDrawableStyleLayer.h",
|
"app/ExampleCustomDrawableStyleLayer.h",
|
||||||
"app/ExampleCustomDrawableStyleLayer.mm",
|
"app/ExampleCustomDrawableStyleLayer.mm",
|
||||||
"include/mbgl/util/image+MLNAdditions.hpp",
|
"include/mbgl/util/image+MLNAdditions.hpp",
|
||||||
"scripts/check-public-symbols.js",
|
|
||||||
"scripts/check-public-symbols.sh",
|
|
||||||
] + MLN_DARWIN_PUBLIC_OBJC_SOURCE +
|
] + MLN_DARWIN_PUBLIC_OBJC_SOURCE +
|
||||||
MLN_DARWIN_PUBLIC_OBJCPP_SOURCE +
|
MLN_DARWIN_PUBLIC_OBJCPP_SOURCE +
|
||||||
MLN_DARWIN_PUBLIC_OBJCPP_OPENGL_SOURCE +
|
MLN_DARWIN_PUBLIC_OBJCPP_OPENGL_SOURCE +
|
||||||
@@ -334,3 +332,42 @@ exports_files(
|
|||||||
MLN_DARWIN_OBJC_HEADERS +
|
MLN_DARWIN_OBJC_HEADERS +
|
||||||
MLN_DARWIN_OBJCPP_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({
|
||||||
|
"//:metal_renderer": [],
|
||||||
|
"//conditions:default": [
|
||||||
|
":darwin_objcpp_opengl_srcs",
|
||||||
|
],
|
||||||
|
}) + select({
|
||||||
|
"//:legacy_renderer": [],
|
||||||
|
"//conditions:default": [
|
||||||
|
":darwin_objcpp_custom_drawable_srcs",
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
visibility = ["//platform:__pkg__"],
|
||||||
|
)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ MLN_DARWIN_OBJC_HEADERS = [
|
|||||||
"src/MLNCompassDirectionFormatter.h",
|
"src/MLNCompassDirectionFormatter.h",
|
||||||
"src/MLNComputedShapeSource.h",
|
"src/MLNComputedShapeSource.h",
|
||||||
"src/MLNCoordinateFormatter.h",
|
"src/MLNCoordinateFormatter.h",
|
||||||
|
"src/MLNCustomDrawableStyleLayer.h",
|
||||||
"src/MLNDefaultStyle.h",
|
"src/MLNDefaultStyle.h",
|
||||||
"src/MLNDistanceFormatter.h",
|
"src/MLNDistanceFormatter.h",
|
||||||
"src/MLNFeature.h",
|
"src/MLNFeature.h",
|
||||||
@@ -74,6 +75,7 @@ MLN_DARWIN_OBJC_HEADERS = [
|
|||||||
"src/MLNOfflinePack.h",
|
"src/MLNOfflinePack.h",
|
||||||
"src/MLNOfflineRegion.h",
|
"src/MLNOfflineRegion.h",
|
||||||
"src/MLNOfflineStorage.h",
|
"src/MLNOfflineStorage.h",
|
||||||
|
"src/MLNOpenGLStyleLayer.h",
|
||||||
"src/MLNOverlay.h",
|
"src/MLNOverlay.h",
|
||||||
"src/MLNPointAnnotation.h",
|
"src/MLNPointAnnotation.h",
|
||||||
"src/MLNPointCollection.h",
|
"src/MLNPointCollection.h",
|
||||||
@@ -210,7 +212,6 @@ MLN_DARWIN_PUBLIC_OBJCPP_OPENGL_SOURCE = [
|
|||||||
]
|
]
|
||||||
MLN_DARWIN_PUBLIC_OBJCPP_CUSTOM_DRAWABLE_SOURCE = [
|
MLN_DARWIN_PUBLIC_OBJCPP_CUSTOM_DRAWABLE_SOURCE = [
|
||||||
"src/MLNCustomDrawableStyleLayer_Private.h",
|
"src/MLNCustomDrawableStyleLayer_Private.h",
|
||||||
"src/MLNCustomDrawableStyleLayer.h",
|
|
||||||
"src/MLNCustomDrawableStyleLayer.mm",
|
"src/MLNCustomDrawableStyleLayer.mm",
|
||||||
]
|
]
|
||||||
MLN_DARWIN_PUBLIC_OBJC_SOURCE = [
|
MLN_DARWIN_PUBLIC_OBJC_SOURCE = [
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
node platform/darwin/scripts/check-public-symbols.js macOS iOS
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
const { ArgumentParser } = require("argparse");
|
const { ArgumentParser } = require("argparse");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const ejs = require('ejs');
|
const path = require('path');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const colorParser = require('csscolorparser');
|
const colorParser = require('csscolorparser');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
@@ -21,7 +21,7 @@ const args = (() => {
|
|||||||
});
|
});
|
||||||
return parser.parse_args();
|
return parser.parse_args();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const cocoaConventions = require('./style-spec-cocoa-conventions-v8.json');
|
const cocoaConventions = require('./style-spec-cocoa-conventions-v8.json');
|
||||||
const prefix = 'MLN';
|
const prefix = 'MLN';
|
||||||
const suffix = 'StyleLayer';
|
const suffix = 'StyleLayer';
|
||||||
@@ -51,7 +51,7 @@ _.forOwn(cocoaConventions, function (properties, kind) {
|
|||||||
_.forOwn(properties, function (newConvention, oldName) {
|
_.forOwn(properties, function (newConvention, oldName) {
|
||||||
let conventionOverride = new ConventionOverride(newConvention);
|
let conventionOverride = new ConventionOverride(newConvention);
|
||||||
let property = spec[kind][oldName];
|
let property = spec[kind][oldName];
|
||||||
|
|
||||||
if (property) {
|
if (property) {
|
||||||
if (conventionOverride.name.startsWith('is-')) {
|
if (conventionOverride.name.startsWith('is-')) {
|
||||||
property.getter = conventionOverride.name;
|
property.getter = conventionOverride.name;
|
||||||
@@ -787,23 +787,25 @@ const lightProperties = Object.keys(spec['light']).reduce((memo, name) => {
|
|||||||
const lightDoc = spec['light-cocoa-doc'];
|
const lightDoc = spec['light-cocoa-doc'];
|
||||||
const lightType = 'light';
|
const lightType = 'light';
|
||||||
|
|
||||||
const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MLNStyleLayer.h.ejs', 'utf8'), { strict: true });
|
const root = args.root ? args.root : path.dirname(path.dirname(path.dirname(__dirname)));
|
||||||
const layerPrivateH = ejs.compile(fs.readFileSync('platform/darwin/src/MLNStyleLayer_Private.h.ejs', 'utf8'), { strict: true });
|
|
||||||
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MLNStyleLayer.mm.ejs', 'utf8'), { strict: true});
|
|
||||||
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/test/MLNStyleLayerTests.mm.ejs', 'utf8'), { strict: true});
|
|
||||||
const forStyleAuthorsMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/For_Style_Authors.md.ejs', 'utf8'), { strict: true });
|
|
||||||
const ddsGuideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/Migrating_to_Expressions.md.ejs', 'utf8'), { strict: true });
|
|
||||||
const templatesMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/Tile_URL_Templates.md.ejs', 'utf8'), { strict: true });
|
|
||||||
|
|
||||||
const lightH = ejs.compile(fs.readFileSync('platform/darwin/src/MLNLight.h.ejs', 'utf8'), {strict: true});
|
const layerH = readAndCompile('platform/darwin/src/MLNStyleLayer.h.ejs', root);
|
||||||
const lightM = ejs.compile(fs.readFileSync('platform/darwin/src/MLNLight.mm.ejs', 'utf8'), {strict: true});
|
const layerPrivateH = readAndCompile('platform/darwin/src/MLNStyleLayer_Private.h.ejs', root);
|
||||||
const testLight = ejs.compile(fs.readFileSync('platform/darwin/test/MLNLightTest.mm.ejs', 'utf8'), { strict: true});
|
const layerM = readAndCompile('platform/darwin/src/MLNStyleLayer.mm.ejs', root);
|
||||||
|
const testLayers = readAndCompile('platform/darwin/test/MLNStyleLayerTests.mm.ejs', root);
|
||||||
|
const forStyleAuthorsMD = readAndCompile('platform/darwin/docs/guides/For_Style_Authors.md.ejs', root);
|
||||||
|
const ddsGuideMD = readAndCompile('platform/darwin/docs/guides/Migrating_to_Expressions.md.ejs', root);
|
||||||
|
const templatesMD = readAndCompile('platform/darwin/docs/guides/Tile_URL_Templates.md.ejs', root);
|
||||||
|
|
||||||
|
const lightH = readAndCompile('platform/darwin/src/MLNLight.h.ejs', root);
|
||||||
|
const lightM = readAndCompile('platform/darwin/src/MLNLight.mm.ejs', root);
|
||||||
|
const testLight = readAndCompile('platform/darwin/test/MLNLightTest.mm.ejs', root);
|
||||||
writeIfModified(`platform/darwin/src/MLNLight.h`, duplicatePlatformDecls(
|
writeIfModified(`platform/darwin/src/MLNLight.h`, duplicatePlatformDecls(
|
||||||
lightH({ properties: lightProperties, doc: lightDoc, type: lightType })), args.root);
|
lightH({ properties: lightProperties, doc: lightDoc, type: lightType })), root);
|
||||||
writeIfModified(`platform/darwin/src/MLNLight.mm`,
|
writeIfModified(`platform/darwin/src/MLNLight.mm`,
|
||||||
lightM({ properties: lightProperties, doc: lightDoc, type: lightType }), args.root);
|
lightM({ properties: lightProperties, doc: lightDoc, type: lightType }), root);
|
||||||
writeIfModified(`platform/darwin/test/MLNLightTest.mm`,
|
writeIfModified(`platform/darwin/test/MLNLightTest.mm`,
|
||||||
testLight({ properties: lightProperties, doc: lightDoc, type: lightType }), args.root);
|
testLight({ properties: lightProperties, doc: lightDoc, type: lightType }), root);
|
||||||
|
|
||||||
const layers = _(spec.layer.type.values).map((value, layerType) => {
|
const layers = _(spec.layer.type.values).map((value, layerType) => {
|
||||||
const layoutProperties = Object.keys(spec[`layout_${layerType}`]).reduce((memo, name) => {
|
const layoutProperties = Object.keys(spec[`layout_${layerType}`]).reduce((memo, name) => {
|
||||||
@@ -877,13 +879,13 @@ for (var layer of layers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`,
|
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`,
|
||||||
duplicatePlatformDecls(layerH(layer)), args.root);
|
duplicatePlatformDecls(layerH(layer)), root);
|
||||||
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}_Private.h`,
|
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}_Private.h`,
|
||||||
duplicatePlatformDecls(layerPrivateH(layer)), args.root);
|
duplicatePlatformDecls(layerPrivateH(layer)), root);
|
||||||
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`,
|
writeIfModified(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`,
|
||||||
layerM(layer), args.root);
|
layerM(layer), root);
|
||||||
writeIfModified(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.mm`,
|
writeIfModified(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.mm`,
|
||||||
testLayers(layer), args.root);
|
testLayers(layer), root);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract examples for guides from unit tests.
|
// Extract examples for guides from unit tests.
|
||||||
@@ -925,21 +927,21 @@ writeIfModified(`platform/ios/docs/guides/For Style Authors.md`, forStyleAuthors
|
|||||||
os: 'iOS',
|
os: 'iOS',
|
||||||
renamedProperties: renamedPropertiesByLayerType,
|
renamedProperties: renamedPropertiesByLayerType,
|
||||||
layers: layers,
|
layers: layers,
|
||||||
}), args.root);
|
}), root);
|
||||||
writeIfModified(`platform/macos/docs/guides/For Style Authors.md`, forStyleAuthorsMD({
|
writeIfModified(`platform/macos/docs/guides/For Style Authors.md`, forStyleAuthorsMD({
|
||||||
os: 'macOS',
|
os: 'macOS',
|
||||||
renamedProperties: renamedPropertiesByLayerType,
|
renamedProperties: renamedPropertiesByLayerType,
|
||||||
layers: layers,
|
layers: layers,
|
||||||
}), args.root);
|
}), root);
|
||||||
writeIfModified(`platform/ios/docs/guides/Migrating to Expressions.md`, ddsGuideMD({
|
writeIfModified(`platform/ios/docs/guides/Migrating to Expressions.md`, ddsGuideMD({
|
||||||
os: 'iOS',
|
os: 'iOS',
|
||||||
}), args.root);
|
}), root);
|
||||||
writeIfModified(`platform/macos/docs/guides/Migrating to Expressions.md`, ddsGuideMD({
|
writeIfModified(`platform/macos/docs/guides/Migrating to Expressions.md`, ddsGuideMD({
|
||||||
os: 'macOS',
|
os: 'macOS',
|
||||||
}), args.root);
|
}), root);
|
||||||
writeIfModified(`platform/ios/docs/guides/Tile URL Templates.md`, templatesMD({
|
writeIfModified(`platform/ios/docs/guides/Tile URL Templates.md`, templatesMD({
|
||||||
os: 'iOS',
|
os: 'iOS',
|
||||||
}), args.root);
|
}), root);
|
||||||
writeIfModified(`platform/macos/docs/guides/Tile URL Templates.md`, templatesMD({
|
writeIfModified(`platform/macos/docs/guides/Tile URL Templates.md`, templatesMD({
|
||||||
os: 'macOS',
|
os: 'macOS',
|
||||||
}), args.root);*/
|
}), root);*/
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <mbgl/style/layer.hpp>
|
#include <mbgl/style/layer.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MLN_EXPORT
|
||||||
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
|
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework")
|
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework")
|
||||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
|
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
|
||||||
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
||||||
@@ -96,11 +97,9 @@ info_plist(
|
|||||||
)
|
)
|
||||||
|
|
||||||
public_hdrs = [
|
public_hdrs = [
|
||||||
":umbrella_header",
|
|
||||||
":ios_public_hdrs",
|
":ios_public_hdrs",
|
||||||
":ios_sdk_hdrs",
|
":ios_sdk_hdrs",
|
||||||
"//platform/darwin:darwin_objc_hdrs",
|
"//platform/darwin:darwin_objc_hdrs",
|
||||||
"//platform/darwin:darwin_objcpp_hdrs",
|
|
||||||
"//platform/darwin:generated_style_public_hdrs",
|
"//platform/darwin:generated_style_public_hdrs",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -116,7 +115,6 @@ apple_static_xcframework(
|
|||||||
},
|
},
|
||||||
minimum_os_versions = {"ios": "12.0"},
|
minimum_os_versions = {"ios": "12.0"},
|
||||||
public_hdrs = public_hdrs,
|
public_hdrs = public_hdrs,
|
||||||
umbrella_header = "umbrella_header",
|
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//platform:ios-sdk"],
|
deps = ["//platform:ios-sdk"],
|
||||||
)
|
)
|
||||||
@@ -150,7 +148,6 @@ apple_xcframework(
|
|||||||
},
|
},
|
||||||
minimum_os_versions = {"ios": "12.0"},
|
minimum_os_versions = {"ios": "12.0"},
|
||||||
public_hdrs = public_hdrs,
|
public_hdrs = public_hdrs,
|
||||||
umbrella_header = "umbrella_header",
|
|
||||||
version = ":maplibre_ios_version",
|
version = ":maplibre_ios_version",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//platform:ios-sdk-dynamic"],
|
deps = ["//platform:ios-sdk-dynamic"],
|
||||||
@@ -158,11 +155,13 @@ apple_xcframework(
|
|||||||
|
|
||||||
ios_framework(
|
ios_framework(
|
||||||
name = "MapLibre.link",
|
name = "MapLibre.link",
|
||||||
|
testonly = True,
|
||||||
bundle_id = "com.maplibre.link",
|
bundle_id = "com.maplibre.link",
|
||||||
families = ["iphone"],
|
families = ["iphone"],
|
||||||
infoplists = ["info_plist"],
|
infoplists = ["info_plist"],
|
||||||
linkopts = [""],
|
linkopts = [""],
|
||||||
minimum_os_version = "12.0",
|
minimum_os_version = "12.0",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//platform:ios-sdk"],
|
deps = ["//platform:ios-sdk"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -333,3 +332,15 @@ exports_files(
|
|||||||
MLN_IOS_PUBLIC_OBJC_SOURCE +
|
MLN_IOS_PUBLIC_OBJC_SOURCE +
|
||||||
MLN_PUBLIC_IOS_APP_SOPURCE,
|
MLN_PUBLIC_IOS_APP_SOPURCE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
js_library(
|
||||||
|
name = "symbols-to-check",
|
||||||
|
srcs = [
|
||||||
|
":ios_objc_srcs",
|
||||||
|
":ios_objcpp_srcs",
|
||||||
|
":ios_private_hdrs",
|
||||||
|
":ios_public_hdrs",
|
||||||
|
":ios_sdk_hdrs",
|
||||||
|
],
|
||||||
|
visibility = ["//platform:__pkg__"],
|
||||||
|
)
|
||||||
|
|||||||
@@ -14,26 +14,22 @@ MLN_IOS_SDK_HEADERS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
MLN_IOS_PUBLIC_HEADERS = [
|
MLN_IOS_PUBLIC_HEADERS = [
|
||||||
"src/MLNAnnotationContainerView.h",
|
|
||||||
"src/MLNCompactCalloutView.h",
|
|
||||||
"src/MLNFaux3DUserLocationAnnotationView.h",
|
|
||||||
"src/MLNMapAccessibilityElement.h",
|
|
||||||
"src/MLNMapView+Impl.h",
|
|
||||||
"src/MLNMapView+Metal.h",
|
|
||||||
"src/MLNMapView+OpenGL.h",
|
|
||||||
"src/MLNScaleBar.h",
|
|
||||||
"src/MLNUserLocationHeadingArrowLayer.h",
|
|
||||||
"src/MLNUserLocationHeadingBeamLayer.h",
|
|
||||||
"src/MLNUserLocationHeadingIndicator.h",
|
|
||||||
"src/NSOrthography+MLNAdditions.h",
|
|
||||||
"src/UIColor+MLNAdditions.h",
|
|
||||||
"src/UIDevice+MLNAdditions.h",
|
|
||||||
"src/UIImage+MLNAdditions.h",
|
|
||||||
"src/UIView+MLNAdditions.h",
|
|
||||||
"src/UIViewController+MLNAdditions.h",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
MLN_IOS_PRIVATE_HEADERS = [
|
MLN_IOS_PRIVATE_HEADERS = [
|
||||||
|
"src/NSOrthography+MLNAdditions.h",
|
||||||
|
"src/UIDevice+MLNAdditions.h",
|
||||||
|
"src/UIImage+MLNAdditions.h",
|
||||||
|
"src/MLNUserLocationHeadingArrowLayer.h",
|
||||||
|
"src/MLNUserLocationHeadingIndicator.h",
|
||||||
|
"src/UIColor+MLNAdditions.h",
|
||||||
|
"src/MLNMapAccessibilityElement.h",
|
||||||
|
"src/UIViewController+MLNAdditions.h",
|
||||||
|
"src/UIView+MLNAdditions.h",
|
||||||
|
"src/MLNScaleBar.h",
|
||||||
|
"src/MLNFaux3DUserLocationAnnotationView.h",
|
||||||
|
"src/MLNUserLocationHeadingBeamLayer.h",
|
||||||
|
"src/MLNAnnotationContainerView.h",
|
||||||
"src/MLNAnnotationContainerView_Private.h",
|
"src/MLNAnnotationContainerView_Private.h",
|
||||||
"src/MLNAnnotationImage_Private.h",
|
"src/MLNAnnotationImage_Private.h",
|
||||||
"src/MLNAnnotationView_Private.h",
|
"src/MLNAnnotationView_Private.h",
|
||||||
@@ -41,6 +37,10 @@ MLN_IOS_PRIVATE_HEADERS = [
|
|||||||
"src/MLNMapView_Private.h",
|
"src/MLNMapView_Private.h",
|
||||||
"src/MLNUserLocationAnnotationView_Private.h",
|
"src/MLNUserLocationAnnotationView_Private.h",
|
||||||
"src/MLNUserLocation_Private.h",
|
"src/MLNUserLocation_Private.h",
|
||||||
|
"src/MLNCompactCalloutView.h",
|
||||||
|
"src/MLNMapView+Impl.h",
|
||||||
|
"src/MLNMapView+Metal.h",
|
||||||
|
"src/MLNMapView+OpenGL.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
MLN_IOS_PUBLIC_OBJC_SOURCE = [
|
MLN_IOS_PUBLIC_OBJC_SOURCE = [
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MLNMapView.h"
|
||||||
@class MLNMapView;
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,6 @@ FOUNDATION_EXPORT MLN_EXPORT const unsigned char MapboxVersionString[];
|
|||||||
#import "NSPredicate+MLNAdditions.h"
|
#import "NSPredicate+MLNAdditions.h"
|
||||||
#import "NSValue+MLNAdditions.h"
|
#import "NSValue+MLNAdditions.h"
|
||||||
#import "MLNUserLocationAnnotationViewStyle.h"
|
#import "MLNUserLocationAnnotationViewStyle.h"
|
||||||
#if MLN_DRAWABLE_RENDERER
|
#if defined(MLN_DRAWABLE_RENDERER) || defined(MLN_RENDER_BACKEND_METAL)
|
||||||
#import "MLNCustomDrawableStyleLayer.h"
|
#import "MLNCustomDrawableStyleLayer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||||
load(
|
load(
|
||||||
"bazel/files.bzl",
|
"bazel/files.bzl",
|
||||||
"MLN_MACOS_PRIVATE_HEADERS",
|
"MLN_MACOS_PRIVATE_HEADERS",
|
||||||
"MLN_MACOS_PUBLIC_HEADERS",
|
"MLN_MACOS_PUBLIC_HEADERS",
|
||||||
"MLN_MACOS_PUBLIC_OBJCPP_SOURCE",
|
|
||||||
"MLN_MACOS_PUBLIC_OBJCPP_OPENGL_SOURCE",
|
|
||||||
"MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE",
|
"MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE",
|
||||||
|
"MLN_MACOS_PUBLIC_OBJCPP_OPENGL_SOURCE",
|
||||||
|
"MLN_MACOS_PUBLIC_OBJCPP_SOURCE",
|
||||||
"MLN_MACOS_PUBLIC_OBJC_SOURCE",
|
"MLN_MACOS_PUBLIC_OBJC_SOURCE",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,5 +41,16 @@ exports_files(
|
|||||||
MLN_MACOS_PUBLIC_HEADERS +
|
MLN_MACOS_PUBLIC_HEADERS +
|
||||||
MLN_MACOS_PUBLIC_OBJCPP_SOURCE +
|
MLN_MACOS_PUBLIC_OBJCPP_SOURCE +
|
||||||
MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE +
|
MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE +
|
||||||
MLN_MACOS_PUBLIC_OBJC_SOURCE
|
MLN_MACOS_PUBLIC_OBJC_SOURCE,
|
||||||
|
)
|
||||||
|
|
||||||
|
js_library(
|
||||||
|
name = "symbols-to-check",
|
||||||
|
srcs = [
|
||||||
|
":macos_objc_srcs",
|
||||||
|
":macos_objcpp_srcs",
|
||||||
|
":macos_private_hdrs",
|
||||||
|
":macos_public_hdrs",
|
||||||
|
],
|
||||||
|
visibility = ["//platform:__pkg__"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
|
#import <AppKit/AppKit.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class MLNMapView;
|
|
||||||
@class MLNAnnotationImage;
|
@class MLNAnnotationImage;
|
||||||
|
@class MLNMapCamera;
|
||||||
|
@class MLNMapView;
|
||||||
@class MLNPolygon;
|
@class MLNPolygon;
|
||||||
@class MLNPolyline;
|
@class MLNPolyline;
|
||||||
@class MLNShape;
|
@class MLNShape;
|
||||||
|
@class MLNStyle;
|
||||||
|
@protocol MLNAnnotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The `MLNMapViewDelegate` protocol defines a set of optional methods that you
|
The `MLNMapViewDelegate` protocol defines a set of optional methods that you
|
||||||
|
|||||||
2634
pnpm-lock.yaml
generated
Normal file
2634
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,6 @@
|
|||||||
const { ArgumentParser } = require("argparse");
|
const { ArgumentParser } = require("argparse");
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const ejs = require('ejs');
|
|
||||||
const spec = require('./style-spec');
|
const spec = require('./style-spec');
|
||||||
const colorParser = require('csscolorparser');
|
const colorParser = require('csscolorparser');
|
||||||
|
|
||||||
@@ -222,10 +221,13 @@ global.defaultValue = function (property) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const layerHpp = ejs.compile(fs.readFileSync(`include/mbgl/style/layers/layer.hpp.ejs`, 'utf8'), {strict: true});
|
console.log("Generating style code...");
|
||||||
const layerCpp = ejs.compile(fs.readFileSync(`src/mbgl/style/layers/layer.cpp.ejs`, 'utf8'), {strict: true});
|
const root = args.root ? args.root : path.dirname(__dirname);
|
||||||
const propertiesHpp = ejs.compile(fs.readFileSync(`src/mbgl/style/layers/layer_properties.hpp.ejs`, 'utf8'), {strict: true});
|
|
||||||
const propertiesCpp = ejs.compile(fs.readFileSync(`src/mbgl/style/layers/layer_properties.cpp.ejs`, 'utf8'), {strict: true});
|
const layerHpp = readAndCompile(`include/mbgl/style/layers/layer.hpp.ejs`, root);
|
||||||
|
const layerCpp = readAndCompile(`src/mbgl/style/layers/layer.cpp.ejs`, root);
|
||||||
|
const propertiesHpp = readAndCompile(`src/mbgl/style/layers/layer_properties.hpp.ejs`, root);
|
||||||
|
const propertiesCpp = readAndCompile(`src/mbgl/style/layers/layer_properties.cpp.ejs`, root);
|
||||||
|
|
||||||
const collator = new Intl.Collator("en-US");
|
const collator = new Intl.Collator("en-US");
|
||||||
|
|
||||||
@@ -273,16 +275,16 @@ const layers = Object.keys(spec.layer.type.values).map((type) => {
|
|||||||
for (const layer of layers) {
|
for (const layer of layers) {
|
||||||
const layerFileName = layer.type.replace('-', '_');
|
const layerFileName = layer.type.replace('-', '_');
|
||||||
|
|
||||||
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.hpp`, propertiesHpp(layer), args.root);
|
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.hpp`, propertiesHpp(layer), root);
|
||||||
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer), args.root);
|
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer), root);
|
||||||
|
|
||||||
// Remove our fake property for the external interace.
|
// Remove our fake property for the external interace.
|
||||||
if (layer.type === 'line') {
|
if (layer.type === 'line') {
|
||||||
layer.paintProperties = layer.paintProperties.filter(property => property.name !== 'line-floor-width');
|
layer.paintProperties = layer.paintProperties.filter(property => property.name !== 'line-floor-width');
|
||||||
}
|
}
|
||||||
|
|
||||||
writeIfModified(`include/mbgl/style/layers/${layerFileName}_layer.hpp`, layerHpp(layer), args.root);
|
writeIfModified(`include/mbgl/style/layers/${layerFileName}_layer.hpp`, layerHpp(layer), root);
|
||||||
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer.cpp`, layerCpp(layer), args.root);
|
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer.cpp`, layerCpp(layer), root);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Light
|
// Light
|
||||||
@@ -298,7 +300,7 @@ const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
|
|||||||
// to get a deterministic order.
|
// to get a deterministic order.
|
||||||
lightProperties.sort((a, b) => collator.compare(a.name, b.name));
|
lightProperties.sort((a, b) => collator.compare(a.name, b.name));
|
||||||
|
|
||||||
const lightHpp = ejs.compile(fs.readFileSync(`include/mbgl/style/light.hpp.ejs`, 'utf8'), {strict: true});
|
const lightHpp = readAndCompile(`include/mbgl/style/light.hpp.ejs`, root);
|
||||||
const lightCpp = ejs.compile(fs.readFileSync(`src/mbgl/style/light.cpp.ejs`, 'utf8'), {strict: true});
|
const lightCpp = readAndCompile(`src/mbgl/style/light.cpp.ejs`, root);
|
||||||
writeIfModified(`include/mbgl/style/light.hpp`, lightHpp({properties: lightProperties}), args.root);
|
writeIfModified(`include/mbgl/style/light.hpp`, lightHpp({properties: lightProperties}), root);
|
||||||
writeIfModified(`src/mbgl/style/light.cpp`, lightCpp({properties: lightProperties}), args.root);
|
writeIfModified(`src/mbgl/style/light.cpp`, lightCpp({properties: lightProperties}), root);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Global functions //
|
// Global functions //
|
||||||
|
|
||||||
|
const ejs = require('ejs');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
@@ -59,3 +60,11 @@ global.writeIfModified = function(filename, newContent, output) {
|
|||||||
}
|
}
|
||||||
console.warn(`* Updating outdated file '${filename}'`);
|
console.warn(`* Updating outdated file '${filename}'`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
global.readAndCompile = function(filename, root) {
|
||||||
|
if (root) {
|
||||||
|
filename = path.resolve(path.join(root, filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ejs.compile(fs.readFileSync(filename, 'utf8'), {strict: true});
|
||||||
|
}
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ const args = (() => {
|
|||||||
});
|
});
|
||||||
parser.add_argument("--root", "--r", {
|
parser.add_argument("--root", "--r", {
|
||||||
help: "Directory root to place generated code",
|
help: "Directory root to place generated code",
|
||||||
required: true
|
required: false
|
||||||
});
|
});
|
||||||
parser.add_argument("--compress", "--c", {
|
parser.add_argument("--compress", "--c", {
|
||||||
help: "Compress shader text with zlib and output byte arrays instead of strings",
|
help: "Compress shader text with zlib and output byte arrays instead of strings",
|
||||||
@@ -220,8 +220,9 @@ const args = (() => {
|
|||||||
|
|
||||||
|
|
||||||
// Generate shader source headers
|
// Generate shader source headers
|
||||||
const shaderRoot = "shaders/";
|
const root = args.root ? args.root : path.dirname(__dirname);
|
||||||
const outputRoot = path.join((args.root ? args.root : ""), "include/mbgl/shaders");
|
const shaderRoot = path.join(root, "shaders");
|
||||||
|
const outputRoot = path.join(root, "include/mbgl/shaders");
|
||||||
let generatedHeaders = [];
|
let generatedHeaders = [];
|
||||||
let shaderNames = [];
|
let shaderNames = [];
|
||||||
|
|
||||||
@@ -319,4 +320,4 @@ struct ShaderSource<BuiltIn::None, gfx::Backend::Type::OpenGL> {
|
|||||||
} // namespace mbgl
|
} // namespace mbgl
|
||||||
`);
|
`);
|
||||||
|
|
||||||
console.log("Shaders generated!");
|
console.log("Shaders generated!");
|
||||||
|
|||||||
Reference in New Issue
Block a user