xref: /aosp_15_r20/external/grpc-grpc/templates/BoringSSL-Package.swift.template (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1%YAML 1.2
2--- |
3    // swift-tools-version:5.5
4    // The swift-tools-version declares the minimum version of Swift required to build this package.
5    import PackageDescription
6    import Foundation
7
8    let basePath = "third_party/boringssl-with-bazel"
9    let privacyInfoPath = "../../src/objective-c/PrivacyInfo.xcprivacy"
10    let testPath = "test/boringssl_spm_build"
11
12
13
14    let package = Package(
15      name: "BoringSSL-GRPC",
16      products: [
17        .library(
18          name: "openssl_grpc",
19          targets: ["openssl_grpc"]
20        )
21      ],
22
23      targets: [
24        .target(
25          name: "openssl_grpc",
26          path: basePath,
27          exclude: [
28          ],
29        <%
30          def remove_prefix(s, prefix):
31            return s[len(prefix):] if s.startswith(prefix) else s
32          files = []
33          lib_maps = {lib.name: lib for lib in libs}
34          for dep in swift_boringssl_package.get('deps', []):
35            lib = lib_maps[dep]
36            files.extend(lib.src)
37          files = sorted(set({remove_prefix(file, "third_party/boringssl-with-bazel/"): file for file in files}))
38        %>
39          sources: [
40            % for file in files:
41            "${file}",
42            % endfor
43          ],
44          resources: [
45            .copy(privacyInfoPath),
46          ],
47          publicHeadersPath: "src/include",
48
49          cSettings: [
50            .define("OPENSSL_NO_ASM", to: "1"),
51            .headerSearchPath("./"),
52            .headerSearchPath("include/"),
53          ]
54        ),
55        .testTarget(
56          name: "build-test",
57          dependencies: [
58            "openssl_grpc",
59          ],
60          path: testPath
61        ),
62      ],
63      cxxLanguageStandard: .cxx14
64    )
65