Skip to content

Commit e88c8e4

Browse files
authored
Fix compileOnly dependencies (#28)
* Update Gradle * Fix compileOnly dependencies
1 parent acfa789 commit e88c8e4

File tree

9 files changed

+18
-97
lines changed

9 files changed

+18
-97
lines changed

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pluginManagement {
3737

3838
// build.gradle.kts of deployable modules
3939
plugins {
40-
id("io.deepmedia.tools.deployer") version "0.15.0"
40+
id("io.deepmedia.tools.deployer") version "0.16.0"
4141
}
4242
```
4343

deployer/build.gradle.kts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
plugins {
44
`kotlin-dsl`
55
`java-gradle-plugin`
6-
id("io.deepmedia.tools.deployer") version "0.14.0"
6+
id("io.deepmedia.tools.deployer") version "0.15.0"
77
kotlin("plugin.serialization") version "1.9.23"
88
id("org.jetbrains.dokka") version "1.9.20"
99
}
1010

1111
dependencies {
12-
compileOnly("com.android.tools.build:gradle:8.1.1")
13-
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
12+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
1413

1514
// api("org.jetbrains.dokka:dokka-gradle-plugin:1.8.20")
1615

17-
implementation("io.ktor:ktor-client-core:2.3.11")
18-
implementation("io.ktor:ktor-client-cio:2.3.11")
19-
implementation("io.ktor:ktor-client-content-negotiation:2.3.11")
20-
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.11")
16+
implementation("io.ktor:ktor-client-core:2.3.13")
17+
implementation("io.ktor:ktor-client-cio:2.3.13")
18+
implementation("io.ktor:ktor-client-content-negotiation:2.3.13")
19+
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.13")
2120
}
2221

2322
// To publish the plugin itself...
@@ -33,7 +32,7 @@ gradlePlugin {
3332
}
3433

3534
group = "io.deepmedia.tools.deployer"
36-
version = "0.15.0" // on change, update README
35+
version = "0.16.0" // on change, update README
3736

3837
val javadocs = tasks.register<Jar>("dokkaJavadocJar") {
3938
dependsOn(tasks.dokkaJavadoc)

deployer/src/main/kotlin/io/deepmedia/tools/deployer/inference/GradlePluginInference.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@ internal class GradlePluginInference : Inference {
2929

3030
private fun inferComponents(project: Project, spec: DeploySpec, gradlePlugins: GradlePluginDevelopmentExtension, create: (Component.() -> Unit) -> Component) {
3131
val mainComponent = create {
32-
/* if (project.isKotlinProject) {
33-
val kotlin = project.kotlinExtension as KotlinSingleTargetExtension<*>
34-
fromKotlinTarget(kotlin.target as KotlinOnlyTarget<*>)
35-
} else { */
36-
fromMavenPublication("pluginMaven", clone = true)
37-
packaging.set("jar")
38-
// }
32+
fromMavenPublication("pluginMaven", clone = true)
33+
packaging.set("jar")
3934
}
4035
gradlePlugins.plugins.all {
4136
create {

deployer/src/main/kotlin/io/deepmedia/tools/deployer/model/Component.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -214,26 +214,6 @@ open class Component @Inject constructor(private val objects: ObjectFactory) {
214214
docs.set(Artifacts.Entry.Promise { it.makeEmptyDocsJar })
215215
}
216216

217-
// private val fallbackSources: Property<Project.() -> TaskProvider<Jar>> = objects.property()
218-
// private val fallbackDocs: Property<Project.() -> TaskProvider<Jar>> = objects.property()
219-
// fun emptySources() { fallbackSources.set { makeEmptySourcesJar } }
220-
// fun kotlinSources() { fallbackSources.set { makeKotlinSourcesJar } }
221-
// fun javaSources() { fallbackSources.set { makeJavaSourcesJar } }
222-
// fun emptyDocs() { fallbackDocs.set { makeEmptyDocsJar } }
223-
/* internal fun resolveSources(project: Project): Artifacts.Entry? {
224-
val fallback = fallbackSources.map { project.it() }
225-
.map { taskProvider -> Artifacts.Entry(taskProvider, taskProvider) }
226-
// val fallback = fallbackSources.map { project.makeSourcesJar(spec, this, project.it()) }
227-
return sources.orElse(fallback).orNull
228-
}
229-
230-
internal fun resolveDocs(project: Project): Artifacts.Entry? {
231-
val fallback = fallbackSources.map { project.it() }
232-
.map { taskProvider -> Artifacts.Entry(taskProvider, taskProvider) }
233-
// val fallback = fallbackDocs.map { project.makeDocsJar(spec, this, project.it()) }
234-
return docs.orElse(fallback).orNull
235-
} */
236-
237217
val extras: Artifacts = objects.newInstance()
238218

239219
val groupId = objects.property<Transformer<String, String>>()

deployer/src/main/kotlin/io/deepmedia/tools/deployer/model/ProjectInfo.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import org.gradle.api.model.ObjectFactory
55
import org.gradle.api.plugins.BasePluginExtension
66
import org.gradle.api.provider.Property
77
import org.gradle.api.provider.Provider
8-
import org.gradle.kotlin.dsl.domainObjectSet
9-
import org.gradle.kotlin.dsl.findByType
10-
import org.gradle.kotlin.dsl.newInstance
11-
import org.gradle.kotlin.dsl.property
8+
import org.gradle.kotlin.dsl.*
129
import javax.inject.Inject
1310

1411
open class ProjectInfo @Inject constructor(private val objects: ObjectFactory) : LicenseScope, DeveloperScope, ScmScope {

deployer/src/main/kotlin/io/deepmedia/tools/deployer/tasks/Workarounds.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import java.io.File
4545
*
4646
* We go the second route below, which is a bit tricky because we have to deal with [Any] types.
4747
*
48-
* [Artifacts.Entry.Resolved.artifactForMaven]: May be one of
48+
* [Artifacts.Entry.Resolved.artifact]: May be one of
4949
* - [org.gradle.api.artifacts.PublishArtifact]. Extension and classifier values are taken from the wrapped instance.
5050
* - [org.gradle.api.tasks.bundling.AbstractArchiveTask]. Extension and classifier values are taken from the wrapped instance.
5151
* - Anything that can be resolved to a [java.io.File] via the [org.gradle.api.Project.file] method.
@@ -79,9 +79,9 @@ internal fun Artifacts.Entry.Resolved.wrapped(project: Project, logger: Logger,
7979
else -> when (val data = unwrappedArtifact) {
8080
is PublishArtifact -> data.classifier to data.extension
8181
is AbstractArchiveTask -> data.archiveClassifier.orNull to data.archiveExtension.get()
82-
// NOTE: logic here is very weak, could at least check if last() seems to be a version number and if so,
83-
// we can infer that this file has no classifier (that is, it's the main POM artifact)
84-
else -> resolvedFile.nameWithoutExtension.split("-").last() to resolvedFile.extension
82+
// There's no safe way to determine the classifier from the filename. If important, users should specify it
83+
// and the artifact would be an Artifacts.Entry.Dictionary which is a few branches above.
84+
else -> null to resolvedFile.extension
8585
}
8686
}
8787

deployer/src/main/kotlin/io/deepmedia/tools/deployer/utils.kt

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,24 @@
22

33
package io.deepmedia.tools.deployer
44

5-
import com.android.build.gradle.LibraryPlugin
6-
import org.gradle.api.InvalidUserCodeException
75
import org.gradle.api.Project
86
import org.gradle.api.Task
97
import org.gradle.api.component.SoftwareComponent
108
import org.gradle.api.internal.component.SoftwareComponentInternal
119
import org.gradle.api.internal.project.ProjectStateInternal
12-
import org.gradle.api.plugins.JavaBasePlugin
13-
import org.gradle.api.provider.Property
14-
import org.gradle.api.provider.Provider
1510
import org.gradle.api.publish.maven.MavenArtifact
1611
import org.gradle.api.publish.maven.MavenArtifactSet
1712
import org.gradle.api.tasks.TaskContainer
1813
import org.gradle.api.tasks.TaskProvider
1914
import org.gradle.kotlin.dsl.named
2015
import org.gradle.kotlin.dsl.register
21-
import org.gradle.plugin.devel.plugins.JavaGradlePluginPlugin
2216
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
23-
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
2417

2518
internal fun String.capitalized(): String {
2619
return replaceFirstChar { it.uppercaseChar() }
2720
}
2821

29-
private var _hasKotlinPluginClasspath: Boolean? = null
30-
31-
private var _hasAndroidPluginClasspath: Boolean? = null
32-
33-
internal val Project.hasKotlinPluginClasspath: Boolean get() {
34-
if (_hasKotlinPluginClasspath == null) {
35-
_hasKotlinPluginClasspath = runCatching {
36-
Class.forName("org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension")
37-
}.isSuccess
38-
}
39-
return _hasKotlinPluginClasspath!!
40-
}
41-
42-
internal val Project.hasAndroidPluginClasspath: Boolean get() {
43-
if (_hasAndroidPluginClasspath == null) {
44-
_hasAndroidPluginClasspath = runCatching {
45-
Class.forName("com.android.build.gradle.api.AndroidBasePlugin")
46-
}.isSuccess
47-
}
48-
return _hasAndroidPluginClasspath!!
49-
}
50-
51-
// internal val Project.isJavaProject get() = plugins.any { it is JavaBasePlugin }
52-
// internal val Project.isGradlePluginProject get() = plugins.any { it is JavaGradlePluginPlugin }
53-
// internal val Project.isKmpProject get() = hasKotlinPluginClasspath && plugins.any { it is KotlinMultiplatformPluginWrapper }
54-
55-
internal val Project.isAndroidLibraryProject get() = hasAndroidPluginClasspath && plugins.any { it is LibraryPlugin }
56-
57-
internal val Project.isKotlinProject get() = hasKotlinPluginClasspath && plugins.any { it is KotlinBasePluginWrapper }
58-
59-
// internal fun Project.whenJavaPluginApplied(block: () -> Unit) = whenPluginApplied<JavaBasePlugin>(block)
60-
// internal fun Project.whenGradlePluginPluginApplied(block: () -> Unit) = whenPluginApplied<JavaGradlePluginPlugin>(block)
61-
// internal fun Project.whenAndroidLibraryPluginApplied(block: () -> Unit) {
62-
// if (hasAndroidPluginClasspath) whenPluginApplied<LibraryPlugin>(block)
63-
// }
64-
/* internal fun Project.whenKmpPluginApplied(block: () -> Unit) {
65-
if (!hasKotlinPluginClasspath) return
66-
whenPluginApplied<KotlinMultiplatformPluginWrapper>(block)
67-
}
68-
// Not the recommended way but the other approach - use plugin IDs - requires to know the ID and it's not
69-
// clear if withId() is invoked when the plugin is applied manually or only in the plugin block
70-
internal inline fun <reified P: Plugin<*>> Project.whenPluginApplied(crossinline block: () -> Unit) {
71-
plugins.withType<P>().all { block() }
72-
} */
22+
internal val Project.isKotlinProject get() = plugins.any { it is KotlinBasePluginWrapper }
7323

7424
internal fun MavenArtifactSet.dump(): String {
7525
return if (isEmpty()) "[]"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

0 commit comments

Comments
 (0)