Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,26 @@ tasks.register<Jar>("oneJarBin") {
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
}
}

// Classpath for running any single code generator that lives in each module's `generate` directory.
//
// ./gradlew runGenerator -Pgenerator=org.ejml.dense.block.GeneratorTileMultiplication_F64
//
tasks.register<JavaExec>("runGenerator") {
group = "ejml"
description = "Runs a code generator by fully qualified class name. Use -Pgenerator=<fqcn>."
workingDir = rootDir
mainClass.set(providers.gradleProperty("generator"))

val parts = project.subprojects
.filter { it.plugins.hasPlugin("ejml.java-conventions") }
.map { dependencies.project(mapOf("path" to it.path, "configuration" to "generateOutput")) }
.plus(dependencies.project(mapOf("path" to ":main:autocode", "configuration" to "runtimeElements")))
classpath = configurations.detachedConfiguration(*parts.toTypedArray())

doFirst {
if (!mainClass.isPresent)
throw GradleException("Specify the generator's fully qualified class name, e.g.\n" +
" ./gradlew runGenerator -Pgenerator=org.ejml.dense.block.GeneratorTileMultiplication_F64")
}
}
34 changes: 10 additions & 24 deletions buildSrc/src/main/kotlin/ejml.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,17 @@ sourceSets {
}
}

// Expose benchmarks source set output for sibling modules (mainly :regression)
val benchmarksOutput by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}
sourceSets["benchmarks"].output.classesDirs.forEach { dir ->
artifacts.add("benchmarksOutput", dir) {
builtBy(tasks.named("benchmarksClasses"))
// Expose these sourceSets so that sibling modules have access to them. Without this
// regression, and testing both fail. IntelliJ can't run generators
listOf("generate", "benchmarks", "test").forEach { sourceSet ->
val output = configurations.create("${sourceSet}Output") {
isCanBeConsumed = true
isCanBeResolved = false
}
}

// Expose test source set output for sibling modules that need test fixtures
val testOutput by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}
sourceSets["test"].output.classesDirs.forEach { dir ->
artifacts.add("testOutput", dir) {
builtBy(tasks.named("testClasses"))
sourceSets[sourceSet].output.classesDirs.forEach { dir ->
artifacts.add(output.name, dir) {
builtBy(tasks.named("${sourceSet}Classes"))
}
}
}

Expand Down Expand Up @@ -225,12 +217,6 @@ tasks.withType<JavaCompile>().configureEach {
options.errorprone.option("NullAway:AnnotatedPackages", "org.ejml")
}

// Skip jar publishing for these codeless container modules
val codelessModules = setOf("main", "examples", "autocode", "regression")
if (name in codelessModules) {
tasks.named<Jar>("jar") { enabled = false }
}

spotless {
ratchetFrom("origin/SNAPSHOT")

Expand Down