79 lines
2.5 KiB
Groovy
79 lines
2.5 KiB
Groovy
import groovy.text.SimpleTemplateEngine
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
}
|
|
dependencies {
|
|
def gradleToolsVersion = "7.4.1"
|
|
classpath "com.android.tools.build:gradle:${gradleToolsVersion}"
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id('maven-publish')
|
|
id('signing')
|
|
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
}
|
|
}
|
|
|
|
project.ext {
|
|
if(project.hasProperty('sqlcipherAndroidVersion') && "${sqlcipherAndroidVersion}") {
|
|
libraryVersion = "${sqlcipherAndroidVersion}"
|
|
} else {
|
|
libraryVersion = "4.6.0-S1"
|
|
}
|
|
minSdkVersion = 21
|
|
androidXSQLiteVersion = "2.2.0"
|
|
roomVersion = "2.5.0"
|
|
androidNdkVersion = "25.2.9519653"
|
|
mavenLocalRepositoryPrefix = "file://"
|
|
if(project.hasProperty('publishLocal') && publishLocal.toBoolean()){
|
|
mavenSnapshotRepositoryUrl = "outputs/snapshot"
|
|
mavenReleaseRepositoryUrl = "outputs/release"
|
|
} else {
|
|
mavenLocalRepositoryPrefix = ""
|
|
mavenSnapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots"
|
|
mavenReleaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
|
}
|
|
if(project.hasProperty('publishSnapshot') && publishSnapshot.toBoolean()){
|
|
mavenVersionName = "${libraryVersion}-SNAPSHOT"
|
|
} else {
|
|
mavenVersionName = "${libraryVersion}"
|
|
}
|
|
if(project.hasProperty('nexusUsername')){
|
|
nexusUsername = "${nexusUsername}"
|
|
}
|
|
if(project.hasProperty('nexusPassword')){
|
|
nexusPassword = "${nexusPassword}"
|
|
}
|
|
nexusUsername = project.hasProperty('nexusUsername') ? "${nexusUsername}" : ""
|
|
nexusPassword = project.hasProperty('nexusPassword') ? "${nexusPassword}" : ""
|
|
nexusStagingProfileId = project.hasProperty('nexusStagingProfileId') ? "${nexusStagingProfileId}" : ""
|
|
}
|
|
|
|
task generateReadMe {
|
|
def readme = new File("README.md")
|
|
def engine = new SimpleTemplateEngine()
|
|
def reader = new FileReader("README.md.template")
|
|
def binding = [
|
|
libraryVersion: project.ext.libraryVersion,
|
|
androidXSQLiteVersion: project.ext.androidXSQLiteVersion,
|
|
androidNdkVersion: project.ext.androidNdkVersion,
|
|
minSdkVersion: project.ext.minSdkVersion,
|
|
]
|
|
def template = engine.createTemplate(reader).make(binding)
|
|
readme.write(template.toString())
|
|
}
|
|
|
|
project.afterEvaluate {
|
|
build.dependsOn generateReadMe
|
|
}
|