diff --git a/.gitignore b/.gitignore index 5bd127c..24f6899 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ bin/ *~ *.dat *.dep + +# Swift Package Manager +.build diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..a8474d7 --- /dev/null +++ b/Package.swift @@ -0,0 +1,15 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let projectName = "bitsy-swift" + +let package = Package( + name: projectName, + targets: [ + .target( + name: projectName, + path: projectName + ), + ] +) diff --git a/README.md b/README.md index a23e9e2..c5f5952 100644 --- a/README.md +++ b/README.md @@ -22,21 +22,19 @@ I spoke about creating Bitsy and implementing it in Swift at several conferences ## Requirements -This version of BitsySwift has been tested with: +This version of BitsySwift has been tested with - * macOS 10.14 (Mojave) or later - * [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) 11.3 - * Swift 5.0 + * macOS 11.6 (Big Sur) and Ubuntu 20.04 LTS + * Xcode 13.0 + * Swift 5.5 -Linux support is currently limited by -[Swift Foundation](https://github.com/apple/swift-corelibs-foundation) but -should come eventually. +although basically only a Swift toolchain is required to build the project. Thus, +it may also run perfectly fine on Windows. ## Installation -To 'install' the compiler, simply clone and build the repository. You must have -[Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) -and the `xcodebuild` utility installed. +To 'install' BitsySwift, simply clone and build the repository. You must have the +[Swift compiler](https://swift.org/download/#releases) available in your `PATH`: ```bash git clone https://github.com/apbendi/bitsy-swift.git diff --git a/bitsy-swift.xcodeproj/project.pbxproj b/bitsy-swift.xcodeproj/project.pbxproj deleted file mode 100644 index 2b653f0..0000000 --- a/bitsy-swift.xcodeproj/project.pbxproj +++ /dev/null @@ -1,329 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - B435CF011D676B8300F3C75C /* SwiftGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B435CF001D676B8300F3C75C /* SwiftGenerator.swift */; }; - B44ABF4F1D2709010012F25B /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF4E1D2709010012F25B /* main.swift */; }; - B44ABF561D27098A0012F25B /* Input.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF551D27098A0012F25B /* Input.swift */; }; - B44ABF581D2709D60012F25B /* CharStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF571D2709D60012F25B /* CharStream.swift */; }; - B44ABF5A1D270EE40012F25B /* TokenType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF591D270EE40012F25B /* TokenType.swift */; }; - B44ABF5C1D270F580012F25B /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF5B1D270F580012F25B /* Token.swift */; }; - B44ABF5E1D270FFB0012F25B /* Tokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF5D1D270FFB0012F25B /* Tokenizer.swift */; }; - B44ABF601D275F760012F25B /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44ABF5F1D275F760012F25B /* Parser.swift */; }; - B46B12F61D3596600037045F /* CommandLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46B12F31D3596600037045F /* CommandLine.swift */; }; - B46B12F71D3596600037045F /* Option.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46B12F41D3596600037045F /* Option.swift */; }; - B46B12F81D3596600037045F /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46B12F51D3596600037045F /* StringExtensions.swift */; }; - B46B12FA1D3886DF0037045F /* ArgumentConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46B12F91D3886DF0037045F /* ArgumentConfig.swift */; }; - B46B12FC1D388C620037045F /* Exec.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46B12FB1D388C620037045F /* Exec.swift */; }; - B4C99B291D418469003DDDD0 /* CodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C99B281D418469003DDDD0 /* CodeGenerator.swift */; }; - B4CEB1EF1D2EF99A0010AB4B /* Output.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4CEB1EE1D2EF99A0010AB4B /* Output.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - B44ABF491D2709010012F25B /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - B435CF001D676B8300F3C75C /* SwiftGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftGenerator.swift; sourceTree = ""; }; - B44ABF4B1D2709010012F25B /* bitsy-swift */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "bitsy-swift"; sourceTree = BUILT_PRODUCTS_DIR; }; - B44ABF4E1D2709010012F25B /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - B44ABF551D27098A0012F25B /* Input.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Input.swift; sourceTree = ""; }; - B44ABF571D2709D60012F25B /* CharStream.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharStream.swift; sourceTree = ""; }; - B44ABF591D270EE40012F25B /* TokenType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenType.swift; sourceTree = ""; }; - B44ABF5B1D270F580012F25B /* Token.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; - B44ABF5D1D270FFB0012F25B /* Tokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tokenizer.swift; sourceTree = ""; }; - B44ABF5F1D275F760012F25B /* Parser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Parser.swift; sourceTree = ""; }; - B46B12F31D3596600037045F /* CommandLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommandLine.swift; sourceTree = ""; }; - B46B12F41D3596600037045F /* Option.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Option.swift; sourceTree = ""; }; - B46B12F51D3596600037045F /* StringExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtensions.swift; sourceTree = ""; }; - B46B12F91D3886DF0037045F /* ArgumentConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgumentConfig.swift; sourceTree = ""; }; - B46B12FB1D388C620037045F /* Exec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Exec.swift; sourceTree = ""; }; - B4C99B281D418469003DDDD0 /* CodeGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeGenerator.swift; sourceTree = ""; }; - B4CEB1EE1D2EF99A0010AB4B /* Output.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Output.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - B44ABF481D2709010012F25B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - B44ABF421D2709010012F25B = { - isa = PBXGroup; - children = ( - B44ABF4D1D2709010012F25B /* bitsy-swift */, - B44ABF4C1D2709010012F25B /* Products */, - ); - sourceTree = ""; - }; - B44ABF4C1D2709010012F25B /* Products */ = { - isa = PBXGroup; - children = ( - B44ABF4B1D2709010012F25B /* bitsy-swift */, - ); - name = Products; - sourceTree = ""; - }; - B44ABF4D1D2709010012F25B /* bitsy-swift */ = { - isa = PBXGroup; - children = ( - B44ABF4E1D2709010012F25B /* main.swift */, - B46B12F91D3886DF0037045F /* ArgumentConfig.swift */, - B44ABF551D27098A0012F25B /* Input.swift */, - B4CEB1EE1D2EF99A0010AB4B /* Output.swift */, - B44ABF571D2709D60012F25B /* CharStream.swift */, - B44ABF591D270EE40012F25B /* TokenType.swift */, - B44ABF5B1D270F580012F25B /* Token.swift */, - B44ABF5D1D270FFB0012F25B /* Tokenizer.swift */, - B44ABF5F1D275F760012F25B /* Parser.swift */, - B4C99B281D418469003DDDD0 /* CodeGenerator.swift */, - B435CF001D676B8300F3C75C /* SwiftGenerator.swift */, - B46B12F11D3595C80037045F /* vendor */, - ); - path = "bitsy-swift"; - sourceTree = ""; - }; - B46B12F11D3595C80037045F /* vendor */ = { - isa = PBXGroup; - children = ( - B46B12FB1D388C620037045F /* Exec.swift */, - B46B12F21D3595EE0037045F /* CommandLine */, - ); - path = vendor; - sourceTree = ""; - }; - B46B12F21D3595EE0037045F /* CommandLine */ = { - isa = PBXGroup; - children = ( - B46B12F31D3596600037045F /* CommandLine.swift */, - B46B12F41D3596600037045F /* Option.swift */, - B46B12F51D3596600037045F /* StringExtensions.swift */, - ); - path = CommandLine; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - B44ABF4A1D2709010012F25B /* bitsy-swift */ = { - isa = PBXNativeTarget; - buildConfigurationList = B44ABF521D2709010012F25B /* Build configuration list for PBXNativeTarget "bitsy-swift" */; - buildPhases = ( - B44ABF471D2709010012F25B /* Sources */, - B44ABF481D2709010012F25B /* Frameworks */, - B44ABF491D2709010012F25B /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "bitsy-swift"; - productName = "bitsy-swift"; - productReference = B44ABF4B1D2709010012F25B /* bitsy-swift */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - B44ABF431D2709010012F25B /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = ScopeLift; - TargetAttributes = { - B44ABF4A1D2709010012F25B = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1130; - }; - }; - }; - buildConfigurationList = B44ABF461D2709010012F25B /* Build configuration list for PBXProject "bitsy-swift" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = B44ABF421D2709010012F25B; - productRefGroup = B44ABF4C1D2709010012F25B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - B44ABF4A1D2709010012F25B /* bitsy-swift */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - B44ABF471D2709010012F25B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - B4CEB1EF1D2EF99A0010AB4B /* Output.swift in Sources */, - B44ABF5C1D270F580012F25B /* Token.swift in Sources */, - B46B12F71D3596600037045F /* Option.swift in Sources */, - B44ABF5E1D270FFB0012F25B /* Tokenizer.swift in Sources */, - B44ABF581D2709D60012F25B /* CharStream.swift in Sources */, - B44ABF5A1D270EE40012F25B /* TokenType.swift in Sources */, - B46B12F81D3596600037045F /* StringExtensions.swift in Sources */, - B46B12FC1D388C620037045F /* Exec.swift in Sources */, - B44ABF561D27098A0012F25B /* Input.swift in Sources */, - B46B12FA1D3886DF0037045F /* ArgumentConfig.swift in Sources */, - B46B12F61D3596600037045F /* CommandLine.swift in Sources */, - B435CF011D676B8300F3C75C /* SwiftGenerator.swift in Sources */, - B4C99B291D418469003DDDD0 /* CodeGenerator.swift in Sources */, - B44ABF4F1D2709010012F25B /* main.swift in Sources */, - B44ABF601D275F760012F25B /* Parser.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - B44ABF501D2709010012F25B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SYMROOT = "${SRCROOT}/build"; - }; - name = Debug; - }; - B44ABF511D2709010012F25B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SYMROOT = "${SRCROOT}/build"; - }; - name = Release; - }; - B44ABF531D2709010012F25B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - B44ABF541D2709010012F25B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - B44ABF461D2709010012F25B /* Build configuration list for PBXProject "bitsy-swift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B44ABF501D2709010012F25B /* Debug */, - B44ABF511D2709010012F25B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - B44ABF521D2709010012F25B /* Build configuration list for PBXNativeTarget "bitsy-swift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B44ABF531D2709010012F25B /* Debug */, - B44ABF541D2709010012F25B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = B44ABF431D2709010012F25B /* Project object */; -} diff --git a/bitsy-swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/bitsy-swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index ddbddd7..0000000 --- a/bitsy-swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/bitsy-swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/bitsy-swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/bitsy-swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/build.sh b/build.sh index f2522c5..e3d6488 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,10 @@ #!/bin/sh -BUILDCMD=xcodebuild -BUILDPATH=build/Release -BINNAME=bitsy-swift +BUILDPATH="$(swift build --show-bin-path)" +BINNAME="bitsy-swift" BINDIR=bin -$BUILDCMD +swift build if [ ! -d "$BINDIR" ]; then mkdir "$BINDIR"