americanexpress / xcprojectlint

A security blanket for Xcode project files
Apache License 2.0
504 stars 18 forks source link

Linux support #4

Closed HeEAaD closed 6 years ago

HeEAaD commented 6 years ago

This PR makes it possible to build and run xcprojectlint in a Linux environment. The following steps were necessary to achieve this:

Motivation

I like to integrate xcprojectlint into a Docker based CI workflow. Therefore it should be buildable on Linux with the open source Foundation framework.

This is how a Dockerfile would look like:

FROM norionomura/swift:411
LABEL maintainer "Steffen Matthischke <steffen.matthischke@gmail.com>"

ENV BRANCH="linux"

RUN git clone --branch $BRANCH https://github.com/HeEAaD/xcprojectlint.git && \
    cd xcprojectlint && \
    swift package update && \
    swift build --configuration release && \
    mv `swift build --configuration release --show-bin-path`/xcprojectlint /usr/bin && \
    cd .. && \
    rm -rf xcprojectlint

# Print Installed xcprojectlint Version
RUN xcprojectlint --version
CMD ["xcprojectlint"]

A run would look like this:

docker run -v `pwd`:`pwd` -w`pwd` xcprojectlint:latest xcprojectlint --report warning --project TestData/Bad.xcodeproj --validations empty-groups
kalkwarf commented 6 years ago

Wow! This is cool. Thank you for the contribution.