Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9c61fec

Browse files
authored
feat: add prefab and maven publish support (#185)
# Why prepare the future support to publish artifact at maven central. because people use hermes mostly and it doesn't make sense to download unnecessary jsc-android from npm # How - change group:artifact to `io.github.react-native-community:jsc-android` - add prefabPublishing support. that would help react-native integration easier
1 parent 4a89838 commit 9c61fec

File tree

15 files changed

+268
-88
lines changed

15 files changed

+268
-88
lines changed

‎.github/workflows/build_and_test.yml‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
env:
13+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }}
14+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
1215

1316
steps:
1417
- uses: actions/checkout@v4
@@ -91,6 +94,13 @@ jobs:
9194
name: archive
9295
path: archive
9396

97+
- name: Extract archive
98+
run: |
99+
mv archive/dist dist
100+
mv archive/dist.unstripped dist.unstripped
101+
rmdir archive
102+
shell: bash
103+
94104
- name: 🍺 Install Maestro
95105
run: |
96106
curl -Ls "https://get.maestro.mobile.dev" | bash
@@ -115,6 +125,20 @@ jobs:
115125
target: google_apis
116126
working-directory: test
117127
script: |
118-
mv ../archive/dist ../dist
119128
npx expo run:android --variant release --no-bundler
129+
adb logcat -c
130+
set +e
120131
maestro test maestro.yaml
132+
STATUS=$?
133+
adb logcat -d > adb.log
134+
exit $STATUS
135+
136+
- name: Upload failed artifacts
137+
if: failure()
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: failure_artifacts
141+
path: |
142+
$HOME/.maestro/tests/**/*
143+
test/android/app/build/outputs/apk/release/app-release.apk
144+
test/adb.log

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package-lock.json
2020
bin/
2121
gen/
2222
out/
23+
.cxx/
2324

2425
# Gradle files
2526
.gradle/

‎lib/android-jsc/build.gradle‎

Lines changed: 0 additions & 65 deletions
This file was deleted.

‎lib/cppruntime/build.gradle‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ apply plugin: 'maven-publish'
33

44
def distDir = project.findProperty("distDir") ?: ""
55
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
6-
def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")
6+
def version = project.findProperty("version") ?: "".replaceAll("\\s", "")
77

88
if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty")
99
if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty")
10-
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
10+
if (!version) throw new RuntimeException("expecting --project-prop version=??? but was empty")
1111

