diff --git a/.travis.yml b/.travis.yml index 6748a434..e3610c65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: swift -osx_image: xcode10 +osx_image: xcode10.2 env: global: diff --git a/bin/nef b/bin/nef index 973162db..fb0d6625 100755 --- a/bin/nef +++ b/bin/nef @@ -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}" @@ -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 ## @@ -232,6 +265,8 @@ clean() { #: - MAIN set -e +checkDependencies + while [ "$1" != "" ]; do case $1 in $JEKYLL ) jekyll $@; exit 0 ;; diff --git a/bin/nef-playground b/bin/nef-playground index da420f31..5c9f56aa 100755 --- a/bin/nef-playground +++ b/bin/nef-playground @@ -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. @@ -248,6 +231,5 @@ done projectFolder="$root/$projectName" -checkCocoaPods playground "$root" "$projectName" setDependency "$projectFolder" "$projectName" "$version" "$branch" "$podfile" diff --git a/bin/nefc b/bin/nefc index e6852048..e41eb211 100755 --- a/bin/nefc +++ b/bin/nefc @@ -86,8 +86,6 @@ compile() { # - Parameter `folder`: path to the project folder. ## buildProject() { - set -e - cd "$1" # parameter `folder` local logPath="nef/log" @@ -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 " ✅" @@ -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." @@ -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 diff --git a/markdown/Common/ConsoleReader.swift b/markdown/Common/ConsoleReader.swift index dd47153e..150d2ad3 100644 --- a/markdown/Common/ConsoleReader.swift +++ b/markdown/Common/ConsoleReader.swift @@ -44,7 +44,10 @@ func arguments(keys: String...) -> [String: String] { func int8Ptr(fromString str: String) -> UnsafePointer? { let data = str.data(using: .utf8) - let ptr: UnsafePointer? = data?.withUnsafeBytes { $0 } + let ptr: UnsafePointer? = data?.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) -> UnsafePointer? in + return bytes.bindMemory(to: Int8.self).baseAddress + } + return ptr } diff --git a/markdown/Markdown.xcodeproj/project.pbxproj b/markdown/Markdown.xcodeproj/project.pbxproj index 2dc2ada1..782f7ad6 100644 --- a/markdown/Markdown.xcodeproj/project.pbxproj +++ b/markdown/Markdown.xcodeproj/project.pbxproj @@ -322,6 +322,7 @@ TargetAttributes = { 8B424B1E224E28FC00AF9010 = { CreatedOnToolsVersion = 10.1; + LastSwiftMigration = 1020; }; 8B66EBB0221FFF4F0001DCA2 = { CreatedOnToolsVersion = 10.1; @@ -331,7 +332,7 @@ }; 8B6FC63B221EFE61008F7694 = { CreatedOnToolsVersion = 10.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; }; }; }; @@ -429,7 +430,7 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -438,7 +439,7 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -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; }; @@ -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; }; @@ -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; }; @@ -593,7 +594,7 @@ SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -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; }; @@ -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; }; @@ -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; }; @@ -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; }; diff --git a/markdown/Markdown.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/markdown/Markdown.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..0c67376e --- /dev/null +++ b/markdown/Markdown.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/template/ios/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift b/template/ios/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift index 8e347f5d..186d3131 100644 --- a/template/ios/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift +++ b/template/ios/PROJECT.playground/Pages/page.xcplaygroundpage/Contents.swift @@ -1,5 +1,5 @@ // nef:begin:hidden import UIKit -// nef:end Nef.Playground.needsIndefiniteExecution(true) +// nef:end diff --git a/template/ios/PROJECT.xcodeproj/project.pbxproj b/template/ios/PROJECT.xcodeproj/project.pbxproj index b44dfc94..122bbc15 100644 --- a/template/ios/PROJECT.xcodeproj/project.pbxproj +++ b/template/ios/PROJECT.xcodeproj/project.pbxproj @@ -84,7 +84,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1010; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Miguel Ángel Díaz"; TargetAttributes = { 8BACBE8222576CAD00266845 = { @@ -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"; @@ -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 = ""; @@ -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"; @@ -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"; diff --git a/template/ios/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme b/template/ios/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme index 9efd074e..ac541cdd 100644 --- a/template/ios/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +++ b/template/ios/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme @@ -1,6 +1,6 @@ + + + + diff --git a/template/osx/PROJECT.xcodeproj/project.pbxproj b/template/osx/PROJECT.xcodeproj/project.pbxproj index 618475a0..7a4c9e75 100644 --- a/template/osx/PROJECT.xcodeproj/project.pbxproj +++ b/template/osx/PROJECT.xcodeproj/project.pbxproj @@ -250,10 +250,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -267,8 +268,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.47deg.macosx.PROJECT; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -278,10 +280,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -295,8 +298,9 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.47deg.macosx.PROJECT; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; };