Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 16 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/sanchuanhehe/harmony-next-pipeline-docker/harmonyos-ci-image:latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: oven-sh/setup-bun@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
# - uses: actions/setup-node@v6
# with:
# node-version: 24
# registry-url: 'https://registry.npmjs.org'
- run: bun install --frozen-lockfile
- name: Verify Harmony build tools
run: |
command -v hvigorw >/dev/null 2>&1 || (echo "Missing hvigorw in the Harmony container image." >&2; exit 1)
command -v ohpm >/dev/null 2>&1 || (echo "Missing ohpm in the Harmony container image." >&2; exit 1)
- name: Build Harmony HAR
run: npm run build:harmony-har -- --build-mode release
- name: Verify Harmony HAR artifact
run: test -f harmony/pushy.har
- run: npm publish --provenance --access public
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ Example/harmony_use_pushy/libs


harmony/package
harmony/pushy.har
**/oh_modules
harmony/pushy/.preview
harmony/pushy/.cxx
Example/harmony_use_pushy/harmony/entry/src/main/resources/rawfile/meta.json
**/.hvigor
Example/harmony_use_pushy/harmony/entry/src/main/cpp/generated
Expand Down
10 changes: 5 additions & 5 deletions Example/harmony_use_pushy/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Example/harmony_use_pushy/harmony/build-profile.json5
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,5 @@
},
],
},
{
name: 'pushy',
srcPath: '../node_modules/react-native-update/harmony/pushy',
},
],
}
6 changes: 3 additions & 3 deletions Example/harmony_use_pushy/harmony/entry/oh-package-lock.json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/harmony_use_pushy/harmony/entry/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
license: '',
dependencies: {
'@rnoh/react-native-openharmony': '0.72.96',
pushy: 'file:../../node_modules/react-native-update/harmony/pushy',
pushy: 'file:../../../../harmony/pushy.har',
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
add_compile_definitions(WITH_HITRACE_SYSTRACE)

add_subdirectory("${OH_MODULES}/pushy/src/main/cpp" ./pushy)
set(PUSHY_CPP_DIR "${NODE_MODULES}/react-native-update/harmony/pushy/src/main/cpp")
set(PUSHY_TURBO_MODULE_CPP "${PUSHY_CPP_DIR}/PushyTurboModule.cpp")
if(NOT EXISTS "${PUSHY_TURBO_MODULE_CPP}")
message(FATAL_ERROR "Cannot find Pushy glue source in node_modules: ${PUSHY_TURBO_MODULE_CPP}")
endif()
add_subdirectory("${RNOH_CPP_DIR}" ./rn)

# Build only the RNOH glue here. librnupdate.so is provided by pushy.har.
add_library(rnoh_pushy SHARED "${PUSHY_TURBO_MODULE_CPP}")
target_include_directories(rnoh_pushy PUBLIC "${PUSHY_CPP_DIR}")
target_link_libraries(rnoh_pushy PUBLIC rnoh)

file(GLOB GENERATED_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp") # this line is needed by codegen v1

add_library(rnoh_app SHARED
${GENERATED_CPP_FILES}
"./PackageProvider.cpp"
"${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
)
target_include_directories(rnoh_app PRIVATE "${PUSHY_CPP_DIR}")
target_link_libraries(rnoh_app PUBLIC rnoh)
target_link_libraries(rnoh_app PUBLIC rnoh_pushy)
target_link_libraries(rnoh_app PUBLIC rnoh_pushy)
6 changes: 3 additions & 3 deletions Example/harmony_use_pushy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"test": "jest"
},
"dependencies": {
"@react-native-oh/react-native-harmony": "^0.72.59",
"@react-native-oh/react-native-harmony": "0.72.96",
"react": "18.2.0",
"react-native": "0.72.5",
"react-native-update": "^10.37.1"
"react-native-update": "^10.37.15"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand All @@ -32,7 +32,7 @@
"metro-react-native-babel-preset": "0.76.8",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
"typescript": "5.9.3"
},
"engines": {
"node": ">=16"
Expand Down
5 changes: 5 additions & 0 deletions harmony/har-wrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.hvigor
.idea
build
oh_modules
oh-package-lock.json5
8 changes: 8 additions & 0 deletions harmony/har-wrapper/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"app": {
"bundleName": "com.reactnativecn.pushy.har",
"vendor": "reactnativecn",
"versionCode": 1,
"versionName": "1.0.0"
}
}
35 changes: 35 additions & 0 deletions harmony/har-wrapper/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"compatibleSdkVersion": "5.0.0(12)",
"targetSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS"
}
],
"buildModeSet": [
{
"name": "debug"
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "pushy",
"srcPath": "../pushy",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
5 changes: 5 additions & 0 deletions harmony/har-wrapper/hvigor/hvigor-config.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"modelVersion": "5.0.0",
"dependencies": {
}
}
6 changes: 6 additions & 0 deletions harmony/har-wrapper/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {appTasks} from '@ohos/hvigor-ohos-plugin';

export default {
system: appTasks,
plugins: [],
};
4 changes: 4 additions & 0 deletions harmony/har-wrapper/oh-package.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
modelVersion: '5.0.0',
dependencies: {},
}
9 changes: 8 additions & 1 deletion harmony/pushy/build-profile.json5
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"apiType": "stageMode",
"buildOption": {
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": ""
}
},
"targets": [
{
"name": "default",
}
]
}
}
72 changes: 42 additions & 30 deletions harmony/pushy/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,51 @@
cmake_minimum_required(VERSION 3.13)
project(rnupdate)

