Skip to content

Commit

Permalink
Merge pull request #55 from objective-audio/swift-package
Browse files Browse the repository at this point in the history
swift package
  • Loading branch information
objective-audio authored Apr 20, 2024
2 parents 93d77cc + ac7fda1 commit 30709b7
Show file tree
Hide file tree
Showing 37 changed files with 80 additions and 2,074 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-13
runs-on: macos-14

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Runs a set of commands using the runners shell
- name: Select Xcode
run:
sudo xcode-select -s '/Applications/Xcode_15.0.app/Contents/Developer'
- name: Run mac tests
run:
xcodebuild -workspace objc_utils_mac.xcworkspace -scheme objc_utils_mac_tests -configuration Debug OBJROOT=build -sdk macosx clean test
xcodebuild
-scheme objc-utils
-configuration debug
-destination 'platform=macOS'
clean test
- name: Run iOS tests
run:
xcodebuild -workspace objc_utils_ios.xcworkspace -scheme objc_utils_ios_tests -configuration Debug OBJROOT=build -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15' clean test
xcodebuild
-scheme objc-utils
-configuration debug
-destination 'platform=iOS Simulator,name=iPhone 15'
clean test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ DerivedData
*.ipa
*.xcuserstate
.DS_Store
/.build
/Packages
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

# CocoaPods
#
Expand Down
32 changes: 32 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "objc-utils",
platforms: [.macOS(.v10_15), .iOS(.v13), .macCatalyst(.v13)],
products: [
.library(
name: "objc-utils",
targets: ["objc-utils"]
),
],
targets: [
.target(
name: "objc-utils",
cSettings: [
.unsafeFlags(["-fno-objc-arc"])
]),
.testTarget(
name: "objc-utils-tests",
dependencies: [
"objc-utils",
],
cSettings: [
.unsafeFlags(["-fno-objc-arc"])
]),
],
cLanguageStandard: .gnu18,
cxxLanguageStandard: .gnucxx2b
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#pragma once

#if ! __has_feature(objc_arc)
#import <TargetConditionals.h>

#if !__has_feature(objc_arc)
#define yas_autorelease(__v) [__v autorelease]
#define yas_retain(__v) [__v retain]
#define yas_retain_or_ignore(__v) [__v retain]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// yas_objc_ios_class_tests.m
//

#import <TargetConditionals.h>

#if TARGET_OS_IPHONE

#import <XCTest/XCTest.h>
#import <objc_utils/objc_utils.h>
@import objc_utils;

@interface yas_objc_ios_class_tests : XCTestCase

Expand All @@ -26,3 +30,5 @@ - (void)test_class {
}

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// yas_objc_mac_class_tests.m
//

#import <TargetConditionals.h>

#if !TARGET_OS_IPHONE && TARGET_OS_MAC

#import <XCTest/XCTest.h>
#import <objc_utils/objc_utils.h>
@import objc_utils;

@interface yas_objc_mac_class_tests : XCTestCase

Expand All @@ -26,3 +30,5 @@ - (void)test_class {
}

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//

#import <XCTest/XCTest.h>
#import <objc_utils/objc_utils.h>
#import <objc-utils/yas_objc_unowned.h>
#import <objc-utils/yas_objc_macros.h>

static NSInteger _objectCount = 0;

Expand Down Expand Up @@ -52,6 +53,8 @@ - (void)test_create {
yas_retain_or_ignore(retainedObject);
}

//#if !__has_feature(objc_arc)

- (void)test_object {
_objectCount = 0;

Expand Down Expand Up @@ -80,6 +83,8 @@ - (void)test_object {
XCTAssertEqual(_objectCount, 0);
}

//#endif

- (void)test_init_with_object {
NSString *stringObject = @"test_string";
YASUnownedObject<NSString *> *unowned = [[YASUnownedObject<NSString *> alloc] initWithObject:stringObject];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// yas_mac_struct_tests.m
//

#import <TargetConditionals.h>

#if !TARGET_OS_IPHONE && TARGET_OS_MAC

#import <XCTest/XCTest.h>
#import <objc_utils/objc_utils.h>
@import objc_utils;

@interface yas_mac_struct_tests : XCTestCase

Expand Down Expand Up @@ -33,3 +37,5 @@ - (void)test_edge_insets {
}

@end

#endif
8 changes: 0 additions & 8 deletions objc_utils/yas_objc_utils_umbrella.h

This file was deleted.

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

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions objc_utils_ios/objc_utils/Info.plist

This file was deleted.

13 changes: 0 additions & 13 deletions objc_utils_ios/objc_utils/objc_utils.h

This file was deleted.

Loading

0 comments on commit 30709b7

Please sign in to comment.