-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure compiler options via build-logic (#2026)
Moves some of the "uninteresting" options to build-logic to clean up `<projectname>.gradle` files. The basic idea of this PR is that much of the tedious configuration shall happen in the spockframework.base plugin. All subprojects apply that plugin and profit from the abstraction. "Interesting stuff" like declaration of dependencies shall still happen in `<projectname>.gradle` files. I'd like to expand this idea , but I want to keep the PRs small and start with the most simple stuff first.
- Loading branch information
Showing
6 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
build-logic/base/src/test/groovy/org/spockframework/gradle/SpockBasePluginSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.spockframework.gradle | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.JavaPlugin | ||
import org.gradle.api.tasks.compile.JavaCompile | ||
import org.gradle.testfixtures.ProjectBuilder | ||
import spock.lang.Specification | ||
|
||
class SpockBasePluginSpec extends Specification { | ||
|
||
def 'Compile settings are configured'() { | ||
setup: | ||
def project = createProject() | ||
|
||
when: | ||
def compileJavaTasks = project.tasks.withType(JavaCompile) | ||
def compileJava = project.tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME) as JavaCompile | ||
|
||
then: | ||
compileJavaTasks.every { it.options.encoding == "UTF-8" } | ||
compileJava.javaCompiler.get().metadata.languageVersion == SpockBasePlugin.COMPILER_VERSION | ||
} | ||
|
||
private static Project createProject() { | ||
def result = ProjectBuilder.builder() | ||
.build() | ||
result.plugins.apply("java-library") | ||
result.plugins.apply("groovy") | ||
result.plugins.apply(SpockBasePlugin) | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters