All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.autonomousapps.internal.utils.project.projects.kt Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package com.autonomousapps.internal.utils.project

import com.autonomousapps.internal.GradleVersions.isAtLeastGradle82
import org.gradle.api.Project
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.get

/** Get the buildPath of the current build from the root component of the resolution result. */
internal fun Project.buildPath(configuration: String): Provider {
  return configurations[configuration].incoming.resolutionResult.let {
    if (isAtLeastGradle82) {
      it.rootComponent.map { root -> (root.id as ProjectComponentIdentifier).build.buildPath }
    } else {
      project.provider { @Suppress("DEPRECATION") (it.root.id as ProjectComponentIdentifier).build.name }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy