Skip to content

Commit 64d5e75

Browse files
author
Anton Pogonets
committed
Dev: migrate to new swift plugin
1 parent b8a51a7 commit 64d5e75

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
buildscript {
2+
ext.kotlin_version = '1.3.50'
3+
24
repositories {
35
google()
46
jcenter()
7+
mavenLocal()
58
maven { url "https://dl.bintray.com/readdle/maven" }
69
}
710

811
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.3.0'
10-
classpath 'com.readdle.android.swift:gradle:1.1.10'
11-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
12+
classpath "com.android.tools.build:gradle:3.5.0"
13+
classpath "com.readdle.android.swift:gradle:1.3.0"
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15+
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
16+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
1217
}
1318
}
1419

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Apr 29 18:40:15 EEST 2018
1+
#Thu Aug 29 12:50:13 EEST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

sample/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'com.readdle.android.swift'
33

4+
apply plugin: 'kotlin-android'
5+
apply plugin: 'kotlin-android-extensions'
6+
47
swift {
58
cleanEnabled true
69
debug {
10+
abiFilters("arm64-v8a", "x86_64")
711
extraBuildFlags("-Xswiftc", "-DDEBUG")
812
}
913
}
@@ -30,10 +34,10 @@ dependencies {
3034
annotationProcessor project(':compiler')
3135
implementation project(':library')
3236

33-
implementation 'com.android.support:appcompat-v7:27.1.1'
34-
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
37+
implementation 'com.android.support:appcompat-v7:28.0.0'
38+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
3539
testImplementation 'junit:junit:4.12'
36-
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
40+
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
3741
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3842
androidTestImplementation 'com.android.support.test:rules:1.0.2'
3943
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

sample/src/main/swift/Package.swift

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.0
22
import Foundation
33
import PackageDescription
44

@@ -9,15 +9,11 @@ let generatedName = "Generated"
99
let generatedPath = ".build/\(generatedName.lowercased())"
1010

1111
let isSourcesGenerated: Bool = {
12-
let basePath = URL(fileURLWithPath: #file)
13-
.deletingLastPathComponent()
14-
.path
15-
16-
let fileManager = FileManager()
17-
fileManager.changeCurrentDirectoryPath(basePath)
12+
let baseURL = URL(fileURLWithPath: #file).deletingLastPathComponent()
13+
let generatedURL = baseURL.appendingPathComponent(generatedPath)
1814

1915
var isDirectory: ObjCBool = false
20-
let exists = fileManager.fileExists(atPath: generatedPath, isDirectory: &isDirectory)
16+
let exists = FileManager.default.fileExists(atPath: generatedURL.path, isDirectory: &isDirectory)
2117

2218
return exists && isDirectory.boolValue
2319
}()
@@ -41,7 +37,7 @@ func addGenerated(_ targets: [Target]) -> [Target] {
4137
.target(
4238
name: generatedName,
4339
dependencies: [
44-
.byNameItem(name: packageName),
40+
.byName(name: packageName),
4541
"java_swift",
4642
"Java",
4743
"JavaCoder",
@@ -57,13 +53,12 @@ let package = Package(
5753
products: addGenerated([
5854
]),
5955
dependencies: [
60-
.package(url: "https://github.com/readdle/java_swift.git", .exact("2.1.3")),
61-
.package(url: "https://github.com/readdle/swift-java.git", .exact("0.1.5")),
62-
.package(url: "https://github.com/readdle/swift-java-coder.git", .exact("1.0.5")),
63-
.package(url: "https://github.com/readdle/swift-anycodable.git", .exact("1.0.0")),
56+
.package(url: "https://github.com/readdle/java_swift.git", .exact("2.1.7")),
57+
.package(url: "https://github.com/readdle/swift-java.git", .exact("0.2.0")),
58+
.package(url: "https://github.com/readdle/swift-java-coder.git", .exact("1.0.13")),
59+
.package(url: "https://github.com/readdle/swift-anycodable.git", .exact("1.0.2")),
6460
],
6561
targets: addGenerated([
6662
.target(name: packageName, dependencies: ["AnyCodable"])
67-
]),
68-
swiftLanguageVersions: [4]
63+
])
6964
)

0 commit comments

Comments
 (0)