Skip to content

Commit

Permalink
Update for Xcode 14.3, use private module
Browse files Browse the repository at this point in the history
  • Loading branch information
kabiroberai committed Jul 27, 2023
1 parent 9e2d22b commit 556ca6f
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ disabled_rules:
- identifier_name
- type_name
- blanket_disable_command
analyzer_rules:
- unused_import
opt_in_rules:
- closure_end_indentation
- closure_spacing
Expand All @@ -27,7 +29,6 @@ opt_in_rules:
- yoda_condition
- nslocalizedstring_key
- unused_setter_value
- unused_import
- optional_enum_case_matching
- prefer_self_type_over_type_of_self
- contains_over_range_nil_comparison
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ before-package::

internal-stage::
$(ECHO_NOTHING)mkdir -p $(THEOS_PACKAGE_DIR)$(ECHO_END)
$(ECHO_NOTHING)rm -rf $(SDK_DIR) $(DSYM_DIR) $(THEOS_STAGING_DIR)/Library/Frameworks/Orion.framework/PrivateHeaders$(ECHO_END)
$(ECHO_NOTHING)rm -rf $(SDK_DIR) $(DSYM_DIR) $(THEOS_STAGING_DIR)/Library/Frameworks/Orion.framework/{PrivateHeaders,Modules/{module.private.modulemap,Orion.swiftmodule/{*.private.swiftinterface,*.abi.json}}}$(ECHO_END)
$(ECHO_NOTHING)cp -a $(THEOS_STAGING_DIR)/Library/Frameworks/Orion.framework $(SDK_DIR)$(ECHO_END)
ifeq ($(_THEOS_FINAL_PACKAGE),$(_THEOS_TRUE))
$(ECHO_NOTHING)cp -a $(THEOS_OBJ_DIR)/dSYMs/Orion.framework.dSYM $(DSYM_DIR)$(ECHO_END)
Expand All @@ -64,7 +64,6 @@ endif
ln -s Versions/Current/Orion.tbd $(SDK_DIR)/Orion.tbd; \
rm $(SDK_DIR)/Versions/Current/Orion; \
fi$(ECHO_END)
$(ECHO_NOTHING)sed -i '' -e '/ORION_PRIVATE_MODULE_BEGIN/,/ORION_PRIVATE_MODULE_END/d' $(SDK_DIR)/Modules/module.modulemap$(ECHO_END)
$(ECHO_NOTHING)rm $(SDK_DIR)/Orion $(SDK_DIR)/Modules/Orion.swiftmodule/*.swiftmodule$(ECHO_END)
$(ECHO_NOTHING)rm -rf $(THEOS_STAGING_DIR)/Library/Frameworks/Orion.doccarchive $(THEOS_STAGING_DIR)/Library/Frameworks/Orion.framework/{Headers,Modules}$(ECHO_END)

Expand Down
19 changes: 17 additions & 2 deletions Orion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -40,6 +40,7 @@
562BD3272638154C003C5A00 /* orion_objcrt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = orion_objcrt.h; sourceTree = "<group>"; };
562BD32A2638155A003C5A00 /* orion_objcrt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = orion_objcrt.m; sourceTree = "<group>"; };
562BD32B2638155A003C5A00 /* orion_lifecycle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = orion_lifecycle.c; sourceTree = "<group>"; };
562E6DF02A722D6A00ADB69E /* module.private.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.private.modulemap; sourceTree = "<group>"; };
562FA0E225B7003E007A32FE /* Ivars+Weak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Ivars+Weak.swift"; sourceTree = "<group>"; };
565F484E25B1ED3400B75BA3 /* libsubstrate.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = libsubstrate.tbd; sourceTree = "<group>"; };
565F485725B1F0D000B75BA3 /* libsubstrate.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = libsubstrate.tbd; sourceTree = "<group>"; };
Expand Down Expand Up @@ -244,6 +245,7 @@
children = (
568974D8252BBFF4006F48E9 /* Info.plist */,
56D2CF9E2677AB6300F8DDBE /* module.modulemap */,
562E6DF02A722D6A00ADB69E /* module.private.modulemap */,
56DA77582677EECA007BDF43 /* Orion.h */,
56EEA36E2621DB9F00411C46 /* Orion-Target-iphonesimulator.h */,
56AF44C42621D8380041FBF6 /* Orion-Target-iphoneos.h */,
Expand Down Expand Up @@ -297,7 +299,8 @@
56897486252BB9C6006F48E9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1430;
TargetAttributes = {
5689748E252BB9C6006F48E9 = {
CreatedOnToolsVersion = 12.0.1;
Expand Down Expand Up @@ -336,6 +339,7 @@
/* Begin PBXShellScriptBuildPhase section */
5648210A25C9B7C300339957 /* Build CLI if Needed */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -357,6 +361,7 @@
};
5648211025C9BA6A00339957 /* Copy CLI if Needed */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -375,6 +380,7 @@
};
567AF4F32536817C0056182E /* Run SwiftLint If Present */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -393,6 +399,7 @@
};
56EEA3612621D90200411C46 /* Copy Target Header */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -583,6 +590,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -604,6 +612,9 @@
MACOSX_DEPLOYMENT_TARGET = 10.14.4;
MARKETING_VERSION = 1.0.1;
MODULEMAP_FILE = Orion/module.modulemap;
MODULEMAP_PRIVATE_FILE = Orion/module.private.modulemap;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
OTHER_LDFLAGS = "-weak-lsubstrate";
PRODUCT_BUNDLE_IDENTIFIER = dev.theos.orion;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down Expand Up @@ -636,6 +647,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -657,6 +669,9 @@
MACOSX_DEPLOYMENT_TARGET = 10.14.4;
MARKETING_VERSION = 1.0.1;
MODULEMAP_FILE = Orion/module.modulemap;
MODULEMAP_PRIVATE_FILE = Orion/module.private.modulemap;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
OTHER_LDFLAGS = "-weak-lsubstrate";
PRODUCT_BUNDLE_IDENTIFIER = dev.theos.orion;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
2 changes: 1 addition & 1 deletion Orion.xcodeproj/xcshareddata/xcschemes/Orion.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions Orion/Orion.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
FOUNDATION_EXPORT double OrionVersionNumber;
FOUNDATION_EXPORT const unsigned char OrionVersionString[];

