Skip to content

Commit

Permalink
Merge pull request #1 from SideStore/feature/swiftall
Browse files Browse the repository at this point in the history
Convert to full swift
  • Loading branch information
lonkelle authored Feb 25, 2023
2 parents 0143ec2 + bf65f98 commit 7ea34a0
Show file tree
Hide file tree
Showing 33 changed files with 1,226 additions and 1,040 deletions.
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CODEOWNERS
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# https://help.github.com/en/articles/about-code-owners

# These owners will be the default owners for everything in the repo.
* @JoeMatt
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [JoeMatt] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: provenanceemu # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
26 changes: 26 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- JoeMatt

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

# A list of assignees, overrides reviewers if set
# assignees:

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
numberOfAssignees: 1

# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip
- WIP
33 changes: 33 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
ℹ We use Github issues for bug reports, feature requests, general support, and questions about the library.
Please fill out this template when filing an issue.
-->

## What did you do?

<!-- Please replace this with what you did. -->

## What did you expect to happen?

<!-- Please replace this with what you expected to happen. -->

## What happened instead?

<!-- Please replace this with of what happened instead. -->

## General Information

- Hero Version:

- iOS Version(s):

- Swift Version:

- Devices/Simulators:

- Reproducible in Examples? (Yes/No):

## Demo Project

<!-- Please link to or upload a project we can download that reproduces the issue. -->
22 changes: 22 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 180
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- confirmed bug
- investigating
- bug?
- WIP
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: true

16 changes: 16 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Rebase PR branch when someone comments /rebase
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Automatic Rebase
uses: cirrus-actions/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Swift Lint

on:
pull_request:
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'

jobs:
swift-lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: GitHub Action for SwiftLint
uses: norio-nomura/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DIFF_BASE: ${{ github.base_ref }}
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Unit Test

on:
pull_request:
paths:
- "**.swift"
- "**.xcodeproj"
- "**.m"
- "**.h"
- "**.podspec"
- "Podfile"
- "Podfile.lock"
- "test.yml"
jobs:
swiftpm:
name: Test iOS (swiftpm)
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@master

- name: iOS - Swift PM
run: |
set -o pipefail && swift test --parallel | xcpretty -c --test --color --report junit --output build/reports/junit.xml --report html --output build/reports/html
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: always()
with:
name: Test Results
path: build/reports

- name: Upload Coverage Results
uses: actions/upload-artifact@v2
if: always()
with:
name: Coverage Results
path: build/coverage

- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: Logs
path: build/logs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<true/>
</dict>
</plist>
46 changes: 23 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
cmake_minimum_required(VERSION 3.15.1)

project(AltKit LANGUAGES C Swift)
project(SideKit LANGUAGES Swift)

add_library(CAltKit
Sources/CAltKit/NSError+ALTServerError.h
Sources/CAltKit/NSError+ALTServerError.m
)
add_library(SideKit
Sources/SideKit/Extensions/ALTServerError+Conveniences.swift
Sources/SideKit/Extensions/Result+Conveniences.swift

add_library(AltKit
Sources/AltKit/Extensions/ALTServerError+Conveniences.swift
Sources/AltKit/Extensions/Result+Conveniences.swift
Sources/SideKit/Errors/ALTServerError.swift
Sources/SideKit/Errors/ALTServerError+NSError.swift
Sources/SideKit/Errors/ALTServerConnectionError.swift
Sources/SideKit/Errors/ALTServerConnectionError+NSError.swift

Sources/AltKit/Server/Connection.swift
Sources/AltKit/Server/NetworkConnection.swift
Sources/AltKit/Server/Server.swift
Sources/AltKit/Server/ServerConnection.swift
Sources/AltKit/Server/ServerManager.swift
Sources/AltKit/Server/ServerProtocol.swift
Sources/SideKit/Server/Connection.swift
Sources/SideKit/Server/NetworkConnection.swift
Sources/SideKit/Server/Server.swift
Sources/SideKit/Server/ServerConnection.swift
Sources/SideKit/Server/ServerManager.swift
Sources/SideKit/Server/ServerProtocol.swift

Sources/AltKit/Types/CodableServerError.swift
Sources/SideKit/Types/CodableServerError.swift
)

target_link_libraries(AltKit PRIVATE CAltKit)
target_link_libraries(SideKit PRIVATE CSideKit)

set_property(TARGET AltKit PROPERTY XCODE_ATTRIBUTE_SWIFT_VERSION "5.0")
set_property(TARGET SideKit PROPERTY XCODE_ATTRIBUTE_SWIFT_VERSION "5.0")

# Make CAltKit's modulemap available to AltKit
set_property(TARGET AltKit PROPERTY XCODE_ATTRIBUTE_SWIFT_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Sources/CAltKit")
# Make CSideKit's modulemap available to SideKit
set_property(TARGET SideKit PROPERTY XCODE_ATTRIBUTE_SWIFT_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Sources/CSideKit")

# Add binary dir to interface include path to make Swift header accessible to targets using AltKit
target_include_directories(AltKit INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
# Add binary dir to interface include path to make Swift header accessible to targets using SideKit
target_include_directories(SideKit INTERFACE ${CMAKE_CURRENT_BINARY_DIR})

# Copy generated Swift header to binary dir
add_custom_command(TARGET AltKit
add_custom_command(TARGET SideKit
POST_BUILD
COMMAND cp $DERIVED_SOURCES_DIR/AltKit-Swift.h ${CMAKE_CURRENT_BINARY_DIR}
COMMAND cp $DERIVED_SOURCES_DIR/SideKit-Swift.h ${CMAKE_CURRENT_BINARY_DIR}
)
46 changes: 27 additions & 19 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,41 @@
import PackageDescription

let package = Package(
name: "AltKit",
name: "SideKit",
platforms: [
.iOS(.v11),
.tvOS(.v11)
.tvOS(.v11),
.macCatalyst(.v13),
.macOS(.v11)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "AltKit",
targets: ["AltKit"]),
name: "SideKit",
targets: ["SideKit"]),
.library(
name: "SideKit-Static",
type: .static,
targets: ["SideKit"]),
.library(
name: "SideKit-Dynamic",
type: .dynamic,
targets: ["SideKit"])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "CAltKit",
dependencies: []),
.target(
name: "AltKit",
dependencies: ["CAltKit"],
linkerSettings: [
.linkedFramework("UIKit")
]
)
]
name: "SideKit",
dependencies: [],
linkerSettings: [
.linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .macCatalyst])),
.linkedFramework("Network")
]
),
.testTarget(
name: "SideKitTests",
dependencies: ["SideKit"]
)
],
swiftLanguageVersions: [.v5]
)
38 changes: 0 additions & 38 deletions Sources/AltKit/Extensions/ALTServerError+Conveniences.swift

This file was deleted.

Loading

0 comments on commit 7ea34a0

Please sign in to comment.