mirror of https://github.com/grpc/grpc.git
[ObjC] generate Package.swift from template (#33505)
This is to help simplify the grpc iOS release flow. Package.swift was manually written and out of sync for a long time in this repo. They are currently being updated updated for releases in [grpc-ios](https://github.com/grpc/grpc-ios) repo, which includes a lot of manual work to include new files and exclude tests. This diff generate Package.swift from a template like other languages to avoid the tedious work. Currently only gRPC-Core is generated form the template, gRPC-cpp remains the same for now as they don't change often. CC @sampajanopull/33513/head
parent
a194f145e4
commit
12e0e60242
3 changed files with 2060 additions and 42 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,121 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
// swift-tools-version:5.5 |
||||
// The swift-tools-version declares the minimum version of Swift required to build this package. |
||||
import PackageDescription |
||||
import Foundation |
||||
|
||||
var basePath = FileManager.default.fileExists(atPath: "native") ? "native" : "." |
||||
|
||||
let package = Package( |
||||
name: "gRPC", |
||||
products: [ |
||||
.library( |
||||
name: "gRPC-Core", |
||||
targets: [ |
||||
"gRPC-Core", |
||||
] |
||||
), |
||||
.library( |
||||
name: "gRPC-cpp", |
||||
targets: [ |
||||
"gRPC-cpp", |
||||
] |
||||
) |
||||
], |
||||
|
||||
dependencies: [ |
||||
.package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20220623.0"..<"0.20220624.0"), |
||||
.package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.9.0"..<"0.10.0"), |
||||
], |
||||
|
||||
targets: [ |
||||
.target( |
||||
name: "gRPC-Core", |
||||
dependencies: [ |
||||
.product(name:"abseil", package: "abseil-cpp-SwiftPM"), |
||||
.product(name:"openssl_grpc", package: "boringssl-SwiftPM"), |
||||
], |
||||
path: basePath, |
||||
exclude: [ |
||||
"examples/", |
||||
"src/objective-c/", |
||||
], |
||||
<% |
||||
files = [] |
||||
lib_maps = {lib.name: lib for lib in libs} |
||||
for dep in swift_package.get('deps', []): |
||||
lib = lib_maps[dep] |
||||
files.extend(lib.get('public_headers', []) + lib.headers + lib.src) |
||||
files = sorted(set(files)) |
||||
%> |
||||
sources: [ |
||||
% for file in files: |
||||
"${file}", |
||||
% endfor |
||||
], |
||||
publicHeadersPath: "spm-core-include", |
||||
cSettings: [ |
||||
.headerSearchPath("./"), |
||||
.headerSearchPath("include/"), |
||||
.headerSearchPath("third_party/re2/"), |
||||
.headerSearchPath("third_party/upb/"), |
||||
.headerSearchPath("third_party/utf8_range/"), |
||||
.headerSearchPath("third_party/xxhash/"), |
||||
.headerSearchPath("src/core/ext/upb-generated/"), |
||||
.headerSearchPath("src/core/ext/upbdefs-generated/"), |
||||
.define("GRPC_ARES", to: "0"), |
||||
], |
||||
linkerSettings: [ |
||||
.linkedFramework("CoreFoundation"), |
||||
.linkedLibrary("z"), |
||||
] |
||||
), |
||||
.target( |
||||
name: "gRPC-cpp", |
||||
dependencies: [ |
||||
.product(name:"abseil", package: "abseil-cpp-SwiftPM"), |
||||
"gRPC-Core", |
||||
], |
||||
path: basePath, |
||||
exclude: [ |
||||
"examples/", |
||||
"src/cpp/client/cronet_credentials.cc", |
||||
"src/cpp/client/channel_test_peer.cc", |
||||
"src/cpp/common/alts_util.cc", |
||||
"src/cpp/common/alts_context.cc", |
||||
"src/cpp/common/insecure_create_auth_context.cc", |
||||
"src/cpp/server/admin/", |
||||
"src/cpp/server/channelz/", |
||||
"src/cpp/server/csds/", |
||||
"src/cpp/server/load_reporter/", |
||||
"src/cpp/ext/", |
||||
"src/cpp/util/core_stats.cc", |
||||
"src/cpp/util/core_stats.h", |
||||
"src/cpp/util/error_details.cc", |
||||
"src/objective-c/examples/", |
||||
"src/objective-c/manual_tests/", |
||||
"src/objective-c/tests/", |
||||
], |
||||
sources: [ |
||||
"src/cpp/", |
||||
], |
||||
publicHeadersPath: "spm-cpp-include", |
||||
cSettings: [ |
||||
.headerSearchPath("./"), |
||||
.headerSearchPath("include/"), |
||||
.headerSearchPath("third_party/upb/"), |
||||
.headerSearchPath("src/core/ext/upb-generated"), |
||||
] |
||||
), |
||||
.testTarget( |
||||
name: "build-test", |
||||
dependencies: [ |
||||
"gRPC-cpp", |
||||
], |
||||
path: basePath + "/test/spm_build" |
||||
), |
||||
], |
||||
cLanguageStandard: .gnu11, |
||||
cxxLanguageStandard: .cxx14 |
||||
) |
Loading…
Reference in new issue