Skip to content

Commit

Permalink
SPM Support (#29)
Browse files Browse the repository at this point in the history
* Initial support for SPM

* Commit ETTrace prebuilt

* Added CocoaPods podspec

* Fixed Crashlytics imports for SPM support

* Fixed Crashlytics imports for SPM support

* Add Package.swift configuration

* Update ETTraceRunner for SPM

* Update build script and Readme

* Fix exclude

* Added EMG prefix to Dummy class

* Removed prebuild folder

* Use SPM to build everything

* Run github action on this branch

* Fix build script

* Log destinations

* Use generic destination

* Use C++17

* Add scripts to autorelease on tag creation

* Chmod build runner

* Add C++ version to build script

* Use ObjetiveC JSONWrapper due to performance issues

* Remove comment
  • Loading branch information
Itaybre authored Jun 8, 2023
1 parent b00c207 commit ddf4353
Show file tree
Hide file tree
Showing 51 changed files with 306 additions and 1,264 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pull Request Build

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Show destinations
run: xcodebuild -scheme ETTrace -showdestinations
- name: Build ETTrace for iOS Simulator
run: xcodebuild build -scheme ETTrace -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' CLANG_CXX_LANGUAGE_STANDARD=c++17
- name: Build ETTrace for iOS
run: xcodebuild build -scheme ETTrace -sdk iphoneos -destination 'generic/platform=iOS' CLANG_CXX_LANGUAGE_STANDARD=c++17
- name: Build ETTrace for macOS
run: xcodebuild build -scheme ETTraceRunner -sdk macosx -destination 'generic/platform=macOS' ONLY_ACTIVE_ARCH=NO
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Workflow

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Signing Certificate
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Build ETTrace xcframework
run: sh build.sh
- name: Zip xcframework
run: zip -r ETTrace.xcframework.zip ETTrace.xcframework
- name: Build ETTraceRunner
run: sh build_runner.sh
env:
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
- name: Upload Artifact
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
ETTrace.xcframework.zip
ETTraceRunner
body:
Release ${{ github.ref }}
Automated release created by GitHub Actions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**/*.xcodeproj/xcshareddata/
ETTrace-iphonesimulator.xcarchive/
ETTrace-iphoneos.xcarchive/
ETTrace.xcframework/
./ETTrace.xcframework/
output.json
output.folded
.swiftpm
18 changes: 18 additions & 0 deletions ETTrace/CommunicationFrame/EMGDummyEmptyClass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// DummyEmptyClass.h
//
//
// Created by Itay Brenner on 2/6/23.
//

#import <Foundation/Foundation.h>

// This class is required becasue SPM doesn't support header only targets

NS_ASSUME_NONNULL_BEGIN

@interface EMGDummyEmptyClass : NSObject

@end

NS_ASSUME_NONNULL_END
14 changes: 14 additions & 0 deletions ETTrace/CommunicationFrame/EMGDummyEmptyClass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// DummyEmptyClass.m
//
//
// Created by Itay Brenner on 2/6/23.
//

#import "EMGDummyEmptyClass.h"

// This class is required becasue SPM doesn't support header only targets

@implementation EMGDummyEmptyClass

@end
18 changes: 0 additions & 18 deletions ETTrace/ETModels/ETModels.h

This file was deleted.

1,070 changes: 0 additions & 1,070 deletions ETTrace/ETTrace.xcodeproj/project.pbxproj

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions ETTrace/ETTrace.xcworkspace/contents.xcworkspacedata

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions ETTrace/ETTrace.xcworkspace/xcshareddata/swiftpm/Package.resolved

This file was deleted.

4 changes: 2 additions & 2 deletions ETTrace/ETTrace/EMGChannelListener.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//

#import "EMGChannelListener.h"
#import <PeerTalk/PTChannel.h>
#import <CommunicationFrame/CommunicationFrame.h>
#import "EMGPerfAnalysis_Private.h"
#import <Peertalk.h>
#import <CommunicationFrame.h>

@interface EMGChannelListener () <PTChannelDelegate>
@property (nonatomic, weak) PTChannel *serverChannel;
Expand Down
2 changes: 1 addition & 1 deletion ETTrace/ETTrace/EMGPerfAnalysis.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import <sys/sysctl.h>
#import <mach-o/arch.h>
#import "EMGChannelListener.h"

#import <QuartzCore/QuartzCore.h>
#import "PerfAnalysis.h"

@implementation EMGPerfAnalysis
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ETTrace/ETTraceRunner/Devices/CommunicationChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation
import CommunicationFrame
import PeerTalk
import Peertalk

class CommunicationChannel: NSObject {

Expand Down
2 changes: 1 addition & 1 deletion ETTrace/ETTraceRunner/Devices/DeviceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation
import CommunicationFrame
import PeerTalk
import Peertalk

protocol DeviceManager {
var communicationChannel: CommunicationChannel { get }
Expand Down
2 changes: 1 addition & 1 deletion ETTrace/ETTraceRunner/Devices/PhysicalDeviceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import PeerTalk
import Peertalk
import CommunicationFrame

enum ConnectionError: Error {
Expand Down
2 changes: 1 addition & 1 deletion ETTrace/ETTraceRunner/Devices/SimulatorDeviceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import PeerTalk
import Peertalk
import CommunicationFrame

struct SimulatorDeviceManager: DeviceManager {
Expand Down
5 changes: 0 additions & 5 deletions ETTrace/ETTraceRunner/ETTraceRunner-Bridging-Header.h

This file was deleted.

22 changes: 0 additions & 22 deletions ETTrace/ETTraceRunner/JSONWrapper.h

This file was deleted.

1 change: 0 additions & 1 deletion ETTrace/ETTraceRunner/PerfAnalysisRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation
import ArgumentParser

@main
struct PerfAnalysisRunner: ParsableCommand {
@Option(name: .shortAndLong, help: "Directory with dSYMs")
var dsyms: String? = nil
Expand Down
4 changes: 3 additions & 1 deletion ETTrace/ETTraceRunner/RunnerHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
// Created by Itay Brenner on 8/3/23.
//

import AppKit
import Foundation
import PeerTalk
import Peertalk
import CommunicationFrame
import Swifter
import JSONWrapper

class RunnerHelper {
let dsyms: String?
Expand Down
1 change: 1 addition & 0 deletions ETTrace/ETTraceRunner/Utils/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import AppKit

func safeShell(_ command: String) throws {
let task = Process()
Expand Down
8 changes: 8 additions & 0 deletions ETTrace/ETTraceRunner/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// main.swift
//
//
// Created by Itay Brenner on 6/6/23.
//

PerfAnalysisRunner.main()
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

#import <Foundation/Foundation.h>
#import "JSONWrapper.h"
@import ETModels;

@implementation JSONWrapper

+ (NSDictionary *)toDictionary:(FlameNode *)node {
+ (NSDictionary *)toDictionary:(NSObject *)anyObject {
FlameNode *node = (FlameNode *)anyObject;

NSObject *children;
if (node.children.count == 1) {
children = [JSONWrapper toDictionary:node.children[0]];
Expand All @@ -30,7 +33,9 @@ + (NSDictionary *)toDictionary:(FlameNode *)node {
};
}

+ (NSData *)toData:(FlameNode *)input {
+ (NSData *)toData:(NSObject *)anyInput {
FlameNode *input = (FlameNode *)anyInput;

return [NSJSONSerialization dataWithJSONObject:[JSONWrapper toDictionary:input] options:NSJSONWritingWithoutEscapingSlashes error:nil];
}

Expand Down
22 changes: 22 additions & 0 deletions ETTrace/JSONWrapper/Public/JSONWrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// TestClass.h
// ETTrace
//
// Created by Noah Martin on 4/13/23.
//

#ifndef TestClass_h
#define TestClass_h

@import Foundation;

@interface JSONWrapper : NSObject

// Use NSObject here because we cannot import Swift packages from the public header to avoid circular dependencies
+ (NSDictionary *)toDictionary:(NSObject *)dictionary;
+ (NSData *)toData:(NSObject *)input;

@end


#endif /* TestClass_h */
10 changes: 0 additions & 10 deletions ETTrace/Podfile

This file was deleted.

23 changes: 0 additions & 23 deletions ETTrace/Podfile.lock

This file was deleted.

Loading

0 comments on commit ddf4353

Please sign in to comment.