# Point to android/jni directory for shared source code
set(ANDROID_JNI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../node_modules/react-native-update/android/jni)
set(HDIFFPATCH_DIR ${ANDROID_JNI_DIR}/HDiffPatch)
set(LZMA_DIR ${ANDROID_JNI_DIR}/lzma)
set(HDP_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/pushy.c
${ANDROID_JNI_DIR}/hpatch.c
${HDIFFPATCH_DIR}/libHDiffPatch/HPatch/patch.c
${HDIFFPATCH_DIR}/file_for_patch.c
${LZMA_DIR}/C/LzmaDec.c
${LZMA_DIR}/C/Lzma2Dec.c
)
set(PUSHY_MODULE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(PUSHY_ABI ${CMAKE_OHOS_ARCH_ABI})
if(NOT PUSHY_ABI)
set(PUSHY_ABI ${OHOS_ARCH})
endif()
set(PREBUILT_RNUPDATE_PATH ${PUSHY_MODULE_ROOT}/libs/${PUSHY_ABI}/librnupdate.so)
set(CMAKE_VERBOSE_MAKEFILE on)

if(EXISTS ${PREBUILT_RNUPDATE_PATH})
add_library(rnupdate SHARED IMPORTED GLOBAL)
set_target_properties(rnupdate PROPERTIES IMPORTED_LOCATION ${PREBUILT_RNUPDATE_PATH})
else()
# When building the HAR itself, native sources are compiled from the repo checkout.
set(ANDROID_JNI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../android/jni)
set(HDIFFPATCH_DIR ${ANDROID_JNI_DIR}/HDiffPatch)
set(LZMA_DIR ${ANDROID_JNI_DIR}/lzma)
set(HDP_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/pushy.c
${ANDROID_JNI_DIR}/hpatch.c
${HDIFFPATCH_DIR}/libHDiffPatch/HPatch/patch.c
${HDIFFPATCH_DIR}/file_for_patch.c
${LZMA_DIR}/C/LzmaDec.c
${LZMA_DIR}/C/Lzma2Dec.c
)

add_library(rnupdate SHARED
${HDP_SOURCES}
)
add_library(rnupdate SHARED
${HDP_SOURCES}
)

target_include_directories(rnupdate PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${ANDROID_JNI_DIR}
${HDIFFPATCH_DIR}
${HDIFFPATCH_DIR}/libHDiffPatch/HPatch
${LZMA_DIR}/C
)
target_include_directories(rnupdate PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${ANDROID_JNI_DIR}
${HDIFFPATCH_DIR}
${HDIFFPATCH_DIR}/libHDiffPatch/HPatch
${LZMA_DIR}/C
)

target_link_libraries(rnupdate PUBLIC
libace_napi.z.so
)

file(GLOB rnoh_pushy_SRC CONFIGURE_DEPENDS *.cpp)
add_library(rnoh_pushy SHARED ${rnoh_pushy_SRC})
target_include_directories(rnoh_pushy PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rnoh_pushy PUBLIC rnoh)
target_link_libraries(rnupdate PUBLIC
libace_napi.z.so
)
endif()

if(TARGET rnoh)
file(GLOB rnoh_pushy_SRC CONFIGURE_DEPENDS *.cpp)
add_library(rnoh_pushy SHARED ${rnoh_pushy_SRC})
target_include_directories(rnoh_pushy PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rnoh_pushy PUBLIC rnoh)
endif()
Loading
Loading