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

* Use Swift 5.7 nightly on CI to fix build issues

* Update SwiftWasm snapshots

* Remove initializers that became ambiguous in 5.7
This commit is contained in:
Max Desiatov 2022-07-30 11:26:20 +02:00 committed by GitHub
parent 10d9d32b97
commit 687baee97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 81 deletions

View File

@ -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
@ -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
@ -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
@ -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

View File

@ -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 }}%)."

View File

@ -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()
}
}

View File

@ -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)
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 = []
}
sections.append(child)
} else {
if child.children.count > 0 {
currentSection.append(contentsOf: child.children)
} else {
if child.children.count > 0 {
currentSection.append(contentsOf: child.children)
} else {
currentSection.append(child)
}
currentSection.append(child)
}
}
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)
}
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 {