Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and conditionalize source for podspec #385

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions hermes.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ module HermesHelper
end

Pod::Spec.new do |spec|
spec.name = "hermes"
spec.name = "hermes-engine"
spec.version = "0.7.0"
spec.summary = "Hermes is a small and lightweight JavaScript engine optimized for running React Native."
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."
spec.homepage = "https://hermesengine.dev"
spec.license = { type: "MIT", file: "LICENSE" }
spec.author = "Facebook"
spec.source = { git: "https://github.com/facebook/hermes.git", tag: "v#{spec.version}" }
# This env var should be supplied with a CDN URL for hermes-engine-darwin.tgz on the Github releases before pod push.
# The podspec would be serialized to JSON and people will download prebuilt binaries instead of the source.
spec.source = ENV['hermes-artifact-url'] ? ENV['hermes-artefict-url'] : { git: "https://github.com/facebook/hermes.git", tag: "v#{spec.version}" }
Huxpro marked this conversation as resolved.
Show resolved Hide resolved
spec.platforms = { :osx => HermesHelper::OSX_DEPLOYMENT_TARGET, :ios => HermesHelper::IOS_DEPLOYMENT_TARGET }

spec.preserve_paths = ["destroot/bin/*"].concat(HermesHelper::BUILD_TYPE == :debug ? ["**/*.{h,c,cpp}"] : [])
Expand All @@ -31,31 +33,33 @@ Pod::Spec.new do |spec|

spec.xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", "CLANG_CXX_LIBRARY" => "compiler-default", "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" }

spec.prepare_command = <<-EOS
# When true, debug build will be used.
# See `build-apple-framework.sh` for details
DEBUG=#{HermesHelper::BUILD_TYPE == :debug}

# In a release package, there are no utilities and source files, we exit
# early as there is nothing to build
if [ ! -f ./utils/build-apple-framework.sh ]; then
exit 0;
fi

# Source utilities into the scope
. ./utils/build-apple-framework.sh

# If universal framework for iOS does not exist, build one
if [ ! -d destroot/Library/Frameworks/iphoneos/hermes.framework ]; then
build_apple_framework "iphoneos" "armv7;armv7s;arm64" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"
build_apple_framework "iphonesimulator" "x86_64;i386" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"

create_universal_framework "iphoneos" "iphonesimulator"
fi

# If MacOS framework does not exist, build one
if [ ! -d destroot/Library/Frameworks/macosx/hermes.framework ]; then
build_apple_framework "macosx" "x86_64;arm64" "#{HermesHelper::OSX_DEPLOYMENT_TARGET}"
fi
EOS
unless ENV['hermes-artefact-url']
spec.prepare_command = <<-EOS
# When true, debug build will be used.
# See `build-apple-framework.sh` for details
DEBUG=#{HermesHelper::BUILD_TYPE == :debug}

# In a release package, there are no utilities and source files, we exit
# early as there is nothing to build
if [ ! -f ./utils/build-apple-framework.sh ]; then
exit 0;
fi

# Source utilities into the scope
. ./utils/build-apple-framework.sh

# If universal framework for iOS does not exist, build one
if [ ! -d destroot/Library/Frameworks/iphoneos/hermes.framework ]; then
build_apple_framework "iphoneos" "armv7;armv7s;arm64" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"
build_apple_framework "iphonesimulator" "x86_64;i386" "#{HermesHelper::IOS_DEPLOYMENT_TARGET}"

create_universal_framework "iphoneos" "iphonesimulator"
fi

# If MacOS framework does not exist, build one
if [ ! -d destroot/Library/Frameworks/macosx/hermes.framework ]; then
build_apple_framework "macosx" "x86_64;arm64" "#{HermesHelper::OSX_DEPLOYMENT_TARGET}"
fi
EOS
end
end