Skip to content

Commit

Permalink
chore: Playground project was created. Sandbox application was moved …
Browse files Browse the repository at this point in the history
…to playground. Maven publication convention plugin was created.
  • Loading branch information
malilex committed Mar 5, 2024
1 parent 06672d8 commit fdf3be5
Show file tree
Hide file tree
Showing 30 changed files with 457 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import utils.findPropertyOrDefault
import utils.versionInfo
import utils.withVersionCatalogs

plugins {
Expand All @@ -9,25 +6,14 @@ plugins {
id("org.gradle.android.cache-fix")
id("convention.detekt")
id("convention.spotless")
`maven-publish`
signing
}

val versionInfo = versionInfo()

android {

withVersionCatalogs {
compileSdk = versions.global.compileSdk.get().toInt()

defaultConfig {
libraryVariants.all {
outputs.all {
val output = this as BaseVariantOutputImpl
output.outputFileName = output.outputFileName
.replace(".aar", "-${versionInfo.fullArtifactName}.aar")
}
}
minSdk = versions.global.minSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -46,13 +32,6 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}

lint {
xmlReport = false
textReport = false
Expand All @@ -69,38 +48,3 @@ dependencies {
testImplementation(base.test.unit.robolectric)
}
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
from(components["release"])
groupId = "io.github.salute-developers"
artifactId = findPropertyOrDefault("nexus.artifactId", "").toString()
version = versionInfo.fullName
val siteUrl = findPropertyOrDefault("nexus.websiteUrl", "").toString()
val gitUrl = findPropertyOrDefault("nexus.gitUrl", "").toString()

signing {
useInMemoryPgpKeys(
System.getenv("OSS_SIGNING_KEY_ID"),
System.getenv("OSS_SIGNING_KEY"),
System.getenv("OSS_SIGNING_PASSWORD"),
)
sign(publishing.publications["release"])
}

pom {
name.set(artifactId)
description.set(findPropertyOrDefault("nexus.description", "").toString())
url.set(siteUrl)
scm {
connection.set(gitUrl)
developerConnection.set(gitUrl)
url.set(siteUrl)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get
import utils.findPropertyOrDefault
import utils.versionInfo

plugins {
id("com.android.library")
`maven-publish`
signing
}

android {
defaultConfig {
libraryVariants.all {
outputs.all {
val output = this as BaseVariantOutputImpl
output.outputFileName = output.outputFileName
.replace(".aar", "-${versionInfo().fullArtifactName}.aar")
}
}
}
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

afterEvaluate {
publishing {
publications {
val versionInfo = versionInfo()
create<MavenPublication>("release") {
from(components["release"])
groupId = "io.github.salute-developers"
artifactId = findPropertyOrDefault("nexus.artifactId", "").toString()
version = versionInfo.fullName
val siteUrl = findPropertyOrDefault("nexus.websiteUrl", "").toString()
val gitUrl = findPropertyOrDefault("nexus.gitUrl", "").toString()

signing {
useInMemoryPgpKeys(
System.getenv("OSS_SIGNING_KEY_ID"),
System.getenv("OSS_SIGNING_KEY"),
System.getenv("OSS_SIGNING_PASSWORD"),
)
sign(publishing.publications["release"])
}

pom {
name.set(artifactId)
description.set(findPropertyOrDefault("nexus.description", "").toString())
url.set(siteUrl)
scm {
connection.set(gitUrl)
developerConnection.set(gitUrl)
url.set(siteUrl)
}
}
}
}
}
}
6 changes: 1 addition & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,4 @@ jgp = { id = "java-gradle-plugin" }
android-cache-fix = { id = "org.gradle.android.cache-fix", version.ref= "plugin-androidCacheFix" }
gradleNexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "plugin-gradleNexusPublish" }
gradlePluginPublish = { id = "com.gradle.plugin-publish", version.ref="plugin-gradlePluginPublish"}

convention-detekt = { id = "convention.detekt" }
convention-android-app = { id = "convention.android-app" }
convention-android-lib = { id = "convention.android-lib" }
convention-spotless= { id = "convention.spotless" }
themebuilder = { id = "io.github.salute-developers.theme-builder-plugin" }
3 changes: 3 additions & 0 deletions playground/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Playground

Приложения и библиотеки для удобства разработки и тестирования SDDS Core.
29 changes: 29 additions & 0 deletions playground/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@file:Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("convention.root-project")
alias(libs.plugins.android.app) apply false
alias(libs.plugins.android.lib) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.android.cache.fix) apply false
alias(libs.plugins.paparazzi) apply false
}

buildscript {
repositories {
google()
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}

dependencies {
classpath(libs.base.gradle.android)
classpath(libs.base.gradle.kotlin)
classpath(libs.base.gradle.detekt)
classpath(libs.base.gradle.spotless)
classpath(libs.base.gradle.paparazzi)
classpath(libs.base.gradle.cacheFix)
}
}
23 changes: 23 additions & 0 deletions playground/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
Binary file added playground/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions playground/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Mar 04 17:09:42 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit fdf3be5

Please sign in to comment.