Skip to content

Commit

Permalink
Carthage support (#32)
Browse files Browse the repository at this point in the history
Carthage support
  • Loading branch information
paulo-bc authored Apr 20, 2020
1 parent 177932b commit c176f90
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ xcuserdata

# Carthage
Carthage/Build

# Pre-action log file
pre_action.log
36 changes: 20 additions & 16 deletions LibWally.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 = 52;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -58,7 +58,6 @@
FE9CD3BA229C397900345DFA /* LibWallyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LibWallyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FE9CD3BF229C397900345DFA /* BIP39Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIP39Tests.swift; sourceTree = "<group>"; };
FE9CD3C1229C397900345DFA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FEB0B872229C72A700459518 /* libwallycore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwallycore.a; path = "libwally-core/src/.libs/libwallycore.a"; sourceTree = "<group>"; };
FEC79CE3229E7F3800D86E2E /* BIP32.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIP32.swift; sourceTree = "<group>"; };
FEC79CE5229E807500D86E2E /* BIP32Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIP32Tests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -140,7 +139,6 @@
isa = PBXGroup;
children = (
A20C942422C6BC3900B0D206 /* libwallycore.a */,
FEB0B872229C72A700459518 /* libwallycore.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -215,7 +213,7 @@
};
};
buildConfigurationList = FE9CD3AB229C397900345DFA /* Build configuration list for PBXProject "LibWally" */;
compatibilityVersion = "Xcode 9.3";
compatibilityVersion = "Xcode 11.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -294,6 +292,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
BUILD_LIB_WALLY_CORE = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -359,6 +358,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
BUILD_LIB_WALLY_CORE = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -419,7 +419,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -435,14 +435,13 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/libwally-core/src/secp256k1/.libs",
"$(PROJECT_DIR)/libwally-core/src/.libs",
"$(PROJECT_DIR)/libwally-core/dist",
"$(PROJECT_DIR)/CLibWally/libwally-core/src/.libs",
);
MODULEMAP_FILE = "$(SRCROOT)/LibWally/LibWally.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.blockchain.LibWally;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "${SRCROOT}/CLibWally";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -456,7 +455,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -472,14 +471,13 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/libwally-core/src/secp256k1/.libs",
"$(PROJECT_DIR)/libwally-core/src/.libs",
"$(PROJECT_DIR)/libwally-core/dist",
"$(PROJECT_DIR)/CLibWally/libwally-core/src/.libs",
);
MODULEMAP_FILE = "$(SRCROOT)/LibWally/LibWally.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.blockchain.LibWally;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "${SRCROOT}/CLibWally";
SWIFT_VERSION = 5.0;
Expand All @@ -491,8 +489,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NZ6PH75U7K;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = LibWallyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -501,6 +500,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.blockchain.LibWallyTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -510,8 +511,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NZ6PH75U7K;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = LibWallyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -520,6 +522,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.blockchain.LibWallyTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
44 changes: 20 additions & 24 deletions LibWally.xcodeproj/xcshareddata/xcschemes/LibWally.xcscheme
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
LastUpgradeVersion = "1140"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Builds libwallycore.a for simulator and device if necessary&#10;exec &gt; $PROJECT_DIR/pre_action.log 2&gt;&amp;1&#10;if [[ $CARTHAGE == &quot;YES&quot; ]] || [[ $BUILD_LIB_WALLY_CORE == &quot;YES&quot; ]]; then&#10; cd $PROJECT_DIR&#10; echo &quot;Starting build scheme Pre-actions&quot;&#10; &quot;${PROJECT_DIR}/carthage-build-libwally.sh&quot;&#10;else&#10; echo &quot;Build scheme Pre-actions skipped, not Carthage&quot;&#10;fi&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FE9CD3B0229C397900345DFA"
BuildableName = "LibWally.framework"
BlueprintName = "LibWally"
ReferencedContainer = "container:LibWally.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down Expand Up @@ -39,17 +57,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FE9CD3B0229C397900345DFA"
BuildableName = "LibWally.framework"
BlueprintName = "LibWally"
ReferencedContainer = "container:LibWally.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,17 +68,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FE9CD3B0229C397900345DFA"
BuildableName = "LibWally.framework"
BlueprintName = "LibWally"
ReferencedContainer = "container:LibWally.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
29 changes: 29 additions & 0 deletions carthage-build-libwally.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh
set -e # abort if any command fails

LIBWALLYCORE="CLibWally/libwally-core/src/.libs/libwallycore.a"
VALIDLIBWALLYCORE=0
REQUIREDARCHS="armv7 armv7s i386 x86_64 arm64 arm64e"
LIPO_CMD="lipo $LIBWALLYCORE -verify_arch $REQUIREDARCHS"

if [ -e "$LIBWALLYCORE" ]; then
echo "$LIBWALLYCORE exists"
if $LIPO_CMD; then
VALIDLIBWALLYCORE=1
echo "libwallycore.a contains $REQUIREDARCHS"
else
echo "libwallycore.a does not contain $REQUIREDARCHS"
lipo "$LIBWALLYCORE" -info
fi
else
echo "$LIBWALLYCORE does not exists"
fi

if ((VALIDLIBWALLYCORE == 0)); then
echo "Rebuilding libwallycore.a"
sh ./build-libwally.sh -csd
else
echo "Skip rebuild"
fi

exit 0

0 comments on commit c176f90

Please sign in to comment.