From 50b438c228929ae95648fea09fbb28ba4a036209 Mon Sep 17 00:00:00 2001 From: boB Rudis Date: Tue, 17 Sep 2019 07:09:06 -0400 Subject: [PATCH] initial commit --- .gitignore | 119 ++++ Package.swift | 16 + README.md | 9 + Sources/SwiftPSL/SwiftPSL.swift | 159 +++++ Sources/psl-app/Info.plist | 8 + Sources/psl-app/main.swift | 22 + Sources/psl-app/psl-app.entitlements | 8 + Sources/psl/module.modulemap | 4 + Sources/psl/psl.h | 1 + SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist | 25 + SwiftPSL.xcodeproj/SwiftPSL_Info.plist | 25 + SwiftPSL.xcodeproj/project.pbxproj | 711 +++++++++++++++++++++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../xcschemes/SwiftPSL-Package.xcscheme | 82 +++ .../xcshareddata/xcschemes/psl-app.xcscheme | 78 +++ Tests/LinuxMain.swift | 6 + Tests/SwiftPSLTests/CoreTests.swift | 36 ++ 19 files changed, 1332 insertions(+) create mode 100644 .gitignore create mode 100644 Package.swift create mode 100644 README.md create mode 100644 Sources/SwiftPSL/SwiftPSL.swift create mode 100644 Sources/psl-app/Info.plist create mode 100644 Sources/psl-app/main.swift create mode 100644 Sources/psl-app/psl-app.entitlements create mode 100644 Sources/psl/module.modulemap create mode 100644 Sources/psl/psl.h create mode 100644 SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist create mode 100644 SwiftPSL.xcodeproj/SwiftPSL_Info.plist create mode 100644 SwiftPSL.xcodeproj/project.pbxproj create mode 100644 SwiftPSL.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 SwiftPSL.xcodeproj/xcshareddata/xcschemes/SwiftPSL-Package.xcscheme create mode 100644 SwiftPSL.xcodeproj/xcshareddata/xcschemes/psl-app.xcscheme create mode 100644 Tests/LinuxMain.swift create mode 100644 Tests/SwiftPSLTests/CoreTests.swift diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37ee6b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,119 @@ + +# Created by https://www.gitignore.io/api/xcode,swift,macos,swiftpm,swiftpackagemanager,vscode,visualstudiocode +# Edit at https://www.gitignore.io/?templates=xcode,swift,macos,swiftpm,swiftpackagemanager,vscode,visualstudiocode + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +#!! ERROR: vscode is undefined. Use list command to see defined gitignore types !!# +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +.DS_Store +wildcat_settings + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output + +.swiftpm/ +Index/ \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..648c559 --- /dev/null +++ b/Package.swift @@ -0,0 +1,16 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SwiftPSL", + dependencies: [ + ], + targets: [ + .systemLibrary(name: "psl", pkgConfig: "libpsl"), + .target(name: "SwiftPSL", dependencies: ["psl"]), + .target(name: "psl-app", dependencies: ["SwiftPSL"]), + .testTarget(name: "SwiftPSLTests", dependencies: ["SwiftPSL"]) + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6633cb --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# SwiftPSL + +A Swift wrapper for [`libpsl`](https://github.com/rockdaboot/libpsl) to work with internet domains in the context of the [Public Suffix List](https://publicsuffix.org/). + +Primarily created as an example Swift wrapper for an ultra-simple C library + +### TODO + +- enable extraction of host, subdomain, domain, and public suffix diff --git a/Sources/SwiftPSL/SwiftPSL.swift b/Sources/SwiftPSL/SwiftPSL.swift new file mode 100644 index 0000000..3134967 --- /dev/null +++ b/Sources/SwiftPSL/SwiftPSL.swift @@ -0,0 +1,159 @@ +import psl + +enum SwiftPSLError : Error { + case FileNotFound + case Invalidarg + case Converter + case ToUTF16 + case ToLower + case ToUTF8 + case NoMem +} + +public final class SwiftPSL { + + public let pslVersion = PSL_VERSION + public let pslVersionMajor = PSL_VERSION_MAJOR + public let pslVersionMinor = PSL_VERSION_MINOR + public let pslVersionPatch = PSL_VERSION_PATCH + + public struct pslType { + static let ICANN : Int32 = PSL_TYPE_ICANN + static let NoStarRule : Int32 = PSL_TYPE_NO_STAR_RULE + static let ANY : Int32 = PSL_TYPE_ANY + static let Private : Int32 = PSL_TYPE_PRIVATE + } + + private var ctx : OpaquePointer? = psl_builtin() + private var isBuiltin = true + +// psl_error_t value. PSL_SUCCESS: Success PSL_ERR_INVALID_ARG: str is a NULL value. PSL_ERR_CONVERTER: Failed to open the unicode converter with name encoding PSL_ERR_TO_UTF16: Failed to convert str to unicode PSL_ERR_TO_LOWER: Failed to convert unicode to lowercase PSL_ERR_TO_UTF8: Failed to convert unicode to UTF-8 PSL_ERR_NO_MEM: Failed to allocate memory + + public func strToUTF8Lower(_ str : String, encoding : String = "utf-8", locale : String = "en") throws -> String? { + + var lower : UnsafeMutablePointer? + + let ret = psl_str_to_utf8lower(str, encoding, locale, &lower) + + var dom : String? = nil + + switch ret { + case PSL_ERR_INVALID_ARG: throw SwiftPSLError.Invalidarg + case PSL_ERR_CONVERTER: throw SwiftPSLError.Converter + case PSL_ERR_TO_UTF16: throw SwiftPSLError.ToUTF16 + case PSL_ERR_TO_LOWER: throw SwiftPSLError.ToLower + case PSL_ERR_TO_UTF8: throw SwiftPSLError.ToUTF8 + case PSL_ERR_NO_MEM: throw SwiftPSLError.NoMem + default: dom = String(cString: lower!) + } + + psl_free_string(lower) + + return(dom) + + } + + public func publicSuffix(_ domain : String, encoding : String = "utf-8", locale : String = "en") -> String? { + let psl : OpaquePointer? = ctx + var lower : UnsafeMutablePointer? + let dom : String? = (psl_str_to_utf8lower(domain, encoding, locale, &lower) == PSL_SUCCESS) ? String(cString: psl_unregistrable_domain(psl, lower)) : nil + psl_free_string(lower) + return(dom) + + } + + public func apexDomain(_ domain : String, encoding : String = "utf-8", locale : String = "en") -> String? { + let psl : OpaquePointer? = ctx + var lower : UnsafeMutablePointer? + let dom : String? = (psl_str_to_utf8lower(domain, encoding, locale, &lower) == PSL_SUCCESS) ? String(cString: psl_registrable_domain(psl, lower)) : nil + psl_free_string(lower) + return(dom) + } + + public func isPublicSuffix(_ domain : String, encoding : String = "utf-8", locale : String = "en") -> Bool { + let psl : OpaquePointer? = ctx + var lower : UnsafeMutablePointer? + let res : Bool = (psl_str_to_utf8lower(domain, encoding, locale, &lower) == PSL_SUCCESS) && (psl_is_public_suffix(psl, lower) == 1) + psl_free_string(lower) + return(res) + } + + public func isPublicSuffix(_ domain : String, type : Int32, encoding : String = "utf-8", locale : String = "en") -> Bool { + let psl : OpaquePointer? = ctx + var lower : UnsafeMutablePointer? + let res : Bool = (psl_str_to_utf8lower(domain, encoding, locale, &lower) == PSL_SUCCESS) && (psl_is_public_suffix2(psl, lower, type) == 1) + psl_free_string(lower) + return(res) + } + + public func isCookieDomainAcceptable(_ hostname : String, cookieDomain : String) -> Bool { + + let psl : OpaquePointer? = ctx + var lower1 : UnsafeMutablePointer? + var lower2 : UnsafeMutablePointer? + + let rc1 = psl_str_to_utf8lower(hostname, "utf-8", "en", &lower1) + let rc2 = psl_str_to_utf8lower(cookieDomain, "utf-8", "en", &lower2) + + let res : Bool = (rc1 == PSL_SUCCESS) && (rc2 == PSL_SUCCESS) && (psl_is_cookie_domain_acceptable(psl, lower1, lower2) == 1) + + psl_free_string(lower1) + psl_free_string(lower2) + + return(res) + + } + + public init() {} + + public init(_ path: String) throws { + ctx = psl_load_file(path) + if (ctx == nil) { throw SwiftPSLError.FileNotFound } + isBuiltin = false + } + + public func free() { + if ((!isBuiltin) && (ctx != nil)) { + psl_free(ctx) + ctx = nil + } + } + + public func suffixCount() -> Int32 { + return(psl_suffix_count(ctx)) + } + + public func suffixWildcardCount() -> Int32 { + return(psl_suffix_wildcard_count(ctx)) + } + + public func suffixExceptionCount() -> Int32 { + return(psl_suffix_exception_count(ctx)) + } + + public func builtinDistFilename() -> String { + return(String(cString: psl_dist_filename())) + } + + public func builtinFilename() -> String { + return(String(cString: psl_builtin_filename())) + } + + public func builtinSHA1() -> String { + return(String(cString: psl_builtin_sha1sum())) + } + + public func isBuiltinOutdated() -> Bool { + return(psl_builtin_outdated() == 1) + } + + public func builtinTimestamp() -> Int { + let ft = psl_builtin_file_time() + return(ft) + } + + deinit { + free() + } + +} diff --git a/Sources/psl-app/Info.plist b/Sources/psl-app/Info.plist new file mode 100644 index 0000000..47fad32 --- /dev/null +++ b/Sources/psl-app/Info.plist @@ -0,0 +1,8 @@ + + + + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + + diff --git a/Sources/psl-app/main.swift b/Sources/psl-app/main.swift new file mode 100644 index 0000000..91ad144 --- /dev/null +++ b/Sources/psl-app/main.swift @@ -0,0 +1,22 @@ +// +// main.swift +// psl-app +// +// Created by hrbrmstr on 9/15/19. +// + +import Foundation +import SwiftPSL + +var psl : SwiftPSL? + +psl = SwiftPSL() + +print("Using", psl!.builtinFilename()) +print("Suffix Count", psl!.suffixCount()) +print("TS", psl!.builtinTimestamp()) + +let arguments: [String] = CommandLine.arguments +if (arguments.count > 1) { print(psl!.apexDomain(arguments[1]) ?? arguments[1]) } + +psl = nil diff --git a/Sources/psl-app/psl-app.entitlements b/Sources/psl-app/psl-app.entitlements new file mode 100644 index 0000000..8cc185a --- /dev/null +++ b/Sources/psl-app/psl-app.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/Sources/psl/module.modulemap b/Sources/psl/module.modulemap new file mode 100644 index 0000000..2e4c378 --- /dev/null +++ b/Sources/psl/module.modulemap @@ -0,0 +1,4 @@ +module psl { + umbrella header "psl.h" + link "psl" +} diff --git a/Sources/psl/psl.h b/Sources/psl/psl.h new file mode 100644 index 0000000..107dc7d --- /dev/null +++ b/Sources/psl/psl.h @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist b/SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist new file mode 100644 index 0000000..7c23420 --- /dev/null +++ b/SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist @@ -0,0 +1,25 @@ + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SwiftPSL.xcodeproj/SwiftPSL_Info.plist b/SwiftPSL.xcodeproj/SwiftPSL_Info.plist new file mode 100644 index 0000000..57ada9f --- /dev/null +++ b/SwiftPSL.xcodeproj/SwiftPSL_Info.plist @@ -0,0 +1,25 @@ + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SwiftPSL.xcodeproj/project.pbxproj b/SwiftPSL.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4e6c393 --- /dev/null +++ b/SwiftPSL.xcodeproj/project.pbxproj @@ -0,0 +1,711 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + "SwiftPSL::SwiftPSLPackageTests::ProductTarget" /* SwiftPSLPackageTests */ = { + isa = PBXAggregateTarget; + buildConfigurationList = OBJ_39 /* Build configuration list for PBXAggregateTarget "SwiftPSLPackageTests" */; + buildPhases = ( + ); + dependencies = ( + OBJ_42 /* PBXTargetDependency */, + ); + name = SwiftPSLPackageTests; + productName = SwiftPSLPackageTests; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + C422247C232F292D004E4C39 /* libpsl.5.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C422247B232F292D004E4C39 /* libpsl.5.dylib */; }; + OBJ_30 /* SwiftPSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* SwiftPSL.swift */; }; + OBJ_37 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; + OBJ_48 /* CoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_19 /* CoreTests.swift */; }; + OBJ_50 /* SwiftPSL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "SwiftPSL::SwiftPSL::Product" /* SwiftPSL.framework */; }; + OBJ_57 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* main.swift */; }; + OBJ_59 /* SwiftPSL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "SwiftPSL::SwiftPSL::Product" /* SwiftPSL.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C4222477232F28BC004E4C39 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = "SwiftPSL::SwiftPSL"; + remoteInfo = SwiftPSL; + }; + C4222478232F28BC004E4C39 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = "SwiftPSL::SwiftPSL"; + remoteInfo = SwiftPSL; + }; + C4222479232F28C0004E4C39 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = "SwiftPSL::SwiftPSLTests"; + remoteInfo = SwiftPSLTests; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + C422247B232F292D004E4C39 /* libpsl.5.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpsl.5.dylib; path = ../../../../usr/local/lib/libpsl.5.dylib; sourceTree = ""; }; + OBJ_11 /* psl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = psl.h; sourceTree = ""; }; + OBJ_12 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; + OBJ_14 /* psl-app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "psl-app.entitlements"; sourceTree = ""; }; + OBJ_15 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + OBJ_16 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; + OBJ_19 /* CoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreTests.swift; sourceTree = ""; }; + OBJ_24 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; + OBJ_9 /* SwiftPSL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPSL.swift; sourceTree = ""; }; + "SwiftPSL::SwiftPSL::Product" /* SwiftPSL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SwiftPSL.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + "SwiftPSL::SwiftPSLTests::Product" /* SwiftPSLTests.xctest */ = {isa = PBXFileReference; lastKnownFileType = file; path = SwiftPSLTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + "SwiftPSL::psl-app::Product" /* psl-app */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = "psl-app"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + OBJ_31 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_49 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 0; + files = ( + OBJ_50 /* SwiftPSL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_58 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 0; + files = ( + C422247C232F292D004E4C39 /* libpsl.5.dylib in Frameworks */, + OBJ_59 /* SwiftPSL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C422247A232F292D004E4C39 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C422247B232F292D004E4C39 /* libpsl.5.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + OBJ_10 /* psl */ = { + isa = PBXGroup; + children = ( + OBJ_11 /* psl.h */, + OBJ_12 /* module.modulemap */, + ); + name = psl; + path = Sources/psl; + sourceTree = SOURCE_ROOT; + }; + OBJ_13 /* psl-app */ = { + isa = PBXGroup; + children = ( + OBJ_14 /* psl-app.entitlements */, + OBJ_15 /* Info.plist */, + OBJ_16 /* main.swift */, + ); + name = "psl-app"; + path = "Sources/psl-app"; + sourceTree = SOURCE_ROOT; + }; + OBJ_17 /* Tests */ = { + isa = PBXGroup; + children = ( + OBJ_18 /* SwiftPSLTests */, + ); + name = Tests; + sourceTree = SOURCE_ROOT; + }; + OBJ_18 /* SwiftPSLTests */ = { + isa = PBXGroup; + children = ( + OBJ_19 /* CoreTests.swift */, + ); + name = SwiftPSLTests; + path = Tests/SwiftPSLTests; + sourceTree = SOURCE_ROOT; + }; + OBJ_20 /* Products */ = { + isa = PBXGroup; + children = ( + "SwiftPSL::psl-app::Product" /* psl-app */, + "SwiftPSL::SwiftPSLTests::Product" /* SwiftPSLTests.xctest */, + "SwiftPSL::SwiftPSL::Product" /* SwiftPSL.framework */, + ); + name = Products; + sourceTree = BUILT_PRODUCTS_DIR; + }; + OBJ_5 /* */ = { + isa = PBXGroup; + children = ( + OBJ_6 /* Package.swift */, + OBJ_7 /* Sources */, + OBJ_17 /* Tests */, + OBJ_20 /* Products */, + OBJ_24 /* README.md */, + C422247A232F292D004E4C39 /* Frameworks */, + ); + name = ""; + sourceTree = ""; + }; + OBJ_7 /* Sources */ = { + isa = PBXGroup; + children = ( + OBJ_8 /* SwiftPSL */, + OBJ_10 /* psl */, + OBJ_13 /* psl-app */, + ); + name = Sources; + sourceTree = SOURCE_ROOT; + }; + OBJ_8 /* SwiftPSL */ = { + isa = PBXGroup; + children = ( + OBJ_9 /* SwiftPSL.swift */, + ); + name = SwiftPSL; + path = Sources/SwiftPSL; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + "SwiftPSL::SwiftPMPackageDescription" /* SwiftPSLPackageDescription */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_33 /* Build configuration list for PBXNativeTarget "SwiftPSLPackageDescription" */; + buildPhases = ( + OBJ_36 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftPSLPackageDescription; + productName = SwiftPSLPackageDescription; + productType = "com.apple.product-type.framework"; + }; + "SwiftPSL::SwiftPSL" /* SwiftPSL */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_26 /* Build configuration list for PBXNativeTarget "SwiftPSL" */; + buildPhases = ( + OBJ_29 /* Sources */, + OBJ_31 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftPSL; + productName = SwiftPSL; + productReference = "SwiftPSL::SwiftPSL::Product" /* SwiftPSL.framework */; + productType = "com.apple.product-type.framework"; + }; + "SwiftPSL::SwiftPSLTests" /* SwiftPSLTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_44 /* Build configuration list for PBXNativeTarget "SwiftPSLTests" */; + buildPhases = ( + OBJ_47 /* Sources */, + OBJ_49 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + OBJ_51 /* PBXTargetDependency */, + ); + name = SwiftPSLTests; + productName = SwiftPSLTests; + productReference = "SwiftPSL::SwiftPSLTests::Product" /* SwiftPSLTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + "SwiftPSL::psl-app" /* psl-app */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_53 /* Build configuration list for PBXNativeTarget "psl-app" */; + buildPhases = ( + OBJ_56 /* Sources */, + OBJ_58 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + OBJ_60 /* PBXTargetDependency */, + ); + name = "psl-app"; + productName = psl_app; + productReference = "SwiftPSL::psl-app::Product" /* psl-app */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + OBJ_1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftMigration = 9999; + LastUpgradeCheck = 9999; + TargetAttributes = { + "SwiftPSL::psl-app" = { + DevelopmentTeam = CBY22P58G8; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "SwiftPSL" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = OBJ_5 /* */; + productRefGroup = OBJ_20 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + "SwiftPSL::SwiftPSL" /* SwiftPSL */, + "SwiftPSL::SwiftPMPackageDescription" /* SwiftPSLPackageDescription */, + "SwiftPSL::SwiftPSLPackageTests::ProductTarget" /* SwiftPSLPackageTests */, + "SwiftPSL::SwiftPSLTests" /* SwiftPSLTests */, + "SwiftPSL::psl-app" /* psl-app */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + OBJ_29 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_30 /* SwiftPSL.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_36 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_37 /* Package.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_47 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_48 /* CoreTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_56 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_57 /* main.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + OBJ_42 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = "SwiftPSL::SwiftPSLTests" /* SwiftPSLTests */; + targetProxy = C4222479232F28C0004E4C39 /* PBXContainerItemProxy */; + }; + OBJ_51 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = "SwiftPSL::SwiftPSL" /* SwiftPSL */; + targetProxy = C4222478232F28BC004E4C39 /* PBXContainerItemProxy */; + }; + OBJ_60 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = "SwiftPSL::SwiftPSL" /* SwiftPSL */; + targetProxy = C4222477232F28BC004E4C39 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + OBJ_27 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/SwiftPSL_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + PRODUCT_BUNDLE_IDENTIFIER = SwiftPSL; + PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_VERSION = 5.0; + TARGET_NAME = SwiftPSL; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + OBJ_28 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/SwiftPSL_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + PRODUCT_BUNDLE_IDENTIFIER = SwiftPSL; + PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_VERSION = 5.0; + TARGET_NAME = SwiftPSL; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + OBJ_3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + "DEBUG=1", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; + ONLY_ACTIVE_ARCH = YES; + OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + USE_HEADERMAP = NO; + }; + name = Debug; + }; + OBJ_34 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD = /usr/bin/true; + OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + OBJ_35 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD = /usr/bin/true; + OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + OBJ_4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_OPTIMIZATION_LEVEL = s; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "SWIFT_PACKAGE=1", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + USE_HEADERMAP = NO; + }; + name = Release; + }; + OBJ_40 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Debug; + }; + OBJ_41 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Release; + }; + OBJ_45 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_VERSION = 5.0; + TARGET_NAME = SwiftPSLTests; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + OBJ_46 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/SwiftPSLTests_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_VERSION = 5.0; + TARGET_NAME = SwiftPSLTests; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + OBJ_54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = CBY22P58G8; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/psl_app_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx @executable_path"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; + SWIFT_FORCE_STATIC_LINK_STDLIB = NO; + SWIFT_VERSION = 5.0; + TARGET_NAME = "psl-app"; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + OBJ_55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = CBY22P58G8; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/Sources/psl", + ); + INFOPLIST_FILE = SwiftPSL.xcodeproj/psl_app_Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx @executable_path"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_CFLAGS = ( + "$(inherited)", + "-I/usr/local/Cellar/libpsl/0.21.0_1/include", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-L/usr/local/Cellar/libpsl/0.21.0_1/lib", + "-lpsl", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -I/usr/local/Cellar/libpsl/0.21.0_1/include"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; + SWIFT_FORCE_STATIC_LINK_STDLIB = NO; + SWIFT_VERSION = 5.0; + TARGET_NAME = "psl-app"; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + OBJ_2 /* Build configuration list for PBXProject "SwiftPSL" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_3 /* Debug */, + OBJ_4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + OBJ_26 /* Build configuration list for PBXNativeTarget "SwiftPSL" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_27 /* Debug */, + OBJ_28 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + OBJ_33 /* Build configuration list for PBXNativeTarget "SwiftPSLPackageDescription" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_34 /* Debug */, + OBJ_35 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + OBJ_39 /* Build configuration list for PBXAggregateTarget "SwiftPSLPackageTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_40 /* Debug */, + OBJ_41 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + OBJ_44 /* Build configuration list for PBXNativeTarget "SwiftPSLTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_45 /* Debug */, + OBJ_46 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + OBJ_53 /* Build configuration list for PBXNativeTarget "psl-app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_54 /* Debug */, + OBJ_55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = OBJ_1 /* Project object */; +} diff --git a/SwiftPSL.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SwiftPSL.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..fe1aa71 --- /dev/null +++ b/SwiftPSL.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..a72dc2b --- /dev/null +++ b/SwiftPSL.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + \ No newline at end of file diff --git a/SwiftPSL.xcodeproj/xcshareddata/xcschemes/SwiftPSL-Package.xcscheme b/SwiftPSL.xcodeproj/xcshareddata/xcschemes/SwiftPSL-Package.xcscheme new file mode 100644 index 0000000..475a28a --- /dev/null +++ b/SwiftPSL.xcodeproj/xcshareddata/xcschemes/SwiftPSL-Package.xcscheme @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SwiftPSL.xcodeproj/xcshareddata/xcschemes/psl-app.xcscheme b/SwiftPSL.xcodeproj/xcshareddata/xcschemes/psl-app.xcscheme new file mode 100644 index 0000000..c1c310b --- /dev/null +++ b/SwiftPSL.xcodeproj/xcshareddata/xcschemes/psl-app.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..73312c2 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,6 @@ +import XCTest +@testable import SwiftPSLTests + +XCTMain([ + testCase(SwiftPSLTests.allTests), +]) diff --git a/Tests/SwiftPSLTests/CoreTests.swift b/Tests/SwiftPSLTests/CoreTests.swift new file mode 100644 index 0000000..a9c94d6 --- /dev/null +++ b/Tests/SwiftPSLTests/CoreTests.swift @@ -0,0 +1,36 @@ +import XCTest + +@testable import SwiftPSL + +let psl = SwiftPSL() + +class CoreTests : XCTestCase { + + func test_isPublicSuffix() { + XCTAssertFalse(psl.isPublicSuffix("www.example.com")) + XCTAssertTrue(psl.isPublicSuffix("com.ar")) + XCTAssertFalse(psl.isPublicSuffix("www.com.ar")) + XCTAssertTrue(psl.isPublicSuffix("cc.ar.us")) + XCTAssertTrue(psl.isPublicSuffix(".cc.ar.us")) + XCTAssertFalse(psl.isPublicSuffix("www.cc.ar.us")) + XCTAssertFalse(psl.isPublicSuffix("www.ck")) + XCTAssertFalse(psl.isPublicSuffix("abc.www.ck")) + XCTAssertTrue(psl.isPublicSuffix("xxx.ck")) + XCTAssertFalse(psl.isPublicSuffix("www.xxx.ck")) + XCTAssertTrue(psl.isPublicSuffix("name")) + XCTAssertTrue(psl.isPublicSuffix(".name")) + XCTAssertFalse(psl.isPublicSuffix("hpsl.is.name")) + XCTAssertFalse(psl.isPublicSuffix(".hpsl.is.name")) + XCTAssertFalse(psl.isPublicSuffix("forgot.hpsl.is.name")) + XCTAssertFalse(psl.isPublicSuffix(".forgot.hpsl.is.name")) + XCTAssertFalse(psl.isPublicSuffix("whoever.hpsl.is.name")) + XCTAssertFalse(psl.isPublicSuffix("whoever.forgot.hpsl.is.name")) + XCTAssertTrue(psl.isPublicSuffix(".")) + XCTAssertTrue(psl.isPublicSuffix("")) + XCTAssertTrue(psl.isPublicSuffix("adfhoweirh")) + XCTAssertTrue(psl.isPublicSuffix("compute.amazonaws.com")) + XCTAssertTrue(psl.isPublicSuffix("y.compute.amazonaws.com")) + XCTAssertFalse(psl.isPublicSuffix("x.y.compute.amazonaws.com")) + } + +}