Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.0
4.1.0
2 changes: 1 addition & 1 deletion bazel/apple_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def envoy_mobile_swift_test(name, srcs, data = [], deps = [], repository = ""):
srcs = srcs,
data = data,
deps = [
repository + "//library/swift:ios_framework_archive",
repository + "//library/swift:ios_lib",
] + deps,
linkopts = ["-lresolv.9"],
visibility = ["//visibility:private"],
Expand Down
27 changes: 5 additions & 22 deletions bazel/envoy_mobile_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ def envoy_mobile_repositories():
python_repos()

def upstream_envoy_overrides():
# Patch protobuf to prevent duplicate symbols: https://github.com/lyft/envoy-mobile/issues/617
# More details: https://github.com/protocolbuffers/protobuf/issues/7046
# TODO: Remove after https://github.com/bazelbuild/bazel/pull/10493 is merged to Bazel
# Reverts:
# - https://github.com/protocolbuffers/protobuf/commit/7b28278c7d4f4175e70aef2f89d304696eb85ae3
# - https://github.com/protocolbuffers/protobuf/commit/a03d332aca5d33c5d4b2cd25037c9e37d57eff02
http_archive(
name = "com_google_protobuf",
patch_args = ["-p1"],
patches = [
"@envoy//bazel:protobuf.patch",
"@envoy_mobile//bazel:protobuf.patch",
],
sha256 = "d7371dc2d46fddac1af8cb27c0394554b068768fc79ecaf5be1a1863e8ff3392",
strip_prefix = "protobuf-3.16.0",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.16.0/protobuf-all-3.16.0.tar.gz"],
)

# Workaround old NDK version breakages https://github.com/lyft/envoy-mobile/issues/934
http_archive(
name = "com_github_libevent_libevent",
Expand Down Expand Up @@ -78,14 +60,15 @@ def upstream_envoy_overrides():
def swift_repos():
http_archive(
name = "build_bazel_rules_apple",
sha256 = "55f4dc1c9bf21bb87442665f4618cff1f1343537a2bd89252078b987dcd9c382",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.20.0/rules_apple.0.20.0.tar.gz",
sha256 = "747d30a8d96e0f4d093c55ebcdc07ac5ef2529c7aa5c41b45788a36ca3a4cb05",
strip_prefix = "rules_apple-8b42998e2086325c3290f4e68752a50cf077fb92",
url = "https://github.com/bazelbuild/rules_apple/archive/8b42998e2086325c3290f4e68752a50cf077fb92.tar.gz",
)

http_archive(
name = "build_bazel_rules_swift",
sha256 = "cea22c0616d797e494d7844a9b604520c87f53c81de49613a7e679ec5b821620",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.14.0/rules_swift.0.14.0.tar.gz",
sha256 = "a228a8e41fdc165a2c55924b728c466e0086f3e638a05d6da98aa6222cbb19c1",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.16.1/rules_swift.0.16.1.tar.gz",
)

def kotlin_repos():
Expand Down
27 changes: 27 additions & 0 deletions bazel/swift_header_collector.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Propagate the generated Swift header from a swift_library target
This exists to work around https://github.com/bazelbuild/rules_swift/issues/291
"""

def _swift_header_collector(ctx):
headers = [
DefaultInfo(
files = ctx.attr.library[CcInfo].compilation_context.headers,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to assert that this only has 1 file to make sure it is what we expect, not a huge deal

),
]

if len(headers[0].files.to_list()) != 1:
header_names = [header.basename for header in headers[0].files.to_list()]
fail("Expected exactly 1 '-Swift.h' header, got {}".format(header_names))

return headers

swift_header_collector = rule(
attrs = dict(
library = attr.label(
mandatory = True,
providers = [CcInfo],
),
),
implementation = _swift_header_collector,
)
218 changes: 0 additions & 218 deletions bazel/swift_static_framework.bzl

This file was deleted.

2 changes: 1 addition & 1 deletion envoy-mobile.tulsiproj/Configs/all.tulsigen
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"//examples/objective-c/hello_world:appmain",
"//examples/swift/hello_world:app",
"//examples/swift/hello_world:appmain",
"//library/swift:ios_framework_archive",
"//library/swift:ios_lib",
"//test/swift/integration:cancel_stream_test",
"//test/swift/integration:cancel_stream_test_lib",
"//test/swift/integration:direct_response_contains_headers_integration_test",
Expand Down
2 changes: 1 addition & 1 deletion examples/objective-c/hello_world/ViewController.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Envoy/Envoy-Swift.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if you consider this public API or not

#import <Envoy/Envoy.h>
#import <UIKit/UIKit.h>
#import "Result.h"
#import "ViewController.h"
Expand Down
23 changes: 20 additions & 3 deletions library/swift/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
load("@envoy_mobile//bazel:swift_static_framework.bzl", "swift_static_framework")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("//bazel:swift_header_collector.bzl", "swift_header_collector")

licenses(["notice"]) # Apache 2

swift_static_framework(
name = "ios_framework",
swift_library(
name = "ios_lib",
srcs = glob([
"DirectResponse.swift",
"Engine.swift",
Expand Down Expand Up @@ -40,7 +42,22 @@ swift_static_framework(
"mocks/*.swift",
"stats/*.swift",
]),
features = ["swift.enable_library_evolution"],
module_name = "Envoy",
private_deps = ["//library/objective-c:envoy_engine_objc_lib"],
visibility = ["//visibility:public"],
)

swift_header_collector(
name = "ios_lib_headers",
library = "ios_lib",
)

ios_static_framework(
name = "ios_framework",
hdrs = ["ios_lib_headers"],
bundle_name = "Envoy",
minimum_os_version = "11.0",
visibility = ["//visibility:public"],
deps = ["ios_lib"],
)