From 58bb339bd36f924f17db8ffc1c2b38175b28a53c Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Thu, 8 Oct 2020 14:12:42 -0700 Subject: [PATCH 1/6] Rename and conditionalize source for podspec This PR did two things. 1. rename to `hermes-engine` since already exists 2. conditionalize `spec.source` so it can distribute prebuilt binaries as @alloy suggested at https://github.com/facebook/hermes/issues/368#issuecomment-702041567 --- hermes.podspec | 62 +++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/hermes.podspec b/hermes.podspec index 321683e9ffa..29cf0e473c8 100644 --- a/hermes.podspec +++ b/hermes.podspec @@ -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}" } 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}"] : []) @@ -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 From 349766ce9504e59c086dd1fc2883c0825f88534b Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Thu, 8 Oct 2020 14:15:14 -0700 Subject: [PATCH 2/6] fix spelling --- hermes.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hermes.podspec b/hermes.podspec index 29cf0e473c8..f08de616170 100644 --- a/hermes.podspec +++ b/hermes.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |spec| spec.author = "Facebook" # 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}" } + spec.source = ENV['hermes-artifact-url'] ? ENV['hermes-artifact-url'] : { git: "https://github.com/facebook/hermes.git", tag: "v#{spec.version}" } 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}"] : []) From fe218c3e422305e9530fa8a72b2d6de791e3db01 Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Thu, 8 Oct 2020 14:18:21 -0700 Subject: [PATCH 3/6] fix another spelling --- hermes.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hermes.podspec b/hermes.podspec index f08de616170..70393cf8e0c 100644 --- a/hermes.podspec +++ b/hermes.podspec @@ -33,7 +33,7 @@ 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" } - unless ENV['hermes-artefact-url'] + unless ENV['hermes-artifact-url'] spec.prepare_command = <<-EOS # When true, debug build will be used. # See `build-apple-framework.sh` for details From 6469dae8d7a9e0b23ffbf1fb0ccc6a4ea7d8ee1e Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Thu, 8 Oct 2020 15:39:01 -0700 Subject: [PATCH 4/6] try to fix test-apple-runtime failure --- test/ApplePlatformsIntegrationTestApp/Podfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ApplePlatformsIntegrationTestApp/Podfile b/test/ApplePlatformsIntegrationTestApp/Podfile index d74224356c6..d547fd08402 100644 --- a/test/ApplePlatformsIntegrationTestApp/Podfile +++ b/test/ApplePlatformsIntegrationTestApp/Podfile @@ -3,11 +3,11 @@ source 'https://cdn.cocoapods.org/' target 'ApplePlatformsIntegrationMobileTests' do use_frameworks! platform :ios, '10' - pod 'hermes', :path => '../../' + pod 'hermes-engine', :path => '../../' end target 'ApplePlatformsIntegrationMacTests' do use_frameworks! platform :osx, '10.14' - pod 'hermes', :path => '../../' + pod 'hermes-engine', :path => '../../' end From 408735ae875ec283ec4c7541829e507f357d3621 Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Fri, 9 Oct 2020 10:50:12 -0700 Subject: [PATCH 5/6] rename to hermes-engine.podspec --- hermes.podspec => hermes-engine.podspec | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hermes.podspec => hermes-engine.podspec (100%) diff --git a/hermes.podspec b/hermes-engine.podspec similarity index 100% rename from hermes.podspec rename to hermes-engine.podspec From 1d4e7b05b150405abad6bf4fe0b54d004abf2093 Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Fri, 9 Oct 2020 11:53:15 -0700 Subject: [PATCH 6/6] rename even more occurences... test-apple-runtime passed but not apple-runtime --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2d4fcd436b..4419af2b298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ set(CMAKE_OSX_SYSROOT ${HERMES_APPLE_TARGET_PLATFORM}) # This must be consistent with the release_version in: # - android/build.gradle # - npm/package.json -# - hermes.podspec +# - hermes-engine.podspec project(Hermes VERSION 0.7.0 LANGUAGES C CXX) @@ -750,7 +750,7 @@ add_custom_target( COMMAND cp -R ${CMAKE_INSTALL_PREFIX}/include ${HERMES_PKG_ROOT}/destroot/ COMMAND - cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${HERMES_PKG_ROOT} + cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes-engine.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${HERMES_PKG_ROOT} COMMAND tar -C ${HERMES_PKG_ROOT}/ -czvf ${HERMES_GITHUB_DIR}/hermes-runtime-${HERMES_GITHUB_SYSTEM_NAME}-v${HERMES_RELEASE_VERSION}.tar.gz . )