plugins { id 'de.undercouch.download' id 'com.android.library' id 'maven-publish' } group = 'io.requery' version = '3.39.3' description = 'Android SQLite compatibility library' android { compileSdkVersion 32 buildToolsVersion "33.0.0" ndkVersion '25.0.8775105' defaultConfig { minSdkVersion 14 versionName project.version testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' consumerProguardFiles 'proguard-rules.pro' ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { abortOnError false } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } externalNativeBuild { ndkBuild { path 'src/main/jni/Android.mk' } } libraryVariants.all { it.generateBuildConfigProvider.configure { enabled = false } } } dependencies { api 'androidx.sqlite:sqlite:2.2.0' api 'androidx.core:core:1.8.0' androidTestImplementation 'androidx.test:core:1.4.0' androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:rules:1.4.0' androidTestImplementation 'androidx.test.ext:junit:1.1.3' } ext { sqliteDistributionUrl = 'https://www.sqlite.org/2022/sqlite-amalgamation-3390300.zip' } task downloadSqlite(type: Download) { src project.sqliteDistributionUrl dest 'src/main/jni/sqlite.zip' overwrite false } task installSqlite(dependsOn: downloadSqlite, type: Copy) { from zipTree(downloadSqlite.dest).matching { include '*/sqlite3.*' eachFile { it.setPath(it.getName()) } } into 'src/main/jni/sqlite' } preBuild.dependsOn installSqlite Properties properties = new Properties() File localProperties = project.rootProject.file('local.properties') if (localProperties.exists()) { properties.load(localProperties.newDataInputStream()) } task sourceJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs } task javadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) android.libraryVariants.all { variant -> if (variant.name == 'release') { owner.classpath += variant.javaCompileProvider.get().classpath } } exclude '**/R.html', '**/R.*.html', '**/index.html' if (JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) } failOnError false } task javadocJar(type: Jar, dependsOn: javadoc) { archiveClassifier.set('javadoc') from javadoc.destinationDir } preBuild.dependsOn installSqlite // https://issuetracker.google.com/issues/207403732 tasks.whenTaskAdded { task -> if (task.name.startsWith("configureNdkBuildDebug") || task.name.startsWith("configureNdkBuildRelease")) { task.dependsOn preBuild } } publishing { publications { maven(MavenPublication) { groupId project.group artifactId project.name version project.version pom { name = project.name description = project.description url = 'https://github.com/requery/sqlite-android' licenses { license { name = 'The Apache Software License, Version 2.0' url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' distribution = 'repo' } } scm { url = 'https://github.com/requery/sqlite-android.git' connection = 'scm:git:git://github.com/requery/sqlite-android.git' developerConnection = 'scm:git:git@github.com/requery/sqlite-android.git' } } afterEvaluate { artifact bundleReleaseAar artifact sourceJar artifact javadocJar } } } }