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: matrix:
include: include:
- { toolchain: wasm-5.6.0-RELEASE } - { toolchain: wasm-5.6.0-RELEASE }
- { toolchain: wasm-5.7-SNAPSHOT-2022-06-01-a } - { toolchain: wasm-5.7-SNAPSHOT-2022-07-27-a }
- { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-06-23-a } - { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-07-23-a }
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -85,7 +85,7 @@ jobs:
shell: bash shell: bash
run: | run: |
set -ex 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 brew install gtk+3
@ -94,7 +94,7 @@ jobs:
gtk_ubuntu_18_04_build: gtk_ubuntu_18_04_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: swiftlang/swift:nightly-bionic image: swiftlang/swift:nightly-5.7-bionic
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -109,7 +109,7 @@ jobs:
gtk_ubuntu_20_04_build: gtk_ubuntu_20_04_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: swiftlang/swift:nightly-focal image: swiftlang/swift:nightly-5.7-focal
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -8,26 +8,26 @@ on:
jobs: jobs:
codecov: codecov:
container: container:
image: swiftlang/swift:nightly-focal image: swiftlang/swift:nightly-5.7-focal
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0 - run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0
- name: Checkout Branch - name: Checkout Branch
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Build Test Target - name: Build Test Target
run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
- name: Run Tests - name: Run Tests
run: swift test --enable-code-coverage --skip-build run: swift test --enable-code-coverage --skip-build
- name: Generate Branch Coverage Report - name: Generate Branch Coverage Report
uses: mattpolzin/swift-codecov-action@0.7.1 uses: mattpolzin/swift-codecov-action@0.7.1
id: cov id: cov
with: with:
MINIMUM_COVERAGE: 15 MINIMUM_COVERAGE: 15
- name: Post Positive Results - name: Post Positive Results
if: ${{ success() }} if: ${{ success() }}
run: | 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 }}%)." 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 - name: Post Negative Results
if: ${{ failure() }} if: ${{ failure() }}
run: | 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 }}%)." 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 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) @_spi(TokamakCore)
extension HStack: StackLayout { extension HStack: StackLayout {
public static var orientation: Axis { .horizontal } public static var orientation: Axis { .horizontal }
public var _alignment: Alignment { .init(horizontal: .center, vertical: alignment) } 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() self.content = content()
} }
var listStack: some View { func stackContent() -> AnyView {
VStack(alignment: .leading, spacing: 0) { () -> AnyView in if let contentContainer = content as? ParentView {
if let contentContainer = content as? ParentView { var sections = [AnyView]()
var sections = [AnyView]() var currentSection = [AnyView]()
var currentSection = [AnyView]() for child in contentContainer.children {
for child in contentContainer.children { if child.view is SectionView {
if child.view is SectionView { if currentSection.count > 0 {
if currentSection.count > 0 { sections.append(AnyView(Section {
sections.append(AnyView(Section { ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view }
ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view } }))
})) currentSection = []
currentSection = [] }
} sections.append(child)
sections.append(child) } else {
if child.children.count > 0 {
currentSection.append(contentsOf: child.children)
} else { } else {
if child.children.count > 0 { currentSection.append(child)
currentSection.append(contentsOf: child.children)
} else {
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) @_spi(TokamakCore)
public var body: some View { public var body: some View {
if let style = style as? ListStyleDeferredToRenderer { if let style = style as? ListStyleDeferredToRenderer {