Skip to content

Commit

Permalink
update to xcode 15 / swift 5.9 (#732)
Browse files Browse the repository at this point in the history
* update workflows to use xcode 15

Signed-off-by: weak <[email protected]>

* fix build issues and warnings

Signed-off-by: weak <[email protected]>

* switch to swift 5.9

Signed-off-by: weak <[email protected]>

* remove orphaned references and update fastlane

Signed-off-by: weak <[email protected]>

---------

Signed-off-by: weak <[email protected]>
  • Loading branch information
weakfl authored Oct 17, 2023
1 parent af193f6 commit 20947ad
Show file tree
Hide file tree
Showing 65 changed files with 362 additions and 418 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ on:

jobs:
build_and_deploy:
runs-on: macos-12
runs-on: macos-13

steps:
- uses: maxim-lobanov/setup-xcode@v1.5.1
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
build_and_test:
runs-on: macos-12
runs-on: macos-13
if: ${{ github.event.pull_request.draft == false }}
steps:
- uses: maxim-lobanov/setup-xcode@v1.5.1
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7
5.9
5 changes: 3 additions & 2 deletions .swiftformat → BuildTools/.swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# file options
--exclude ./fastlane
--exclude ./OpenHABCore/.build
--exclude ../fastlane
--exclude ../OpenHABCore/.build
--exclude ./build
--symlinks ignore

# disabled rules
Expand Down
9 changes: 4 additions & 5 deletions .swiftlint.yml → BuildTools/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ opt_in_rules:
- trailing_closure
- implicit_return
- multiline_function_chains
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- reduce_boolean
Expand All @@ -26,10 +24,11 @@ disabled_rules: # rule identifiers to exclude from running
- todo

included:
- ./
- ../
excluded:
- ./fastlane
- ./OpenHABCore/.build
- ../fastlane
- ../OpenHABCore/.build
- .build

nesting:
type_level: 2
Expand Down
10 changes: 10 additions & 0 deletions BuildTools/Empty.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0
//
// SPDX-License-Identifier: EPL-2.0
23 changes: 23 additions & 0 deletions BuildTools/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"pins" : [
{
"identity" : "swiftformatplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/weakfl/SwiftFormatPlugin",
"state" : {
"revision" : "115b875683a00fc3a3876e6fac82d63c4bddcc43",
"version" : "0.52.7"
}
},
{
"identity" : "swiftlintplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/weakfl/SwiftLintPlugin.git",
"state" : {
"revision" : "6e1d5fe55dae1c0514f006b50b3265c9b5398fa7",
"version" : "0.53.0"
}
}
],
"version" : 2
}
17 changes: 17 additions & 0 deletions BuildTools/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// swift-tools-version:5.8
import PackageDescription

