-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
15 changed files
with
268 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ package-lock.json | |
bin/ | ||
gen/ | ||
out/ | ||
.cxx/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
set(CMAKE_VERBOSE_MAKEFILE on) | ||
project(jsc-android) | ||
|
||
add_library(jsc SHARED empty.cpp) | ||
|
||
set(OUTPUT_SRC "${PREBUILT_LIBS_DIR}/${ANDROID_ABI}/libjsc.so") | ||
set(OUTPUT_DST "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libjsc.so") | ||
|
||
add_custom_command( | ||
TARGET jsc POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${OUTPUT_SRC} | ||
${OUTPUT_DST} | ||
COMMENT "Overwriting ${OUTPUT_SRC} to ${OUTPUT_DST}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
def distDir = project.findProperty("distDir") ?: "" | ||
def jniLibsDir = project.findProperty("jniLibsDir") ?: "" | ||
def headersDir = project.findProperty("headersDir") ?: "${distDir}/include" | ||
def version = project.findProperty("version") ?: "".replaceAll("\\s", "") | ||
def i18n = project.findProperty("i18n") ?: "" | ||
|
||
def signingKey = project.findProperty('signingKey') | ||
def signingPassword = project.findProperty('signingPassword') | ||
|
||
if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty") | ||
if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty") | ||
if (!version) throw new RuntimeException("expecting --project-prop version=??? but was empty") | ||
if (!i18n) throw new RuntimeException("expecting --project-prop i18n=??? but was empty") | ||
|
||
android { | ||
namespace 'io.github.react_native_community.jscandroid' | ||
compileSdkVersion 35 | ||
|
||
defaultConfig { | ||
minSdkVersion 24 | ||
targetSdkVersion 34 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
externalNativeBuild { | ||
cmake { | ||
arguments '-DANDROID_STL=c++_shared', | ||
"-DPREBUILT_LIBS_DIR=${jniLibsDir}" | ||
targets 'jsc' | ||
} | ||
} | ||
} | ||
|
||
externalNativeBuild { | ||
cmake { | ||
path 'CMakeLists.txt' | ||
} | ||
} | ||
|
||
packagingOptions { | ||
doNotStrip '**/libjsc.so' | ||
pickFirst '**/libjsc.so' | ||
|
||
excludes += [ | ||
'**/libc++_shared.so', | ||
] | ||
} | ||
|
||
buildFeatures { | ||
prefabPublishing true | ||
} | ||
|
||
prefab { | ||
jsc { | ||
headers file(headersDir).absolutePath | ||
} | ||
} | ||
|
||
publishing { | ||
singleVariant("release") { | ||
} | ||
} | ||
} | ||
|
||
dependencies {} | ||
|
||
project.group = "io.github.react-native-community" | ||
def artifactName = Boolean.valueOf(i18n) ? "jsc-android-intl" : "jsc-android" | ||
project.version = "${version}" | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
from components.release | ||
pom { | ||
name = artifactName | ||
artifactId = artifactName | ||
description = 'Pre-build version of JavaScriptCore to be used by React Native apps' | ||
url = 'https://github.com/react-native-community/jsc-android-buildscripts' | ||
|
||
developers { | ||
developer { | ||
id = 'react-native-community' | ||
name = 'React Native Community' | ||
} | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'BSD-2-Clause' | ||
url = 'https://github.com/react-native-community/jsc-android-buildscripts/blob/main/LICENSE' | ||
distribution = 'repo' | ||
} | ||
} | ||
|
||
scm { | ||
url = 'https://github.com/react-native-community/jsc-android-buildscripts.git' | ||
connection = 'scm:git:https://github.com/react-native-community/jsc-android-buildscripts.git' | ||
developerConnection = 'scm:git:[email protected]:react-native-community/jsc-android-buildscripts.git' | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
url = "file://${distDir}" | ||
} | ||
} | ||
|
||
if (signingKey && signingPassword) { | ||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications.release | ||
} | ||
} | ||
} | ||
} |
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
rootProject.name = 'JavaScriptCore Lib' | ||
|
||
include ':android-jsc' | ||
include ':jsc-android' | ||
include ':cppruntime' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.