Files
2026-06-13 16:22:24 +08:00

205 lines
10 KiB
Swift

// swift-tools-version:6.0
import PackageDescription
var package = Package(
name: "SWCompression",
platforms: [
.macOS(.v15),
.iOS(.v18),
.tvOS(.v18),
.watchOS(.v11),
.visionOS(.v2)
],
products: [
.library(
name: "SWCompression",
targets: ["SWCompression"]),
],
dependencies: [
.package(url: "https://github.com/tsolomko/BitByteData", from: "2.1.0"),
],
targets: [
.target(
name: "SWCompression",
dependencies: ["BitByteData"],
path: "Sources",
exclude: ["swcomp"],
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZ4", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"],
resources: [.copy("PrivacyInfo.xcprivacy")]),
.testTarget(
name: "TestSWCompression",
dependencies: ["SWCompression"],
path: "Tests",
exclude: [
"Results.md",
"Test Files/gitattributes-copy",
"Test Files/README.md",
],
sources: ["TestSWCompression"],
resources: [
.copy("Test Files/Answers/test3.answer"),
.copy("Test Files/Answers/test_nonstandard_runlength.answer"),
.copy("Test Files/Answers/test1.answer"),
.copy("Test Files/Answers/test9.answer"),
.copy("Test Files/Answers/test5.answer"),
.copy("Test Files/Answers/test7.answer"),
.copy("Test Files/Answers/test2.answer"),
.copy("Test Files/Answers/test8.answer"),
.copy("Test Files/Answers/test4.answer"),
.copy("Test Files/Answers/test6.answer"),
.copy("Test Files/LZ4/test_B1234.lz4"),
.copy("Test Files/LZ4/test_small_dict_B5_BD.lz4"),
.copy("Test Files/LZ4/test1_legacy.lz4"),
.copy("Test Files/LZ4/test_B4_BD.lz4"),
.copy("Test Files/LZ4/test4_legacy.lz4"),
.copy("Test Files/LZ4/test_B6_BD.lz4"),
.copy("Test Files/LZ4/test_small_dict_B5.lz4"),
.copy("Test Files/LZ4/test9_legacy.lz4"),
.copy("Test Files/LZ4/lz4_dict"),
.copy("Test Files/LZ4/test4.lz4"),
.copy("Test Files/LZ4/test5.lz4"),
.copy("Test Files/LZ4/test7.lz4"),
.copy("Test Files/LZ4/test_skippable_frame.lz4"),
.copy("Test Files/LZ4/test3_legacy.lz4"),
.copy("Test Files/LZ4/test6.lz4"),
.copy("Test Files/LZ4/test2.lz4"),
.copy("Test Files/LZ4/test6_legacy.lz4"),
.copy("Test Files/LZ4/zeros.lz4"),
.copy("Test Files/LZ4/test3.lz4"),
.copy("Test Files/LZ4/test1.lz4"),
.copy("Test Files/LZ4/SWCompressionSourceCode.tar.lz4"),
.copy("Test Files/LZ4/test_B7.lz4"),
.copy("Test Files/LZ4/test5_legacy.lz4"),
.copy("Test Files/LZ4/test_B5_BD.lz4"),
.copy("Test Files/LZ4/test_B6.lz4"),
.copy("Test Files/LZ4/test8_legacy.lz4"),
.copy("Test Files/LZ4/test_B4.lz4"),
.copy("Test Files/LZ4/test_B5.lz4"),
.copy("Test Files/LZ4/test_dict_B5_BD.lz4"),
.copy("Test Files/LZ4/test8.lz4"),
.copy("Test Files/LZ4/test_B7_BD.lz4"),
.copy("Test Files/LZ4/test_dict_B5.lz4"),
.copy("Test Files/LZ4/test9.lz4"),
.copy("Test Files/LZ4/lz4_small_dict"),
.copy("Test Files/LZ4/test_dict_B5_dictID.lz4"),
.copy("Test Files/LZ4/test7_legacy.lz4"),
.copy("Test Files/LZ4/test_B1234_BD.lz4"),
.copy("Test Files/LZ4/test_multi_frame.lz4"),
.copy("Test Files/LZ4/test2_legacy.lz4"),
.copy("Test Files/GZip/test4_extra_field.gz"),
.copy("Test Files/GZip/test5.gz"),
.copy("Test Files/GZip/test1.gz"),
.copy("Test Files/GZip/test4.gz"),
.copy("Test Files/GZip/test3.gz"),
.copy("Test Files/GZip/minimal.gz"),
.copy("Test Files/GZip/test7.gz"),
.copy("Test Files/GZip/test6.gz"),
.copy("Test Files/GZip/test2.gz"),
.copy("Test Files/GZip/test9.gz"),
.copy("Test Files/GZip/test_multi.gz"),
.copy("Test Files/GZip/test8.gz"),
.copy("Test Files/Zlib/test.zlib"),
.copy("Test Files/Zlib/random_file.zlib"),
.copy("Test Files/Zlib/test_empty.zlib"),
.copy("Test Files/XZ/test1.xz"),
.copy("Test Files/XZ/test5.xz"),
.copy("Test Files/XZ/test4.xz"),
.copy("Test Files/XZ/test_multi_pad.xz"),
.copy("Test Files/XZ/test9.xz"),
.copy("Test Files/XZ/test8.xz"),
.copy("Test Files/XZ/test_multi.xz"),
.copy("Test Files/XZ/test_sha256.xz"),
.copy("Test Files/XZ/test_delta_filter.xz"),
.copy("Test Files/XZ/test7.xz"),
.copy("Test Files/XZ/test3.xz"),
.copy("Test Files/XZ/test2.xz"),
.copy("Test Files/XZ/test6.xz"),
.copy("Test Files/ZIP/test_zip_bzip2.zip"),
.copy("Test Files/ZIP/test_empty_dir.zip"),
.copy("Test Files/ZIP/test_dos_latin_us.zip"),
.copy("Test Files/ZIP/test_win.zip"),
.copy("Test Files/ZIP/test_unicode.zip"),
.copy("Test Files/ZIP/bad_cd_ext_ts.zip"),
.copy("Test Files/ZIP/test_data_descriptor.zip"),
.copy("Test Files/ZIP/test_custom_extra_field.zip"),
.copy("Test Files/ZIP/test_zip_lzma.zip"),
.copy("Test Files/ZIP/test_empty_file.zip"),
.copy("Test Files/ZIP/test_empty_cont.zip"),
.copy("Test Files/ZIP/SWCompressionSourceCode.zip"),
.copy("Test Files/ZIP/test_zip64.zip"),
.copy("Test Files/Deflate/test6.deflate"),
.copy("Test Files/Deflate/test9.deflate"),
.copy("Test Files/Deflate/test8.deflate"),
.copy("Test Files/TAR/test_pax_record_newline.tar"),
.copy("Test Files/TAR/test.tar"),
.copy("Test Files/TAR/test_negative_mtime.tar"),
.copy("Test Files/TAR/test_gnu_inc_format.tar"),
.copy("Test Files/TAR/Formats/test_pax.tar"),
.copy("Test Files/TAR/Formats/test_ustar.tar"),
.copy("Test Files/TAR/Formats/test_v7.tar"),
.copy("Test Files/TAR/Formats/test_oldgnu.tar"),
.copy("Test Files/TAR/Formats/test_gnu.tar"),
.copy("Test Files/TAR/test_empty_dir.tar"),
.copy("Test Files/TAR/Long names/long_test_gnu.tar"),
.copy("Test Files/TAR/Long names/long_test_pax.tar"),
.copy("Test Files/TAR/Long names/long_test_oldgnu.tar"),
.copy("Test Files/TAR/test_unicode_pax.tar"),
.copy("Test Files/TAR/test_big_num_field.tar"),
.copy("Test Files/TAR/test_empty_cont.tar"),
.copy("Test Files/TAR/SWCompressionSourceCode.tar"),
.copy("Test Files/TAR/test_only_dir_header.tar"),
.copy("Test Files/TAR/test_empty_file.tar"),
.copy("Test Files/TAR/full_test.tar"),
.copy("Test Files/TAR/test_unicode_ustar.tar"),
.copy("Test Files/TAR/test_win.tar"),
.copy("Test Files/LZMA/test_empty.lzma"),
.copy("Test Files/LZMA/test11.lzma"),
.copy("Test Files/LZMA/test10.lzma"),
.copy("Test Files/LZMA/test9.lzma"),
.copy("Test Files/LZMA/test8.lzma"),
.copy("Test Files/7z/test_empty_cont.7z"),
.copy("Test Files/7z/test_minor_version_2.7z"),
.copy("Test Files/7z/test_multi_blocks.7z"),
.copy("Test Files/7z/test_7z_copy.7z"),
.copy("Test Files/7z/test_minor_version_3.7z"),
.copy("Test Files/7z/test_single_thread.7z"),
.copy("Test Files/7z/test_all_timestamps.7z"),
.copy("Test Files/7z/test_complicated_coding_scheme.7z"),
.copy("Test Files/7z/test_anti_file.7z"),
.copy("Test Files/7z/test_delta_filter.7z"),
.copy("Test Files/7z/test_encrypted_header.7z"),
.copy("Test Files/7z/test3.7z"),
.copy("Test Files/7z/test2.7z"),
.copy("Test Files/7z/test_7z_bzip2.7z"),
.copy("Test Files/7z/test_lzma_big_dict.7z"),
.copy("Test Files/7z/test_7z_deflate.7z"),
.copy("Test Files/7z/test1.7z"),
.copy("Test Files/7z/test_empty_file.7z"),
.copy("Test Files/7z/test_7z_lz4.7z"),
.copy("Test Files/7z/test_empty_dir.7z"),
.copy("Test Files/7z/test_win.7z"),
.copy("Test Files/7z/SWCompressionSourceCode.7z"),
.copy("Test Files/7z/test_minor_version_4.7z"),
.copy("Test Files/7z/test_unicode.7z"),
.copy("Test Files/BZip2/test5.bz2"),
.copy("Test Files/BZip2/test4.bz2"),
.copy("Test Files/BZip2/test6.bz2"),
.copy("Test Files/BZip2/test7.bz2"),
.copy("Test Files/BZip2/test3.bz2"),
.copy("Test Files/BZip2/test2.bz2"),
.copy("Test Files/BZip2/test_nonstandard_runlength.bz2"),
.copy("Test Files/BZip2/test1.bz2"),
.copy("Test Files/BZip2/test9.bz2"),
.copy("Test Files/BZip2/test8.bz2"),
]),
],
swiftLanguageModes: [.v6]
)
#if os(macOS)
package.dependencies.append(.package(url: "https://github.com/jakeheis/SwiftCLI", from: "6.0.0"))
package.targets.append(.executableTarget(name: "swcomp", dependencies: ["SWCompression", "SwiftCLI"], path: "Sources",
exclude: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZ4", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib", "PrivacyInfo.xcprivacy"],
sources: ["swcomp"]))
#endif