Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reconciler stress tests for elaborate testing #381

Merged
merged 8 commits into from
Jun 15, 2021
30 changes: 18 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,14 @@ let package = Package(
// a module or a test suite.
// Targets can depend on other targets in this package, and on products
// in packages which this package depends on.
.target(
name: "CombineShim",
dependencies: [.product(
name: "OpenCombine",
package: "OpenCombine",
condition: .when(platforms: [.wasi, .linux])
)]
),
.target(
name: "TokamakCore",
dependencies: ["CombineShim"]
dependencies: [
.product(
name: "OpenCombineShim",
package: "OpenCombine"
),
]
),
.target(
name: "TokamakShim",
Expand Down Expand Up @@ -105,7 +102,13 @@ let package = Package(
),
.target(
name: "TokamakGTK",
dependencies: ["TokamakCore", "CGTK", "CGDK", "TokamakGTKCHelpers", "CombineShim"]
dependencies: [
"TokamakCore", "CGTK", "CGDK", "TokamakGTKCHelpers",
.product(
name: "OpenCombineShim",
package: "OpenCombine"
),
]
),
.target(
name: "TokamakGTKDemo",
Expand Down Expand Up @@ -135,15 +138,18 @@ let package = Package(
.target(
name: "TokamakDOM",
dependencies: [
"CombineShim",
"OpenCombineJS",
"TokamakCore",
"TokamakStaticHTML",
.product(
name: "OpenCombineShim",
package: "OpenCombine"
),
.product(
name: "JavaScriptKit",
package: "JavaScriptKit",
condition: .when(platforms: [.wasi])
),
"OpenCombineJS",
]
),
.target(
Expand Down
2 changes: 1 addition & 1 deletion Sources/TokamakCore/App/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/16/20.
//

import CombineShim
import OpenCombineShim

/// Provides the ability to set the title of the Scene.
public protocol _TitledApp {
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/App/AppStorage.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/16/20.
//

import CombineShim
import OpenCombineShim

@propertyWrapper public struct AppStorage<Value>: DynamicProperty {
let provider: _StorageProvider?
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/App/Scenes/SceneStorage.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/17/20.
//

import CombineShim
import OpenCombineShim

/// The renderer must specify a default `_StorageProvider` before any `SceneStorage`
/// values are accessed.
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/App/_AnyApp.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/19/20.
//

import CombineShim
import OpenCombineShim

public struct _AnyApp: App {
var app: Any
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/App/_StorageProvider.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/22/20.
//

import CombineShim
import OpenCombineShim

public protocol _StorageProvider {
func store(key: String, value: Bool?)
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/Environment/EnvironmentObject.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/7/20.
//

import CombineShim
import OpenCombineShim

@propertyWrapper public struct EnvironmentObject<ObjectType>: DynamicProperty
where ObjectType: ObservableObject
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/Environment/EnvironmentValues.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CombineShim
import OpenCombineShim

public struct EnvironmentValues: CustomStringConvertible {
public var description: String {
Expand Down
2 changes: 1 addition & 1 deletion Sources/TokamakCore/MountedViews/MountedApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/19/20.
//

import CombineShim
import OpenCombineShim

// This is very similar to `MountedCompositeView`. However, the `mountedBody`
// is the computed content of the specified `Scene`, instead of having child
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2020 Tokamak contributors
// Copyright 2018-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/19/20.
//

import CombineShim
import OpenCombineShim

class MountedCompositeElement<R: Renderer>: MountedElement<R> {
let parentTarget: R.TargetType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created by Max Desiatov on 03/12/2018.
//

import CombineShim
import OpenCombineShim

final class MountedCompositeView<R: Renderer>: MountedCompositeElement<R> {
override func mount(
Expand Down
3 changes: 1 addition & 2 deletions Sources/TokamakCore/Reflection/Layouts/FieldDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func _getTypeByMangledNameInContext(
_ nameLength: UInt,
_ genericContext: UnsafeRawPointer?,
_ genericArguments: UnsafeRawPointer?
)
-> Any.Type?
) -> Any.Type?

/// https://github.com/apple/swift/blob/f2c42509628bed66bf5b8ee02fae778a2ba747a1/include/swift/Reflection/Records.h#L160
struct FieldDescriptor {
Expand Down
2 changes: 1 addition & 1 deletion Sources/TokamakCore/StackReconciler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created by Max Desiatov on 28/11/2018.
//

import CombineShim
import OpenCombineShim

/** A class that reconciles a "raw" tree of element values (such as `App`, `Scene` and `View`,
all coming from `body` or `renderedBody` properties) with a tree of mounted element instances
Expand Down
8 changes: 4 additions & 4 deletions Sources/TokamakCore/State/ObservedObject.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CombineShim
import OpenCombineShim

public typealias ObservableObject = CombineShim.ObservableObject
public typealias Published = CombineShim.Published
public typealias ObservableObject = OpenCombineShim.ObservableObject
public typealias Published = OpenCombineShim.Published

protocol ObservedProperty: DynamicProperty {
var objectWillChange: AnyPublisher<(), Never> { get }
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/State/StateObject.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CombineShim
import OpenCombineShim

@propertyWrapper
public struct StateObject<ObjectType: ObservableObject>: DynamicProperty {
Expand Down
1 change: 0 additions & 1 deletion Sources/TokamakCore/Views/Containers/List/List+Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public extension List {

init<Data, ID, RowContent>(
_ data: Data,

id: KeyPath<Data.Element, ID>,
selection: Binding<Set<SelectionValue>>?,
@ViewBuilder rowContent: @escaping (Data.Element) -> RowContent
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/App/App.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,8 @@
// Created by Carson Katri on 7/16/20.
//

import CombineShim
import JavaScriptKit
import OpenCombineShim
import TokamakCore
import TokamakStaticHTML

Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/App/ColorSchemeObserver.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CombineShim
import JavaScriptKit
import OpenCombineShim

enum ColorSchemeObserver {
static var publisher = CurrentValueSubject<ColorScheme, Never>(
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/App/ScenePhaseObserver.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CombineShim
import JavaScriptKit
import OpenCombineShim

enum ScenePhaseObserver {
static var publisher = CurrentValueSubject<ScenePhase, Never>(.active)
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/Storage/LocalStorage.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,8 @@
// Created by Carson Katri on 7/20/20.
//

import CombineShim
import JavaScriptKit
import OpenCombineShim
import TokamakCore

private let rootPublisher = ObservableObjectPublisher()
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/Storage/SessionStorage.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,8 @@
// Created by Carson Katri on 7/20/20.
//

import CombineShim
import JavaScriptKit
import OpenCombineShim
import TokamakCore

private let sessionStorage = JSObject.global.sessionStorage.object!
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakDOM/Storage/WebStorage.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,8 @@
// Created by Carson Katri on 7/21/20.
//

import CombineShim
import JavaScriptKit
import OpenCombineShim
import TokamakCore

protocol WebStorage {
Expand Down
6 changes: 3 additions & 3 deletions Sources/TokamakDemo/ButtonStyleDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public struct ButtonStyleDemo: View {
Text("Label").padding(.leading, 5)
}
})
.buttonStyle(
PressedButtonStyle(pressedColor: Color.red)
)
.buttonStyle(
PressedButtonStyle(pressedColor: Color.red)
)
}
}
}
4 changes: 2 additions & 2 deletions Sources/TokamakGTK/App/App.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,8 @@
//

import CGTK
import CombineShim
import Dispatch
import OpenCombineShim
import TokamakCore

public extension App {
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakStaticHTML/App.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tokamak contributors
// Copyright 2020-2021 Tokamak contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/31/20.
//

import CombineShim
import OpenCombineShim
import TokamakCore

public extension App {
Expand Down
Loading