let package = Package(
name: "BuildTools",
platforms: [.macOS(.v10_13)],
dependencies: [
.package(url: "https://github.com/weakfl/SwiftFormatPlugin", exact: "0.52.7"),
.package(url: "https://github.com/weakfl/SwiftLintPlugin.git", exact: "0.53.0")
],
targets: [
.target(
name: "BuildTools",
path: ""
)
]
)
87 changes: 43 additions & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
CFPropertyList (3.0.6)
rexml
addressable (2.8.1)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.660.0)
aws-sdk-core (3.167.0)
aws-partitions (1.836.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.59.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (1.72.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.117.1)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.5.2)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
Expand All @@ -30,14 +30,14 @@ GEM
commander (4.6.0)
highline (~> 2.0.0)
declarative (0.0.20)
digest-crc (0.6.4)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.94.0)
faraday (1.10.2)
excon (0.104.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
Expand Down Expand Up @@ -65,8 +65,8 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.211.0)
fastimage (2.2.7)
fastlane (2.216.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -87,18 +87,19 @@ GEM
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
Expand All @@ -108,9 +109,9 @@ GEM
fastlane-plugin-changelog (0.16.0)
fastlane-plugin-versioning (0.5.1)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.31.0)
google-apis-core (>= 0.9.1, < 2.a)
google-apis-core (0.9.1)
google-apis-androidpublisher_v3 (0.51.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -119,18 +120,18 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.16.0)
google-apis-core (>= 0.9.1, < 2.a)
google-apis-playcustomapp_v1 (0.12.0)
google-apis-core (>= 0.9.1, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.19.0)
google-apis-core (>= 0.9.0, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.44.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
Expand All @@ -139,53 +140,51 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.3.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.1)
json (2.6.2)
jwt (2.5.0)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.2)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.1)
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.0.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
naturally (2.2.1)
optparse (0.1.1)
os (1.1.4)
plist (3.6.0)
public_suffix (5.0.0)
plist (3.7.0)
public_suffix (5.0.3)
rake (13.0.6)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.17.0)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
simctl (1.6.10)
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -195,10 +194,10 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
4 changes: 2 additions & 2 deletions OpenHABCore/Sources/OpenHABCore/Model/NumberState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public struct NumberState: CustomStringConvertible, Equatable {

private func getActualValue() -> NSNumber {
if format?.contains("%d") == true {
return NSNumber(value: Int(value))
NSNumber(value: Int(value))
} else {
return NSNumber(value: value)
NSNumber(value: value)
}
}
}
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class OpenHABItem: NSObject, CommItem {
public init(name: String, type: String, state: String?, link: String, label: String?, groupType: String?, stateDescription: OpenHABStateDescription?, members: [OpenHABItem], category: String?, options: [OpenHABOptions]?) {
self.name = name
self.type = type.toItemType()
if let state, (state == "NULL" || state == "UNDEF" || state.caseInsensitiveCompare("undefined") == .orderedSame) {
if let state, state == "NULL" || state == "UNDEF" || state.caseInsensitiveCompare("undefined") == .orderedSame {
self.state = nil
} else {
self.state = state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public class OpenHABServerProperties: Decodable {

public func linkUrl(byType type: String?) -> String? {
if let index = links.firstIndex(where: { $0.type == type }) {
return links[index].url
links[index].url
} else {
return nil
nil
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ public class OpenHABSitemapPage: NSObject {

public extension OpenHABSitemapPage {
func filter(_ isIncluded: (OpenHABWidget) throws -> Bool) rethrows -> OpenHABSitemapPage {
let filteredOpenHABSitemapPage = OpenHABSitemapPage(
let filteredOpenHABSitemapPage = try OpenHABSitemapPage(
pageId: pageId,
title: title,
link: link,
leaf: leaf,
expandedWidgets: try widgets.filter(isIncluded)
expandedWidgets: widgets.filter(isIncluded)
)
return filteredOpenHABSitemapPage
}
Expand Down
6 changes: 3 additions & 3 deletions OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {

public var mappingsOrItemOptions: [OpenHABWidgetMapping] {
if mappings.isEmpty, let itemOptions = item?.stateDescription?.options {
return itemOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
itemOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
} else {
return mappings
mappings
}
}

Expand Down Expand Up @@ -329,10 +329,10 @@ public extension OpenHABWidget {
}
}

// swiftlint:disable line_length
extension OpenHABWidget.CodingData {
var openHABWidget: OpenHABWidget {
let mappedWidgets = widgets.map(\.openHABWidget)
// swiftlint:disable:next line_length
return OpenHABWidget(widgetId: widgetId, label: label, icon: icon, type: type, url: url, period: period, minValue: minValue, maxValue: maxValue, step: step, refresh: refresh, height: height, isLeaf: isLeaf, iconColor: iconcolor, labelColor: labelcolor, valueColor: valuecolor, service: service, state: state, text: text, legend: legend, encoding: encoding, item: item?.openHABItem, linkedPage: linkedPage, mappings: mappings, widgets: mappedWidgets, visibility: visibility, switchSupport: switchSupport, forceAsItem: forceAsItem)
}
}
Expand Down
Loading

0 comments on commit 20947ad

Please sign in to comment.