#import "Orion-Target.h"
#import "orion_public.h"
#import <Orion/Orion-Target.h>
#import <Orion/orion_public.h>
11 changes: 0 additions & 11 deletions Orion/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,3 @@ framework module Orion {
export *
module * { export * }
}
// ORION_PRIVATE_MODULE_BEGIN

// ideally we would declare this as Orion_Private in a
// private modulemap but Swift seems to ignore private
// modulemaps.
explicit module Orion.Private {
header "orion_objcrt.h"
header "orion_lifecycle.h"
}

// ORION_PRIVATE_MODULE_END
4 changes: 4 additions & 0 deletions Orion/module.private.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
framework module Orion_Private {
header "orion_objcrt.h"
header "orion_lifecycle.h"
}
2 changes: 1 addition & 1 deletion Sources/Orion/ClassHook+Deinit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
#if SWIFT_PACKAGE
@_implementationOnly import OrionC
#else
@_implementationOnly import Orion.Private
@_implementationOnly import Orion_Private
#endif

/// The action to perform after a `ClassHookProtocol.deinitializer()` is run.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Orion/ClassHook+Super.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
#if SWIFT_PACKAGE
@_implementationOnly import OrionC
#else
@_implementationOnly import Orion.Private
@_implementationOnly import Orion_Private
#endif

// based on https://github.com/SSheldon/rust-objc/tree/95bce4e0d7fa99efebbd135a47cb7dec54710261/src/message/apple
Expand Down
2 changes: 0 additions & 2 deletions Sources/OrionC/include/orion_lifecycle.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef ORION_LIFECYCLE_H_
#define ORION_LIFECYCLE_H_

#include <orion_public.h>

// this is only used in SPM mode but guarding it behind
// a conditional confuses the compiler. Don't call it yourself.
void _orion_init_c(void);
Expand Down
1 change: 1 addition & 0 deletions Sources/OrionC/orion_lifecycle.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include "orion_lifecycle.h"
#include "orion_public.h"

#if SWIFT_PACKAGE

Expand Down

0 comments on commit 556ca6f

Please sign in to comment.