Komondor icon indicating copy to clipboard operation
Komondor copied to clipboard

Pre-build dependencies during the install phase

Open orta opened this issue 5 years ago • 0 comments

#if canImport(PackageConfig)
    import PackageConfig

    let config = PackageConfig([
        "komondor": [
            "pre-push": "swift test",
            "pre-commit": [
                "swift test",
                "swift run swiftFormat .",
                "swift run swiftlint autocorrect --path Sources/",
                "git add .",
            ],
        ],
    ])
#endif

From this we can derive that swift run swiftlint and swift run swiftFormat rely on swift packages.

Komondor can batch look in the building folder to see if there are .build/*/[name].product but not .build/*/[name] and use swift build --product [name] to built them.

See sourcekitten, swiftFormat and swiftlint:

 ~/d/p/d/Komondor  $ ls .build/x86_64-apple-macosx10.10/debug/                                                                                                          master
CYaml.build                    KomondorPackageTests.product   Result.swiftmodule             SwiftyTextTable.swiftdoc       libPackageConfig.dylib
Clang_C.build                  ModuleCache                    SWXMLHash.build                SwiftyTextTable.swiftmodule    libPackageConfig.dylib.dSYM
Commandant.build               PackageConfig.build            SWXMLHash.swiftdoc             Yams.build                     package-config-example.product
Commandant.swiftdoc            PackageConfig.product          SWXMLHash.swiftmodule          Yams.swiftdoc                  sourcekitten.product
Commandant.swiftmodule         PackageConfig.swiftdoc         ShellOut.build                 Yams.swiftmodule               swiftFormat.product
CryptoSwift.build              PackageConfig.swiftmodule      ShellOut.swiftdoc              index                          swiftlint.product
Komondor.build                 QuickSpecBase.build            ShellOut.swiftmodule           komondor
Komondor.swiftdoc              Result.build                   SourceKit.build                komondor.dSYM
Komondor.swiftmodule           Result.swiftdoc                SwiftyTextTable.build          komondor.product

orta avatar Nov 25 '18 20:11 orta