diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 8655b56..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: macOS-latest - strategy: - matrix: - destination: ['platform=macOS', 'platform=iOS Simulator,OS=13.0,name=iPhone 11'] - - steps: - - name: Checkout Project - uses: actions/checkout@v1 - - - name: Switch to Xcode 11 - run: sudo xcode-select -s /Applications/Xcode_11.app - - - name: Show Build Version - run: xcodebuild -version - - - name: Show Build Settings - run: xcodebuild -showBuildSettings - - - name: Show Build SDK - run: xcodebuild -showsdks - - - name: Show Available Destinations - run: xcodebuild -scheme RSParser -showdestinations - - - name: Run Build - env: - destination: ${{ matrix.destination }} - run: xcodebuild -scheme RSParser test -destination "${destination}" -showBuildTimingSummary CODE_SIGN_IDENTITY= diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..9b96331 --- /dev/null +++ b/Package.swift @@ -0,0 +1,44 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "RSParser", + platforms: [.macOS(SupportedPlatform.MacOSVersion.v10_15), .iOS(SupportedPlatform.IOSVersion.v13)], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "RSParser", + type: .dynamic, + targets: ["RSParser"]), + .library( + name: "RSParserObjC", + type: .dynamic, + targets: ["RSParserObjC"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "RSParser", + dependencies: ["RSParserObjC"], + path: "Sources/Swift"), + .target( + name: "RSParserObjC", + dependencies: [], + path: "Sources/ObjC", + cSettings: [ + .headerSearchPath("include") + ]), + .testTarget( + name: "RSParserTests", + dependencies: ["RSParser"], + exclude: ["RSDateParserTests.m", "Info.plist"], + resources: [.copy("Resources")]), + ] +) diff --git a/Sources/FeedServices/README.md b/Sources/FeedServices/README.md deleted file mode 100644 index ab3ed1b..0000000 --- a/Sources/FeedServices/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Feed Services - -This folder contains parsers for the APIs for the various online RSS readers. - -Or, it will. diff --git a/Sources/Feeds/FeedParser.h b/Sources/ObjC/FeedParser.h similarity index 100% rename from Sources/Feeds/FeedParser.h rename to Sources/ObjC/FeedParser.h diff --git a/Sources/Utilities/NSData+RSParser.h b/Sources/ObjC/NSData+RSParser.h similarity index 100% rename from Sources/Utilities/NSData+RSParser.h rename to Sources/ObjC/NSData+RSParser.h diff --git a/Sources/Utilities/NSData+RSParser.m b/Sources/ObjC/NSData+RSParser.m similarity index 99% rename from Sources/Utilities/NSData+RSParser.m rename to Sources/ObjC/NSData+RSParser.m index b63f621..d2f7c16 100644 --- a/Sources/Utilities/NSData+RSParser.m +++ b/Sources/ObjC/NSData+RSParser.m @@ -6,7 +6,10 @@ // Copyright © 2017 Ranchero Software, LLC. All rights reserved. // -#import +#import "NSData+RSParser.h" + + + /* TODO: find real-world cases where the isProbably* cases fail when they should succeed, and add them to tests.*/ diff --git a/Sources/Utilities/NSString+RSParser.h b/Sources/ObjC/NSString+RSParser.h similarity index 100% rename from Sources/Utilities/NSString+RSParser.h rename to Sources/ObjC/NSString+RSParser.h diff --git a/Sources/Utilities/NSString+RSParser.m b/Sources/ObjC/NSString+RSParser.m similarity index 99% rename from Sources/Utilities/NSString+RSParser.m rename to Sources/ObjC/NSString+RSParser.m index 405c3a4..8d51ffa 100755 --- a/Sources/Utilities/NSString+RSParser.m +++ b/Sources/ObjC/NSString+RSParser.m @@ -6,8 +6,10 @@ // Copyright © 2015 Ranchero Software, LLC. All rights reserved. // +#import "NSString+RSParser.h" #import -#import + + @interface NSScanner (RSParser) diff --git a/Sources/ParserData.h b/Sources/ObjC/ParserData.h similarity index 100% rename from Sources/ParserData.h rename to Sources/ObjC/ParserData.h diff --git a/Sources/ParserData.m b/Sources/ObjC/ParserData.m similarity index 100% rename from Sources/ParserData.m rename to Sources/ObjC/ParserData.m diff --git a/Sources/Feeds/XML/RSAtomParser.h b/Sources/ObjC/RSAtomParser.h similarity index 100% rename from Sources/Feeds/XML/RSAtomParser.h rename to Sources/ObjC/RSAtomParser.h diff --git a/Sources/Feeds/XML/RSAtomParser.m b/Sources/ObjC/RSAtomParser.m similarity index 98% rename from Sources/Feeds/XML/RSAtomParser.m rename to Sources/ObjC/RSAtomParser.m index 56a564e..04b1b6c 100755 --- a/Sources/Feeds/XML/RSAtomParser.m +++ b/Sources/ObjC/RSAtomParser.m @@ -6,16 +6,18 @@ // Copyright (c) 2015 Ranchero Software LLC. All rights reserved. // + +#import "RSAtomParser.h" +#import "RSSAXParser.h" +#import "RSParsedFeed.h" +#import "RSParsedArticle.h" +#import "NSString+RSParser.h" +#import "RSDateParser.h" +#import "ParserData.h" +#import "RSParsedEnclosure.h" +#import "RSParsedAuthor.h" + #import -#import -#import -#import -#import -#import -#import -#import -#import -#import @interface RSAtomParser () diff --git a/Sources/Utilities/RSDateParser.h b/Sources/ObjC/RSDateParser.h similarity index 100% rename from Sources/Utilities/RSDateParser.h rename to Sources/ObjC/RSDateParser.h diff --git a/Sources/Utilities/RSDateParser.m b/Sources/ObjC/RSDateParser.m similarity index 99% rename from Sources/Utilities/RSDateParser.m rename to Sources/ObjC/RSDateParser.m index 4a92f80..cb9c572 100755 --- a/Sources/Utilities/RSDateParser.m +++ b/Sources/ObjC/RSDateParser.m @@ -6,8 +6,10 @@ // Copyright (c) 2015 Ranchero Software, LLC. All rights reserved. // + +#import "RSDateParser.h" #import -#import + typedef struct { const char *abbreviation; diff --git a/Sources/HTML/RSHTMLLinkParser.h b/Sources/ObjC/RSHTMLLinkParser.h similarity index 100% rename from Sources/HTML/RSHTMLLinkParser.h rename to Sources/ObjC/RSHTMLLinkParser.h diff --git a/Sources/HTML/RSHTMLLinkParser.m b/Sources/ObjC/RSHTMLLinkParser.m similarity index 94% rename from Sources/HTML/RSHTMLLinkParser.m rename to Sources/ObjC/RSHTMLLinkParser.m index c6e7bd7..624e335 100755 --- a/Sources/HTML/RSHTMLLinkParser.m +++ b/Sources/ObjC/RSHTMLLinkParser.m @@ -6,12 +6,15 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // + +#import "RSHTMLLinkParser.h" +#import "RSSAXHTMLParser.h" +#import "RSSAXParser.h" +#import "RSParserInternal.h" +#import "ParserData.h" + #import -#import -#import -#import -#import -#import + @interface RSHTMLLinkParser() diff --git a/Sources/HTML/RSHTMLMetadata.h b/Sources/ObjC/RSHTMLMetadata.h similarity index 100% rename from Sources/HTML/RSHTMLMetadata.h rename to Sources/ObjC/RSHTMLMetadata.h diff --git a/Sources/HTML/RSHTMLMetadata.m b/Sources/ObjC/RSHTMLMetadata.m similarity index 99% rename from Sources/HTML/RSHTMLMetadata.m rename to Sources/ObjC/RSHTMLMetadata.m index e1b3bcb..2def0b0 100755 --- a/Sources/HTML/RSHTMLMetadata.m +++ b/Sources/ObjC/RSHTMLMetadata.m @@ -6,9 +6,11 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import -#import -#import +#import "RSHTMLMetadata.h" +#import "RSParserInternal.h" +#import "RSHTMLTag.h" + + static NSString *urlStringFromDictionary(NSDictionary *d); static NSString *absoluteURLStringWithRelativeURLString(NSString *relativeURLString, NSString *baseURLString); diff --git a/Sources/HTML/RSHTMLMetadataParser.h b/Sources/ObjC/RSHTMLMetadataParser.h similarity index 100% rename from Sources/HTML/RSHTMLMetadataParser.h rename to Sources/ObjC/RSHTMLMetadataParser.h diff --git a/Sources/HTML/RSHTMLMetadataParser.m b/Sources/ObjC/RSHTMLMetadataParser.m similarity index 92% rename from Sources/HTML/RSHTMLMetadataParser.m rename to Sources/ObjC/RSHTMLMetadataParser.m index d154cf4..7423afb 100755 --- a/Sources/HTML/RSHTMLMetadataParser.m +++ b/Sources/ObjC/RSHTMLMetadataParser.m @@ -6,14 +6,17 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // +#import "RSHTMLMetadataParser.h" +#import "RSHTMLMetadata.h" +#import "RSSAXHTMLParser.h" +#import "RSSAXHTMLParser.h" +#import "RSSAXParser.h" +#import "RSParserInternal.h" +#import "ParserData.h" +#import "RSHTMLTag.h" + #import -#import -#import -#import -#import -#import -#import -#import + @interface RSHTMLMetadataParser () diff --git a/Sources/HTML/RSHTMLTag.h b/Sources/ObjC/RSHTMLTag.h similarity index 100% rename from Sources/HTML/RSHTMLTag.h rename to Sources/ObjC/RSHTMLTag.h diff --git a/Sources/HTML/RSHTMLTag.m b/Sources/ObjC/RSHTMLTag.m similarity index 100% rename from Sources/HTML/RSHTMLTag.m rename to Sources/ObjC/RSHTMLTag.m diff --git a/Sources/OPML/RSOPMLAttributes.h b/Sources/ObjC/RSOPMLAttributes.h similarity index 100% rename from Sources/OPML/RSOPMLAttributes.h rename to Sources/ObjC/RSOPMLAttributes.h diff --git a/Sources/OPML/RSOPMLAttributes.m b/Sources/ObjC/RSOPMLAttributes.m similarity index 93% rename from Sources/OPML/RSOPMLAttributes.m rename to Sources/ObjC/RSOPMLAttributes.m index 49bb91e..db6508b 100755 --- a/Sources/OPML/RSOPMLAttributes.m +++ b/Sources/ObjC/RSOPMLAttributes.m @@ -6,8 +6,10 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import -#import +#import "RSOPMLAttributes.h" +#import "RSParserInternal.h" + + NSString *OPMLTextKey = @"text"; diff --git a/Sources/OPML/RSOPMLDocument.h b/Sources/ObjC/RSOPMLDocument.h similarity index 90% rename from Sources/OPML/RSOPMLDocument.h rename to Sources/ObjC/RSOPMLDocument.h index 2de8cf5..5061853 100755 --- a/Sources/OPML/RSOPMLDocument.h +++ b/Sources/ObjC/RSOPMLDocument.h @@ -7,7 +7,10 @@ // @import Foundation; -#import + +#import "RSOPMLItem.h" + + @interface RSOPMLDocument : RSOPMLItem diff --git a/Sources/OPML/RSOPMLDocument.m b/Sources/ObjC/RSOPMLDocument.m similarity index 84% rename from Sources/OPML/RSOPMLDocument.m rename to Sources/ObjC/RSOPMLDocument.m index 02ac559..1506bd9 100755 --- a/Sources/OPML/RSOPMLDocument.m +++ b/Sources/ObjC/RSOPMLDocument.m @@ -6,7 +6,8 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import + +#import "RSOPMLDocument.h" @implementation RSOPMLDocument diff --git a/Sources/OPML/RSOPMLError.h b/Sources/ObjC/RSOPMLError.h similarity index 100% rename from Sources/OPML/RSOPMLError.h rename to Sources/ObjC/RSOPMLError.h diff --git a/Sources/OPML/RSOPMLError.m b/Sources/ObjC/RSOPMLError.m similarity index 96% rename from Sources/OPML/RSOPMLError.m rename to Sources/ObjC/RSOPMLError.m index 93b477a..7aa3c5e 100755 --- a/Sources/OPML/RSOPMLError.m +++ b/Sources/ObjC/RSOPMLError.m @@ -6,7 +6,7 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import +#import "RSOPMLError.h" NSString *RSOPMLErrorDomain = @"com.ranchero.OPML"; diff --git a/Sources/OPML/RSOPMLFeedSpecifier.h b/Sources/ObjC/RSOPMLFeedSpecifier.h similarity index 100% rename from Sources/OPML/RSOPMLFeedSpecifier.h rename to Sources/ObjC/RSOPMLFeedSpecifier.h diff --git a/Sources/OPML/RSOPMLFeedSpecifier.m b/Sources/ObjC/RSOPMLFeedSpecifier.m similarity index 91% rename from Sources/OPML/RSOPMLFeedSpecifier.m rename to Sources/ObjC/RSOPMLFeedSpecifier.m index 2147ff9..bb32ccf 100755 --- a/Sources/OPML/RSOPMLFeedSpecifier.m +++ b/Sources/ObjC/RSOPMLFeedSpecifier.m @@ -6,8 +6,9 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import -#import +#import "RSOPMLFeedSpecifier.h" +#import "RSParserInternal.h" + @implementation RSOPMLFeedSpecifier diff --git a/Sources/OPML/RSOPMLItem.h b/Sources/ObjC/RSOPMLItem.h similarity index 100% rename from Sources/OPML/RSOPMLItem.h rename to Sources/ObjC/RSOPMLItem.h diff --git a/Sources/OPML/RSOPMLItem.m b/Sources/ObjC/RSOPMLItem.m similarity index 90% rename from Sources/OPML/RSOPMLItem.m rename to Sources/ObjC/RSOPMLItem.m index 34628bd..a273cd3 100755 --- a/Sources/OPML/RSOPMLItem.m +++ b/Sources/ObjC/RSOPMLItem.m @@ -6,10 +6,11 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import -#import -#import -#import +#import "RSOPMLItem.h" +#import "RSOPMLAttributes.h" +#import "RSOPMLFeedSpecifier.h" +#import "RSParserInternal.h" + @interface RSOPMLItem () diff --git a/Sources/OPML/RSOPMLParser.h b/Sources/ObjC/RSOPMLParser.h similarity index 100% rename from Sources/OPML/RSOPMLParser.h rename to Sources/ObjC/RSOPMLParser.h diff --git a/Sources/OPML/RSOPMLParser.m b/Sources/ObjC/RSOPMLParser.m similarity index 97% rename from Sources/OPML/RSOPMLParser.m rename to Sources/ObjC/RSOPMLParser.m index 4c90e8e..93f2c42 100755 --- a/Sources/OPML/RSOPMLParser.m +++ b/Sources/ObjC/RSOPMLParser.m @@ -7,13 +7,16 @@ // #import "RSOPMLParser.h" +#import "RSSAXParser.h" +#import "RSOPMLItem.h" +#import "RSOPMLDocument.h" +#import "RSOPMLAttributes.h" +#import "RSOPMLError.h" +#import "RSOPMLParser.h" +#import "ParserData.h" + #import -#import -#import -#import -#import -#import -#import + @interface RSOPMLParser () diff --git a/Sources/Feeds/XML/RSParsedArticle.h b/Sources/ObjC/RSParsedArticle.h similarity index 100% rename from Sources/Feeds/XML/RSParsedArticle.h rename to Sources/ObjC/RSParsedArticle.h diff --git a/Sources/Feeds/XML/RSParsedArticle.m b/Sources/ObjC/RSParsedArticle.m similarity index 93% rename from Sources/Feeds/XML/RSParsedArticle.m rename to Sources/ObjC/RSParsedArticle.m index 436f5af..b94930a 100755 --- a/Sources/Feeds/XML/RSParsedArticle.m +++ b/Sources/ObjC/RSParsedArticle.m @@ -6,11 +6,14 @@ // Copyright (c) 2014 Ranchero Software LLC. All rights reserved. // -#import -#import -#import -#import -#import + +#import "RSParsedArticle.h" +#import "RSParserInternal.h" +#import "NSString+RSParser.h" +#import "RSParsedAuthor.h" +#import "RSParsedEnclosure.h" + + @implementation RSParsedArticle diff --git a/Sources/Feeds/XML/RSParsedAuthor.h b/Sources/ObjC/RSParsedAuthor.h similarity index 100% rename from Sources/Feeds/XML/RSParsedAuthor.h rename to Sources/ObjC/RSParsedAuthor.h diff --git a/Sources/Feeds/XML/RSParsedAuthor.m b/Sources/ObjC/RSParsedAuthor.m similarity index 94% rename from Sources/Feeds/XML/RSParsedAuthor.m rename to Sources/ObjC/RSParsedAuthor.m index 01faf63..154b546 100644 --- a/Sources/Feeds/XML/RSParsedAuthor.m +++ b/Sources/ObjC/RSParsedAuthor.m @@ -6,7 +6,8 @@ // Copyright © 2017 Ranchero Software, LLC. All rights reserved. // -#import +#import "NSString+RSParser.h" + #import "RSParsedAuthor.h" @implementation RSParsedAuthor diff --git a/Sources/Feeds/XML/RSParsedEnclosure.h b/Sources/ObjC/RSParsedEnclosure.h similarity index 100% rename from Sources/Feeds/XML/RSParsedEnclosure.h rename to Sources/ObjC/RSParsedEnclosure.h diff --git a/Sources/Feeds/XML/RSParsedEnclosure.m b/Sources/ObjC/RSParsedEnclosure.m similarity index 100% rename from Sources/Feeds/XML/RSParsedEnclosure.m rename to Sources/ObjC/RSParsedEnclosure.m diff --git a/Sources/Feeds/XML/RSParsedFeed.h b/Sources/ObjC/RSParsedFeed.h similarity index 100% rename from Sources/Feeds/XML/RSParsedFeed.h rename to Sources/ObjC/RSParsedFeed.h diff --git a/Sources/Feeds/XML/RSParsedFeed.m b/Sources/ObjC/RSParsedFeed.m similarity index 93% rename from Sources/Feeds/XML/RSParsedFeed.m rename to Sources/ObjC/RSParsedFeed.m index ae7cf79..ef0c42e 100755 --- a/Sources/Feeds/XML/RSParsedFeed.m +++ b/Sources/ObjC/RSParsedFeed.m @@ -6,7 +6,9 @@ // Copyright © 2015 Ranchero Software, LLC. All rights reserved. // -#import +#import "RSParsedFeed.h" + + @implementation RSParsedFeed diff --git a/Sources/Utilities/RSParserInternal.h b/Sources/ObjC/RSParserInternal.h similarity index 100% rename from Sources/Utilities/RSParserInternal.h rename to Sources/ObjC/RSParserInternal.h diff --git a/Sources/Utilities/RSParserInternal.m b/Sources/ObjC/RSParserInternal.m similarity index 96% rename from Sources/Utilities/RSParserInternal.m rename to Sources/ObjC/RSParserInternal.m index ecc944b..4ba6f8a 100755 --- a/Sources/Utilities/RSParserInternal.m +++ b/Sources/ObjC/RSParserInternal.m @@ -6,8 +6,9 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // + +#import "RSParserInternal.h" #import -#import static BOOL RSParserIsNil(id obj) { diff --git a/Sources/Feeds/XML/RSRSSParser.h b/Sources/ObjC/RSRSSParser.h similarity index 100% rename from Sources/Feeds/XML/RSRSSParser.h rename to Sources/ObjC/RSRSSParser.h diff --git a/Sources/Feeds/XML/RSRSSParser.m b/Sources/ObjC/RSRSSParser.m similarity index 97% rename from Sources/Feeds/XML/RSRSSParser.m rename to Sources/ObjC/RSRSSParser.m index eb4c315..aca7c93 100755 --- a/Sources/Feeds/XML/RSRSSParser.m +++ b/Sources/ObjC/RSRSSParser.m @@ -6,17 +6,21 @@ // Copyright (c) 2015 Ranchero Software LLC. All rights reserved. // +#import "RSRSSParser.h" +#import "RSSAXParser.h" +#import "RSParsedFeed.h" +#import "RSParsedArticle.h" +#import "RSParserInternal.h" +#import "NSString+RSParser.h" +#import "RSDateParser.h" +#import "ParserData.h" +#import "RSParsedEnclosure.h" +#import "RSParsedAuthor.h" + + + #import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import + @interface RSRSSParser () diff --git a/Sources/HTML/RSSAXHTMLParser.h b/Sources/ObjC/RSSAXHTMLParser.h similarity index 100% rename from Sources/HTML/RSSAXHTMLParser.h rename to Sources/ObjC/RSSAXHTMLParser.h diff --git a/Sources/HTML/RSSAXHTMLParser.m b/Sources/ObjC/RSSAXHTMLParser.m similarity index 98% rename from Sources/HTML/RSSAXHTMLParser.m rename to Sources/ObjC/RSSAXHTMLParser.m index c24653a..5df2d84 100755 --- a/Sources/HTML/RSSAXHTMLParser.m +++ b/Sources/ObjC/RSSAXHTMLParser.m @@ -6,12 +6,14 @@ // Copyright © 2016 Ranchero Software, LLC. All rights reserved. // -#import -#import +#import "RSSAXHTMLParser.h" +#import "RSSAXParser.h" +#import "RSParserInternal.h" + #import #import #import -#import + @interface RSSAXHTMLParser () diff --git a/Sources/SAX/RSSAXParser.h b/Sources/ObjC/RSSAXParser.h similarity index 100% rename from Sources/SAX/RSSAXParser.h rename to Sources/ObjC/RSSAXParser.h diff --git a/Sources/SAX/RSSAXParser.m b/Sources/ObjC/RSSAXParser.m similarity index 99% rename from Sources/SAX/RSSAXParser.m rename to Sources/ObjC/RSSAXParser.m index 8ee1272..02d6988 100755 --- a/Sources/SAX/RSSAXParser.m +++ b/Sources/ObjC/RSSAXParser.m @@ -6,11 +6,13 @@ // Copyright (c) 2015 Ranchero Software, LLC. All rights reserved. // +#import "RSSAXParser.h" +#import "RSParserInternal.h" + #import #import #import -#import -#import + @interface RSSAXParser () diff --git a/Sources/ObjC/include/RSParser.h b/Sources/ObjC/include/RSParser.h new file mode 100644 index 0000000..c9bd000 --- /dev/null +++ b/Sources/ObjC/include/RSParser.h @@ -0,0 +1,56 @@ +// +// RSParser.h +// RSParser +// +// Created by Brent Simmons on 6/20/17. +// Copyright © 2017 Ranchero Software, LLC. All rights reserved. +// + +@import Foundation; + + +#import "../ParserData.h" +#import "../RSDateParser.h" + +// OPML + +#import "../RSOPMLParser.h" +#import "../RSOPMLDocument.h" +#import "../RSOPMLItem.h" +#import "../RSOPMLAttributes.h" +#import "../RSOPMLFeedSpecifier.h" +#import "../RSOPMLError.h" + +// For writing your own XML parser. + +#import "../RSSAXParser.h" + +// You should use FeedParser (Swift) instead of these two specific parsers +// and the objects they create. +// But they’re available if you want them. + +#import "../RSRSSParser.h" +#import "../RSAtomParser.h" +#import "../RSParsedFeed.h" +#import "../RSParsedArticle.h" +#import "../RSParsedEnclosure.h" +#import "../RSParsedAuthor.h" + +// HTML + +#import "../RSHTMLMetadataParser.h" +#import "../RSHTMLMetadata.h" +#import "../RSHTMLLinkParser.h" +#import "../RSSAXHTMLParser.h" // For writing your own HTML parser. +#import "../RSHTMLTag.h" + +// Utilities + +#import "../NSData+RSParser.h" +#import "../NSString+RSParser.h" + + + + + + diff --git a/Sources/RSParser.h b/Sources/RSParser.h deleted file mode 100644 index 9bb1b10..0000000 --- a/Sources/RSParser.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// RSParser.h -// RSParser -// -// Created by Brent Simmons on 6/20/17. -// Copyright © 2017 Ranchero Software, LLC. All rights reserved. -// - -@import Foundation; - -// To parse RSS, Atom, JSON Feed, and RSS-in-JSON the easy way, see FeedParser.swift. - -#import - -// Dates - -#import - -// OPML - -#import -#import -#import -#import -#import -#import - -// For writing your own XML parser. - -#import - -// You should use FeedParser (Swift) instead of these two specific parsers -// and the objects they create. -// But they’re available if you want them. - -#import -#import -#import -#import -#import -#import - -// HTML - -#import -#import -#import -#import // For writing your own HTML parser. -#import - -// Utilities - -#import -#import diff --git a/Sources/Swift/Exports.swift b/Sources/Swift/Exports.swift new file mode 100644 index 0000000..c9c3068 --- /dev/null +++ b/Sources/Swift/Exports.swift @@ -0,0 +1,9 @@ +// +// Exports.swift +// +// +// Created by Stuart Breckenridge on 29/7/20. +// + +import Foundation +@_exported import RSParserObjC diff --git a/Sources/Feeds/FeedParser.swift b/Sources/Swift/Feeds/FeedParser.swift similarity index 98% rename from Sources/Feeds/FeedParser.swift rename to Sources/Swift/Feeds/FeedParser.swift index bd85f8e..41d6284 100644 --- a/Sources/Feeds/FeedParser.swift +++ b/Sources/Swift/Feeds/FeedParser.swift @@ -7,6 +7,7 @@ // import Foundation +import RSParserObjC // FeedParser handles RSS, Atom, JSON Feed, and RSS-in-JSON. // You don’t need to know the type of feed. diff --git a/Sources/Feeds/FeedParserError.swift b/Sources/Swift/Feeds/FeedParserError.swift similarity index 100% rename from Sources/Feeds/FeedParserError.swift rename to Sources/Swift/Feeds/FeedParserError.swift diff --git a/Sources/Feeds/FeedType.swift b/Sources/Swift/Feeds/FeedType.swift similarity index 97% rename from Sources/Feeds/FeedType.swift rename to Sources/Swift/Feeds/FeedType.swift index 16cefbe..bfe33c0 100644 --- a/Sources/Feeds/FeedType.swift +++ b/Sources/Swift/Feeds/FeedType.swift @@ -7,6 +7,9 @@ // import Foundation +#if SWIFT_PACKAGE +import RSParserObjC +#endif public enum FeedType { case rss diff --git a/Sources/Feeds/JSON/JSONFeedParser.swift b/Sources/Swift/Feeds/JSON/JSONFeedParser.swift similarity index 99% rename from Sources/Feeds/JSON/JSONFeedParser.swift rename to Sources/Swift/Feeds/JSON/JSONFeedParser.swift index 0c3822d..54b9af7 100644 --- a/Sources/Feeds/JSON/JSONFeedParser.swift +++ b/Sources/Swift/Feeds/JSON/JSONFeedParser.swift @@ -7,6 +7,9 @@ // import Foundation +#if SWIFT_PACKAGE +import RSParserObjC +#endif // See https://jsonfeed.org/version/1 diff --git a/Sources/Feeds/JSON/RSSInJSONParser.swift b/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift similarity index 99% rename from Sources/Feeds/JSON/RSSInJSONParser.swift rename to Sources/Swift/Feeds/JSON/RSSInJSONParser.swift index 74e6b06..ea19073 100644 --- a/Sources/Feeds/JSON/RSSInJSONParser.swift +++ b/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift @@ -7,6 +7,9 @@ // import Foundation +#if SWIFT_PACKAGE +import RSParserObjC +#endif // See https://github.com/scripting/Scripting-News/blob/master/rss-in-json/README.md // Also: http://cyber.harvard.edu/rss/rss.html diff --git a/Sources/Feeds/ParsedAttachment.swift b/Sources/Swift/Feeds/ParsedAttachment.swift similarity index 100% rename from Sources/Feeds/ParsedAttachment.swift rename to Sources/Swift/Feeds/ParsedAttachment.swift diff --git a/Sources/Feeds/ParsedAuthor.swift b/Sources/Swift/Feeds/ParsedAuthor.swift similarity index 100% rename from Sources/Feeds/ParsedAuthor.swift rename to Sources/Swift/Feeds/ParsedAuthor.swift diff --git a/Sources/Feeds/ParsedFeed.swift b/Sources/Swift/Feeds/ParsedFeed.swift similarity index 100% rename from Sources/Feeds/ParsedFeed.swift rename to Sources/Swift/Feeds/ParsedFeed.swift diff --git a/Sources/Feeds/ParsedHub.swift b/Sources/Swift/Feeds/ParsedHub.swift similarity index 100% rename from Sources/Feeds/ParsedHub.swift rename to Sources/Swift/Feeds/ParsedHub.swift diff --git a/Sources/Feeds/ParsedItem.swift b/Sources/Swift/Feeds/ParsedItem.swift similarity index 100% rename from Sources/Feeds/ParsedItem.swift rename to Sources/Swift/Feeds/ParsedItem.swift diff --git a/Sources/Feeds/XML/AtomParser.swift b/Sources/Swift/Feeds/XML/AtomParser.swift similarity index 94% rename from Sources/Feeds/XML/AtomParser.swift rename to Sources/Swift/Feeds/XML/AtomParser.swift index 151349a..ad6b664 100644 --- a/Sources/Feeds/XML/AtomParser.swift +++ b/Sources/Swift/Feeds/XML/AtomParser.swift @@ -8,6 +8,10 @@ import Foundation +#if SWIFT_PACKAGE +import RSParserObjC +#endif + // RSSParser wraps the Objective-C RSAtomParser. // // The Objective-C parser creates RSParsedFeed, RSParsedArticle, etc. diff --git a/Sources/Feeds/XML/RSParsedFeedTransformer.swift b/Sources/Swift/Feeds/XML/RSParsedFeedTransformer.swift similarity index 98% rename from Sources/Feeds/XML/RSParsedFeedTransformer.swift rename to Sources/Swift/Feeds/XML/RSParsedFeedTransformer.swift index c6d0b2b..4d680ac 100644 --- a/Sources/Feeds/XML/RSParsedFeedTransformer.swift +++ b/Sources/Swift/Feeds/XML/RSParsedFeedTransformer.swift @@ -7,6 +7,9 @@ // import Foundation +#if SWIFT_PACKAGE +import RSParserObjC +#endif // RSRSSParser and RSAtomParser were written in Objective-C quite a while ago. // They create an RSParsedFeed object and related Objective-C objects. diff --git a/Sources/Feeds/XML/RSSParser.swift b/Sources/Swift/Feeds/XML/RSSParser.swift similarity index 97% rename from Sources/Feeds/XML/RSSParser.swift rename to Sources/Swift/Feeds/XML/RSSParser.swift index 885790e..f14d9c7 100644 --- a/Sources/Feeds/XML/RSSParser.swift +++ b/Sources/Swift/Feeds/XML/RSSParser.swift @@ -7,6 +7,7 @@ // import Foundation +import RSParserObjC // RSSParser wraps the Objective-C RSRSSParser. // diff --git a/Sources/JSON/JSONTypes.swift b/Sources/Swift/JSON/JSONTypes.swift similarity index 100% rename from Sources/JSON/JSONTypes.swift rename to Sources/Swift/JSON/JSONTypes.swift diff --git a/Sources/JSON/JSONUtilities.swift b/Sources/Swift/JSON/JSONUtilities.swift similarity index 100% rename from Sources/JSON/JSONUtilities.swift rename to Sources/Swift/JSON/JSONUtilities.swift diff --git a/Sources/Utilities/String+RSParser.swift b/Sources/Swift/Utilities/String+RSParser.swift similarity index 100% rename from Sources/Utilities/String+RSParser.swift rename to Sources/Swift/Utilities/String+RSParser.swift diff --git a/Sources/XML-RPC/README.md b/Sources/XML-RPC/README.md deleted file mode 100644 index 13750c8..0000000 --- a/Sources/XML-RPC/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# XML-RPC - -This folder contains code for reading and writing XML-RPC. - -Or, it will. \ No newline at end of file diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..93c8b6d --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import RSParserTests + +var tests = [XCTestCaseEntry]() +tests += RSParserTests.allTests() +XCTMain(tests) diff --git a/RSParserTests/AtomParserTests.swift b/Tests/RSParserTests/AtomParserTests.swift similarity index 100% rename from RSParserTests/AtomParserTests.swift rename to Tests/RSParserTests/AtomParserTests.swift diff --git a/RSParserTests/EntityDecodingTests.swift b/Tests/RSParserTests/EntityDecodingTests.swift similarity index 100% rename from RSParserTests/EntityDecodingTests.swift rename to Tests/RSParserTests/EntityDecodingTests.swift diff --git a/RSParserTests/FeedParserTypeTests.swift b/Tests/RSParserTests/FeedParserTypeTests.swift similarity index 99% rename from RSParserTests/FeedParserTypeTests.swift rename to Tests/RSParserTests/FeedParserTypeTests.swift index 4f7e033..533d1c5 100644 --- a/RSParserTests/FeedParserTypeTests.swift +++ b/Tests/RSParserTests/FeedParserTypeTests.swift @@ -8,6 +8,7 @@ import XCTest import RSParser +import RSParserObjC class FeedParserTypeTests: XCTestCase { diff --git a/RSParserTests/HTMLLinkTests.swift b/Tests/RSParserTests/HTMLLinkTests.swift similarity index 97% rename from RSParserTests/HTMLLinkTests.swift rename to Tests/RSParserTests/HTMLLinkTests.swift index 7c8d012..5817148 100644 --- a/RSParserTests/HTMLLinkTests.swift +++ b/Tests/RSParserTests/HTMLLinkTests.swift @@ -8,6 +8,7 @@ import XCTest import RSParser +import RSParserObjC class HTMLLinkTests: XCTestCase { diff --git a/RSParserTests/HTMLMetadataTests.swift b/Tests/RSParserTests/HTMLMetadataTests.swift similarity index 99% rename from RSParserTests/HTMLMetadataTests.swift rename to Tests/RSParserTests/HTMLMetadataTests.swift index b407bc3..684700f 100644 --- a/RSParserTests/HTMLMetadataTests.swift +++ b/Tests/RSParserTests/HTMLMetadataTests.swift @@ -8,6 +8,7 @@ import XCTest import RSParser +import RSParserObjC class HTMLMetadataTests: XCTestCase { diff --git a/RSParserTests/Info.plist b/Tests/RSParserTests/Info.plist similarity index 100% rename from RSParserTests/Info.plist rename to Tests/RSParserTests/Info.plist diff --git a/RSParserTests/JSONFeedParserTests.swift b/Tests/RSParserTests/JSONFeedParserTests.swift similarity index 100% rename from RSParserTests/JSONFeedParserTests.swift rename to Tests/RSParserTests/JSONFeedParserTests.swift diff --git a/RSParserTests/OPMLTests.swift b/Tests/RSParserTests/OPMLTests.swift similarity index 99% rename from RSParserTests/OPMLTests.swift rename to Tests/RSParserTests/OPMLTests.swift index 633ed57..a9f45f6 100644 --- a/RSParserTests/OPMLTests.swift +++ b/Tests/RSParserTests/OPMLTests.swift @@ -8,6 +8,7 @@ import XCTest import RSParser +import RSParserObjC class OPMLTests: XCTestCase { diff --git a/RSParserTests/RSDateParserTests.m b/Tests/RSParserTests/RSDateParserTests.m similarity index 100% rename from RSParserTests/RSDateParserTests.m rename to Tests/RSParserTests/RSDateParserTests.m diff --git a/RSParserTests/RSSInJSONParserTests.swift b/Tests/RSParserTests/RSSInJSONParserTests.swift similarity index 100% rename from RSParserTests/RSSInJSONParserTests.swift rename to Tests/RSParserTests/RSSInJSONParserTests.swift diff --git a/RSParserTests/RSSParserTests.swift b/Tests/RSParserTests/RSSParserTests.swift similarity index 100% rename from RSParserTests/RSSParserTests.swift rename to Tests/RSParserTests/RSSParserTests.swift diff --git a/RSParserTests/Resources/3960.json b/Tests/RSParserTests/Resources/3960.json similarity index 100% rename from RSParserTests/Resources/3960.json rename to Tests/RSParserTests/Resources/3960.json diff --git a/RSParserTests/Resources/489.rss b/Tests/RSParserTests/Resources/489.rss similarity index 100% rename from RSParserTests/Resources/489.rss rename to Tests/RSParserTests/Resources/489.rss diff --git a/RSParserTests/Resources/4fsodonline.atom b/Tests/RSParserTests/Resources/4fsodonline.atom similarity index 100% rename from RSParserTests/Resources/4fsodonline.atom rename to Tests/RSParserTests/Resources/4fsodonline.atom diff --git a/RSParserTests/Resources/DaringFireball.atom b/Tests/RSParserTests/Resources/DaringFireball.atom similarity index 100% rename from RSParserTests/Resources/DaringFireball.atom rename to Tests/RSParserTests/Resources/DaringFireball.atom diff --git a/RSParserTests/Resources/DaringFireball.html b/Tests/RSParserTests/Resources/DaringFireball.html similarity index 100% rename from RSParserTests/Resources/DaringFireball.html rename to Tests/RSParserTests/Resources/DaringFireball.html diff --git a/RSParserTests/Resources/DaringFireball.json b/Tests/RSParserTests/Resources/DaringFireball.json similarity index 100% rename from RSParserTests/Resources/DaringFireball.json rename to Tests/RSParserTests/Resources/DaringFireball.json diff --git a/RSParserTests/Resources/DaringFireball.rss b/Tests/RSParserTests/Resources/DaringFireball.rss similarity index 100% rename from RSParserTests/Resources/DaringFireball.rss rename to Tests/RSParserTests/Resources/DaringFireball.rss diff --git a/RSParserTests/Resources/EMarley.rss b/Tests/RSParserTests/Resources/EMarley.rss similarity index 100% rename from RSParserTests/Resources/EMarley.rss rename to Tests/RSParserTests/Resources/EMarley.rss diff --git a/RSParserTests/Resources/KatieFloyd.rss b/Tests/RSParserTests/Resources/KatieFloyd.rss similarity index 100% rename from RSParserTests/Resources/KatieFloyd.rss rename to Tests/RSParserTests/Resources/KatieFloyd.rss diff --git a/RSParserTests/Resources/OneFootTsunami.atom b/Tests/RSParserTests/Resources/OneFootTsunami.atom similarity index 100% rename from RSParserTests/Resources/OneFootTsunami.atom rename to Tests/RSParserTests/Resources/OneFootTsunami.atom diff --git a/RSParserTests/Resources/ScriptingNews.json b/Tests/RSParserTests/Resources/ScriptingNews.json similarity index 100% rename from RSParserTests/Resources/ScriptingNews.json rename to Tests/RSParserTests/Resources/ScriptingNews.json diff --git a/RSParserTests/Resources/Subs.opml b/Tests/RSParserTests/Resources/Subs.opml similarity index 100% rename from RSParserTests/Resources/Subs.opml rename to Tests/RSParserTests/Resources/Subs.opml diff --git a/RSParserTests/Resources/SubsNoTitleAttributes.opml b/Tests/RSParserTests/Resources/SubsNoTitleAttributes.opml similarity index 100% rename from RSParserTests/Resources/SubsNoTitleAttributes.opml rename to Tests/RSParserTests/Resources/SubsNoTitleAttributes.opml diff --git a/RSParserTests/Resources/allthis-partial.json b/Tests/RSParserTests/Resources/allthis-partial.json similarity index 100% rename from RSParserTests/Resources/allthis-partial.json rename to Tests/RSParserTests/Resources/allthis-partial.json diff --git a/RSParserTests/Resources/allthis.atom b/Tests/RSParserTests/Resources/allthis.atom similarity index 100% rename from RSParserTests/Resources/allthis.atom rename to Tests/RSParserTests/Resources/allthis.atom diff --git a/RSParserTests/Resources/allthis.json b/Tests/RSParserTests/Resources/allthis.json similarity index 100% rename from RSParserTests/Resources/allthis.json rename to Tests/RSParserTests/Resources/allthis.json diff --git a/RSParserTests/Resources/atp.rss b/Tests/RSParserTests/Resources/atp.rss similarity index 100% rename from RSParserTests/Resources/atp.rss rename to Tests/RSParserTests/Resources/atp.rss diff --git a/RSParserTests/Resources/bio.rdf b/Tests/RSParserTests/Resources/bio.rdf similarity index 100% rename from RSParserTests/Resources/bio.rdf rename to Tests/RSParserTests/Resources/bio.rdf diff --git a/RSParserTests/Resources/cloudblog.rss b/Tests/RSParserTests/Resources/cloudblog.rss similarity index 100% rename from RSParserTests/Resources/cloudblog.rss rename to Tests/RSParserTests/Resources/cloudblog.rss diff --git a/RSParserTests/Resources/coco.html b/Tests/RSParserTests/Resources/coco.html similarity index 100% rename from RSParserTests/Resources/coco.html rename to Tests/RSParserTests/Resources/coco.html diff --git a/RSParserTests/Resources/curt.json b/Tests/RSParserTests/Resources/curt.json similarity index 100% rename from RSParserTests/Resources/curt.json rename to Tests/RSParserTests/Resources/curt.json diff --git a/RSParserTests/Resources/dcrainmaker.xml b/Tests/RSParserTests/Resources/dcrainmaker.xml similarity index 100% rename from RSParserTests/Resources/dcrainmaker.xml rename to Tests/RSParserTests/Resources/dcrainmaker.xml diff --git a/RSParserTests/Resources/donthitsave.xml b/Tests/RSParserTests/Resources/donthitsave.xml similarity index 100% rename from RSParserTests/Resources/donthitsave.xml rename to Tests/RSParserTests/Resources/donthitsave.xml diff --git a/RSParserTests/Resources/expertopinionent.atom b/Tests/RSParserTests/Resources/expertopinionent.atom similarity index 100% rename from RSParserTests/Resources/expertopinionent.atom rename to Tests/RSParserTests/Resources/expertopinionent.atom diff --git a/RSParserTests/Resources/furbo.html b/Tests/RSParserTests/Resources/furbo.html similarity index 100% rename from RSParserTests/Resources/furbo.html rename to Tests/RSParserTests/Resources/furbo.html diff --git a/RSParserTests/Resources/inessential.html b/Tests/RSParserTests/Resources/inessential.html similarity index 100% rename from RSParserTests/Resources/inessential.html rename to Tests/RSParserTests/Resources/inessential.html diff --git a/RSParserTests/Resources/inessential.json b/Tests/RSParserTests/Resources/inessential.json similarity index 100% rename from RSParserTests/Resources/inessential.json rename to Tests/RSParserTests/Resources/inessential.json diff --git a/RSParserTests/Resources/kc0011.rss b/Tests/RSParserTests/Resources/kc0011.rss similarity index 100% rename from RSParserTests/Resources/kc0011.rss rename to Tests/RSParserTests/Resources/kc0011.rss diff --git a/RSParserTests/Resources/livemint.xml b/Tests/RSParserTests/Resources/livemint.xml similarity index 100% rename from RSParserTests/Resources/livemint.xml rename to Tests/RSParserTests/Resources/livemint.xml diff --git a/RSParserTests/Resources/macworld.rss b/Tests/RSParserTests/Resources/macworld.rss similarity index 100% rename from RSParserTests/Resources/macworld.rss rename to Tests/RSParserTests/Resources/macworld.rss diff --git a/RSParserTests/Resources/manton.rss b/Tests/RSParserTests/Resources/manton.rss similarity index 100% rename from RSParserTests/Resources/manton.rss rename to Tests/RSParserTests/Resources/manton.rss diff --git a/RSParserTests/Resources/monkeydom.rss b/Tests/RSParserTests/Resources/monkeydom.rss similarity index 100% rename from RSParserTests/Resources/monkeydom.rss rename to Tests/RSParserTests/Resources/monkeydom.rss diff --git a/RSParserTests/Resources/natasha.xml b/Tests/RSParserTests/Resources/natasha.xml similarity index 100% rename from RSParserTests/Resources/natasha.xml rename to Tests/RSParserTests/Resources/natasha.xml diff --git a/RSParserTests/Resources/pxlnv.json b/Tests/RSParserTests/Resources/pxlnv.json similarity index 100% rename from RSParserTests/Resources/pxlnv.json rename to Tests/RSParserTests/Resources/pxlnv.json diff --git a/RSParserTests/Resources/rose.json b/Tests/RSParserTests/Resources/rose.json similarity index 100% rename from RSParserTests/Resources/rose.json rename to Tests/RSParserTests/Resources/rose.json diff --git a/RSParserTests/Resources/russcox.atom b/Tests/RSParserTests/Resources/russcox.atom similarity index 100% rename from RSParserTests/Resources/russcox.atom rename to Tests/RSParserTests/Resources/russcox.atom diff --git a/RSParserTests/Resources/scriptingNews.rss b/Tests/RSParserTests/Resources/scriptingNews.rss similarity index 100% rename from RSParserTests/Resources/scriptingNews.rss rename to Tests/RSParserTests/Resources/scriptingNews.rss diff --git a/RSParserTests/Resources/sixcolors.html b/Tests/RSParserTests/Resources/sixcolors.html similarity index 100% rename from RSParserTests/Resources/sixcolors.html rename to Tests/RSParserTests/Resources/sixcolors.html diff --git a/RSParserTests/Resources/theomnishow.rss b/Tests/RSParserTests/Resources/theomnishow.rss similarity index 100% rename from RSParserTests/Resources/theomnishow.rss rename to Tests/RSParserTests/Resources/theomnishow.rss diff --git a/buildscripts/VerifyNoBuildSettings.swift b/buildscripts/VerifyNoBuildSettings.swift deleted file mode 100755 index 82e839b..0000000 --- a/buildscripts/VerifyNoBuildSettings.swift +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/swift - -// This script is originally from github.com/olofhellman/VerifyNoBS -// The idea is that all build settings should be kept in .xcconfig files, -// rather than in the xcode pbxproj file inside an Xcode project bundle -// Having the script run as part of a regular build ensures that the project file -// doesn't accidentally accumulate build settings - -import Darwin -import Foundation - -func reportError(message: String) { - print("error message was \(message)") - let stderr = FileHandle.standardError - if let data = message.data(using: String.Encoding.utf8, allowLossyConversion: false) { - stderr.write(data) - } else { - print("there was an error. script \"VerifyNoBuildSettings\" could not convert error message to printable string") - } -} - -public enum ProcessXcodeprojResult { - case FoundBuildSettings([String]) - case Error(String) - case OK(String) -} - -public func processXcodeprojAt(url: URL) -> ProcessXcodeprojResult { - let startTime = Date() - guard let xcodeproj = try? String(contentsOf: url, encoding: String.Encoding.utf8) else { - return .Error("script \"VerifyNoBuildSettings\" failed making xcodeproj from url") - } - let lines = xcodeproj.components(separatedBy: CharacterSet.newlines) - print ("found \(lines.count) lines") - - var badLines: [String] = [] - var inBuildSettingsBlock = false - for nthLine in lines { - if inBuildSettingsBlock { - if let _ = nthLine.range(of:"\\u007d[:space:]*;", options: .regularExpression) { - inBuildSettingsBlock = false - } else if let _ = nthLine.range(of:"CODE_SIGN_IDENTITY") { - - } else if let _ = nthLine.range(of:"PRODUCT_NAME") { - - } else { - badLines.append(nthLine) - } - } else { - if let _ = nthLine.range(of:"buildSettings[:space:]*=", options: .regularExpression) { - inBuildSettingsBlock = true - } - } - } - - let timeInterval = Date().timeIntervalSince(startTime) - print ("process took \(timeInterval) seconds") - if (badLines.count > 0) { - return .FoundBuildSettings(badLines) - } - return .OK(":-)") -} -print("Verifying no buildSettings...") - -let commandLineArgs = CommandLine.arguments -print("processArgs were \(commandLineArgs)") -let xcodeprojfilepath = commandLineArgs[1] -let myUrl = URL(fileURLWithPath:xcodeprojfilepath) -let result = processXcodeprojAt(url: myUrl) - -switch result { - case .Error(let str): - reportError (message: "error script \"VerifyNoBuildSettings\" encountered an error: \(str)") - exit(EXIT_FAILURE) - case .FoundBuildSettings(let badLines): - reportError (message: "script \"VerifyNoBuildSettings\" found build settings in the project file:") - for badLine in badLines { - reportError (message: " \(badLine)\n") - } - exit(EXIT_FAILURE) - case .OK: - print ("script \"VerifyNoBuildSettings\" verified the project contained no buildSettings") - exit(EXIT_SUCCESS) -}