Skip to content
Closed
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
22 changes: 22 additions & 0 deletions bazel/swift_header_collector.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
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):
return [
DefaultInfo(
files = ctx.attr.library[CcInfo].compilation_context.headers,
),
]

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

This file was deleted.

2 changes: 1 addition & 1 deletion bazel/swift_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def envoy_mobile_swift_test(name, srcs):
name = test_lib_name,
srcs = srcs,
deps = [
"//library/swift/src:ios_framework_archive",
"//library/swift/src:lib",
],
linkopts = ["-lresolv.9"],
visibility = ["//visibility:private"],
Expand Down
2 changes: 1 addition & 1 deletion envoy-mobile.tulsiproj/Configs/all.tulsigen
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"library/swift/test/BUILD"
],
"buildTargets" : [
"//library/swift/src:ios_framework_archive"
"//library/swift/src:lib"
],
"optionSet" : {
"BazelBuildOptionsDebug" : {
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>
#import <Envoy/Envoy.h>
#import <UIKit/UIKit.h>
#import "Result.h"
#import "ViewController.h"
Expand Down
1 change: 1 addition & 0 deletions library/objective-c/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ objc_library(
hdrs = [
"EnvoyEngine.h",
],
module_name = "EnvoyEngine",
sdk_frameworks = [
"SystemConfiguration",
"UIKit",
Expand Down
27 changes: 20 additions & 7 deletions library/swift/src/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
licenses(["notice"]) # Apache 2

load("//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")

swift_static_framework(
name = "ios_framework",
swift_library(
name = "lib",
srcs = [
"Data+Extension.swift",
"EnvoyClient.swift",
Expand All @@ -27,9 +29,20 @@ swift_static_framework(
"UpstreamHttpProtocol.swift",
],
module_name = "Envoy",
objc_includes = [
"//library/objective-c:EnvoyEngine.h",
],
private_deps = ["//library/objective-c:envoy_engine_objc_lib"],
visibility = ["//visibility:public"],
)

swift_header_collector(
name = "lib_headers",
library = "lib",
)

ios_static_framework(
name = "ios_framework",
hdrs = ["lib_headers"],
bundle_name = "Envoy",
minimum_os_version = "10.0",
visibility = ["//visibility:public"],
deps = ["//library/objective-c:envoy_engine_objc_lib"],
deps = ["lib"],
)
1 change: 1 addition & 0 deletions library/swift/src/EnvoyClient.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@_implementationOnly import EnvoyEngine
import Foundation

/// Envoy's implementation of `HTTPClient`, buildable using `EnvoyClientBuilder`.
Expand Down
1 change: 1 addition & 0 deletions library/swift/src/EnvoyClientBuilder.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@_implementationOnly import EnvoyEngine
import Foundation

/// Builder used for creating new instances of EnvoyClient.
Expand Down
1 change: 1 addition & 0 deletions library/swift/src/EnvoyStreamEmitter.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@_implementationOnly import EnvoyEngine
import Foundation

/// Default implementation of the `StreamEmitter` interface.
Expand Down
1 change: 1 addition & 0 deletions library/swift/src/ResponseHandler.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@_implementationOnly import EnvoyEngine
import Foundation

/// Callback interface for receiving stream events.
Expand Down