Skip to content

Commit

Permalink
[ci] Create hermes-engine-darwin npm package
Browse files Browse the repository at this point in the history
Notably the symbolic links need to be stripped from the framework bundle,
as npm by design does not support symbolic links to exist in packages.
However, seeing as we already package distinct versions of the framework
in distinct npm packages, there isn't any need to support multiple
versions of Hermes in a single framework bundle; so this should be fine.
  • Loading branch information
alloy committed Jul 16, 2020
1 parent faa5c24 commit d8295cb
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ workflows:
- android
- linux
- macos
- build-macos-runtime
- windows
- test-linux
- test-macos
Expand Down
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -700,16 +700,21 @@ add_custom_target(
github-cli-release
DEPENDS ${HERMES_GITHUB_DIR}/${HERMES_CLI_GITHUB_FILE})

set(HERMES_PKG_ROOT ${HERMES_GITHUB_DIR}/package-root)
set(HERMES_PKG_FRAMEWORK ${HERMES_PKG_ROOT}/destroot/Library/Frameworks/hermes.framework)

add_custom_target(
hermes-runtime-darwin-cocoapods-release
COMMAND
${CMAKE_COMMAND} --build . --target install/strip
COMMAND
mkdir -p ${HERMES_GITHUB_DIR}/package-root
mkdir -p ${HERMES_PKG_ROOT}
COMMAND
cp -R -f ${CMAKE_INSTALL_PREFIX} ${HERMES_PKG_ROOT}/destroot
COMMAND
cp -R -f ${CMAKE_INSTALL_PREFIX} ${HERMES_GITHUB_DIR}/package-root/destroot
rm -r ${HERMES_PKG_FRAMEWORK}/{Headers,Resources,hermes} && mv ${HERMES_PKG_FRAMEWORK}/Versions/0/* ${HERMES_PKG_FRAMEWORK}/ && rm -r ${HERMES_PKG_FRAMEWORK}/Versions && install_name_tool -id @rpath/hermes.framework/hermes ${HERMES_PKG_FRAMEWORK}/hermes
COMMAND
cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${HERMES_GITHUB_DIR}/package-root/
cp ${CMAKE_CURRENT_SOURCE_DIR}/hermes.podspec ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${HERMES_PKG_ROOT}
COMMAND
tar -C ${HERMES_GITHUB_DIR}/package-root/ -czhf ${HERMES_GITHUB_DIR}/hermes-runtime-${HERMES_GITHUB_SYSTEM_NAME}-v${HERMES_RELEASE_VERSION}.tar.gz .
tar -C ${HERMES_PKG_ROOT}/ -czhf ${HERMES_GITHUB_DIR}/hermes-runtime-${HERMES_GITHUB_SYSTEM_NAME}-v${HERMES_RELEASE_VERSION}.tar.gz .
)
5 changes: 5 additions & 0 deletions npm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
*.tar.gz
*.tgz
*.sha256
android
node_modules
osx-bin
package-lock.json
destroot
LICENSE
README.md
hermes.podspec
12 changes: 12 additions & 0 deletions npm/hermes-engine-darwin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Hermes

Hermes is a small and lightweight JavaScript VM optimized for running React
Native apps on macOS.

See [hermesengine.dev](https://hermesengine.dev) for more information.

This package contains a Hermes bytecode compiler for macOS, plus macOS runtime
framework.

Additional tools are available in
[hermes-engine-cli](https://www.npmjs.com/package/hermes-engine-cli).
19 changes: 19 additions & 0 deletions npm/hermes-engine-darwin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "hermes-engine-darwin",
"version": "%VERSION%",
"private": false,
"description": "A JavaScript engine optimized for running React Native on macOS",
"license": "MIT",
"repository": {
"type": "git",
"url": "git@github.com:facebook/hermes.git"
},
"files": [
"LICENSE",
"README.md",
"hermes.podspec",
"destroot/bin/hermesc",
"destroot/include/**/*",
"destroot/Library/**/*"
]
}
4 changes: 4 additions & 0 deletions npm/unpack-builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ var inputs = [
{
name: "hermes-cli-darwin-v" + releaseVersion + ".tar.gz",
dest: "osx-bin"
},
{
name: "hermes-runtime-darwin-v" + releaseVersion + ".tar.gz",
dest: ".",
}
]

Expand Down

0 comments on commit d8295cb

Please sign in to comment.