Skip to content

Commit 3c46168

Browse files
meatball133BNAndrasdependabot[bot]shaver
authored
Update generator to swift 6.0 (#782)
* Update generator to swift 6.0 * Use beta versio * Update to use swift 6 formatter * Remove macos version mention * Set minimum macOS version to 12 in Package.swift * Sync branch (#809) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@692973e...d632683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@d632683...11bd719) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: András B Nagy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver <[email protected]> * Remove uneeded import * Sync (#813) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@692973e...d632683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@d632683...11bd719) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 * Remove obsolete LinuxMain.swift and XCTestManifests.swift files from various exercises (#812) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: András B Nagy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver <[email protected]> * Sync (#815) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@692973e...d632683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@d632683...11bd719) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 * Remove obsolete LinuxMain.swift and XCTestManifests.swift files from various exercises (#812) * Remove redundant test cases from MagicianInTrainingTests (#814) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: András B Nagy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: András B Nagy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver <[email protected]>
1 parent 4394b31 commit 3c46168

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Run tests
1919
run: swift test
2020
generator-tests:
21-
runs-on: macos-13
21+
runs-on: macos-15
2222
env:
2323
RUNALL: "true"
2424
steps:
@@ -28,7 +28,7 @@ jobs:
2828
- name: Run tests
2929
run: swift test --package-path ./generator
3030
generator-template-tests:
31-
runs-on: macos-13
31+
runs-on: macos-15
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:6.0
22

33
import PackageDescription
44
import Foundation

generator/Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import PackageDescription
66
let package = Package(
77
name: "Generator",
88
platforms: [
9-
.macOS(.v10_15) // Set the minimum macOS version to 10.15 or any version greater than 10.15.
9+
.macOS(.v12) // Set the minimum macOS version to 10.15 or any version greater than 10.15.
1010
],
1111
dependencies: [
1212
.package(url: "https://github.com/stencilproject/Stencil.git", from: "0.15.1"),
1313
.package(url: "https://github.com/LebJe/TOMLKit.git", from: "0.5.5"),
14-
.package(url: "https://github.com/apple/swift-format", from: "508.0.1"),
14+
.package(url: "https://github.com/apple/swift-format", from: "600.0.0"),
1515
],
1616
targets: [
1717
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

generator/Sources/Generator/generator-help.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GeneratorHelp {
2525
} catch {
2626
throw GeneratorError.remoteError("No remote file found")
2727
}
28-
let data = try String(contentsOf: url) ?? ""
28+
let data = try String(contentsOf: url, encoding: .utf8)
2929
let fileData = Data(data.utf8)
3030
json = try JSONSerialization.jsonObject(with: fileData, options: []) as? [String: Any] ?? [:]
3131
}

generator/Sources/Generator/main.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Foundation
22
import Stencil
33
import SwiftFormat
4-
import SwiftFormatConfiguration
54

65
enum GeneratorError: Error {
76
case invalidArgumentCount
@@ -42,7 +41,7 @@ class Generator {
4241
var text = ""
4342
let configuration = Configuration()
4443
let swiftFormat = SwiftFormatter(configuration: configuration)
45-
try swiftFormat.format(source: template, assumingFileURL: nil, to: &text)
44+
try swiftFormat.format(source: template, assumingFileURL: nil, selection: .infinite, to: &text)
4645
try text.write(toFile: path, atomically: true, encoding: .utf8)
4746
}
4847

Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
import XCTest
1+
import Testing
22
@testable import Generator
33

4-
class GeneratorTests: XCTestCase {
5-
func testAllTestsIncluded() {
6-
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-tests-included")
7-
XCTAssertNoThrow(try generatorHelp.toml())
8-
let expected = ["1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce", "3549048d-1a6e-4653-9a79-b0bda163e8d5", "b4c6dbb8-b4fb-42c2-bafd-10785abe7709"]
9-
XCTAssertEqual(generatorHelp.uuids, expected)
10-
}
4+
@Test("Testing having all tests be included")
5+
func testAllTestsIncluded() {
6+
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-tests-included")
7+
#expect(throws: Never.self) {try generatorHelp.toml()}
8+
let expected = ["1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce", "3549048d-1a6e-4653-9a79-b0bda163e8d5", "b4c6dbb8-b4fb-42c2-bafd-10785abe7709"]
9+
#expect(generatorHelp.uuids == expected)
10+
}
1111

12-
func testAllTestsRemoved() {
13-
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-test-removed")
14-
XCTAssertNoThrow(try generatorHelp.toml())
15-
let expected: [String] = []
16-
XCTAssertEqual(generatorHelp.uuids, expected)
17-
}
12+
@Test("Testing having all tests be removed")
13+
func testAllTestsRemoved() {
14+
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-test-removed")
15+
#expect(throws: Never.self) {try generatorHelp.toml()}
16+
let expected: [String] = []
17+
#expect(generatorHelp.uuids == expected)
18+
}
1819

19-
func testTwoTestsRemoved() {
20-
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/two-tests-removed")
21-
XCTAssertNoThrow(try generatorHelp.toml())
22-
let expected = ["b4c6dbb8-b4fb-42c2-bafd-10785abe7709"]
23-
XCTAssertEqual(generatorHelp.uuids, expected)
24-
}
20+
@Test("Testing having two tests be removed")
21+
func testTwoTestsRemoved() {
22+
let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/two-tests-removed")
23+
#expect(throws: Never.self) {try generatorHelp.toml()}
24+
let expected = ["b4c6dbb8-b4fb-42c2-bafd-10785abe7709"]
25+
#expect(generatorHelp.uuids == expected)
2526
}

0 commit comments

Comments
 (0)