Skip to content

Commit

Permalink
Merge pull request #197 from woshimaliang/generates_header
Browse files Browse the repository at this point in the history
Set generates_header when generated_header_name is provided
  • Loading branch information
woshimaliang authored Dec 3, 2021
2 parents f96b657 + 0ed30ee commit 7673f06
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 14 deletions.
18 changes: 15 additions & 3 deletions Examples/FBSDK/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@ http_archive(

http_archive(
name = "build_bazel_rules_apple",
sha256 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.2.tar.gz",
sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
)

http_archive(
name = "build_bazel_rules_swift",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.24.0/rules_swift.0.24.0.tar.gz",
sha256 = "4f167e5dbb49b082c5b7f49ee688630d69fb96f15c84c448faa2e97a5780dbbc",
)

http_archive(
name = "com_google_protobuf",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.19.1/protobuf-all-3.19.1.tar.gz"],
sha256 = "80631d5a18d51daa3a1336e340001ad4937e926762f21144c62d26fe2a8d71fe",
strip_prefix = "protobuf-3.19.1",
)

load(
Expand Down Expand Up @@ -38,4 +51,3 @@ load(
)

protobuf_deps()

17 changes: 15 additions & 2 deletions Examples/SwiftSubspec/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ http_archive(

http_archive(
name = "build_bazel_rules_apple",
sha256 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.2.tar.gz",
sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
)

http_archive(
name = "build_bazel_rules_swift",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.24.0/rules_swift.0.24.0.tar.gz",
sha256 = "4f167e5dbb49b082c5b7f49ee688630d69fb96f15c84c448faa2e97a5780dbbc",
)

load(
Expand All @@ -32,6 +38,13 @@ load(

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@com_google_protobuf//:protobuf_deps.bzl",
"protobuf_deps",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Sources/ObjcSupport/include/module.modulemap

This file was deleted.

5 changes: 5 additions & 0 deletions Sources/PodToBUILD/Skylark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public indirect enum SkylarkNode {
/// A integer in Skylark.
case int(Int)

/// A Boolean in Skylark.
case bool(Bool)

/// A string in Skylark.
/// @note The string value is enclosed within ""
case string(String)
Expand Down Expand Up @@ -123,6 +126,8 @@ public struct SkylarkCompiler {
switch node {
case let .int(value):
return "\(value)"
case let .bool(value):
return value ? "True" : "False"
case let .string(value):
return "\"\(value)\""
case let .multiLineString(value):
Expand Down
5 changes: 3 additions & 2 deletions Sources/PodToBUILD/SwiftLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public struct SwiftLibrary: BazelTarget {
isSplitDep: isSplitDep,
sourceType: .swift
)
self.name = name
self.name = name

self.sourceFiles = SwiftLibrary.getSources(spec: spec)

Expand Down Expand Up @@ -149,7 +149,7 @@ public struct SwiftLibrary: BazelTarget {
$0.hasPrefix("//") || $0.hasPrefix("@")
}
}

let swiftFlags = XCConfigTransformer.defaultTransformer(
externalName: externalName, sourceType: .swift)
.compilerFlags(for: fallbackSpec)
Expand Down Expand Up @@ -255,6 +255,7 @@ public struct SwiftLibrary: BazelTarget {
.named(name: "copts", value: coptsSkylark),
.named(name: "swiftc_inputs", value: swiftcInputs.toSkylark()),
.named(name: "generated_header_name", value: (externalName + "-Swift.h").toSkylark()),
.named(name: "generates_header", value: SkylarkNode.bool(true)),
.named(name: "features", value: ["swift.no_generated_module_map"].toSkylark()),
.named(name: "visibility", value: ["//visibility:public"].toSkylark()),
]
Expand Down
17 changes: 15 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.2.tar.gz",
sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
)

http_archive(
name = "build_bazel_rules_swift",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.24.0/rules_swift.0.24.0.tar.gz",
sha256 = "4f167e5dbb49b082c5b7f49ee688630d69fb96f15c84c448faa2e97a5780dbbc",
)

load(
Expand All @@ -20,6 +26,13 @@ load(

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@com_google_protobuf//:protobuf_deps.bzl",
"protobuf_deps",
Expand Down

0 comments on commit 7673f06

Please sign in to comment.