Skip to content

Commit d33f584

Browse files
committed
Build Android aar.
1 parent 40554dc commit d33f584

File tree

9 files changed

+422
-2
lines changed

9 files changed

+422
-2
lines changed

.github/workflows/android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ jobs:
3232
3333
- name: Build for Android
3434
run: |
35-
cargo ndk -t armeabi-v7a -t arm64-v8a -o ./jniLibs build --release -Zbuild-std -p powersync_loadable
35+
cd android
36+
./gradlew build
37+
ls -lh build/outputs/aar

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ authors = ["JourneyApps"]
3131
keywords = ["sqlite", "powersync"]
3232
license = "Private"
3333
homepage = "https://powersync.co"
34-
repository = "https://github.com/journeyapps/powersync-rs"
34+
repository = "https://github.com/journeyapps/powersync-sqlite-core"
3535

3636
[workspace.dependencies]
3737
sqlite_nostd = { path="./sqlite-rs-embedded/sqlite_nostd" }

android/.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

android/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
7+
local.properties

android/build.gradle.kts

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import java.util.Properties
2+
3+
plugins {
4+
id("com.android.library") version "8.0.1"
5+
id("maven-publish")
6+
id("signing")
7+
}
8+
9+
group = "co.powersync"
10+
version = "0.1.3"
11+
description = "PowerSync Core SQLite Extension"
12+
13+
repositories {
14+
mavenCentral()
15+
google()
16+
}
17+
18+
val buildRust = tasks.register("buildRust", Exec::class.java) {
19+
System.out.println("foo")
20+
workingDir("..")
21+
commandLine("cargo", "ndk", "-t", "armeabi-v7a", "-t", "arm64-v8a", "-t", "x86", "-t", "x86_64", "-o", "./android/build/intermediates/jniLibs", "build", "--release", "-Zbuild-std", "-p", "powersync_loadable")
22+
}
23+
24+
android {
25+
compileSdk = 33
26+
ndkVersion = "25.2.9519653"
27+
28+
namespace = "co.powersync.sqlitecore"
29+
30+
defaultConfig {
31+
minSdk = 24
32+
33+
ndk {
34+
abiFilters += setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
35+
}
36+
}
37+
38+
sourceSets {
39+
getByName("main") {
40+
jniLibs.srcDir("build/intermediates/jniLibs")
41+
}
42+
}
43+
44+
buildTypes {
45+
release {
46+
isMinifyEnabled = false
47+
}
48+
}
49+
50+
publishing {
51+
singleVariant("release") {
52+
withSourcesJar()
53+
}
54+
}
55+
}
56+
tasks.withType<JavaCompile> {
57+
dependsOn(buildRust)
58+
}
59+
60+
val secretsFile = rootProject.file("local.properties")
61+
val secretProperties = Properties()
62+
63+
if (secretsFile.exists()) {
64+
secretsFile.reader().use { secretProperties.load(it) }
65+
66+
secretProperties.forEach { key, value ->
67+
if (key is String && key.startsWith("signing")) {
68+
ext[key] = value
69+
}
70+
}
71+
}
72+
73+
publishing {
74+
publications {
75+
register<MavenPublication>("maven") {
76+
groupId = project.group.toString()
77+
artifactId = project.name
78+
version = project.version.toString()
79+
80+
afterEvaluate {
81+
from(components["release"])
82+
}
83+
84+
pom {
85+
name.set(project.name)
86+
description.set(project.description)
87+
url.set("https://github.com/journeyapps/powersync-sqlite-core")
88+
89+
developers {
90+
developer {
91+
id.set("journeyapps")
92+
name.set("Journey Mobile, Inc.")
93+
email.set("info@journeyapps.com")
94+
}
95+
}
96+
97+
licenses {
98+
license {
99+
name.set("Proprietary")
100+
}
101+
}
102+
103+
scm {
104+
connection.set("scm:git:github.com/journeyapps/powersync-sqlite-core.git")
105+
developerConnection.set("scm:git:ssh://github.com/journeyapps/powersync-sqlite-core.git")
106+
url.set("https://github.com/journeyapps/powersync-sqlite-core")
107+
}
108+
}
109+
}
110+
}
111+
112+
repositories {
113+
maven {
114+
name = "sonatype"
115+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
116+
credentials {
117+
username = secretProperties.getProperty("ossrhUsername")
118+
password = secretProperties.getProperty("ossrhPassword")
119+
}
120+
}
121+
122+
maven {
123+
name = "here"
124+
url = uri("build/here/")
125+
}
126+
}
127+
}
128+
129+
signing {
130+
useGpgCmd()
131+
sign(publishing.publications)
132+
}
133+
134+
tasks.withType<AbstractPublishToMaven>() {
135+
dependsOn("assembleRelease")
136+
}
62.2 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)