Skip to content
Permalink
Browse files

Stop using SwiftPM for tools

  • Loading branch information...
jsorge committed Jul 23, 2019
1 parent 9143440 commit 616296f8835fb357ad2fcfbb702ec6d5d7748747
Showing with 87 additions and 22 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 .swift-sh-version
  3. +1 −0 .swift-version
  4. +1 −0 .xcodegen-version
  5. +9 −3 Makefile
  6. +0 −19 Package.swift
  7. +39 −0 tools/ensure-swift-sh.sh
  8. +35 −0 tools/ensure-xcodegen.sh
@@ -98,4 +98,5 @@ iOSInjectionProject/
# xcodegen # xcodegen
*.xcodeproj *.xcodeproj
.DS_Store .DS_Store
vendor/


@@ -0,0 +1 @@
1.12.0
@@ -0,0 +1 @@
5.0.1
@@ -0,0 +1 @@
2.5.0
12 Makefile 100644 → 100755
@@ -1,11 +1,17 @@
.PHONY: project .PHONY: project
project: project:
swift run xcodegen @chmod +x ./tools/ensure-xcodegen.sh
@./tools/ensure-xcodegen.sh
@./vendor/XcodeGen


.PHONY: start .PHONY: start
start: start:
swift run swift-sh ./tools/start.swift @chmod +x ./tools/ensure-swift-sh.sh
@./tools/ensure-swift-sh.sh
@./vendor/swift-sh ./tools/start.swift


.PHONY: new-module .PHONY: new-module
new-module: new-module:
swift run swift-sh ./tools/new-module.swift @chmod +x ./tools/ensure-swift-sh.sh
@./tools/ensure-swift-sh.sh
@./vendor/swift-sh ./tools/new-module.swift

This file was deleted.

@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -e
set -o pipefail
set -u

required_version="$(cat .swift-sh-version)"
install_location=./vendor

install() {
if [ ! -d $install_location ]; then
mkdir $install_location;
fi;

rm -f $install_location/XcodeGen $install_location/xcodegen.tar.gz

curl --location --fail --retry 5 \
https://github.com/mxcl/swift-sh/archive/"$required_version".zip \
--output $install_location/swift-sh-pkg.zip

(
cd $install_location
unzip -o swift-sh-pkg.zip
unzipped_path=./swift-sh-$required_version
swift build --package-path $unzipped_path/ -c release
mv $unzipped_path/.build/release/swift-sh swift-sh
rm -rf $unzipped_path
rm swift-sh-pkg.zip
echo "$required_version" > swift-sh-version
)

echo "Installed swift-sh locally"
}

if [ ! -x $install_location/swift-sh ]; then
install
elif [[ ! $required_version == $(cat $install_location/swift-sh-version) ]]; then
install
fi
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -e
set -o pipefail
set -u

required_version="$(cat .xcodegen-version)"
install_location=./vendor

install() {
if [ ! -d $install_location ]; then
mkdir $install_location;
fi;

rm -f ./tmp/XcodeGen ./tmp/xcodegen.tar.gz

curl --location --fail --retry 5 \
https://github.com/yonaskolb/XcodeGen/releases/download/"$required_version"/xcodegen.zip \
--output $install_location/xcodegen.zip

(
cd $install_location
unzip -o xcodegen.zip -d download > /dev/null
mv download/xcodegen/bin/xcodegen XcodeGen
rm -rf xcodegen.zip download
)

echo "Installed XcodeGen locally"
}

if [ ! -x $install_location/XcodeGen ]; then
install
elif ! diff <(echo "Version: $required_version") <($install_location/XcodeGen version) > /dev/null; then
install
fi

0 comments on commit 616296f

Please sign in to comment.
You can’t perform that action at this time.