-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for bridgeless NativeModule in New Architecture #194
Changes from all commits
1a2adfb
cfeb850
1ff8f07
bf2fff0
7222e79
ac39379
da6de00
e7485df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,57 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
#!/bin/sh | ||
|
||
yarn lint-staged | ||
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then | ||
set -x | ||
fi | ||
|
||
if [ -f "package-lock.json" ]; | ||
then echo "package-lock.json is not allowed"; | ||
exit 1; | ||
if [ "$LEFTHOOK" = "0" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
exit 0 | ||
fi | ||
|
||
call_lefthook() | ||
{ | ||
if test -n "$LEFTHOOK_BIN" | ||
then | ||
"$LEFTHOOK_BIN" "$@" | ||
elif lefthook -h >/dev/null 2>&1 | ||
then | ||
lefthook "$@" | ||
else | ||
dir="$(git rev-parse --show-toplevel)" | ||
osArch=$(uname | tr '[:upper:]' '[:lower:]') | ||
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') | ||
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" | ||
then | ||
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@" | ||
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" | ||
then | ||
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@" | ||
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" | ||
then | ||
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@" | ||
elif test -f "$dir/node_modules/lefthook/bin/index.js" | ||
then | ||
"$dir/node_modules/lefthook/bin/index.js" "$@" | ||
|
||
elif bundle exec lefthook -h >/dev/null 2>&1 | ||
then | ||
bundle exec lefthook "$@" | ||
elif yarn lefthook -h >/dev/null 2>&1 | ||
then | ||
yarn lefthook "$@" | ||
elif pnpm lefthook -h >/dev/null 2>&1 | ||
then | ||
pnpm lefthook "$@" | ||
elif swift package plugin lefthook >/dev/null 2>&1 | ||
then | ||
swift package --disable-sandbox plugin lefthook "$@" | ||
elif command -v mint >/dev/null 2>&1 | ||
then | ||
mint run csjones/lefthook-plugin "$@" | ||
else | ||
echo "Can't find lefthook in PATH" | ||
fi | ||
fi | ||
} | ||
|
||
call_lefthook run "pre-commit" "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
|
||
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then | ||
set -x | ||
fi | ||
|
||
if [ "$LEFTHOOK" = "0" ]; then | ||
exit 0 | ||
fi | ||
|
||
call_lefthook() | ||
{ | ||
if test -n "$LEFTHOOK_BIN" | ||
then | ||
"$LEFTHOOK_BIN" "$@" | ||
elif lefthook -h >/dev/null 2>&1 | ||
then | ||
lefthook "$@" | ||
else | ||
dir="$(git rev-parse --show-toplevel)" | ||
osArch=$(uname | tr '[:upper:]' '[:lower:]') | ||
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') | ||
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" | ||
then | ||
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@" | ||
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" | ||
then | ||
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@" | ||
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" | ||
then | ||
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@" | ||
elif test -f "$dir/node_modules/lefthook/bin/index.js" | ||
then | ||
"$dir/node_modules/lefthook/bin/index.js" "$@" | ||
|
||
elif bundle exec lefthook -h >/dev/null 2>&1 | ||
then | ||
bundle exec lefthook "$@" | ||
elif yarn lefthook -h >/dev/null 2>&1 | ||
then | ||
yarn lefthook "$@" | ||
elif pnpm lefthook -h >/dev/null 2>&1 | ||
then | ||
pnpm lefthook "$@" | ||
elif swift package plugin lefthook >/dev/null 2>&1 | ||
then | ||
swift package --disable-sandbox plugin lefthook "$@" | ||
elif command -v mint >/dev/null 2>&1 | ||
then | ||
mint run csjones/lefthook-plugin "$@" | ||
else | ||
echo "Can't find lefthook in PATH" | ||
fi | ||
fi | ||
} | ||
|
||
call_lefthook run "prepare-commit-msg" "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Kenny Tsui | ||
Copyright (c) 2025 Klaviyo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Autogenerated by the template, no offense Kenny <3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lolll |
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ buildscript { | |
} | ||
} | ||
|
||
def reactNativeArchitectures() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This just came from the template |
||
def value = rootProject.getProperties().get("reactNativeArchitectures") | ||
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] | ||
} | ||
|
||
def isNewArchitectureEnabled() { | ||
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" | ||
} | ||
|
@@ -58,7 +63,6 @@ android { | |
defaultConfig { | ||
minSdkVersion getExtOrIntegerDefault("minSdkVersion") | ||
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
} | ||
|
||
buildFeatures { | ||
|
@@ -79,20 +83,6 @@ android { | |
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These gradle changes were necessary yet not sufficient for removing the turbomodule code gen from our project for now. When we do add TM support, they'll have to come back |
||
sourceSets { | ||
main { | ||
if (isNewArchitectureEnabled()) { | ||
java.srcDirs += [ | ||
"src/newarch", | ||
// This is needed to build Kotlin project with NewArch enabled | ||
"${project.buildDir}/generated/source/codegen/java" | ||
] | ||
} else { | ||
java.srcDirs += ["src/oldarch"] | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
|
@@ -133,10 +123,3 @@ dependencies { | |
implementation "org.jetbrains.kotlin:kotlin-reflect:1.8.21" | ||
} | ||
|
||
if (isNewArchitectureEnabled()) { | ||
react { | ||
jsRootDir = file("../src/") | ||
libraryName = "KlaviyoReactNativeSdk" | ||
codegenJavaPackageName = "com.klaviyoreactnativesdk" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,8 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro | |
# org.gradle.parallel=true | ||
#Tue Dec 19 15:08:27 EST 2023 | ||
KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=3.0.3 | ||
KlaviyoReactNativeSdk_compileSdkVersion=31 | ||
KlaviyoReactNativeSdk_kotlinVersion=1.8.0 | ||
KlaviyoReactNativeSdk_minSdkVersion=23 | ||
KlaviyoReactNativeSdk_ndkversion=21.4.7075529 | ||
KlaviyoReactNativeSdk_targetSdkVersion=31 | ||
android.enableJetifier=true | ||
android.useAndroidX=true | ||
Comment on lines
-20
to
-21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these defaulted to true now? or incompatible with new arch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just noticing this as well. I'm not sure about jetifier, but we use androidX so that probably needs to come back There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking back in git, it appears I added them pretty early on, but I'm not clear why. They weren't part of the original template, nor are they in the latest one. And I'm not sure why we'd need them, since the SDK's android files do not make use of androidx at all.
evan-masseau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
KlaviyoReactNativeSdk_compileSdkVersion=31 | ||
KlaviyoReactNativeSdk_ndkversion=21.4.7075529 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was from the new project template, it moves our git hooks to lefthook.yml. I don't have a strong opinion, but just figured I'd adopt it while we're updating