Skip to content

Commit

Permalink
Merge pull request #185 from kylewludwig/swiftpm-archiving-hotfix
Browse files Browse the repository at this point in the history
SwiftPM archiving hotfix
  • Loading branch information
JonasVautherin authored Mar 12, 2021
2 parents 8879616 + c87d63f commit fa54b0a
Show file tree
Hide file tree
Showing 97 changed files with 1,003 additions and 953 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Build
on:
push:
branches:
- 'master'
- "master"
tags:
- '*'
- "*"
pull_request:
branches:
- '*'
- "*"

jobs:
build:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: install tools
run: pip3 install protoc-gen-mavsdk && brew install protobuf
- name: generate from protos
run: bash Sources/MAVSDK-Swift/tools/generate_from_protos.bash
run: bash Sources/Mavsdk/tools/generate_from_protos.bash
- name: check for diff
run: git diff --exit-code
generate-docs:
Expand All @@ -41,9 +41,9 @@ jobs:
with:
submodules: recursive
- name: install tools
run: gem install jazzy && pip install s3cmd
run: gem install jazzy && pip install --user s3cmd
- name: generate docs
run: bash Sources/MAVSDK-Swift/tools/generate_docs.sh
run: bash Sources/Mavsdk/tools/generate_docs.sh
- name: deploy docs (if master)
if: github.ref == 'refs/heads/master'
run: s3cmd --acl-public --access_key=${{ secrets.AWS_ACCESS_KEY_ID }} --secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }} --add-header="Cache-Control:public, max-age=0" put --recursive docs/swift_output/* s3://dronecode-sdk-swift/docs/master/;
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "Sources/MAVSDK-Swift/proto"]
path = Sources/MAVSDK-Swift/proto
url = https://github.com/mavlink/mavsdk-proto
[submodule "Sources/Mavsdk/proto"]
path = Sources/Mavsdk/proto
url = https://github.com/mavlink/MAVSDK-Proto.git
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"version": "1.0.0"
}
},
{
"package": "MAVSDK-XCFramework",
"repositoryURL": "https://github.com/mavlink/MAVSDK-XCFramework",
"state": {
"branch": null,
"revision": "4a27a60c2caf9c3a2b60befb6ae642f019c24b65",
"version": "0.37.0"
}
},
{
"package": "RxSwift",
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
Expand Down
26 changes: 14 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import PackageDescription

let package = Package(
name: "MAVSDK_Swift",
name: "Mavsdk",
platforms: [
.iOS(.v13),
.macOS(.v10_15)
],
products: [
.library(name: "MAVSDK_Swift",
.library(name: "Mavsdk",
targets: [
"MAVSDK-Swift",
"Mavsdk",
]
),
.library(name: "MavsdkServer",
Expand All @@ -19,9 +23,10 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift", from: "1.0.0"),
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"),
.package(url: "https://github.com/mavlink/MAVSDK-XCFramework", .exact("0.37.0"))
],
targets: [
.target(name: "MAVSDK-Swift",
.target(name: "Mavsdk",
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
.product(name: "RxSwift", package: "RxSwift")
Expand All @@ -34,17 +39,14 @@ let package = Package(
),
.target(name: "MavsdkServer",
dependencies: [
.product(name: "RxSwift", package: "RxSwift"),
"mavsdk_server"
.product(name: "mavsdk_server",
package: "MAVSDK-XCFramework",
condition: .when(platforms: [.iOS, .macOS]))
]
),
.binaryTarget(name: "mavsdk_server",
url: "https://github.com/mavlink/MAVSDK/releases/download/v0.37.0/mavsdk_server.xcframework.zip",
checksum: "7c7c45c4f4ae59a93d6cb5d29d2ccede2424108dc549ce94f7ccd834466de51a"),
.testTarget(name: "MAVSDK-SwiftTests",
.testTarget(name: "MavsdkTests",
dependencies: [
"MAVSDK-Swift",
"MavsdkServer",
"Mavsdk",
.product(name: "RxTest", package: "RxSwift"),
.product(name: "RxBlocking", package: "RxSwift")
]
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MAVSDK-Swift
# MAVSDK

The official MAVSDK client for Swift. This cross-platform gRPC library communicates to MAVLink compatible systems using a plugin architecture.

Expand All @@ -9,16 +9,16 @@ The official MAVSDK client for Swift. This cross-platform gRPC library communica
Add the following to your Package.swift dependencies:
```
dependencies: [
.package(url: "https://github.com/mavlink/MAVSDK-Swift", from: "0.9.0"),
.package(url: "https://github.com/mavlink/Mavsdk", from: "0.9.0"),
],
```
And add each product within each target as needed (`MavsdkServer` may be optional):
```
targets: [
.target(name: "MAVSDK-Swift",
.target(name: "MyTarget",
dependencies: [
.product(name: "MAVSDK-Swift", package: "MAVSDK-Swift"),
.product(name: "MavsdkServer", package: "MAVSDK-Swift")
.product(name: "Mavsdk", package: "Mavsdk"),
.product(name: "MavsdkServer", package: "Mavsdk")
],
),
]
Expand All @@ -34,7 +34,7 @@ The backend is currently limited to UDP only, even though the core supports UDP,

```swift
import MavsdkServer
import MAVSDK_Swift
import Mavsdk

let port = mavsdkServer.run()
let drone = Drone(port: Int32(port))
Expand Down Expand Up @@ -78,7 +78,7 @@ Before contributing, it's a good idea to file an issue on GitHub to get feedback

### Build the SDK

MAVSDK functions are mainly generated from files in the _/proto_ submodule (see _Sources/MAVSDK-Swift/proto_). First, you may need to initialize any uninitialized and nested submodules.
MAVSDK functions are mainly generated from files in the _/proto_ submodule (see _Sources/Mavsdk/proto_). First, you may need to initialize any uninitialized and nested submodules.

```shell
git submodule update --init --recursive
Expand All @@ -102,20 +102,23 @@ pip3 install protoc-gen-mavsdk
Then, to generate the source code, run:

```shell
bash Sources/MAVSDK-Swift/tools/generate_from_protos.bash
bash Sources/Mavsdk/tools/generate_from_protos.bash
```

**NOTE**: The following requires Xcode 12 and Swift 5.3.

With your current Xcode project open, you can then locally source MAVSDK-Swift to override the remote Swift Package into your project. Open a Finder window, drag-and-drop the MAVSDK-Swift directory within the top level of your .xcodeproj, then click `File > Swift Packages > Resolve Package Versions` to resolve the package dependencies.
With your current Xcode project open, you can then locally source `Mavsdk` to override the remote Swift Package into your project. Open a Finder window, drag-and-drop the `Mavsdk` directory within the top level of your .xcodeproj, then click `File > Swift Packages > Resolve Package Versions` to resolve the package dependencies.

**NOTE**: If you have Xcode 11 and Swift 5.2 or lower and require `MavsdkServer`, use these additional steps.

Move `MavsdkServer.swift` from within the MAVSDK-Swift package into your project. Modify Package.swift to remove the follwing:
- "MavsdkServer" `.library`
- "MavsdkServer" `.target`
- "mavsdk_server" `.binaryTarget`
- "MavsdkServer" reference within "MAVSDK-SwiftTests" `.testTarget`.
Move `MavsdkServer.swift` from within the Mavsdk package into your main project. Modify Package.swift to remove the following:
```
.library(name: "MavsdkServer",
targets: [
"mavsdk_server"
]
)
```

Next, using Finder, download, unzip and move the binary for the iOS MAVSDK server (`mavsdk_server.xcframework`) downloaded from [MAVSDK Releases](https://github.com/mavlink/MAVSDK/releases) into your projects root directory (or where other dependencies may be installed) and update `FRAMEWORK_SEARCH_PATHS` in the Target Build Settings accordingly to find it.

Expand All @@ -131,5 +134,5 @@ sudo gem install jazzy

Then, to generate the docs, run:
```
bash Sources/MAVSDK-Swift/tools/generate_docs.sh
bash Sources/Mavsdk/tools/generate_docs.sh
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jazzy \
--module-version master \
--root-url https://mavsdk.mavlink.io/docs/swift \
--output docs/swift_output \
--module MAVSDK_Swift
--module Mavsdk
5 changes: 2 additions & 3 deletions Sources/MavsdkServer/MavsdkServer.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#if !os(Linux)
import Foundation
import RxSwift
import mavsdk_server
@_implementationOnly import mavsdk_server

public class MavsdkServer {
private var mavsdkServerHandle: OpaquePointer? = Optional.none
Expand All @@ -12,7 +11,7 @@ public class MavsdkServer {
Run `mavsdk_server`, connecting to the drone.
- Parameter systemAddress: The address on which `mavsdk_server` will listen for a MAVLink system. Note that this is about the MAVLink connection between `mavsdk_server` and the drone.
- Parameter mavsdkServerPort: The port on which `mavsdk_server` will listen for a `Drone` object to connect. Note that this is about the connection between MAVSDK-Swift and `mavsdk_server`, and has nothing to do with MAVLink itself.
- Parameter mavsdkServerPort: The port on which `mavsdk_server` will listen for a `Drone` object to connect. Note that this is about the connection between `Mavsdk` and `mavsdk_server`, and has nothing to do with MAVLink itself.
*/
public func run(systemAddress: String = "udp://:14540", mavsdkServerPort: Int = 0) -> Int {
self.mavsdkServerHandle = mavsdk_server_run(systemAddress, Int32(mavsdkServerPort))
Expand Down
105 changes: 0 additions & 105 deletions Tests/MAVSDK-SwiftTests/ActionTest.swift

This file was deleted.

Loading

0 comments on commit fa54b0a

Please sign in to comment.