Skip to content

Commit 88add0f

Browse files
committed
Rename and conditionalize source for podspec (#385)
Summary: I cherry-picked this PR which: 1. rename everything to `hermes-engine` since <https://cocoapods.org/pods/Hermes> already exists 2. conditionalize `spec.source` so it can distribute prebuilt binaries as alloy suggested at #368 (comment) Noted that the version in the `podspec` had been updated to 0.7.1 correctly. Pull Request resolved: #385 Test Plan: CircleCI doing fine Reviewed By: tmikov Differential Revision: D24206180 Pulled By: Huxpro fbshipit-source-id: ec46350e00099c61a7de8cc9eb99991af72abdb4
1 parent 49c2875 commit 88add0f

File tree

4 files changed

+69
-65
lines changed

4 files changed

+69
-65
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ set(CMAKE_OSX_SYSROOT ${HERMES_APPLE_TARGET_PLATFORM})
6565
# This must be consistent with the release_version in:
6666
# - android/build.gradle
6767
# - npm/package.json
68-
# - hermes.podspec
68+
# - hermes-engine.podspec
6969
project(Hermes
7070
VERSION 0.7.1
7171
LANGUAGES C CXX)
@@ -737,7 +737,7 @@ add_custom_target(
737737
COMMAND
738738
cp -R ${CMAKE_INSTALL_PREFIX}/include ${HERMES_PKG_ROOT}/destroot/
739739
COMMAND
740-
cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${HERMES_PKG_ROOT}
740+
cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes-engine.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${HERMES_PKG_ROOT}
741741
COMMAND
742742
tar -C ${HERMES_PKG_ROOT}/ -czvf ${HERMES_GITHUB_DIR}/hermes-runtime-${HERMES_GITHUB_SYSTEM_NAME}-v${HERMES_RELEASE_VERSION}.tar.gz .
743743
)

hermes-engine.podspec

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
module HermesHelper
7+
# BUILD_TYPE = :debug
8+
BUILD_TYPE = :release
9+
10+
OSX_DEPLOYMENT_TARGET = "10.13"
11+
IOS_DEPLOYMENT_TARGET = "10.0"
12+
end
13+
14+
Pod::Spec.new do |spec|
15+
spec.name = "hermes-engine"
16+
spec.version = "0.7.1"
17+
spec.summary = "Hermes is a small and lightweight JavaScript engine optimized for running React Native."
18+
spec.description = "Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode."
19+
spec.homepage = "https://hermesengine.dev"
20+
spec.license = { type: "MIT", file: "LICENSE" }
21+
spec.author = "Facebook"
22+
# This env var should be supplied with a CDN URL for hermes-engine-darwin.tgz on the Github releases before pod push.
23+
# The podspec would be serialized to JSON and people will download prebuilt binaries instead of the source.
24+
spec.source = ENV['hermes-artifact-url'] ? ENV['hermes-artifact-url'] : { git: "https://github.com/facebook/hermes.git", tag: "v#{spec.version}" }
25+
spec.platforms = { :osx => HermesHelper::OSX_DEPLOYMENT_TARGET, :ios => HermesHelper::IOS_DEPLOYMENT_TARGET }
26+
27+
spec.preserve_paths = ["destroot/bin/*"].concat(HermesHelper::BUILD_TYPE == :debug ? ["**/*.{h,c,cpp}"] : [])
28+
spec.source_files = "destroot/include/**/*.h"
29+
spec.header_mappings_dir = "destroot/include"
30+
31+
spec.ios.vendored_frameworks = "destroot/Library/Frameworks/iphoneos/hermes.framework"
32+
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
33+
34+
spec.xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", "CLANG_CXX_LIBRARY" => "compiler-default", "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" }
35+
36+
unless ENV['hermes-artifact-url']
37+
spec.prepare_command = <<-EOS
38+
# When true, debug build will be used.
39+
# See `build-apple-framework.sh` for details
40+
DEBUG=#{HermesHelper::BUILD_TYPE == :debug}
41+
42+
# In a release package, there are no utilities and source files, we exit
43+
# early as there is nothing to build
44+
if [ ! -f ./utils/build-apple-framework.sh ]; then
45+
exit 0;
46+
fi
47+
48+
# Source utilities into the scope
49+
. ./utils/build-apple-framework.sh
50+
51+
# If universal framework for iOS does not exist, build one
52+
if [ ! -d destroot/Library/Frameworks/iphoneos/hermes.framework ]; then
53+
build_apple_framework "iphoneos" "armv7;armv7s;arm64" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"
54+
build_apple_framework "iphonesimulator" "x86_64;i386" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"
55+
56+
create_universal_framework "iphoneos" "iphonesimulator"
57+
fi
58+
59+
# If MacOS framework does not exist, build one
60+
if [ ! -d destroot/Library/Frameworks/macosx/hermes.framework ]; then
61+
build_apple_framework "macosx" "x86_64;arm64" "#{HermesHelper::OSX_DEPLOYMENT_TARGET}"
62+
fi
63+
EOS
64+
end
65+
end

hermes.podspec

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/ApplePlatformsIntegrationTestApp/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ source 'https://cdn.cocoapods.org/'
33
target 'ApplePlatformsIntegrationMobileTests' do
44
use_frameworks!
55
platform :ios, '10'
6-
pod 'hermes', :path => '../../'
6+
pod 'hermes-engine', :path => '../../'
77
end
88

99
target 'ApplePlatformsIntegrationMacTests' do
1010
use_frameworks!
1111
platform :osx, '10.14'
12-
pod 'hermes', :path => '../../'
12+
pod 'hermes-engine', :path => '../../'
1313
end

0 commit comments

Comments
 (0)