Skip to content

Commit

Permalink
Use the same version as package.json in XCFramework (#6101)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Sep 5, 2023
2 parents 012a218 + 9cb9689 commit 85151fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
7 changes: 5 additions & 2 deletions ios-xcframework/Config/Gutenberg-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE = YES
CODE_SIGN_STYLE = Automatic
COPY_PHASE_STRIP = NO
CURRENT_PROJECT_VERSION = 1
// The automation building the XCFramework through this scaffolding project is reponsible for setting this to match the gutenberg-mobile version.
CURRENT_PROJECT_VERSION = 0
DEFINES_MODULE = YES
DYLIB_COMPATIBILITY_VERSION = 1
DYLIB_CURRENT_VERSION = 1
Expand Down Expand Up @@ -74,7 +75,9 @@ LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/
//
// This setting defines the user-visible version of the project. The value corresponds to
// the `CFBundleShortVersionString` key in your app's Info.plist.
MARKETING_VERSION = 1.0
//
// The automation building the XCFramework through this scaffolding project is reponsible for setting this to match the gutenberg-mobile version.
MARKETING_VERSION = 0.0
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++20
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
MTL_FAST_MATH = YES
Expand Down
6 changes: 3 additions & 3 deletions ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
buildConfigurationList = 3FE06AC629F3F61300F752AD /* Build configuration list for PBXNativeTarget "Gutenberg" */;
buildPhases = (
5DA264C12005B59AC528A3D3 /* [CP] Check Pods Manifest.lock */,
3FA0C5822A1CC63B00600A9A /* Check App.js */,
3FA0C5822A1CC63B00600A9A /* [Gutenberg] Check App.js */,
3FE06ABA29F3F61300F752AD /* Headers */,
3FE06ABB29F3F61300F752AD /* Sources */,
3FE06ABC29F3F61300F752AD /* Frameworks */,
Expand Down Expand Up @@ -286,7 +286,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Gutenberg/Pods-Gutenberg-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3FA0C5822A1CC63B00600A9A /* Check App.js */ = {
3FA0C5822A1CC63B00600A9A /* [Gutenberg] Check App.js */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
Expand All @@ -296,7 +296,7 @@
);
inputPaths = (
);
name = "Check App.js";
name = "[Gutenberg] Check App.js";
outputFileListPaths = (
);
outputPaths = (
Expand Down
20 changes: 18 additions & 2 deletions ios-xcframework/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@ function log {
function archive {
PLATFORM=$1

log "Archiving $SCHEME for $PLATFORM platform"
log "Archiving $SCHEME for $PLATFORM platform, setting version to $VERSION"

_xcodebuild archive \
_xcodebuild \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-configuration Release \
-sdk "$PLATFORM" \
-archivePath "$ARCHIVES_ROOT/$PLATFORM.xcarchive" \
-derivedDataPath "$DERIVED_DATA_PATH" \
archive \
MARKETING_VERSION="$VERSION" \
CURRENT_PROJECT_VERSION="$VERSION" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO
}
Expand All @@ -63,6 +66,19 @@ if [ ! -d $HERMES_XCFRAMEWORK ]; then
exit 1
fi

# Fail early if cannot fetch version
if ! command -v jq &> /dev/null; then
log 'fail' "jq command not found, please install it with brew install jq."
exit 1
fi

GUTENBERG_MOBILE_PACKAGE_PATH='../package.json'
if [ ! -f $GUTENBERG_MOBILE_PACKAGE_PATH ]; then
log 'fail' "Could not find Gutenberg Mobile package.json at path: $GUTENBERG_MOBILE_PACKAGE_PATH"
exit 1
fi
VERSION=$(jq -e -r .version $GUTENBERG_MOBILE_PACKAGE_PATH)

BUILD_DIR=./build
DERIVED_DATA_PATH="$BUILD_DIR/derived_data"
ARCHIVES_ROOT="$BUILD_DIR/archives"
Expand Down

0 comments on commit 85151fd

Please sign in to comment.