1212
android {
13-
namespace 'org.webkit.androidjsc_cppruntime'
13+
namespace 'io.github.react_native_community.jscandroid_cppruntime'
1414
compileSdkVersion 35
1515

1616
defaultConfig {
@@ -34,17 +34,17 @@ android {
3434

3535
dependencies {}
3636

37-
project.group = "org.webkit"
38-
project.version = "r${revision}"
37+
project.group = "io.github.react-native-community"
38+
project.version = "${version}"
3939

4040
afterEvaluate {
4141
publishing {
4242
publications {
4343
release(MavenPublication) {
4444
from components.release
4545
pom {
46-
name = "android-jsc"
47-
artifactId = "android-jsc-cppruntime"
46+
name = "jsc-android"
47+
artifactId = "jsc-android-cppruntime"
4848
packaging = "aar"
4949
}
5050
}
File renamed without changes.

‎lib/jsc-android/CMakeLists.txt‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
set(CMAKE_VERBOSE_MAKEFILE on)
3+
project(jsc-android)
4+
5+
add_library(jsc SHARED empty.cpp)
6+
7+
set(OUTPUT_SRC "${PREBUILT_LIBS_DIR}/${ANDROID_ABI}/libjsc.so")
8+
set(OUTPUT_DST "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libjsc.so")
9+
10+
add_custom_command(
11+
TARGET jsc POST_BUILD
12+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
13+
${OUTPUT_SRC}
14+
${OUTPUT_DST}
15+
COMMENT "Overwriting ${OUTPUT_SRC} to ${OUTPUT_DST}"
16+
)

‎lib/jsc-android/build.gradle‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'maven-publish'
3+
apply plugin: 'signing'
4+
5+
def distDir = project.findProperty("distDir") ?: ""
6+
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
7+
def headersDir = project.findProperty("headersDir") ?: "${distDir}/include"
8+
def version = project.findProperty("version") ?: "".replaceAll("\\s", "")
9+
def i18n = project.findProperty("i18n") ?: ""
10+
11+
def signingKey = project.findProperty('signingKey')
12+
def signingPassword = project.findProperty('signingPassword')
13+
14+
if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty")
15+
if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty")
16+
if (!version) throw new RuntimeException("expecting --project-prop version=??? but was empty")
17+
if (!i18n) throw new RuntimeException("expecting --project-prop i18n=??? but was empty")
18+
19+
android {
20+
namespace 'io.github.react_native_community.jscandroid'
21+
compileSdkVersion 35
22+
23+
defaultConfig {
24+
minSdkVersion 24
25+
targetSdkVersion 34
26+
versionCode 1
27+
versionName "1.0"
28+
29+
externalNativeBuild {
30+
cmake {
31+
arguments '-DANDROID_STL=c++_shared',
32+
"-DPREBUILT_LIBS_DIR=${jniLibsDir}"
33+
targets 'jsc'
34+
}
35+
}
36+
}
37+
38+
externalNativeBuild {
39+
cmake {
40+
path 'CMakeLists.txt'
41+
}
42+
}
43+
44+
packagingOptions {
45+
doNotStrip '**/libjsc.so'
46+
pickFirst '**/libjsc.so'
47+
48+
excludes += [
49+
'**/libc++_shared.so',
50+
]
51+
}
52+
53+
buildFeatures {
54+
prefabPublishing true
55+
}
56+
57+
prefab {
58+
jsc {
59+
headers file(headersDir).absolutePath
60+
}
61+
}
62+
63+
publishing {
64+
singleVariant("release") {
65+
}
66+
}
67+
}
68+
69+
dependencies {}
70+
71+
project.group = "io.github.react-native-community"
72+
def artifactName = Boolean.valueOf(i18n) ? "jsc-android-intl" : "jsc-android"
73+
project.version = "${version}"
74+
75+
afterEvaluate {
76+
publishing {
77+
publications {
78+
release(MavenPublication) {
79+
from components.release
80+
pom {
81+
name = artifactName
82+
artifactId = artifactName
83+
description = 'Pre-build version of JavaScriptCore to be used by React Native apps'
84+
url = 'https://github.com/react-native-community/jsc-android-buildscripts'
85+
86+
developers {
87+
developer {
88+
id = 'react-native-community'
89+
name = 'React Native Community'
90+
}
91+
}
92+
93+
licenses {
94+
license {
95+
name = 'BSD-2-Clause'
96+
url = 'https://github.com/react-native-community/jsc-android-buildscripts/blob/main/LICENSE'
97+
distribution = 'repo'
98+
}
99+
}
100+
101+
scm {
102+
url = 'https://github.com/react-native-community/jsc-android-buildscripts.git'
103+
connection = 'scm:git:https://github.com/react-native-community/jsc-android-buildscripts.git'
104+
developerConnection = 'scm:git:git@github.com:react-native-community/jsc-android-buildscripts.git'
105+
}
106+
}
107+
}
108+
}
109+
110+
repositories {
111+
maven {
112+
url = "file://${distDir}"
113+
}
114+
}
115+
116+
if (signingKey && signingPassword) {
117+
signing {
118+
useInMemoryPgpKeys(signingKey, signingPassword)
119+
sign publishing.publications.release
120+
}
121+
}
122+
}
123+
}

‎lib/jsc-android/empty.cpp‎

Whitespace-only changes.

‎lib/settings.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rootProject.name = 'JavaScriptCore Lib'
22

3-
include ':android-jsc'
3+
include ':jsc-android'
44
include ':cppruntime'

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /