Skip to content

Commit

Permalink
Fix build configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
surpher committed Apr 21, 2024
1 parent 0c05695 commit a551cd5
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ Carthage/
/PactSwiftMockServer.xcodeproj/xcuserdata/marko.xcuserdatad/xcschemes/xcschememanagement.plist
.tmp

# Swiftlint
.xcfilelist
*.xcfilelist

####################
# Binaries ##
####################
Expand Down
7 changes: 5 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ opt_in_rules:
- static_operator
- toggle_bool
- unneeded_parentheses_in_closure_argument
- unused_declaration
- unused_import
- yoda_condition
- xct_specific_matcher

analyzer_rules:
- unused_declaration
- unused_import
- explicit_self

attributes:
always_on_same_line: ["@IBAction", "@objc"]

Expand Down
2 changes: 2 additions & 0 deletions Configurations/Project-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ENABLE_STRICT_OBJC_MSGSEND = YES

BUILD_LIBRARY_FOR_DISTRIBUTION = YES

DEAD_CODE_STRIPPING = YES

// GCC

GCC_NO_COMMON_BLOCKS = YES
Expand Down
6 changes: 6 additions & 0 deletions Configurations/Target-iOS-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ HEADER_SEARCH_PATHS = $(PROJECT_DIR)/Sources/Headers
OTHER_LDFLAGS = -weak_framework XCTEST -weak-lXCTestSwiftSupport

DEFINES_MODULE = YES
CODE_SIGN_IDENTITY =
CODE_SIGN_STYLE = Automatic
CLANG_ENABLE_MODULES = YES
ENABLE_BITCODE = NO
ENABLE_TESTING_SEARCH_PATHS = YES

ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++14
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++

3 changes: 3 additions & 0 deletions Configurations/Target-iOS-Tests-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ PRODUCT_BUNDLE_IDENTIFIER = au.com.pact-foundation.PactSwiftMockServerTests
CODE_SIGN_IDENTITY[sdk=macosx*] = -

LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks

DEAD_CODE_STRIPPING = YES
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
5 changes: 5 additions & 0 deletions Configurations/Target-iPhone-iOS-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ CODE_SIGN_STYLE = Automatic
CLANG_ENABLE_MODULES = YES
ENABLE_BITCODE = NO
ENABLE_TESTING_SEARCH_PATHS = YES

CODE_SIGN_IDENTITY =
ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++14
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
5 changes: 5 additions & 0 deletions Configurations/Target-macOS-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG
SWIFT_OPTIMIZATION_LEVEL = -Onone

ENABLE_TESTING_SEARCH_PATHS = YES

DEAD_CODE_STRIPPING = YES
ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++14
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
29 changes: 4 additions & 25 deletions PactSwiftMockServer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@
AD1597EA2648DE0E007CFAA5 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1250;
LastUpgradeCheck = 1520;
TargetAttributes = {
AD1597F22648DE0E007CFAA5 = {
CreatedOnToolsVersion = 12.5;
Expand Down Expand Up @@ -643,7 +644,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run SwiftLint before even attempting to compile\n\"${PROJECT_DIR}\"/Support/build_file_list_and_swiftlint PactSwiftMockServer ./.swiftlint.yml\n";
shellScript = "PATH={$PATH}:/opt/local/bin:/opt/homebrew/bin/:/usr/local/bin\n\"${SRCROOT}\"/Support/build_file_list_and_swiftlint PactSwiftMockServer ./.swiftlint.yml\n";
};
ADE254FD26CDE3C700FA21A9 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -662,7 +663,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run SwiftLint before even attempting to compile\n\"${PROJECT_DIR}\"/Support/build_file_list_and_swiftlint PactSwiftMockServer ./.swiftlint.yml\n";
shellScript = "PATH={$PATH}:/opt/local/bin:/opt/homebrew/bin/:/usr/local/bin\n\"${SRCROOT}\"/Support/build_file_list_and_swiftlint PactSwiftMockServer ./.swiftlint.yml\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -800,33 +801,13 @@
isa = XCBuildConfiguration;
baseConfigurationReference = ADBEF2F42648FB0600486C4A /* Target-iOS-Debug.xcconfig */;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Resources/iOS-simulator",
);
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
AD1598092648DE0E007CFAA5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = ADBEF2F82648FB0600486C4A /* Target-iOS-Release.xcconfig */;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Resources/iOS-simulator",
);
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down Expand Up @@ -890,15 +871,13 @@
isa = XCBuildConfiguration;
baseConfigurationReference = ADBEF2EB2648FB0600486C4A /* Target-iOS-Tests-Debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Debug;
};
AD38D30D264A33E800124396 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = ADBEF2F62648FB0600486C4A /* Target-iOS-Tests-Release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Sources/Model/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public enum Logging {
/// Initialize the logger with no sinks.
///
/// This initialized logger does nothing until ``Logging/apply()`` has been called.
@MainActor @discardableResult
@MainActor
@discardableResult
private static func initialize() -> Bool {
guard isInitialized == false else {
return false
Expand All @@ -89,8 +90,7 @@ public enum Logging {
}

/// Returns a value indicating whether the PactSwift ``Logging`` has been initialized.
@MainActor
public private(set) static var isInitialized: Bool = false
@MainActor public private(set) static var isInitialized = false

/// Initialize the Pact logging infrastructure.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/PactSwiftMockServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ FOUNDATION_EXPORT double PactSwiftMockServerVersionNumber;
FOUNDATION_EXPORT const unsigned char PactSwiftMockServerVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <PactSwiftMockServer/PublicHeader.h>
#import "pact_ffi.h"
#import <PactSwiftMockServer/pact_ffi.h>
13 changes: 6 additions & 7 deletions Support/build_file_list_and_swiftlint
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@ fi

echo "--- 🤖 Linting $SRCROOT/Sources/*.swift"

if which swiftlint >/dev/null; then
if command -v "swiftlint"; then
# Build a list of Swift files in the Sources directory
find Sources -name \*.swift -exec echo "\$(SRCROOT)/"{} \; > $DERIVED_FILE_DIR/$1.xcfilelist
find Sources -name \*.swift -exec echo "\$(SRCROOT)/"{} \; > "$DERIVED_FILE_DIR/$1.xcfilelist"

# Update the xcfilelist if the list of Swift files has changed
cmp --silent $SRCROOT/$1.xcfilelist $DERIVED_FILE_DIR/$1.xcfilelist || cp -f $DERIVED_FILE_DIR/$1.xcfilelist $SRCROOT/$1.xcfilelist
cmp --silent "$SRCROOT/$1.xcfilelist" "$DERIVED_FILE_DIR/$1.xcfilelist" || cp -f "$DERIVED_FILE_DIR/$1.xcfilelist" "$SRCROOT/$1.xcfilelist"

# Run swiftlint (TODO: - swiftlint by iterating through the $1.xcfilelist)
# swiftlint --config $2 -- #filename0 #filename1 #filename2 ...
swiftlint --path Sources --config $2
swiftlint --no-cache --config "$2" Sources

# Output an empty derived file
touch $DERIVED_FILE_DIR/swiftlint.txt
touch "$DERIVED_FILE_DIR/swiftlint.txt"

# All hunky dory
echo "--- 👍 .swift files linted"
else
echo "--- ⚠️ Swiftlint"
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
echo "warning: SwiftLint not installed! See https://github.com/realm/SwiftLint?tab=readme-ov-file#installation"
fi

0 comments on commit a551cd5

Please sign in to comment.