Merge branch 'feature/unify-core'

This commit is contained in:
Brent Simmons
2025-04-22 21:08:17 -07:00
22 changed files with 120 additions and 125 deletions

View File

@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
import PackageDescription
var dependencies: [Package.Dependency] = [
@@ -17,7 +17,7 @@ dependencies.append(contentsOf: [
let package = Package(
name: "Account",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "Account",

View File

@@ -1,9 +1,9 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
import PackageDescription
let package = Package(
name: "Articles",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "Articles",

View File

@@ -1,17 +1,17 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/Ranchero-Software/RSDatabase.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/Ranchero-Software/RSParser.git", .upToNextMajor(from: "2.0.2")),
]
#if swift(>=5.6)
dependencies.append(contentsOf: [
.package(path: "../Articles"),
.package(path: "../RSCore"),
.package(path: "../RSParser"),
])
#else
dependencies.append(contentsOf: [
@@ -21,7 +21,7 @@ dependencies.append(contentsOf: [
let package = Package(
name: "ArticlesDatabase",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "ArticlesDatabase",

View File

@@ -1,21 +0,0 @@
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "Core",
platforms: [.macOS(.v13), .iOS(.v16)],
products: [
.library(
name: "Core",
targets: ["Core"]),
],
targets: [
.target(
name: "Core"),
.testTarget(
name: "CoreTests",
dependencies: ["Core"]
),
]
)

View File

@@ -1,37 +0,0 @@
//
// Date+Extensions.swift
// RSCore
//
// Created by Brent Simmons on 6/21/16.
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
//
import Foundation
public extension Date {
// Below are for rough use only they don't use the calendar.
func bySubtracting(days: Int) -> Date {
return addingTimeInterval(0.0 - TimeInterval(days: days))
}
func bySubtracting(hours: Int) -> Date {
return addingTimeInterval(0.0 - TimeInterval(hours: hours))
}
func byAdding(days: Int) -> Date {
return addingTimeInterval(TimeInterval(days: days))
}
}
public extension TimeInterval {
init(days: Int) {
self.init(days * 24 * 60 * 60)
}
init(hours: Int) {
self.init(hours * 60 * 60)
}
}

View File

@@ -1,12 +0,0 @@
import XCTest
@testable import Core
final class CoreTests: XCTestCase {
func testExample() throws {
// XCTest Documentation
// https://developer.apple.com/documentation/xctest
// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
}
}

View File

@@ -738,7 +738,6 @@
8405DDA122168920008CE1BF /* TimelineTableView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TimelineTableView.xib; sourceTree = "<group>"; };
8405DDA422168C62008CE1BF /* TimelineContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineContainerViewController.swift; sourceTree = "<group>"; };
840BEE4021D70E64009BBAFA /* CrashReportWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportWindowController.swift; sourceTree = "<group>"; };
840C544F2D0C9A4A00A240DB /* Core */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Core; sourceTree = "<group>"; };
840D617C2029031C009BC708 /* NetNewsWire.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetNewsWire.app; sourceTree = BUILT_PRODUCTS_DIR; };
840D61952029031D009BC708 /* NetNewsWire_iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetNewsWire_iOSTests.swift; sourceTree = "<group>"; };
840D61972029031D009BC708 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -1537,7 +1536,6 @@
8424B3162DB73D320053AA11 /* RSParser */,
843E2F152CF2B43700ED170F /* RSWeb */,
848E84CB2DB749300023F3BA /* RSCore */,
840C544F2D0C9A4A00A240DB /* Core */,
);
sourceTree = "<group>";
usesTabs = 1;

View File

@@ -17,6 +17,27 @@
}
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:RSWeb",
"identifier" : "RSWebTests",
"name" : "RSWebTests"
}
},
{
"target" : {
"containerPath" : "container:",
"identifier" : "RSCoreTests",
"name" : "RSCoreTests"
}
},
{
"target" : {
"containerPath" : "container:Account",
"identifier" : "AccountTests",
"name" : "AccountTests"
}
},
{
"skippedTests" : [
"ScriptingTests\/testFeedOPML()"
@@ -27,33 +48,12 @@
"name" : "NetNewsWireTests"
}
},
{
"target" : {
"containerPath" : "container:Account",
"identifier" : "AccountTests",
"name" : "AccountTests"
}
},
{
"target" : {
"containerPath" : "container:RSParser",
"identifier" : "RSParserTests",
"name" : "RSParserTests"
}
},
{
"target" : {
"containerPath" : "container:RSWeb",
"identifier" : "RSWebTests",
"name" : "RSWebTests"
}
},
{
"target" : {
"containerPath" : "container:Core",
"identifier" : "CoreTests",
"name" : "CoreTests"
}
}
],
"version" : 1

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@@ -1,13 +1,12 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swift-tools-version:5.10
import PackageDescription
let package = Package(
name: "RSCore",
platforms: [.macOS(SupportedPlatform.MacOSVersion.v10_15), .iOS(SupportedPlatform.IOSVersion.v13)],
products: [
.library(name: "RSCore", type: .dynamic, targets: ["RSCore"]),
name: "RSCore",
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(name: "RSCore", type: .dynamic, targets: ["RSCore"]),
.library(name: "RSCoreObjC", type: .dynamic, targets: ["RSCoreObjC"]),
.library(name: "RSCoreResources", type: .static, targets: ["RSCoreResources"])
],
@@ -19,8 +18,12 @@ let package = Package(
name: "RSCoreObjC",
dependencies: [],
cSettings: [
.headerSearchPath("include")
]
.headerSearchPath("include"),
.unsafeFlags(["-fprofile-instr-generate", "-fcoverage-mapping"])
],
linkerSettings: [
.unsafeFlags(["-fprofile-instr-generate"])
]
),
.target(
name: "RSCoreResources",

View File

@@ -16,14 +16,22 @@ public extension Date {
return addingTimeInterval(0.0 - TimeInterval(days: days))
}
func bySubtracting(hours: Int) -> Date {
return addingTimeInterval(0.0 - TimeInterval(hours: hours))
}
func byAdding(days: Int) -> Date {
return addingTimeInterval(TimeInterval(days: days))
}
}
private extension TimeInterval {
public extension TimeInterval {
init(days: Int) {
self.init(days * 24 * 60 * 60)
}
init(hours: Int) {
self.init(hours * 60 * 60)
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@@ -1,11 +1,10 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swift-tools-version:5.10
import PackageDescription
let package = Package(
name: "RSParser",
platforms: [.macOS(SupportedPlatform.MacOSVersion.v10_15), .iOS(SupportedPlatform.IOSVersion.v13)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(

View File

@@ -1,10 +1,10 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
import PackageDescription
let package = Package(
name: "RSWeb",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "RSWeb",
@@ -12,15 +12,15 @@ let package = Package(
targets: ["RSWeb"]),
],
dependencies: [
.package(url: "https://github.com/Ranchero-Software/RSParser.git", .upToNextMinor(from: "2.0.2")),
.package(path: "../Core")
.package(path: "../RSParser"),
.package(path: "../RSCore")
],
targets: [
.target(
name: "RSWeb",
dependencies: [
"RSParser",
"Core"
"RSCore"
],
resources: [.copy("UTS46/uts46")],
swiftSettings: [.define("SWIFT_PACKAGE")]),
@@ -29,7 +29,7 @@ let package = Package(
dependencies: [
"RSWeb",
"RSParser",
"Core"
"RSCore"
]),
]
)

View File

@@ -6,7 +6,7 @@
//
import Foundation
import Core
import RSCore
@preconcurrency import RSParser
public extension Notification.Name {

View File

@@ -1,9 +1,9 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
import PackageDescription
let package = Package(
name: "Secrets",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "Secrets",

View File

@@ -11,7 +11,6 @@ import Account
import RSCore
import RSWeb
import RSParser
import Core
extension Notification.Name {

View File

@@ -10,7 +10,7 @@ import Foundation
import os.log
import RSCore
import RSWeb
import Core
import RSCore
extension Notification.Name {

View File

@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.10
import PackageDescription
var dependencies: [Package.Dependency] = [
@@ -18,7 +18,7 @@ dependencies.append(contentsOf: [
let package = Package(
name: "SyncDatabase",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v13), .iOS(.v17)],
products: [
.library(
name: "SyncDatabase",

44
quiet_build_and_test.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
set -euo pipefail
# This script is for checking that both Mac and iOS targets build and that tests pass.
# Note: depends on xcbeautify: <https://github.com/cpisciotta/xcbeautify>
# === CONFIGURABLE VARIABLES ===
PROJECT_PATH="NetNewsWire.xcodeproj"
SCHEME_MAC="NetNewsWire"
SCHEME_IOS="NetNewsWire-iOS"
DESTINATION_MAC="platform=macOS,arch=arm64"
DESTINATION_IOS="platform=iOS Simulator,name=iPhone 16"
echo "🛠 Building macOS target..."
xcodebuild \
-project "$PROJECT_PATH" \
-scheme "$SCHEME_MAC" \
-destination "$DESTINATION_MAC" \
clean build | xcbeautify --quiet
echo "🛠 Building iOS target..."
xcodebuild \
-project "$PROJECT_PATH" \
-scheme "$SCHEME_IOS" \
-destination "$DESTINATION_IOS" \
clean build | xcbeautify --quiet
echo "✅ Builds completed."
echo "🧪 Running tests for macOS target..."
xcodebuild \
-project "$PROJECT_PATH" \
-scheme "$SCHEME_MAC" \
-destination "$DESTINATION_MAC" \
test | xcbeautify --quiet
echo "🧪 Running tests for iOS target..."
xcodebuild \
-project "$PROJECT_PATH" \
-scheme "$SCHEME_IOS" \
-destination "$DESTINATION_IOS" \
test | xcbeautify --quiet
echo "🎉 All builds and tests completed successfully."