Skip to content

Commit 8006e55

Browse files
committed
added Swift Package, AAR Package, Node Package and JitPack support
1 parent e8dbf58 commit 8006e55

22 files changed

+1531
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,20 @@ $(DIST_DIR)/%.xcframework: $(LIB_NAMES)
224224

225225
xcframework: $(DIST_DIR)/agent.xcframework
226226

227+
AAR_ARM64 = packages/android/src/main/jniLibs/arm64-v8a/
228+
AAR_ARM = packages/android/src/main/jniLibs/armeabi-v7a/
229+
AAR_X86 = packages/android/src/main/jniLibs/x86_64/
230+
aar:
231+
mkdir -p $(AAR_ARM64) $(AAR_ARM) $(AAR_X86)
232+
$(MAKE) clean && $(MAKE) PLATFORM=android ARCH=arm64-v8a
233+
mv $(DIST_DIR)/agent.so $(AAR_ARM64)
234+
$(MAKE) clean && $(MAKE) PLATFORM=android ARCH=armeabi-v7a
235+
mv $(DIST_DIR)/agent.so $(AAR_ARM)
236+
$(MAKE) clean && $(MAKE) PLATFORM=android ARCH=x86_64
237+
mv $(DIST_DIR)/agent.so $(AAR_X86)
238+
cd packages/android && ./gradlew clean assembleRelease
239+
cp packages/android/build/outputs/aar/android-release.aar $(DIST_DIR)/agent.aar
240+
227241
# Extract version from header
228242
version:
229243
@echo $(shell sed -n 's/^#define SQLITE_AGENT_VERSION[[:space:]]*"\([^"]*\)".*/\1/p' $(SRC_DIR)/sqlite-agent.h)

Package.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Package.swift
3+
// sqlite-agent
4+
//
5+
// Created by Gioele Cantoni on 05/11/25.
6+
//
7+
8+
// swift-tools-version: 6.1
9+
// The swift-tools-version declares the minimum version of Swift required to build this package.
10+
11+
import PackageDescription
12+
13+
let package = Package(
14+
name: "agent",
15+
platforms: [.macOS(.v11), .iOS(.v11)],
16+
products: [
17+
// Products can be used to vend plugins, making them visible to other packages.
18+
.plugin(
19+
name: "agentPlugin",
20+
targets: ["agentPlugin"]),
21+
.library(
22+
name: "agent",
23+
targets: ["agent"])
24+
],
25+
targets: [
26+
// Build tool plugin that invokes the Makefile
27+
.plugin(
28+
name: "agentPlugin",
29+
capability: .buildTool(),
30+
path: "packages/swift/plugin"
31+
),
32+
// agent library target
33+
.target(
34+
name: "agent",
35+
dependencies: [],
36+
path: "packages/swift/extension",
37+
plugins: ["agentPlugin"]
38+
),
39+
]
40+
)

jitpack.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
jdk:
2+
- openjdk17
3+
install:
4+
- make aar ANDROID_NDK=$ANDROID_HOME/ndk-bundle
5+
- export VERSION=$(make version 2>/dev/null | tail -1)
6+
- cd packages/android && ./gradlew publishToMavenLocal -PVERSION="$VERSION"

packages/android/build.gradle

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath 'com.android.tools.build:gradle:8.5.2'
8+
}
9+
}
10+
11+
plugins {
12+
id 'com.gradleup.nmcp.aggregation' version '1.2.0'
13+
}
14+
15+
apply plugin: 'com.android.library'
16+
apply plugin: 'maven-publish'
17+
apply plugin: 'signing'
18+
19+
android {
20+
namespace 'ai.sqlite.agent'
21+
compileSdk 34
22+
23+
defaultConfig {
24+
minSdk 26
25+
targetSdk 34
26+
}
27+
28+
buildTypes {
29+
release {
30+
minifyEnabled false
31+
}
32+
}
33+
34+
compileOptions {
35+
sourceCompatibility JavaVersion.VERSION_1_8
36+
targetCompatibility JavaVersion.VERSION_1_8
37+
}
38+
39+
sourceSets {
40+
main {
41+
jniLibs.srcDirs = ['src/main/jniLibs']
42+
}
43+
}
44+
}
45+
46+
repositories {
47+
google()
48+
mavenCentral()
49+
maven { url 'https://jitpack.io' }
50+
}
51+
52+
dependencies {
53+
}
54+
55+
afterEvaluate {
56+
publishing {
57+
publications {
58+
release(MavenPublication) {
59+
groupId = 'ai.sqlite'
60+
artifactId = 'agent'
61+
version = project.hasProperty('VERSION') ? project.VERSION : ['make', 'version'].execute(null, file('../..')).text.trim()
62+
63+
artifact(project.hasProperty('AAR_PATH') ? project.AAR_PATH : "$buildDir/outputs/aar/android-release.aar")
64+
65+
// Maven Central metadata
66+
pom {
67+
name = 'sqlite-agent'
68+
description = 'A SQLite extension that enables SQLite databases to run autonomous AI agents, using other SQLite AI extensions.'
69+
url = 'https://github.com/sqliteai/sqlite-agent'
70+
71+
licenses {
72+
license {
73+
name = 'MIT License'
74+
url = 'https://github.com/sqliteai/sqlite-agent/blob/main/LICENSE'
75+
}
76+
}
77+
78+
developers {
79+
developer {
80+
id = 'sqliteai'
81+
name = 'SQLite Cloud, Inc.'
82+
83+
organization = 'SQLite Cloud, Inc.'
84+
organizationUrl = 'https://sqlite.ai'
85+
}
86+
}
87+
88+
scm {
89+
connection = 'scm:git:git://github.com/sqliteai/sqlite-agent.git'
90+
developerConnection = 'scm:git:ssh://github.com:sqliteai/sqlite-agent.git'
91+
url = 'https://github.com/sqliteai/sqlite-agent/tree/main'
92+
}
93+
}
94+
}
95+
}
96+
}
97+
98+
// Signing configuration for Maven Central
99+
signing {
100+
required { project.hasProperty("SIGNING_KEY") }
101+
if (project.hasProperty("SIGNING_KEY")) {
102+
useInMemoryPgpKeys(
103+
project.property("SIGNING_KEY").toString(),
104+
project.property("SIGNING_PASSWORD").toString()
105+
)
106+
sign publishing.publications.release
107+
}
108+
}
109+
}
110+
111+
// Maven Central publishing via NMCP aggregation
112+
nmcpAggregation {
113+
if (project.hasProperty("SONATYPE_USERNAME") && project.hasProperty("SONATYPE_PASSWORD")) {
114+
centralPortal {
115+
username = project.property("SONATYPE_USERNAME")
116+
password = project.property("SONATYPE_PASSWORD")
117+
publishingType = "AUTOMATIC"
118+
}
119+
publishAllProjectsProbablyBreakingProjectIsolation()
120+
}
121+
}

packages/android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
2+
android.useAndroidX=true
44.4 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.10.2-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)