Skip to content

Commit

Permalink
Merge pull request #9 from mrousavy/fix/android-aar
Browse files Browse the repository at this point in the history
Fix Android npm package (aar)
  • Loading branch information
mrousavy authored Apr 18, 2021
2 parents 238105a + 02d8a66 commit 07ab2b2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ lib/
.externalNativeBuild/
native_prebuilt
ndk-deps

android-npm
3 changes: 2 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Multithreading_compileSdkVersion=29
Multithreading_buildToolsVersion=29.0.2
Multithreading_targetSdkVersion=29
Multithreading_targetSdkVersion=29
android.useAndroidX=true
6 changes: 6 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rootProject.name = 'rnmultithreading'

include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android/')

include ':rnmultithreading'
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-multithreading",
"version": "0.1.1",
"version": "1.0.0",
"description": "🧵 Fast and easy multithreading for React Native using JSI",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand All @@ -22,12 +22,13 @@
"!**/__mocks__"
],
"scripts": {
"test": "jest",
"bootstrap": "yarn && cd example && yarn && cd ios && pod install",
"typescript": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"prepare": "bob build",
"release": "release-it",
"bootstrap": "yarn && cd example && yarn && cd ios && pod install"
"prepare": "bob build && scripts/build-android.sh",
"prepack": "rm -rf android-backup && mv android android-backup && mv android-npm android",
"postpack": "mv android android-npm && mv android-backup android",
"release": "release-it"
},
"keywords": [
"react-native",
Expand Down
31 changes: 31 additions & 0 deletions scripts/build-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

cd $CWD
cd ..

echo 'Building Android in:'
echo $PWD

rm -rf android-npm/

cd android
rm -rf build/

# Build .aar files
./gradlew clean
./gradlew assembleDebug assembleRelease

rm -rf ../android-npm
mkdir ../android-npm

# Move over the .aar files
shopt -s dotglob nullglob
mv -v build/outputs/aar/* ../android-npm

# Move over the build.gradle file
cd $CWD
cd ..
cd scripts
cp template.build.gradle ../android-npm/build.gradle
2 changes: 2 additions & 0 deletions scripts/template.build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('rnmultithreading-debug.aar')) // TODO: Use release variant here?

0 comments on commit 07ab2b2

Please sign in to comment.