Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CollectorTask output to be dependent on project name [Plugin] #980

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ package com.mikepenz.aboutlibraries.plugin
import com.mikepenz.aboutlibraries.plugin.model.CollectedContainer
import com.mikepenz.aboutlibraries.plugin.util.DependencyCollector
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.*
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.slf4j.LoggerFactory
import java.io.File

@CacheableTask
Expand All @@ -12,6 +17,9 @@ abstract class AboutLibrariesCollectorTask : DefaultTask() {
@Internal
protected val extension = project.extensions.getByName("aboutLibraries") as AboutLibrariesExtension

@Input
val projectName = project.name

@Input
val includePlatform = extension.includePlatform

Expand All @@ -37,9 +45,14 @@ abstract class AboutLibrariesCollectorTask : DefaultTask() {

@TaskAction
fun action() {
LOGGER.info("Collecting for: $projectName")
if (!::collectedDependencies.isInitialized) {
configure()
}
dependencyCache.writeText(groovy.json.JsonOutput.toJson(collectedDependencies))
}

private companion object {
private val LOGGER = LoggerFactory.getLogger(AboutLibrariesCollectorTask::class.java)!!
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class AboutLibrariesPlugin : Plugin<Project> {

private val Project.experimentalCache: Boolean
get() = hasProperty("org.gradle.unsafe.configuration-cache") &&
property("org.gradle.unsafe.configuration-cache") == "true" ||
hasProperty("org.gradle.configuration-cache") &&
property("org.gradle.configuration-cache") == "true"
property("org.gradle.unsafe.configuration-cache") == "true" ||
hasProperty("org.gradle.configuration-cache") &&
property("org.gradle.configuration-cache") == "true"


companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.io.OutputStreamWriter
import java.net.URL

internal class GitHubApi(
private val gitHubToken: String? = null
private val gitHubToken: String? = null,
) : IApi {
private var rateLimit: Int = 0

Expand All @@ -36,7 +36,7 @@ internal class GitHubApi(
}
limit
} catch (t: Throwable) {
LOGGER.error("Could not retrieve `rate_limit`. Please check if the token is provided.")
LOGGER.error("Could not retrieve `rate_limit`. Please check if the token is provided. (${t.message})")
0
}
}
Expand Down