Skip to content

Commit

Permalink
revert: 恢复 SwiftPM wrapper,其作用在于区分 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Aug 24, 2023
1 parent 0ac14e9 commit 16af5e0
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 16 deletions.
51 changes: 35 additions & 16 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ let package = Package(
)
],
targets: [
// MARK: - Public
// MARK: - GrowingAnalytics Public API
.autotracker,
.tracker,

// MARK: - GrowingAnalytics Wrapper
.Wrapper.autotracker,
.Wrapper.tracker,

// MARK: - GrowingAnalytics Core
.Core.trackerCore,
.Core.autotrackerCore,
Expand Down Expand Up @@ -79,8 +83,8 @@ let package = Package(
)

extension Product {
static let autotracker = library(name: .autotracker, targets: [.autotracker])
static let tracker = library(name: .tracker, targets: [.tracker])
static let autotracker = library(name: .autotracker, targets: [.Wrapper.autotracker])
static let tracker = library(name: .tracker, targets: [.Wrapper.tracker])

enum Module {
static let imp = library(name: .imp, targets: [.imp])
Expand All @@ -92,27 +96,37 @@ extension Product {

extension Target {
static let autotracker = target(name: .autotracker,
dependencies: [
.Core.autotrackerCore,
.Module.coreServices,
.Module.hybrid,
.Module.mobileDebugger,
.Module.webCircle
],
dependencies: [.Core.autotrackerCore],
path: .autotracker,
publicHeadersPath: ".",
cSettings: [.hspFor(.autotracker)])

static let tracker = target(name: .tracker,
dependencies: [
.Core.trackerCore,
.Module.coreServices,
.Module.mobileDebugger
],
dependencies: [.Core.trackerCore],
path: .tracker,
publicHeadersPath: ".",
cSettings: [.hspFor(.tracker)])

enum Wrapper {
static let autotracker = target(name: .Wrapper.autotracker,
dependencies: [
.autotracker,
.Module.coreServices,
.Module.hybrid,
.Module.mobileDebugger,
.Module.webCircle
],
path: "SwiftPM-Wrap/GrowingAutotracker-Wrapper")

static let tracker = target(name: .Wrapper.tracker,
dependencies: [
.tracker,
.Module.coreServices,
.Module.mobileDebugger
],
path: "SwiftPM-Wrap/GrowingTracker-Wrapper")
}

enum Core {
static let autotrackerCore = target(name: .autotrackerCore,
dependencies: [
Expand Down Expand Up @@ -250,7 +264,7 @@ extension Target {
}

extension Target.Dependency {
static let autotracker = byName(name: .autotracker)
static let autotracker = byName(name: .autotracker, condition: .when(platforms: [.iOS, .macCatalyst]))
static let tracker = byName(name: .tracker)

static let autotrackerUtils = product(name: "GrowingUtilsAutotrackerCore", package: "growingio-sdk-ios-utilities")
Expand Down Expand Up @@ -324,6 +338,11 @@ extension String {
static let encrypt = "GrowingService_Encryption"
static let screenshot = "GrowingService_Screenshot"

enum Wrapper {
static let autotracker = "GrowingAutotracker_Wrapper"
static let tracker = "GrowingTracker_Wrapper"
}

enum Path {
static let publicHeaders = "Public"

Expand Down
18 changes: 18 additions & 0 deletions SwiftPM-Wrap/GrowingAutotracker-Wrapper/dummy.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// dummy.h
// GrowingAnalytics
//
// Created by YoloMao on 2022/3/28.
// Copyright (C) 2022 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
20 changes: 20 additions & 0 deletions SwiftPM-Wrap/GrowingAutotracker-Wrapper/include/dummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// dummy.h
// GrowingAnalytics
//
// Created by YoloMao on 2022/3/28.
// Copyright (C) 2022 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Prevent a missing umbrella header warning.
18 changes: 18 additions & 0 deletions SwiftPM-Wrap/GrowingTracker-Wrapper/dummy.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// dummy.h
// GrowingAnalytics
//
// Created by YoloMao on 2022/3/28.
// Copyright (C) 2022 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
20 changes: 20 additions & 0 deletions SwiftPM-Wrap/GrowingTracker-Wrapper/include/dummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// dummy.h
// GrowingAnalytics
//
// Created by YoloMao on 2022/3/28.
// Copyright (C) 2022 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Prevent a missing umbrella header warning.

0 comments on commit 16af5e0

Please sign in to comment.