Skip to content

Commit e64af39

Browse files
committed
android local maven
1 parent da5f4b4 commit e64af39

File tree

8 files changed

+29
-9
lines changed

8 files changed

+29
-9
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2015-present, Facebook, Inc.
3+
Copyright (c) 2025 Krzysztof Borowy
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ plugins {
1010
alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false
1111
alias(libs.plugins.ksp) apply false
1212
alias(libs.plugins.androidx.room) apply false
13+
alias(libs.plugins.mavenPublish) apply false
1314
}

examples/example-react-native/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ newArchEnabled=true
5050
#ANDROID_NDK_VERSION=26.1.10909125
5151

5252
# Version of Kotlin to build against.
53-
#KOTLIN_VERSION=1.8.22
53+
KOTLIN_VERSION=2.2.10

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ coroutines = "1.10.2"
1313
room = "2.8.0"
1414
sqlite = "2.6.0"
1515
ksp = "2.2.10-2.0.2" # must match kotlin
16+
publish = "0.34.0"
1617

1718
[libraries]
1819
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
@@ -39,4 +40,5 @@ composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "k
3940
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
4041
androidKotlinMultiplatformLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
4142
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
42-
androidx-room = { id = "androidx.room", version.ref = "room" }
43+
androidx-room = { id = "androidx.room", version.ref = "room" }
44+
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }

packages/async-storage/android/local_repo/.gitkeep

Whitespace-only changes.

scripts/build-native-lib.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ MODULE_NAME="shared-storage"
55
RN_MODULE_DIR="packages/async-storage"
66

77
ANDROID_BUILD_TASK="bundleAndroidMainAar"
8-
ANDROID_OUTPUT_NAME="shared-storage.aar"
9-
ANDROID_OUTPUT_DIR="$MODULE_NAME/build/outputs/aar"
10-
ANDROID_RN_OUTPUT_DIR="$RN_MODULE_DIR/android/libs"
8+
ANDROID_OUTPUT_NAME="local_repo" # Maven local repo
9+
ANDROID_OUTPUT_DIR="$MODULE_NAME/build"
10+
ANDROID_RN_OUTPUT_DIR="$RN_MODULE_DIR/android"
11+
ANDROID_PUBLISH_TASK="publishAndroidPublicationToLocalRepoRepository"
1112

1213
IOS_BUILD_TASK="linkReleaseFrameworkIosFat"
1314
IOS_OUTPUT_NAME="SharedStorage.framework"
@@ -19,9 +20,12 @@ IOS_RN_OUTPUT_DIR="$RN_MODULE_DIR/ios/Framework"
1920

2021
build_android() {
2122
echo "👷 Assembling android shared-storage"
22-
./gradlew :$MODULE_NAME:$ANDROID_BUILD_TASK --rerun
23-
echo "shared module built"
24-
echo "move binary to RN module"
23+
./gradlew :$MODULE_NAME:$ANDROID_BUILD_TASK
24+
25+
echo "Publishing binaries to local repo"
26+
./gradlew :$MODULE_NAME:$ANDROID_PUBLISH_TASK
27+
28+
echo "Moving local repo to RN target"
2529
mv $ANDROID_OUTPUT_DIR/$ANDROID_OUTPUT_NAME $ANDROID_RN_OUTPUT_DIR/$ANDROID_OUTPUT_NAME
2630
echo "all done"
2731
}

shared-storage/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
alias(libs.plugins.androidKotlinMultiplatformLibrary)
66
alias(libs.plugins.ksp)
77
alias(libs.plugins.androidx.room)
8+
alias(libs.plugins.mavenPublish)
89
}
910

1011
kotlin {
@@ -76,3 +77,12 @@ kotlin {
7677
add("kspJvm", libs.androidx.room.compiler)
7778
}
7879
}
80+
81+
publishing {
82+
repositories {
83+
maven {
84+
name = "LocalRepo"
85+
url = uri(layout.buildDirectory.dir("local_repo"))
86+
}
87+
}
88+
}

shared-storage/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GROUP=org.asyncstorage
2+
POM_ARTIFACT_ID=shared-storage
3+
VERSION_NAME=1.0.0

0 commit comments

Comments
 (0)