This PR makes it possible to build and run xcprojectlint in a Linux environment. The following steps were necessary to achieve this:
add required Tests/LinuxMain.swift. This file is empty for now because the tests using Bundle(for aClass:) which is unimplemented.
remove of all import Darwin because it's not available on Linux. Why was this import added in the first place?
replace NSDictionary contort with a simple cast. I'm not sure why this is necessary, the tests were green after I replaced it though.
replace all enumerateLinesUsingBlock(:) calls with components(separatedBy: CharacterSet.newlines). The former uses enumerateStrings(:) which is unimplemented
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"]
This PR makes it possible to build and run xcprojectlint in a Linux environment. The following steps were necessary to achieve this:
Bundle(for aClass:)
which is unimplemented.import Darwin
because it's not available on Linux. Why was this import added in the first place?enumerateLinesUsingBlock(:)
calls withcomponents(separatedBy: CharacterSet.newlines)
. The former usesenumerateStrings(:)
which is unimplementedMotivation
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:
A run would look like this: