File tree Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
import PackageDescription
19
19
20
+ extension Context {
21
+ fileprivate static var buildPlugins : Bool {
22
+ let noPlugins = Context . environment. keys. contains ( " GRPC_SWIFT_PROTOBUF_NO_PLUGINS " )
23
+ return !noPlugins
24
+ }
25
+ }
26
+
27
+ extension [ Product ] {
28
+ func removingPluginsIfNecessary( ) -> Self {
29
+ if Context . buildPlugins {
30
+ return self
31
+ } else {
32
+ // Remove plugin products.
33
+ return self . filter { !( $0 is Product . Plugin ) }
34
+ }
35
+ }
36
+ }
37
+
38
+ extension [ Target ] {
39
+ func removingPluginsIfNecessary( ) -> Self {
40
+ if Context . buildPlugins {
41
+ return self
42
+ } else {
43
+ // Remove plugin targets.
44
+ return self . filter { target in
45
+ switch target. type {
46
+ case . plugin:
47
+ return false
48
+ default :
49
+ return true
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+
20
56
let products : [ Product ] = [
21
57
. library(
22
58
name: " GRPCProtobuf " ,
@@ -173,7 +209,7 @@ let package = Package(
173
209
. watchOS( . v11) ,
174
210
. visionOS( . v2) ,
175
211
] ,
176
- products: products,
212
+ products: products. removingPluginsIfNecessary ( ) ,
177
213
dependencies: dependencies,
178
- targets: targets
214
+ targets: targets. removingPluginsIfNecessary ( )
179
215
)
You can’t perform that action at this time.
0 commit comments