Skip to content

Commit

Permalink
feat: change turbo-android build script
Browse files Browse the repository at this point in the history
  • Loading branch information
pklatka committed Mar 27, 2024
1 parent e85b09f commit bfc061f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 11 additions & 1 deletion packages/turbo/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ repositories {
}
}

parent.allprojects {
repositories {
mavenLocal()

maven {
url "$rootDir/../node_modules/react-native-turbo/android/vendor"
}
}
}

def addTurboDependencies(Map<String, String> libraries) {
libraries.each { type, lib ->
if (type.startsWith("dep")) {
Expand All @@ -151,7 +161,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation(files('vendor/turbo-android.aar'))
implementation "dev.hotwire:turbo:local"
// From node_modules
}

Expand Down
12 changes: 6 additions & 6 deletions packages/turbo/scripts/build-turbo-android.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TURBO_ANDROID_REPO_PATH="https://github.com/hotwired/turbo-android.git"
TURBO_ANDROID_MAIN_SOURCE_DIR="./turbo/src/main/*"
TURBO_ANDROID_VERSION=$1
PATCH_DIR=$(realpath ./patches)
PATCH_FILE=$(realpath ./patches/turbo-android-react-native-support.patch)
TURBO_ANDROID_DIR=$(realpath ./android)
DEPENDENCIES_GRADLE_FILE="turbo-android-dependencies.gradle"
DEPENDENCY_REGEX="[a-zA-Z0-9.\-]+:[a-zA-Z0-9.\-]+:[0-9a-zA-Z.\-]+"
Expand All @@ -25,13 +25,13 @@ git clone --branch $TURBO_ANDROID_VERSION --depth 1 $TURBO_ANDROID_REPO_PATH

# Apply patch
cd turbo-android
git apply $PATCH_DIR/turbo-android-react-native-support.patch
git apply $PATCH_FILE

# Build .aar file
./gradlew clean assemble -p turbo
# Build turbo-android to local maven repository
./gradlew -PVersion=local publishToMavenLocal

# Copy .aar file to lib directory
cp ./turbo/build/outputs/aar/turbo-release.aar $TURBO_ANDROID_DIR/vendor/turbo-android.aar
# Build turbo-android to vendor directory
./gradlew -Dmaven.repo.local=$TURBO_ANDROID_DIR/vendor -PVersion=local publishToMavenLocal

# Get necessary dependencies from turbo build.gradle
./gradlew turbo:dependencies --configuration implementation > deps.txt
Expand Down

0 comments on commit bfc061f

Please sign in to comment.