Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SPM #1

Open
wants to merge 5 commits into
base: spm-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ DerivedData
extern/

*.pyc
.build
42 changes: 42 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "SocketRocket",
platforms: [.iOS(.v9)],
products: [
.library(
name: "SocketRocket",
targets: ["SocketRocket"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
.target(
name: "SocketRocket",
path: "SocketRocket",
exclude: ["Resources"], // Исключите ненужные файлы или директории
sources: [".", "Internal"], // Указание исходных файлов
publicHeadersPath: "include", // Все публичные заголовки должны быть перемещены в 'include'
cSettings: [
.headerSearchPath("."),
.headerSearchPath("Internal"),
.headerSearchPath("Internal/Delegate"),
.headerSearchPath("Internal/IOConsumer"),
.headerSearchPath("Internal/Proxy"),
.headerSearchPath("Internal/RunLoop"),
.headerSearchPath("Internal/Security"),
.headerSearchPath("Internal/Utilities")
],
linkerSettings: [
.linkedFramework("CFNetwork", .when(platforms: [.iOS, .tvOS])),
.linkedFramework("Security"),
.linkedFramework("CoreServices", .when(platforms: [.macOS])),
.linkedLibrary("icucore")
]
)
]
)
3 changes: 2 additions & 1 deletion SocketRocket/Internal/Delegate/SRDelegateController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#import <Foundation/Foundation.h>

#import <SocketRocket/SRWebSocket.h>
// #import <SocketRocket/SRWebSocket.h>
#import "SRWebSocket.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
4 changes: 2 additions & 2 deletions SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//

#import <SocketRocket/NSRunLoop+SRWebSocket.h>

// #import <SocketRocket/NSRunLoop+SRWebSocket.h>
#import "NSRunLoop+SRWebSocket.h"
// Empty function that force links the object file for the category.
extern void import_NSRunLoop_SRWebSocket(void);
4 changes: 2 additions & 2 deletions SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//

#import <SocketRocket/NSURLRequest+SRWebSocket.h>

// #import <SocketRocket/NSURLRequest+SRWebSocket.h>
#import "NSURLRequest+SRWebSocket.h"
// Empty function that force links the object file for the category.
extern void import_NSURLRequest_SRWebSocket(void);
3 changes: 2 additions & 1 deletion SocketRocket/Internal/Security/SRPinningSecurityPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#import <Foundation/Foundation.h>

#import <SocketRocket/SRSecurityPolicy.h>
// #import <SocketRocket/SRSecurityPolicy.h>
#import "SRSecurityPolicy.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion SocketRocket/Internal/Utilities/SRLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern void SRErrorLog(NSString *format, ...)

va_end(arg_list);

NSLog(@"[SocketRocket] %@", formattedString);
// NSLog(@"[SocketRocket] %@", formattedString);
}

extern void SRDebugLog(NSString *format, ...)
Expand Down
15 changes: 15 additions & 0 deletions SocketRocket/include/SocketRocket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Copyright 2012 Square Inc.
// Portions Copyright (c) 2016-present, Facebook, Inc.
//
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//

#import "../NSRunLoop+SRWebSocket.h"
#import "../NSURLRequest+SRWebSocket.h"
#import "../SRSecurityPolicy.h"
#import "../SRWebSocket.h"
13 changes: 7 additions & 6 deletions TestChat/TCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#import "TCViewController.h"

#import <SocketRocket/SocketRocket.h>
// #import <SocketRocket/SocketRocket.h>
#import "SocketRocket.h"

#import "TCChatCell.h"

Expand Down Expand Up @@ -142,34 +143,34 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

- (void)webSocketDidOpen:(SRWebSocket *)webSocket;
{
NSLog(@"Websocket Connected");
// NSLog(@"Websocket Connected");
self.title = @"Connected!";
}

- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
{
NSLog(@":( Websocket Failed With Error %@", error);
// NSLog(@":( Websocket Failed With Error %@", error);

self.title = @"Connection Failed! (see logs)";
_webSocket = nil;
}

- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(nonnull NSString *)string
{
NSLog(@"Received \"%@\"", string);
// NSLog(@"Received \"%@\"", string);
[self _addMessage:[[TCMessage alloc] initWithMessage:string incoming:YES]];
}

- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
{
NSLog(@"WebSocket closed");
// NSLog(@"WebSocket closed");
self.title = @"Connection Closed! (see logs)";
_webSocket = nil;
}

- (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload;
{
NSLog(@"WebSocket received pong");
// NSLog(@"WebSocket received pong");
}

///--------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion Tests/Operations/SRTWebSocketOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// of patent rights can be found in the PATENTS file in the same directory.
//

#import <SocketRocket/SRWebSocket.h>
// #import <SocketRocket/SRWebSocket.h>
#import "SRWebSocket.h"

@interface SRTWebSocketOperation : NSOperation <SRWebSocketDelegate>

Expand Down
3 changes: 2 additions & 1 deletion Tests/SRAutobahnTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
@import XCTest;
@import ObjectiveC;

#import <SocketRocket/SRWebSocket.h>
// #import <SocketRocket/SRWebSocket.h>
#import "SRWebSocket.h"

#import "SRTWebSocketOperation.h"
#import "SRAutobahnOperation.h"
Expand Down
27 changes: 27 additions & 0 deletions create_symlinks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 /path/to"
exit 1
fi

SOURCE_DIR=$1
INCLUDE_DIR="$SOURCE_DIR/include"

mkdir -p "$INCLUDE_DIR"

find "$SOURCE_DIR" -type f -name "*.h" | while read -r file; do
filename=$(basename "$file")
symlink_path="$INCLUDE_DIR/$filename"
if [ ! -e "$symlink_path" ]; then
ln -s "../$file" "$symlink_path"
# cp "$file" "$symlink_path"
echo "Создана ссылка для: $file"
# Выводим исходный путь файла, на который ссылка указывает
echo "Исходный путь: $file"
else
echo "Ссылка для $file уже существует"
fi
done

echo "Обработка завершена."