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

Use Swift 5.7 nightly on CI, fix build issues #507

Merged
merged 3 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
matrix:
include:
- { toolchain: wasm-5.6.0-RELEASE }
- { toolchain: wasm-5.7-SNAPSHOT-2022-06-01-a }
- { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-06-23-a }
- { toolchain: wasm-5.7-SNAPSHOT-2022-07-27-a }
- { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-07-23-a }

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_13.4.app/Contents/Developer/
sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer/

brew install gtk+3

Expand All @@ -94,7 +94,7 @@ jobs:
gtk_ubuntu_18_04_build:
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-bionic
image: swiftlang/swift:nightly-5.7-bionic

steps:
- uses: actions/checkout@v2
Expand All @@ -109,7 +109,7 @@ jobs:
gtk_ubuntu_20_04_build:
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-focal
image: swiftlang/swift:nightly-5.7-focal

steps:
- uses: actions/checkout@v2
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ on:
jobs:
codecov:
container:
image: swiftlang/swift:nightly-focal
image: swiftlang/swift:nightly-5.7-focal
runs-on: ubuntu-latest
steps:
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0
- name: Checkout Branch
uses: actions/checkout@v2
- name: Build Test Target
run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
- name: Run Tests
run: swift test --enable-code-coverage --skip-build
- name: Generate Branch Coverage Report
uses: mattpolzin/swift-codecov-action@0.7.1
id: cov
with:
MINIMUM_COVERAGE: 15
- name: Post Positive Results
if: ${{ success() }}
run: |
echo "::warning file=Package.swift,line=1,col=1::The current code coverage percentage is passing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)."
- name: Post Negative Results
if: ${{ failure() }}
run: |
echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)."
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0
- name: Checkout Branch
uses: actions/checkout@v2
- name: Build Test Target
run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
- name: Run Tests
run: swift test --enable-code-coverage --skip-build
- name: Generate Branch Coverage Report
uses: mattpolzin/swift-codecov-action@0.7.1
id: cov
with:
MINIMUM_COVERAGE: 15
- name: Post Positive Results
if: ${{ success() }}
run: |
echo "::warning file=Package.swift,line=1,col=1::The current code coverage percentage is passing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)."
- name: Post Negative Results
if: ${{ failure() }}
run: |
echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)."
22 changes: 0 additions & 22 deletions Sources/TokamakCore/Fiber/Layout/StackLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,30 +261,8 @@ extension VStack: StackLayout {
public var _alignment: Alignment { .init(horizontal: alignment, vertical: .center) }
}

public extension VStack where Content == EmptyView {
init(
alignment: HorizontalAlignment = .center,
spacing: CGFloat? = nil
) {
self.alignment = alignment
self.spacing = spacing
content = EmptyView()
}
}

@_spi(TokamakCore)
extension HStack: StackLayout {
public static var orientation: Axis { .horizontal }
public var _alignment: Alignment { .init(horizontal: .center, vertical: alignment) }
}

public extension HStack where Content == EmptyView {
init(
alignment: VerticalAlignment = .center,
spacing: CGFloat? = nil
) {
self.alignment = alignment
self.spacing = spacing
content = EmptyView()
}
}
68 changes: 35 additions & 33 deletions Sources/TokamakCore/Views/Containers/List/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,48 @@ public struct List<SelectionValue, Content>: View
self.content = content()
}

var listStack: some View {
VStack(alignment: .leading, spacing: 0) { () -> AnyView in
if let contentContainer = content as? ParentView {
var sections = [AnyView]()
var currentSection = [AnyView]()
for child in contentContainer.children {
if child.view is SectionView {
if currentSection.count > 0 {
sections.append(AnyView(Section {
ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view }
}))
currentSection = []
}
sections.append(child)
} else {
if child.children.count > 0 {
currentSection.append(contentsOf: child.children)
} else {
currentSection.append(child)
}
func stackContent() -> AnyView {
if let contentContainer = content as? ParentView {
var sections = [AnyView]()
var currentSection = [AnyView]()
for child in contentContainer.children {
if child.view is SectionView {
if currentSection.count > 0 {
sections.append(AnyView(Section {
ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view }
}))
currentSection = []
}
}
if currentSection.count > 0 {
sections.append(AnyView(Section {
ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view }
}))
}
return AnyView(_ListRow.buildItems(sections) { view, isLast in
if let section = view.view as? SectionView {
section.listRow(style)
sections.append(child)
} else {
if child.children.count > 0 {
currentSection.append(contentsOf: child.children)
} else {
_ListRow.listRow(view, style, isLast: isLast)
currentSection.append(child)
}
})
} else {
return AnyView(content)
}
}
if currentSection.count > 0 {
sections.append(AnyView(Section {
ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view }
}))
}
return AnyView(_ListRow.buildItems(sections) { view, isLast in
if let section = view.view as? SectionView {
section.listRow(style)
} else {
_ListRow.listRow(view, style, isLast: isLast)
}
})
} else {
return AnyView(content)
}
}

var listStack: some View {
VStack(alignment: .leading, spacing: 0, content: stackContent)
}

@_spi(TokamakCore)
public var body: some View {
if let style = style as? ListStyleDeferredToRenderer {
Expand Down