Skip to content

Commit

Permalink
Merge pull request #34 from bow-swift/swift_5
Browse files Browse the repository at this point in the history
Swift 5
  • Loading branch information
miguelangel-dev authored Apr 17, 2019
2 parents 90f09f9 + ccb2895 commit d5c7166
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: swift
osx_image: xcode10
osx_image: xcode10.2

env:
global:
Expand Down
35 changes: 35 additions & 0 deletions bin/nef
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ printHelpPlayground() {
echo " Build a playground compatible with external frameworks"
echo ""
echo " ${optional}${bold}--name${reset}${normal} specify the name for the Xcode project that you are creating ${optional}[default: $DEFAULT_PLAYGROUND]${reset}"
echo ""
echo " ${optional}${bold}--bow-version${reset}${normal} specify the version of Bow that you want to use in the project ${optional}[optional]${reset}"
echo " ${optional}${bold}--bow-branch${reset}${normal} specify the branch of Bow that you want to use in the project ${optional}[optional]${reset}"
echo " ${optional}${bold}--podfile${reset}${normal} specify a Podfile with your own dependencies ${optional}[optional]${reset}"
Expand All @@ -80,6 +81,38 @@ printHelpCompileClean() {
echo ""
}

#: - Dependencies

##
# checkDependencies() throws
##
checkDependencies() {
checkCocoaPods
}

##
# checkCocoaPods() throws
##
checkCocoaPods() {
totalCommandsPod=$(command -v pod | wc -l)
if [ $totalCommandsPod -eq 0 ]; then
echo "[!] ${bold}${red}error: ${reset}required cocoapods. Please ${bold}install cocoapods${reset}. Run: 'sudo gem install cocoapods'"
exit 1
fi

requiredVersion='1.6.1'
podVersion=`pod --version`
minorPodVersionRequired=(`printf "$podVersion\n$requiredVersion\n" | sort`)

if [ "$minorPodVersionRequired" != "$requiredVersion" ]; then
echo "[!] ${bold}${red}error: ${reset}required cocoapods version ${bold}'$requiredVersion'${normal} [found: ${red}'$podVersion'${reset}]"
echo ""
echo "Please ${bold}update your cocoapods${reset}. Run: 'sudo gem install cocoapods'"
echo ""
exit 1
fi
}

#: - Jekyll

##
Expand Down Expand Up @@ -232,6 +265,8 @@ clean() {
#: - MAIN
set -e

checkDependencies

while [ "$1" != "" ]; do
case $1 in
$JEKYLL ) jekyll $@; exit 0 ;;
Expand Down
18 changes: 0 additions & 18 deletions bin/nef-playground
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,6 @@ lastestBowVersion() {
echo $version
}

##
# checkCocoaPods() throws
##
checkCocoaPods() {
required='1.6.1'
podVersion=`pod --version`
minorPodVersionRequired=(`printf "$podVersion\n$required\n" | sort`)

if [ "$minorPodVersionRequired" != "$required" ]; then
echo "[!] ${bold}${red}error: ${reset}required cocoapods version ${bold}'$required'${normal} [found: ${red}'$podVersion'${reset}]"
echo ""
echo "Please ${bold}update your cocoapods${reset}. Run: 'sudo gem install cocoapods'"
echo ""
exit 1
fi
}

##
# playground(String parent, String projecName)
# - Parameter `parent`: path to the project parent.
Expand Down Expand Up @@ -248,6 +231,5 @@ done

projectFolder="$root/$projectName"

checkCocoaPods
playground "$root" "$projectName"
setDependency "$projectFolder" "$projectName" "$version" "$branch" "$podfile"
21 changes: 11 additions & 10 deletions bin/nefc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ compile() {
# - Parameter `folder`: path to the project folder.
##
buildProject() {
set -e

cd "$1" # parameter `folder`
local logPath="nef/log"

Expand All @@ -106,9 +104,11 @@ buildProject() {
log="$logPath/$workspaceName.log"

echo -ne "${reset}Building ${green}$workspaceName${normal} ($schemeName) ..."
xcodebuild -workspace "$workspace" -sdk "$sdk" -scheme "$schemeName" -derivedDataPath "$DERIVED_DATA_DIR" -configuration Debug 1> "$log" 2>&1

set +e
xcodebuild -workspace "$workspace" -sdk "$sdk" -scheme "$schemeName" -derivedDataPath "$DERIVED_DATA_DIR" -configuration Debug 1> "$log" 2>&1
installed=`grep "BUILD SUCCEEDED" "$log"`
set -e

if [ "${#installed}" -gt 0 ]; then
echo ""
Expand Down Expand Up @@ -206,12 +206,13 @@ buildPODS() {
path="${podfilePath::${#podfilePath}-${#podfile}-1}"
cd "$path"

set +e
pod install --repo-update 1> "$log" 2>&1
installed=`grep "Pod installation complete" "$log"`
set -e

if [ "${#installed}" -gt 0 ]; then
echo ""
return 0
else
echo ""
echo "${bold}${red}error: ${reset}${bold}pod install${normal} review 'nef/log/pod-install.log' for more information."
Expand Down Expand Up @@ -402,19 +403,19 @@ compilePlaygroundPage() {
# A. macOS paltform
if [ "$platformIOS" -eq "0" ]; then
if [ "${#hasSourceFolderFiles}" -gt 0 ]; then
xcrun -k swiftc -D NOT_IN_PLAYGROUND -emit-module $sources -F "nef/build/fw" -o "$staticLibPath" 1> "$llog" 2>&1;
xcrun -k swiftc -D NOT_IN_PLAYGROUND -static-executable "$staticLibPath" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1;
xcrun -k swiftc -D NOT_IN_PLAYGROUND -emit-module $sources -F "nef/build/fw" -o "$staticLibPath" 1> "$llog" 2>&1
xcrun -k swiftc -D NOT_IN_PLAYGROUND -static-executable "$staticLibPath" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1
else
xcrun -k swiftc -D NOT_IN_PLAYGROUND -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1;
xcrun -k swiftc -D NOT_IN_PLAYGROUND -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1
fi

# B. iOS platform
else
if [ "${#hasSourceFolderFiles}" -gt 0 ]; then
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -emit-module $sources -F "nef/build/fw" -o "$staticLibPath" 1> "$llog" 2>&1;
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -static-executable "$staticLibPath" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1;
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -emit-module $sources -F "nef/build/fw" -o "$staticLibPath" 1> "$llog" 2>&1
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -static-executable "$staticLibPath" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1
else
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1;
xcrun -k -sdk "iphonesimulator" swiftc -D NOT_IN_PLAYGROUND -target "x86_64-apple-ios12.1-simulator" -F "nef/build/fw" "$file" -o "nef/build/output/$playgroundName" 1> "$log" 2>&1
fi
fi

Expand Down
5 changes: 4 additions & 1 deletion markdown/Common/ConsoleReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ func arguments(keys: String...) -> [String: String] {

func int8Ptr(fromString str: String) -> UnsafePointer<Int8>? {
let data = str.data(using: .utf8)
let ptr: UnsafePointer<Int8>? = data?.withUnsafeBytes { $0 }
let ptr: UnsafePointer<Int8>? = data?.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) -> UnsafePointer<Int8>? in
return bytes.bindMemory(to: Int8.self).baseAddress
}

return ptr
}

Expand Down
23 changes: 12 additions & 11 deletions markdown/Markdown.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
TargetAttributes = {
8B424B1E224E28FC00AF9010 = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
};
8B66EBB0221FFF4F0001DCA2 = {
CreatedOnToolsVersion = 10.1;
Expand All @@ -331,7 +332,7 @@
};
8B6FC63B221EFE61008F7694 = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1010;
LastSwiftMigration = 1020;
};
};
};
Expand Down Expand Up @@ -429,7 +430,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -438,7 +439,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -457,7 +458,7 @@
PRODUCT_BUNDLE_IDENTIFIER = bow.nef.MarkupTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -476,7 +477,7 @@
PRODUCT_BUNDLE_IDENTIFIER = bow.nef.MarkupTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -538,7 +539,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -593,7 +594,7 @@
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -606,7 +607,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -619,7 +620,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -640,7 +641,7 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -661,7 +662,7 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// nef:begin:hidden
import UIKit
// nef:end

Nef.Playground.needsIndefiniteExecution(true)
// nef:end
18 changes: 11 additions & 7 deletions template/ios/PROJECT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Miguel Ángel Díaz";
TargetAttributes = {
8BACBE8222576CAD00266845 = {
Expand Down Expand Up @@ -249,10 +249,11 @@
8BACBE8822576CAD00266845 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -266,9 +267,10 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.47deg.ios.PROJECT;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -278,10 +280,11 @@
8BACBE8922576CAD00266845 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -295,9 +298,10 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.47deg.ios.PROJECT;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d5c7166

Please sign in to comment.