-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPackage.swift
More file actions
130 lines (127 loc) · 4.47 KB
/
Package.swift
File metadata and controls
130 lines (127 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// swift-tools-version: 5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftAndroidNative open source project
//
// Copyright (c) 2024-2026 Skip.dev and SwiftAndroidNative project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftAndroidNative project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import PackageDescription
let android = Context.environment["TARGET_OS_ANDROID"] ?? "0" != "0"
let package = Package(
name: "swift-android-native",
platforms: [.iOS(.v17), .macOS(.v14), .tvOS(.v17), .watchOS(.v10), .macCatalyst(.v17)],
products: [
.library(name: "AndroidNative", targets: ["AndroidNative"]),
.library(name: "AndroidContext", targets: ["AndroidContext"]),
.library(name: "AndroidAssetManager", targets: ["AndroidAssetManager"]),
.library(name: "AndroidLogging", targets: ["AndroidLogging"]),
.library(name: "AndroidLooper", targets: ["AndroidLooper"]),
.library(name: "AndroidChoreographer", targets: ["AndroidLooper"]),
],
dependencies: [
.package(url: "https://source.skip.tools/swift-jni.git", "0.0.0"..<"2.0.0")
],
targets: [
.target(
name: "AndroidNDK",
linkerSettings: [
.linkedLibrary("android", .when(platforms: [.android])),
.linkedLibrary("log", .when(platforms: [.android])),
]),
.target(name: "ConcurrencyRuntimeC"),
.target(
name: "AndroidSystem",
dependencies: [
.target(name: "AndroidNDK", condition: .when(platforms: [.android]))
],
swiftSettings: [
.define("SYSTEM_PACKAGE_DARWIN", .when(platforms: [.macOS, .macCatalyst, .iOS, .watchOS, .tvOS, .visionOS])),
.define("SYSTEM_PACKAGE"),
]),
.testTarget(
name: "AndroidSystemTests",
dependencies: [
"AndroidSystem"
]),
.target(
name: "AndroidAssetManager",
dependencies: [
.product(name: "SwiftJNI", package: "swift-jni"),
.target(name: "AndroidNDK", condition: .when(platforms: [.android])),
]),
.testTarget(
name: "AndroidAssetManagerTests",
dependencies: [
"AndroidAssetManager"
]),
.target(
name: "AndroidLogging",
dependencies: [
.target(name: "AndroidNDK", condition: .when(platforms: [.android]))
]),
.testTarget(
name: "AndroidLoggingTests",
dependencies: [
"AndroidLogging"
]),
.target(
name: "AndroidContext",
dependencies: [
"AndroidAssetManager",
.target(name: "AndroidNDK", condition: .when(platforms: [.android])),
]),
.testTarget(
name: "AndroidContextTests",
dependencies: [
"AndroidContext"
]),
.target(
name: "AndroidLooper",
dependencies: [
"AndroidSystem",
"AndroidLogging",
"ConcurrencyRuntimeC",
]),
.testTarget(
name: "AndroidLooperTests",
dependencies: [
"AndroidLooper"
]),
.target(
name: "AndroidChoreographer",
dependencies: [
"AndroidSystem",
"AndroidLogging",
]),
.testTarget(
name: "AndroidChoreographerTests",
dependencies: [
"AndroidChoreographer"
]),
.target(
name: "AndroidNative",
dependencies: [
"AndroidContext",
"AndroidLogging",
"AndroidLooper",
"AndroidChoreographer",
]),
.testTarget(
name: "AndroidNativeTests",
dependencies: [
"AndroidNative"
], resources: [.embedInCode("Resources/sample_resource.txt")]),
]
//swiftLanguageModes: [.v5]
)
if android {
// add compatibility import from OSLog to AndroidLogging
package.targets += [.target(name: "OSLog", dependencies: ["AndroidLogging"])]
}