Skip to content

Commit 63dded0

Browse files
author
Riccardo Cipolleschi
committed
Update scripts to make the replace work
1 parent e993fef commit 63dded0

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DerivedData
2121
*.xcuserstate
2222
project.xcworkspace
2323
**/.xcode.env.local
24+
/poackages/react-native/sdks/downloads/
2425

2526
# Gradle
2627
/build/

packages/react-native/sdks/hermes-engine/hermes-engine.podspec

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ react_native_path = File.join(__dir__, "..", "..")
1111
# package.json
1212
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
1313
version = package['version']
14-
version = "0.72.0-rc.5"
1514

1615
# sdks/.hermesversion
1716
hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
@@ -65,11 +64,11 @@ Pod::Spec.new do |spec|
6564
# test something specific for that tarball.
6665
if source[:http].include?('https://repo1.maven.org/')
6766
spec.script_phase = {
68-
:name => "[Hermes] Download Hermes for the right configuration, if needed",
67+
:name => "[Hermes] Replace Hermes for the right configuration, if needed",
6968
:execution_position => :before_compile,
7069
:script => <<-EOS
7170
. "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
72-
"$NODE_BINARY" "$REACT_NATIVE_PATH/sdks/hermes-engine/utils/replace_hermes_version.js" -c "$CONFIGURATION" -r "#{version}"
71+
"$NODE_BINARY" "$REACT_NATIVE_PATH/sdks/hermes-engine/utils/replace_hermes_version.js" -c "$CONFIGURATION" -r "#{version}" -p "$REACT_NATIVE_PATH"
7372
EOS
7473
}
7574
end

packages/react-native/sdks/hermes-engine/hermes-utils.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ def abort_if_invalid_tarball_provided!()
3333
def compute_hermes_source(build_from_source, hermestag_file, git, version, react_native_path)
3434
source = {}
3535

36-
# if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
37-
# use_tarball(source)
38-
# elsif ENV.has_key?('HERMES_COMMIT')
39-
# build_hermes_from_commit(source, git, ENV['HERMES_COMMIT'])
40-
# elsif build_from_source
41-
# if File.exist?(hermestag_file)
42-
# build_from_tagfile(source, git, hermestag_file)
43-
# else
44-
# build_hermes_from_source(source, git)
45-
# end
46-
# elsif hermes_artifact_exists(release_tarball_url(version, :debug))
36+
if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
37+
use_tarball(source)
38+
elsif ENV.has_key?('HERMES_COMMIT')
39+
build_hermes_from_commit(source, git, ENV['HERMES_COMMIT'])
40+
elsif build_from_source
41+
if File.exist?(hermestag_file)
42+
build_from_tagfile(source, git, hermestag_file)
43+
else
44+
build_hermes_from_source(source, git)
45+
end
46+
elsif hermes_artifact_exists(release_tarball_url(version, :debug))
4747
use_release_tarball(source, version, :debug)
4848
download_stable_hermes(react_native_path, version, :debug)
4949
download_stable_hermes(react_native_path, version, :release)
50-
# elsif hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", ""))
51-
# use_nightly_tarball(source, react_native_path, version)
52-
# else
53-
# build_hermes_from_source(source, git)
54-
# end
50+
elsif hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", ""))
51+
use_nightly_tarball(source, react_native_path, version)
52+
else
53+
build_hermes_from_source(source, git)
54+
end
5555

5656
return source
5757
end

packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function shouldReplaceHermesConfiguration(configuration) {
3333

3434
if (fileExists) {
3535
console.log(`Found ${LAST_BUILD_FILENAME} file`);
36-
const oldConfiguration = fs.readFileSync(LAST_BUILD_FILENAME);
36+
const oldConfiguration = fs.readFileSync(LAST_BUILD_FILENAME).toString();
3737
if (oldConfiguration === configuration) {
3838
console.log('No need to download a new build of Hermes!');
3939
return false;
@@ -54,7 +54,7 @@ function shouldReplaceHermesConfiguration(configuration) {
5454
function replaceHermesConfiguration(configuration, version, reactNativePath) {
5555
const tarballURLPath = `${reactNativePath}/sdks/downloads/hermes-ios-${version}-${configuration}.tar.gz`;
5656

57-
const finalLocation = 'Pods/hermes-engine';
57+
const finalLocation = 'hermes-engine';
5858
console.log('Preparing the final location');
5959
fs.rmSync(finalLocation, {force: true, recursive: true});
6060
fs.mkdirSync(finalLocation, {recursive: true});
@@ -77,6 +77,7 @@ function main(configuration, version, reactNativePath) {
7777

7878
replaceHermesConfiguration(configuration, version, reactNativePath);
7979
updateLastBuildConfiguration(configuration);
80+
console.log('Done replacing hermes-engine');
8081
}
8182

8283
// This script is executed in the Pods folder, which is usually not synched to Github, so it should be ok
@@ -101,5 +102,4 @@ const configuration = argv.configuration;
101102
const version = argv.reactNativeVersion;
102103
const reactNativePath = argv.reactNativePath;
103104

104-
throw new Error(`React native path is: ${reactNativePath}`);
105105
main(configuration, version, reactNativePath);

0 commit comments

Comments
 (0)