From 8756d17aa6c85b47774cbee65db1153a27ad543f Mon Sep 17 00:00:00 2001 From: Avior Date: Tue, 10 Jan 2023 14:48:15 +0100 Subject: [PATCH] feat: Make library buildable by jitpack.io --- library/build.gradle.kts | 45 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/library/build.gradle.kts b/library/build.gradle.kts index ba21046..47b9edc 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -1,19 +1,55 @@ plugins { id("com.android.library") + `maven-publish` kotlin("android") } +val artifact = "charts" +group = "com.dzeio" +val projectVersion = project.findProperty("version") as String? ?: "0.1.0" +version = projectVersion + +publishing { + publications { + register("release") { + groupId = group as String? + artifactId = artifact + version = projectVersion + + afterEvaluate { + from(components["release"]) + } + } + } +} + android { + namespace = "${group}.${artifact}" compileSdk = 33 + buildToolsVersion = "33.0.0" defaultConfig { minSdk = 21 targetSdk = 33 + aarMetadata { + minCompileSdk = 21 + } testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") } + testFixtures { + enable = true + } + + publishing { + singleVariant("release") { + withSourcesJar() + withJavadocJar() + } + } + buildTypes { release { isMinifyEnabled = true @@ -23,12 +59,13 @@ android { ) } } + compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } + kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } - namespace = "com.dzeio.charts" }