Skip to content

Commit

Permalink
Adjust publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbilik committed Nov 22, 2024
1 parent 464a3e5 commit da5747e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ fun DependencyHandlerScope.implementation(dependencyNotation: Any) {
add("implementation", dependencyNotation)
}

fun DependencyHandlerScope.compileOnly(dependencyNotation: Any) {
add("compileOnly", dependencyNotation)
}

fun DependencyHandlerScope.debugImplementation(dependencyNotation: Any) {
add("debugImplementation", dependencyNotation)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package io.github.ackeecz.snapshots.plugin

import io.github.ackeecz.snapshots.androidCommon
import io.github.ackeecz.snapshots.apply
import io.github.ackeecz.snapshots.debugImplementation
import io.github.ackeecz.snapshots.implementation
import io.github.ackeecz.snapshots.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

class ComposeConventionPlugin : Plugin<Project> {

Expand All @@ -17,7 +14,6 @@ class ComposeConventionPlugin : Plugin<Project> {

private fun Project.configure() {
configureCompose()
addDependencies()
}

private fun Project.configureCompose() {
Expand All @@ -28,15 +24,4 @@ class ComposeConventionPlugin : Plugin<Project> {
}
}
}

private fun Project.addDependencies() {
dependencies {
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
debugImplementation(libs.androidx.ui.tooling)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.activity.compose)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package io.github.ackeecz.snapshots.plugin

import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import groovy.util.Node
import groovy.util.NodeList
import io.github.ackeecz.snapshots.apply
import io.github.ackeecz.snapshots.libs
import org.gradle.api.Plugin
Expand Down Expand Up @@ -36,7 +34,7 @@ class PublishingConventionPlugin : Plugin<Project> {
append("-$versionSuffix")
}
}
println("Publishing $groupId:$artifactId:$version")

coordinates(
groupId = groupId,
artifactId = artifactId,
Expand Down Expand Up @@ -68,35 +66,9 @@ class PublishingConventionPlugin : Plugin<Project> {
connection.set(commonLibProperties.getProperty("POM_SCM_CONNECTION"))
developerConnection.set(commonLibProperties.getProperty("POM_SCM_DEVELOPER_CONNECTION"))
}
// exclude compose, paparazzi and kotlin since these are very unstable when used together with incorrect
// version so move this responsibility to callers
withXml {
// remove kotlin, paparazzi and compose from dependencies
val dependencies = ((asNode().get("dependencies") as NodeList)[0] as Node).children() as NodeList
dependencies.removeAll { dep ->
val node = dep as Node
val groupId = (node.children() as List<Node>).find {
it.name().toString().contains("groupId")
}?.text()
groupId?.contains("androidx") == true ||
groupId == "app.cash.paparazzi" ||
groupId == "org.jetbrains.kotlin"
}
// remove compose bom from dependency management
val dependencyManagementDependenciesNode =
((asNode().get("dependencyManagement") as? NodeList)?.getOrNull(0) as? Node)?.children() as? NodeList
val dependencyManagementDependencies = (dependencyManagementDependenciesNode?.getOrNull(0) as? Node)?.children()
dependencyManagementDependencies?.removeAll { dep ->
val node = dep as Node
val groupId = (node.children() as List<Node>).find {
it.name().toString().contains("groupId")
}?.text()
groupId?.contains("androidx") == true
}
}
}

// signAllPublications()
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
}
}
Expand Down
10 changes: 8 additions & 2 deletions framework/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//import io.github.ackeecz.snapshots.publishing
import io.github.ackeecz.snapshots.compileOnly
import io.github.ackeecz.snapshots.implementation
import io.github.ackeecz.snapshots.libs

plugins {
alias(libs.plugins.ackeecz.snapshots.android.library)
alias(libs.plugins.ackeecz.snapshots.compose)
alias(libs.plugins.ackeecz.snapshots.publishing)
alias(libs.plugins.ackeecz.snapshots.compose)
}


Expand All @@ -13,5 +15,9 @@ android {

dependencies {
implementation(libs.showkase.core)

compileOnly(platform(libs.androidx.compose.bom))
compileOnly(libs.androidx.ui)

implementation(libs.kotest.framework.api)
}
1 change: 0 additions & 1 deletion lib.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARTIFACT_BASE_NAME=snapshots
GIT_URL=https://github.com/AckeeCZ/ackee-android-snapshots.git
GROUP=io.github.ackeecz
POM_DEVELOPER_EMAIL[email protected]
POM_DEVELOPER_ID=ackee
Expand Down
7 changes: 5 additions & 2 deletions paparazzi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//import io.github.ackeecz.snapshots.publishing
import io.github.ackeecz.snapshots.implementation
import io.github.ackeecz.snapshots.libs

plugins {
alias(libs.plugins.ackeecz.snapshots.android.library)
Expand All @@ -13,7 +14,9 @@ android {
dependencies {
implementation(projects.framework)

implementation(libs.paparazzi)
compileOnly(libs.paparazzi)
implementation(libs.kotest.framework.api)
implementation(libs.showkase.core)
compileOnly(platform(libs.androidx.compose.bom))
compileOnly(libs.androidx.ui)
}
10 changes: 10 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import io.github.ackeecz.snapshots.debugImplementation
import io.github.ackeecz.snapshots.implementation
import io.github.ackeecz.snapshots.libs

plugins {
alias(libs.plugins.ackeecz.snapshots.android.application)
alias(libs.plugins.ackeecz.snapshots.compose)
Expand Down Expand Up @@ -37,6 +41,12 @@ dependencies {
testImplementation(projects.paparazzi)
implementation(projects.annotations)

implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
debugImplementation(libs.androidx.ui.tooling)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)

Expand Down

0 comments on commit da5747e

Please sign in to comment.