File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,3 +107,26 @@ tasks.register<Jar>("oneJarBin") {
107107 exclude(" META-INF/*.RSA" , " META-INF/*.SF" , " META-INF/*.DSA" )
108108 }
109109}
110+
111+ // Classpath for running any single code generator that lives in each module's `generate` directory.
112+ //
113+ // ./gradlew runGenerator -Pgenerator=org.ejml.dense.block.GeneratorTileMultiplication_F64
114+ //
115+ tasks.register<JavaExec >(" runGenerator" ) {
116+ group = " ejml"
117+ description = " Runs a code generator by fully qualified class name. Use -Pgenerator=<fqcn>."
118+ workingDir = rootDir
119+ mainClass.set(providers.gradleProperty(" generator" ))
120+
121+ val parts = project.subprojects
122+ .filter { it.plugins.hasPlugin(" ejml.java-conventions" ) }
123+ .map { dependencies.project(mapOf (" path" to it.path, " configuration" to " generateOutput" )) }
124+ .plus(dependencies.project(mapOf (" path" to " :main:autocode" , " configuration" to " runtimeElements" )))
125+ classpath = configurations.detachedConfiguration(* parts.toTypedArray())
126+
127+ doFirst {
128+ if (! mainClass.isPresent)
129+ throw GradleException (" Specify the generator's fully qualified class name, e.g.\n " +
130+ " ./gradlew runGenerator -Pgenerator=org.ejml.dense.block.GeneratorTileMultiplication_F64" )
131+ }
132+ }
Original file line number Diff line number Diff line change @@ -61,25 +61,17 @@ sourceSets {
6161 }
6262}
6363
64- // Expose benchmarks source set output for sibling modules (mainly :regression)
65- val benchmarksOutput by configurations.creating {
66- isCanBeConsumed = true
67- isCanBeResolved = false
68- }
69- sourceSets[" benchmarks" ].output.classesDirs.forEach { dir ->
70- artifacts.add(" benchmarksOutput" , dir) {
71- builtBy(tasks.named(" benchmarksClasses" ))
64+ // Expose these sourceSets so that sibling modules have access to them. Without this
65+ // regression, and testing both fail. IntelliJ can't run generators
66+ listOf (" generate" , " benchmarks" , " test" ).forEach { sourceSet ->
67+ val output = configurations.create(" ${sourceSet} Output" ) {
68+ isCanBeConsumed = true
69+ isCanBeResolved = false
7270 }
73- }
74-
75- // Expose test source set output for sibling modules that need test fixtures
76- val testOutput by configurations.creating {
77- isCanBeConsumed = true
78- isCanBeResolved = false
79- }
80- sourceSets[" test" ].output.classesDirs.forEach { dir ->
81- artifacts.add(" testOutput" , dir) {
82- builtBy(tasks.named(" testClasses" ))
71+ sourceSets[sourceSet].output.classesDirs.forEach { dir ->
72+ artifacts.add(output.name, dir) {
73+ builtBy(tasks.named(" ${sourceSet} Classes" ))
74+ }
8375 }
8476}
8577
You can’t perform that action at this time.
0 commit comments