Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully upgrading to Swift 5.0 #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.1
// swift-tools-version:4.2
// Package.swift
// Perfect-MongoDB
//
Expand All @@ -25,12 +25,24 @@ let package = Package(
.library(name: "PerfectMongoDB", targets: ["PerfectMongoDB"])
],
dependencies: [
.package(url: "https://github.com/PerfectSideRepos/Perfect-CMongo.git", from: "0.1.0"),
.package(url: "https://github.com/PerfectSideRepos/Perfect-CBSON.git", from: "0.0.0"),
.package(url: "https://github.com/PerfectlySoft/PerfectLib.git", from: "3.0.0")
],
targets: [
.target(name: "PerfectMongoDB", dependencies: ["PerfectLib"]),
],
targets: [
.systemLibrary(name: "PerfectCMongo",
pkgConfig: "libmongoc-1.0",
providers: [
.apt(["libmongoc-dev"]),
.brew(["mongo-c-driver"])
]
),
.systemLibrary(name: "PerfectCBSON",
pkgConfig: "libbson-1.0",
providers: [
.apt(["libbson-dev"]),
.brew(["mongo-c-driver"])
]
),
.target(name: "PerfectMongoDB", dependencies: ["PerfectCMongo", "PerfectCBSON", "PerfectLib"]),
.testTarget(name: "PerfectMongoDBTests", dependencies: ["PerfectMongoDB"])
]
)
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Perfect - MongoDB Connector [简体中文](README.zh_CN.md)

<p align="center">
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
<img src="https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat" alt="Swift 5.0">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
Expand Down Expand Up @@ -82,7 +82,7 @@ Building
Add this project as a dependency in your Package.swift file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.Package(url:"https://github.com/PerfectlySoft/Perfect-MongoDB.git", majorVersion: 3)
.package(url:"https://github.com/PerfectlySoft/Perfect-MongoDB.git", .branch("master"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Documentation
Expand Down
11 changes: 2 additions & 9 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Perfect - MongoDB 数据库连接器 [English](README.md)

<p align="center">
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat" alt="Swift 3.0">
<img src="https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat" alt="Swift 5.0">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
Expand All @@ -50,13 +50,6 @@ Perfect - MongoDB 数据库连接器 [English](README.md)



## 问题报告

我们正在过渡到 JIRA 程序错误管理系统,因此 GitHub 的问题报告功能就被禁用了。

如果您发现任何问题,或有任何意见和建议,请在我们的 JIRA 工作台指出 [http://jira.perfect.org:8080/servicedesk/customer/portal/1](http://jira.perfect.org:8080/servicedesk/customer/portal/1)。

目前的问题清单请查阅 [http://jira.perfect.org:8080/projects/ISS/issues](http://jira.perfect.org:8080/projects/ISS/issues)

macOS 注意事项
----------------
Expand Down Expand Up @@ -90,7 +83,7 @@ apt-get install libmongoc-dev libbson-dev libssl-dev
请在您的 Package.swift 文件下增加以下内容:

```swift
.Package(url:"https://github.com/PerfectlySoft/Perfect-MongoDB.git", majorVersion: 3)
.package(url:"https://github.com/PerfectlySoft/Perfect-MongoDB.git", .branch("master"))
```

## 更多信息
Expand Down
5 changes: 5 additions & 0 deletions Sources/PerfectCBSON/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module PerfectCBSON [system] {
header "shim.h"
link "bson-1.0"
export *
}
2 changes: 2 additions & 0 deletions Sources/PerfectCBSON/shim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define BCON_H_
#include <bson.h>
5 changes: 5 additions & 0 deletions Sources/PerfectCMongo/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module PerfectCMongo [system] {
header "shim.h"
link "mongoc-1.0"
export *
}
9 changes: 9 additions & 0 deletions Sources/PerfectCMongo/shim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <mongoc.h>

static bool _mongoc_cursor_next(mongoc_cursor_t *cursor, const void **bson)
{
const bson_t *bson2 = NULL;
bool r = mongoc_cursor_next(cursor, &bson2);
*bson = bson2;
return r;
}