Package@swift-6.0.swift 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. // swift-tools-version:5.10
  2. // Package.swift
  3. //
  4. // Copyright (c) 2014 - 2018 Apple Inc. and the project authors
  5. // Licensed under Apache License v2.0 with Runtime Library Exception
  6. //
  7. // See LICENSE.txt for license information:
  8. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  9. //
  10. import PackageDescription
  11. let package = Package(
  12. name: "SwiftProtobuf",
  13. products: [
  14. .executable(
  15. name: "protoc-gen-swift",
  16. targets: ["protoc-gen-swift"]
  17. ),
  18. .executable(
  19. name: "protoc",
  20. targets: ["protoc"]
  21. ),
  22. .library(
  23. name: "SwiftProtobuf",
  24. targets: ["SwiftProtobuf"]
  25. ),
  26. .library(
  27. name: "SwiftProtobufPluginLibrary",
  28. targets: ["SwiftProtobufPluginLibrary"]
  29. ),
  30. .plugin(
  31. name: "SwiftProtobufPlugin",
  32. targets: ["SwiftProtobufPlugin"]
  33. ),
  34. ],
  35. targets: [
  36. .target(
  37. name: "SwiftProtobuf",
  38. exclude: ["CMakeLists.txt"],
  39. resources: [.copy("PrivacyInfo.xcprivacy")],
  40. swiftSettings: .packageSettings
  41. ),
  42. .target(
  43. name: "SwiftProtobufPluginLibrary",
  44. dependencies: ["SwiftProtobuf"],
  45. exclude: ["CMakeLists.txt"],
  46. resources: [.copy("PrivacyInfo.xcprivacy")],
  47. swiftSettings: .packageSettings
  48. ),
  49. .target(
  50. name: "SwiftProtobufTestHelpers",
  51. dependencies: ["SwiftProtobuf"],
  52. swiftSettings: .packageSettings
  53. ),
  54. .executableTarget(
  55. name: "protoc",
  56. path: "Sources/protobuf",
  57. sources: [
  58. // protoc main
  59. "protobuf/src/google/protobuf/compiler/main_no_generators.cc",
  60. // libprotoc
  61. "protobuf/src/google/protobuf/any.cc",
  62. "protobuf/src/google/protobuf/any.pb.cc",
  63. "protobuf/src/google/protobuf/any_lite.cc",
  64. "protobuf/src/google/protobuf/api.pb.cc",
  65. "protobuf/src/google/protobuf/arena.cc",
  66. "protobuf/src/google/protobuf/arenastring.cc",
  67. "protobuf/src/google/protobuf/arenaz_sampler.cc",
  68. "protobuf/src/google/protobuf/arena_align.cc",
  69. "protobuf/src/google/protobuf/compiler/code_generator.cc",
  70. "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
  71. "protobuf/src/google/protobuf/compiler/code_generator_lite.cc",
  72. "protobuf/src/google/protobuf/compiler/versions.cc",
  73. "protobuf/src/google/protobuf/compiler/subprocess.cc",
  74. "protobuf/src/google/protobuf/compiler/importer.cc",
  75. "protobuf/src/google/protobuf/compiler/parser.cc",
  76. "protobuf/src/google/protobuf/compiler/plugin.cc",
  77. "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
  78. "protobuf/src/google/protobuf/compiler/zip_writer.cc",
  79. "protobuf/src/google/protobuf/compiler/retention.cc",
  80. // libprotobuf
  81. "protobuf/src/google/protobuf/cpp_features.pb.cc",
  82. "protobuf/src/google/protobuf/descriptor.cc",
  83. "protobuf/src/google/protobuf/descriptor.pb.cc",
  84. "protobuf/src/google/protobuf/descriptor_database.cc",
  85. "protobuf/src/google/protobuf/duration.pb.cc",
  86. "protobuf/src/google/protobuf/dynamic_message.cc",
  87. "protobuf/src/google/protobuf/empty.pb.cc",
  88. "protobuf/src/google/protobuf/extension_set.cc",
  89. "protobuf/src/google/protobuf/extension_set_heavy.cc",
  90. "protobuf/src/google/protobuf/feature_resolver.cc",
  91. "protobuf/src/google/protobuf/field_mask.pb.cc",
  92. "protobuf/src/google/protobuf/generated_enum_util.cc",
  93. "protobuf/src/google/protobuf/generated_message_bases.cc",
  94. "protobuf/src/google/protobuf/generated_message_reflection.cc",
  95. "protobuf/src/google/protobuf/generated_message_tctable_full.cc",
  96. "protobuf/src/google/protobuf/generated_message_tctable_gen.cc",
  97. "protobuf/src/google/protobuf/generated_message_tctable_lite.cc",
  98. "protobuf/src/google/protobuf/generated_message_util.cc",
  99. "protobuf/src/google/protobuf/implicit_weak_message.cc",
  100. "protobuf/src/google/protobuf/inlined_string_field.cc",
  101. "protobuf/src/google/protobuf/internal_feature_helper.cc",
  102. "protobuf/src/google/protobuf/io/coded_stream.cc",
  103. "protobuf/src/google/protobuf/io/gzip_stream.cc",
  104. "protobuf/src/google/protobuf/io/io_win32.cc",
  105. "protobuf/src/google/protobuf/io/printer.cc",
  106. "protobuf/src/google/protobuf/io/strtod.cc",
  107. "protobuf/src/google/protobuf/io/tokenizer.cc",
  108. "protobuf/src/google/protobuf/io/zero_copy_sink.cc",
  109. "protobuf/src/google/protobuf/io/zero_copy_stream.cc",
  110. "protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
  111. "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
  112. "protobuf/src/google/protobuf/json/internal/lexer.cc",
  113. "protobuf/src/google/protobuf/json/internal/message_path.cc",
  114. "protobuf/src/google/protobuf/json/internal/parser.cc",
  115. "protobuf/src/google/protobuf/json/internal/unparser.cc",
  116. "protobuf/src/google/protobuf/json/internal/untyped_message.cc",
  117. "protobuf/src/google/protobuf/json/internal/writer.cc",
  118. "protobuf/src/google/protobuf/json/internal/zero_copy_buffered_stream.cc",
  119. "protobuf/src/google/protobuf/json/json.cc",
  120. "protobuf/src/google/protobuf/map.cc",
  121. "protobuf/src/google/protobuf/map_field.cc",
  122. "protobuf/src/google/protobuf/message.cc",
  123. "protobuf/src/google/protobuf/message_lite.cc",
  124. "protobuf/src/google/protobuf/micro_string.cc",
  125. "protobuf/src/google/protobuf/parse_context.cc",
  126. "protobuf/src/google/protobuf/port.cc",
  127. "protobuf/src/google/protobuf/raw_ptr.cc",
  128. "protobuf/src/google/protobuf/reflection_mode.cc",
  129. "protobuf/src/google/protobuf/reflection_ops.cc",
  130. "protobuf/src/google/protobuf/repeated_field.cc",
  131. "protobuf/src/google/protobuf/repeated_ptr_field.cc",
  132. "protobuf/src/google/protobuf/service.cc",
  133. "protobuf/src/google/protobuf/source_context.pb.cc",
  134. "protobuf/src/google/protobuf/struct.pb.cc",
  135. "protobuf/src/google/protobuf/stubs/common.cc",
  136. "protobuf/src/google/protobuf/text_format.cc",
  137. "protobuf/src/google/protobuf/timestamp.pb.cc",
  138. "protobuf/src/google/protobuf/type.pb.cc",
  139. "protobuf/src/google/protobuf/unknown_field_set.cc",
  140. "protobuf/src/google/protobuf/util/delimited_message_util.cc",
  141. "protobuf/src/google/protobuf/util/field_comparator.cc",
  142. "protobuf/src/google/protobuf/util/field_mask_util.cc",
  143. "protobuf/src/google/protobuf/util/message_differencer.cc",
  144. "protobuf/src/google/protobuf/util/time_util.cc",
  145. "protobuf/src/google/protobuf/util/type_resolver_util.cc",
  146. "protobuf/src/google/protobuf/wire_format.cc",
  147. "protobuf/src/google/protobuf/wire_format_lite.cc",
  148. "protobuf/src/google/protobuf/wrappers.pb.cc",
  149. // abseil
  150. "abseil/absl/base/internal/cycleclock.cc",
  151. "abseil/absl/base/internal/low_level_alloc.cc",
  152. "abseil/absl/base/internal/raw_logging.cc",
  153. "abseil/absl/base/internal/spinlock.cc",
  154. "abseil/absl/base/internal/spinlock_wait.cc",
  155. "abseil/absl/base/internal/strerror.cc",
  156. "abseil/absl/base/internal/sysinfo.cc",
  157. "abseil/absl/base/internal/tracing.cc",
  158. "abseil/absl/base/internal/thread_identity.cc",
  159. "abseil/absl/base/internal/throw_delegate.cc",
  160. "abseil/absl/base/internal/unscaledcycleclock.cc",
  161. "abseil/absl/container/internal/raw_hash_set.cc",
  162. "abseil/absl/container/internal/hashtablez_sampler.cc",
  163. "abseil/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
  164. "abseil/absl/crc/crc32c.cc",
  165. "abseil/absl/crc/internal/cpu_detect.cc",
  166. "abseil/absl/crc/internal/crc.cc",
  167. "abseil/absl/crc/internal/crc_cord_state.cc",
  168. "abseil/absl/crc/internal/crc_memcpy_fallback.cc",
  169. "abseil/absl/crc/internal/crc_memcpy_x86_arm_combined.cc",
  170. "abseil/absl/crc/internal/crc_non_temporal_memcpy.cc",
  171. "abseil/absl/crc/internal/crc_x86_arm_combined.cc",
  172. "abseil/absl/debugging/internal/address_is_readable.cc",
  173. "abseil/absl/debugging/internal/decode_rust_punycode.cc",
  174. "abseil/absl/debugging/internal/demangle.cc",
  175. "abseil/absl/debugging/internal/demangle_rust.cc",
  176. "abseil/absl/debugging/internal/elf_mem_image.cc",
  177. "abseil/absl/debugging/internal/examine_stack.cc",
  178. "abseil/absl/debugging/internal/utf8_for_code_point.cc",
  179. "abseil/absl/debugging/internal/vdso_support.cc",
  180. "abseil/absl/debugging/leak_check.cc",
  181. "abseil/absl/debugging/stacktrace.cc",
  182. "abseil/absl/debugging/symbolize.cc",
  183. "abseil/absl/hash/internal/city.cc",
  184. "abseil/absl/hash/internal/hash.cc",
  185. "abseil/absl/hash/internal/low_level_hash.cc",
  186. "abseil/absl/log/die_if_null.cc",
  187. "abseil/absl/log/globals.cc",
  188. "abseil/absl/log/initialize.cc",
  189. "abseil/absl/log/internal/check_op.cc",
  190. "abseil/absl/log/internal/conditions.cc",
  191. "abseil/absl/log/internal/globals.cc",
  192. "abseil/absl/log/internal/log_format.cc",
  193. "abseil/absl/log/internal/log_message.cc",
  194. "abseil/absl/log/internal/log_sink_set.cc",
  195. "abseil/absl/log/internal/nullguard.cc",
  196. "abseil/absl/log/internal/proto.cc",
  197. "abseil/absl/log/internal/structured_proto.cc",
  198. "abseil/absl/log/log_sink.cc",
  199. "abseil/absl/numeric/int128.cc",
  200. "abseil/absl/profiling/internal/exponential_biased.cc",
  201. "abseil/absl/status/status.cc",
  202. "abseil/absl/status/statusor.cc",
  203. "abseil/absl/status/status_payload_printer.cc",
  204. "abseil/absl/status/internal/status_internal.cc",
  205. "abseil/absl/strings/ascii.cc",
  206. "abseil/absl/strings/charconv.cc",
  207. "abseil/absl/strings/cord.cc",
  208. "abseil/absl/strings/cord_analysis.cc",
  209. "abseil/absl/strings/escaping.cc",
  210. "abseil/absl/strings/internal/charconv_bigint.cc",
  211. "abseil/absl/strings/internal/charconv_parse.cc",
  212. "abseil/absl/strings/internal/cordz_functions.cc",
  213. "abseil/absl/strings/internal/cordz_handle.cc",
  214. "abseil/absl/strings/internal/cordz_info.cc",
  215. "abseil/absl/strings/internal/cord_internal.cc",
  216. "abseil/absl/strings/internal/cord_rep_btree.cc",
  217. "abseil/absl/strings/internal/cord_rep_btree_navigator.cc",
  218. "abseil/absl/strings/internal/cord_rep_btree_reader.cc",
  219. "abseil/absl/strings/internal/cord_rep_consume.cc",
  220. "abseil/absl/strings/internal/cord_rep_crc.cc",
  221. "abseil/absl/strings/internal/damerau_levenshtein_distance.cc",
  222. "abseil/absl/strings/internal/escaping.cc",
  223. "abseil/absl/strings/internal/memutil.cc",
  224. "abseil/absl/strings/internal/ostringstream.cc",
  225. "abseil/absl/strings/internal/stringify_sink.cc",
  226. "abseil/absl/strings/internal/str_format/arg.cc",
  227. "abseil/absl/strings/internal/str_format/bind.cc",
  228. "abseil/absl/strings/internal/str_format/extension.cc",
  229. "abseil/absl/strings/internal/str_format/float_conversion.cc",
  230. "abseil/absl/strings/internal/str_format/output.cc",
  231. "abseil/absl/strings/internal/str_format/parser.cc",
  232. "abseil/absl/strings/internal/utf8.cc",
  233. "abseil/absl/strings/match.cc",
  234. "abseil/absl/strings/numbers.cc",
  235. "abseil/absl/strings/string_view.cc",
  236. "abseil/absl/strings/str_cat.cc",
  237. "abseil/absl/strings/str_replace.cc",
  238. "abseil/absl/strings/str_split.cc",
  239. "abseil/absl/strings/substitute.cc",
  240. "abseil/absl/synchronization/barrier.cc",
  241. "abseil/absl/synchronization/blocking_counter.cc",
  242. "abseil/absl/synchronization/internal/create_thread_identity.cc",
  243. "abseil/absl/synchronization/internal/graphcycles.cc",
  244. "abseil/absl/synchronization/internal/per_thread_sem.cc",
  245. "abseil/absl/synchronization/internal/kernel_timeout.cc",
  246. "abseil/absl/synchronization/internal/pthread_waiter.cc",
  247. "abseil/absl/synchronization/internal/stdcpp_waiter.cc",
  248. "abseil/absl/synchronization/internal/futex_waiter.cc",
  249. "abseil/absl/synchronization/internal/sem_waiter.cc",
  250. "abseil/absl/synchronization/internal/win32_waiter.cc",
  251. "abseil/absl/synchronization/internal/waiter_base.cc",
  252. "abseil/absl/synchronization/mutex.cc",
  253. "abseil/absl/synchronization/notification.cc",
  254. "abseil/absl/time/civil_time.cc",
  255. "abseil/absl/time/clock.cc",
  256. "abseil/absl/time/duration.cc",
  257. "abseil/absl/time/format.cc",
  258. "abseil/absl/time/internal/cctz/src/time_zone_fixed.cc",
  259. "abseil/absl/time/internal/cctz/src/time_zone_format.cc",
  260. "abseil/absl/time/internal/cctz/src/time_zone_if.cc",
  261. "abseil/absl/time/internal/cctz/src/time_zone_impl.cc",
  262. "abseil/absl/time/internal/cctz/src/time_zone_info.cc",
  263. "abseil/absl/time/internal/cctz/src/time_zone_libc.cc",
  264. "abseil/absl/time/internal/cctz/src/time_zone_lookup.cc",
  265. "abseil/absl/time/internal/cctz/src/time_zone_posix.cc",
  266. "abseil/absl/time/internal/cctz/src/zone_info_source.cc",
  267. "abseil/absl/time/time.cc",
  268. // utf8 validation
  269. "protobuf/third_party/utf8_range/utf8_range.c",
  270. // UPB files
  271. "protobuf/upb/base/status.c",
  272. "protobuf/upb/mem/alloc.c",
  273. "protobuf/upb/mem/arena.c",
  274. "protobuf/upb/wire/decode.c",
  275. "protobuf/upb/wire/encode.c",
  276. "protobuf/upb/wire/eps_copy_input_stream.c",
  277. "protobuf/upb/wire/reader.c",
  278. "protobuf/upb/wire/byte_size.c",
  279. "protobuf/upb/wire/internal/decoder.c",
  280. "protobuf/upb/wire/decode_fast/dispatch.c",
  281. "protobuf/upb/wire/decode_fast/field_fixed.c",
  282. "protobuf/upb/wire/decode_fast/field_generic.c",
  283. "protobuf/upb/wire/decode_fast/field_message.c",
  284. "protobuf/upb/wire/decode_fast/field_string.c",
  285. "protobuf/upb/wire/decode_fast/field_varint.c",
  286. "protobuf/upb/wire/decode_fast/function_array.c",
  287. "protobuf/upb/wire/decode_fast/select.c",
  288. "protobuf/upb/hash/common.c",
  289. "protobuf/upb/message/accessors.c",
  290. "protobuf/upb/message/array.c",
  291. "protobuf/upb/message/compare.c",
  292. "protobuf/upb/message/copy.c",
  293. "protobuf/upb/message/map.c",
  294. "protobuf/upb/message/map_sorter.c",
  295. "protobuf/upb/message/merge.c",
  296. "protobuf/upb/message/message.c",
  297. "protobuf/upb/message/promote.c",
  298. "protobuf/upb/message/internal/compare_unknown.c",
  299. "protobuf/upb/message/internal/extension.c",
  300. "protobuf/upb/message/internal/iterator.c",
  301. "protobuf/upb/message/internal/message.c",
  302. "protobuf/upb/mini_table/compat.c",
  303. "protobuf/upb/mini_table/extension_registry.c",
  304. "protobuf/upb/mini_table/message.c",
  305. "protobuf/upb/mini_table/internal/message.c",
  306. "protobuf/upb/mini_descriptor/build_enum.c",
  307. "protobuf/upb/mini_descriptor/decode.c",
  308. "protobuf/upb/mini_descriptor/link.c",
  309. "protobuf/upb/mini_descriptor/internal/base92.c",
  310. "protobuf/upb/mini_descriptor/internal/encode.c",
  311. "protobuf/upb/reflection/def_pool.c",
  312. "protobuf/upb/reflection/def_type.c",
  313. "protobuf/upb/reflection/desc_state.c",
  314. "protobuf/upb/reflection/enum_def.c",
  315. "protobuf/upb/reflection/enum_reserved_range.c",
  316. "protobuf/upb/reflection/enum_value_def.c",
  317. "protobuf/upb/reflection/extension_range.c",
  318. "protobuf/upb/reflection/field_def.c",
  319. "protobuf/upb/reflection/file_def.c",
  320. "protobuf/upb/reflection/message.c",
  321. "protobuf/upb/reflection/message_def.c",
  322. "protobuf/upb/reflection/message_reserved_range.c",
  323. "protobuf/upb/reflection/method_def.c",
  324. "protobuf/upb/reflection/oneof_def.c",
  325. "protobuf/upb/reflection/service_def.c",
  326. "protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.c",
  327. "protobuf/upb/reflection/internal/def_builder.c",
  328. "protobuf/upb/reflection/internal/strdup2.c",
  329. "protobuf/upb/text/debug_string.c",
  330. "protobuf/upb/text/encode.c",
  331. "protobuf/upb/text/internal/encode.c",
  332. // UPB lex files for round trip functions
  333. "protobuf/upb/lex/round_trip.c",
  334. // upb_generator additional files (minimal set)
  335. "protobuf/upb_generator/plugin.cc",
  336. "protobuf/upb_generator/common.cc",
  337. "protobuf/upb_generator/common/names.cc",
  338. "protobuf/upb_generator/file_layout.cc",
  339. "protobuf/upb_generator/minitable/names.cc",
  340. "protobuf/upb_generator/minitable/names_internal.cc",
  341. ],
  342. cxxSettings: [
  343. .headerSearchPath("abseil/"),
  344. .headerSearchPath("protobuf/"),
  345. .headerSearchPath("protobuf/third_party/utf8_range/"),
  346. .headerSearchPath("protobuf/src/"),
  347. .headerSearchPath("protobuf/upb/"),
  348. .headerSearchPath("protobuf/upb_generator/"),
  349. .define("UPB_BOOTSTRAP_STAGE", to: "0"),
  350. ],
  351. linkerSettings: [
  352. .linkedFramework(
  353. "CoreFoundation",
  354. .when(
  355. platforms: [
  356. .macOS,
  357. .macCatalyst,
  358. .iOS,
  359. .tvOS,
  360. .watchOS,
  361. .visionOS,
  362. ]
  363. )
  364. ),
  365. .linkedLibrary("m"),
  366. ]
  367. ),
  368. .executableTarget(
  369. name: "protoc-gen-swift",
  370. dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"],
  371. exclude: ["CMakeLists.txt"],
  372. swiftSettings: .packageSettings
  373. ),
  374. .executableTarget(
  375. name: "Conformance",
  376. dependencies: ["SwiftProtobuf"],
  377. exclude: ["failure_list_swift.txt", "text_format_failure_list_swift.txt"],
  378. swiftSettings: .packageSettings
  379. ),
  380. .plugin(
  381. name: "SwiftProtobufPlugin",
  382. capability: .buildTool(),
  383. dependencies: ["protoc-gen-swift", "protoc"]
  384. ),
  385. .testTarget(
  386. name: "SwiftProtobufTests",
  387. dependencies: ["SwiftProtobuf"],
  388. swiftSettings: .packageSettings
  389. ),
  390. .testTarget(
  391. name: "SwiftProtobufPluginLibraryTests",
  392. dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"],
  393. swiftSettings: .packageSettings
  394. ),
  395. .testTarget(
  396. name: "protoc-gen-swiftTests",
  397. dependencies: ["protoc-gen-swift", "SwiftProtobufTestHelpers"],
  398. swiftSettings: .packageSettings
  399. ),
  400. ],
  401. swiftLanguageVersions: [.v5],
  402. cxxLanguageStandard: .gnucxx17
  403. )
  404. // Settings for every Swift target in this package, like project-level settings
  405. // in an Xcode project.
  406. extension Array where Element == PackageDescription.SwiftSetting {
  407. static var packageSettings: Self {
  408. [
  409. .enableExperimentalFeature("StrictConcurrency=complete"),
  410. .enableUpcomingFeature("ExistentialAny"),
  411. ]
  412. }
  413. }