Skip to content

Commit 07ab2b2

Browse files
authored
Merge pull request #9 from mrousavy/fix/android-aar
Fix Android npm package (aar)
2 parents 238105a + 02d8a66 commit 07ab2b2

File tree

6 files changed

+49
-6
lines changed

6 files changed

+49
-6
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ lib/
6363
.externalNativeBuild/
6464
native_prebuilt
6565
ndk-deps
66+
67+
android-npm

android/gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Multithreading_compileSdkVersion=29
22
Multithreading_buildToolsVersion=29.0.2
3-
Multithreading_targetSdkVersion=29
3+
Multithreading_targetSdkVersion=29
4+
android.useAndroidX=true

android/settings.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rootProject.name = 'rnmultithreading'
2+
3+
include ':react-native-reanimated'
4+
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android/')
5+
6+
include ':rnmultithreading'

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-multithreading",
3-
"version": "0.1.1",
3+
"version": "1.0.0",
44
"description": "🧵 Fast and easy multithreading for React Native using JSI",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -22,12 +22,13 @@
2222
"!**/__mocks__"
2323
],
2424
"scripts": {
25-
"test": "jest",
25+
"bootstrap": "yarn && cd example && yarn && cd ios && pod install",
2626
"typescript": "tsc --noEmit",
2727
"lint": "eslint \"**/*.{js,ts,tsx}\"",
28-
"prepare": "bob build",
29-
"release": "release-it",
30-
"bootstrap": "yarn && cd example && yarn && cd ios && pod install"
28+
"prepare": "bob build && scripts/build-android.sh",
29+
"prepack": "rm -rf android-backup && mv android android-backup && mv android-npm android",
30+
"postpack": "mv android android-npm && mv android-backup android",
31+
"release": "release-it"
3132
},
3233
"keywords": [
3334
"react-native",

scripts/build-android.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
4+
5+
cd $CWD
6+
cd ..
7+
8+
echo 'Building Android in:'
9+
echo $PWD
10+
11+
rm -rf android-npm/
12+
13+
cd android
14+
rm -rf build/
15+
16+
# Build .aar files
17+
./gradlew clean
18+
./gradlew assembleDebug assembleRelease
19+
20+
rm -rf ../android-npm
21+
mkdir ../android-npm
22+
23+
# Move over the .aar files
24+
shopt -s dotglob nullglob
25+
mv -v build/outputs/aar/* ../android-npm
26+
27+
# Move over the build.gradle file
28+
cd $CWD
29+
cd ..
30+
cd scripts
31+
cp template.build.gradle ../android-npm/build.gradle

scripts/template.build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configurations.maybeCreate("default")
2+
artifacts.add("default", file('rnmultithreading-debug.aar')) // TODO: Use release variant here?

0 commit comments

Comments
 (0)