Skip to content

Commit

Permalink
--use-libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
muzipiao committed Nov 19, 2024
1 parent c74b857 commit 773aef4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
set -o pipefail
echo Check if the library described by the podspec can be built
pod lib lint --allow-warnings --skip-tests
pod lib lint --use-libraries --allow-warnings --skip-tests
echo Build as frameworks
xcodebuild build -project GMObjC.xcodeproj -scheme 'GMObjC' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c
echo Build the Demo apps
Expand Down
22 changes: 12 additions & 10 deletions Examples/GMObjCDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "GMObjC iOS Demo/Info.plist";
Expand All @@ -939,7 +939,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.iosdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -957,7 +957,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "GMObjC iOS Demo/Info.plist";
Expand All @@ -971,7 +971,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.iosdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -988,12 +988,12 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = "GMObjC Mac Demo/GMObjC_Mac_Demo.entitlements";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1005,8 +1005,9 @@
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.macdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -1024,12 +1025,12 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = "GMObjC Mac Demo/GMObjC_Mac_Demo.entitlements";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1041,8 +1042,9 @@
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.macdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
8 changes: 8 additions & 0 deletions GMObjC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
16 changes: 8 additions & 8 deletions Tests/GMObjCTests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -812,7 +812,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.lifei.Tests-iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.testsios;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = NO;
Expand Down Expand Up @@ -859,7 +859,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -879,7 +879,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.lifei.Tests-iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.testsios;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = NO;
Expand Down Expand Up @@ -929,7 +929,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -960,7 +960,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.testhost;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1010,7 +1010,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 9CA5KUE8T7;
DEVELOPMENT_TEAM = 4BX77JHQHH;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -1034,7 +1034,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.jinher.jingquezhili;
PRODUCT_BUNDLE_IDENTIFIER = com.lifei.gmobjc.testhost;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
Expand Down
25 changes: 12 additions & 13 deletions Tests/Tests iOS/GMSm2v1Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ - (void)testASN1SameResult {
NSString *ciphertHex = [GMSm2Utils encryptText:plaintext publicKey:self.gPubKey];
XCTAssertTrue(ciphertHex.length > 0, @"加密字符串不为空");

NSData *plainData = [plaintext dataUsingEncoding:NSUTF8StringEncoding];
NSData *ciphertData = [GMSm2Utils encryptData:plainData publicKey:self.gPubKey];
NSData *ciphertData = [GMSmUtils dataFromHexString:ciphertHex];
XCTAssertNotNil(ciphertData, @"加密字符串不为空");

NSData *c1c3c2Data = [GMSm2Utils asn1DecodeToC1C3C2Data:ciphertData hasPrefix:NO];
Expand All @@ -444,21 +443,21 @@ - (void)testASN1SameResult {
NSData *c1c3c2HexToData = [GMSmUtils dataFromHexString:c1c3c2Hex];
XCTAssertTrue([c1c3c2HexToData isEqualToData:c1c3c2Data], @"不同API解码结果应该相同");

NSData *encodeStr = [GMSm2Utils asn1EncodeWithC1C3C2Data:c1c3c2Data hasPrefix:NO];
XCTAssertNotNil(encodeStr, @"ASN1编码后字符串不为空");
NSData *encodeData = [GMSm2Utils asn1EncodeWithC1C3C2Data:c1c3c2Data hasPrefix:NO];
XCTAssertNotNil(encodeData, @"ASN1编码后字符串不为空");
for (NSInteger i = 0; i < 1000; i++) {
NSData *newEncodeStr = [GMSm2Utils asn1EncodeWithC1C3C2Data:c1c3c2Data hasPrefix:NO];
BOOL isSame_encode = [newEncodeStr isEqualToData:encodeStr];
XCTAssertTrue(isSame_encode, @"多次编码应该相同");
NSData *newEncodeData = [GMSm2Utils asn1EncodeWithC1C3C2Data:c1c3c2Data hasPrefix:NO];
BOOL isSameEncode = [newEncodeData isEqualToData:encodeData];
XCTAssertTrue(isSameEncode, @"多次编码应该相同");
}

BOOL isSame_Ctext = [encodeStr isEqualToData:ciphertData];
XCTAssertTrue(isSame_Ctext, @"编码后和原始密文相同");
BOOL isSameCiphertext = [encodeData isEqualToData:ciphertData];
XCTAssertTrue(isSameCiphertext, @"编码后和原始密文相同");

NSData *decryptStr = [GMSm2Utils decryptData:ciphertData privateKey:self.gPriKey];
XCTAssertNotNil(decryptStr, @"解密结果不为空");
BOOL isSame_plain = [decryptStr isEqualToData:plainData];
XCTAssertTrue(isSame_plain, @"加解密结果应该相同");
NSData *decryptData = [GMSm2Utils decryptData:ciphertData privateKey:self.gPriKey];
XCTAssertNotNil(decryptData, @"解密结果不为空");
BOOL isSamePlaintext = [decryptData isEqualToData:[plaintext dataUsingEncoding:NSUTF8StringEncoding]];
XCTAssertTrue(isSamePlaintext, @"加解密结果应该相同");
}

- (void)testASN1AnyText {
Expand Down

0 comments on commit 773aef4

Please sign in to comment.