diff --git a/Package.resolved b/Package.resolved index c95e1dd1..10355fa9 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "942a1612e8d4b18479d16ed7518859be9ac852972e43afb2a08c65d1037a641f", "pins" : [ { "identity" : "async-http-client", @@ -152,7 +153,16 @@ "revision" : "3b13e439a341bbbfe0f710c7d1be37221745ef1a", "version" : "0.6.1" } + }, + { + "identity" : "swiftformat", + "kind" : "remoteSourceControl", + "location" : "https://github.com/nicklockwood/SwiftFormat", + "state" : { + "revision" : "c7ddb09c3381cff833106345721fc314dba49e20", + "version" : "0.49.18" + } } ], - "version" : 2 + "version" : 3 } diff --git a/Package.swift b/Package.swift index ec58b627..a4a95146 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,8 @@ let package = Package( .package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"), .package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.6.1"), .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"), + // This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/` + .package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"), ], targets: [ .executableTarget( diff --git a/docker/lint.dockerfile b/docker/lint.dockerfile index 9c175e61..239ae71e 100644 --- a/docker/lint.dockerfile +++ b/docker/lint.dockerfile @@ -5,14 +5,3 @@ RUN apt-get update && apt-get install -y locales locales-all ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 - -# tools -RUN mkdir -p $HOME/.tools -RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile - -# swiftformat (until part of the toolchain) - -ARG swiftformat_version=0.49.18 -RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format -RUN cd $HOME/.tools/swift-format && swift build -c release -RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat diff --git a/docker/test-amazonlinux2.dockerfile b/docker/test-amazonlinux2.dockerfile index 0fc0ca9d..f5091034 100644 --- a/docker/test-amazonlinux2.dockerfile +++ b/docker/test-amazonlinux2.dockerfile @@ -15,7 +15,3 @@ COPY ./scripts/install-libarchive.sh / RUN /install-libarchive.sh RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import - -# tools -RUN mkdir -p $HOME/.tools -RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile diff --git a/docker/test-ubi9.dockerfile b/docker/test-ubi9.dockerfile index 46bed02f..110efd6a 100644 --- a/docker/test-ubi9.dockerfile +++ b/docker/test-ubi9.dockerfile @@ -15,7 +15,3 @@ COPY ./scripts/install-libarchive.sh / RUN /install-libarchive.sh RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import - -# tools -RUN mkdir -p $HOME/.tools -RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile diff --git a/docker/test.dockerfile b/docker/test.dockerfile index c28571bd..a5e7acb7 100644 --- a/docker/test.dockerfile +++ b/docker/test.dockerfile @@ -18,7 +18,3 @@ COPY ./scripts/install-libarchive.sh / RUN /install-libarchive.sh RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import - -# tools -RUN mkdir -p $HOME/.tools -RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile diff --git a/scripts/check-lint.sh b/scripts/check-lint.sh index eb446b2e..16399ba9 100755 --- a/scripts/check-lint.sh +++ b/scripts/check-lint.sh @@ -2,4 +2,4 @@ set -o errexit -swiftformat --lint --dryrun . +swift run swiftformat --lint --dryrun .