Add classes dirs artifact helpers, minor cleanup
This commit is contained in:
@@ -8,12 +8,29 @@ import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ConfigurationContainer
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.plugins.BasePluginConvention
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import java.io.File
|
||||
|
||||
fun Project.classesDirsArtifact(): FileCollection {
|
||||
val classesDirsCfg = configurations.getOrCreate("classes-dirs")
|
||||
|
||||
val classesDirs = the<JavaPluginConvention>().sourceSets["main"].output.classesDirs
|
||||
|
||||
val classesTask = tasks["classes"]
|
||||
|
||||
afterEvaluate {
|
||||
classesDirs.files.forEach {
|
||||
addArtifact(classesDirsCfg, classesTask, it)
|
||||
}
|
||||
}
|
||||
|
||||
return classesDirs
|
||||
}
|
||||
|
||||
fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
|
||||
val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testCompile"])
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugin.use.PluginDependenciesSpec
|
||||
import org.gradle.plugin.use.PluginDependencySpec
|
||||
@@ -62,6 +63,7 @@ fun DependencyHandler.projectDist(name: String): Dependency = project(name, conf
|
||||
fun DependencyHandler.projectTests(name: String): Dependency = project(name, configuration = "tests-jar").apply { isTransitive = false }
|
||||
fun DependencyHandler.projectRuntimeJar(name: String): Dependency = project(name, configuration = "runtimeJar")
|
||||
fun DependencyHandler.projectArchives(name: String): Dependency = project(name, configuration = "archives")
|
||||
fun DependencyHandler.projectClasses(name: String): Dependency = project(name, configuration = "classes-dirs")
|
||||
|
||||
val protobufLiteProject = ":custom-dependencies:protobuf-lite"
|
||||
fun DependencyHandler.protobufLite(): ProjectDependency =
|
||||
|
||||
Reference in New Issue
Block a user