Skip to content

Commit d1458a5

Browse files
coadofacebook-github-bot
authored andcommitted
Set hermes release version
Summary: This diff sets version in `CMakeLists.txt` to `1.0.0` and configures build to pass `-DHERMES_RELEASE_VERSION=for RN ${hermesReleaseVersion}` where `hermesReleaseVersion` is of type `<date>.0.0`. Differential Revision: D82313203
1 parent 5b91d78 commit d1458a5

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ endif()
6565
# - npm/package.json
6666
# - hermes-engine.podspec
6767
project(Hermes
68-
VERSION 0.12.0
68+
VERSION 1.0.0
6969
LANGUAGES C CXX)
7070

7171
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")

android/build-logic/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
plugins { `kotlin-dsl` }
8+
plugins {
9+
`kotlin-dsl`
10+
kotlin("plugin.serialization") version "2.2.0"
11+
}
12+
13+
dependencies { implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0") }
914

1015
repositories {
1116
mavenCentral()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.hermes.helpers.internal
9+
10+
import java.io.File
11+
import kotlinx.serialization.*
12+
import org.gradle.api.Project
13+
14+
@Serializable @JsonIgnoreUnknownKeys data class PackageJson(val version: String)
15+
16+
class SerializeHermesCompilerPackageJson(project: Project) {
17+
private val serializedPackageJson = run {
18+
val packageJsonFile = File(project.rootDir.parentFile, "npm/hermes-compiler/package.json")
19+
if (!packageJsonFile.exists()) {
20+
throw IllegalStateException("package.json file not found at $packageJsonFile")
21+
}
22+
Json.decodeFromString<PackageJson>(packageJsonFile.readText())
23+
}
24+
25+
val hermesReleaseVersion = serializedPackageJson.version
26+
}

android/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import com.facebook.hermes.helpers.internal.SerializeHermesCompilerPackageJson
89
import com.facebook.hermes.tasks.internal.CustomExecTask
910
import org.apache.tools.ant.taskdefs.condition.Os
1011

@@ -21,6 +22,8 @@ group = "com.facebook.hermes"
2122

2223
version = project.findProperty("VERSION_NAME")?.toString()!!
2324

25+
val hermesReleaseVersion = SerializeHermesCompilerPackageJson(project).hermesReleaseVersion
26+
2427
val cmakeVersion = System.getenv("CMAKE_VERSION") ?: libs.versions.cmake.get()
2528
val cmakePath = "${getSDKPath()}/cmake/$cmakeVersion"
2629
val cmakeBinaryPath = "${cmakePath}/bin/cmake"
@@ -222,7 +225,7 @@ android {
222225
"-DIMPORT_HOST_COMPILERS=${File(hermesBuildDir, "ImportHostCompilers.cmake").toString()}",
223226
"-DJSI_DIR=${jsiDir}",
224227
"-DHERMES_BUILD_SHARED_JSI=True",
225-
// "-DHERMES_RELEASE_VERSION=for RN ${version}",
228+
"-DHERMES_RELEASE_VERSION=for RN ${hermesReleaseVersion}",
226229
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True",
227230
// We intentionally build Hermes with Intl support only. This is to simplify
228231
// the build setup and to avoid overcomplicating the build-type matrix.

utils/build-apple-framework-rn.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ function get_mac_deployment_target {
4343
use_env_var "${MAC_DEPLOYMENT_TARGET}" "MAC_DEPLOYMENT_TARGET"
4444
}
4545

46+
function get_release_version {
47+
local current_date
48+
current_date=$(date '+%Y%m%d')
49+
echo "${current_date}.0.0"
50+
}
51+
4652
# Build host hermes compiler for internal bytecode
4753
function build_host_hermesc {
4854
echo "Building hermesc"
@@ -98,6 +104,7 @@ function configure_apple_framework {
98104
-DCMAKE_C_FLAGS:STRING="-gdwarf" \
99105
-DIMPORT_HOST_COMPILERS:PATH="$IMPORT_HERMESC_PATH" \
100106
-DJSI_DIR="$JSI_PATH" \
107+
-DHERMES_RELEASE_VERSION="for RN $(get_release_version)" \
101108
-DCMAKE_BUILD_TYPE="$cmake_build_type" \
102109
$boost_context_flag
103110
popd > /dev/null || exit 1

0 commit comments

Comments
 (0)