Class ArchitectureValidatorExtension
java.lang.Object
com.arc_e_tect.gradle.architecture.ArchitectureValidatorExtension
DSL extension for the Architecture Validator Gradle plugin.
architectureValidator {
basePackage = 'com.example.myapp'
failOnViolation = true
hexagonalArchitecture {
inPorts = ['..application.port.inbound..']
}
}
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionArchitectureValidatorExtension(org.gradle.api.model.ObjectFactory objects, org.gradle.api.file.ProjectLayout layout) Creates the extension, with every property already set to its default. -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.provider.Property<String> Root package ArchUnit rules are scoped to.org.gradle.api.provider.Property<Boolean> Whether the build fails when duplicate rules are discovered across the built-in rule pack, external rule packs, and hand-written tests.org.gradle.api.provider.Property<Boolean> Whether the build fails when a rule is violated.Package-pattern overrides for the built-in hexagonal rule pack.org.gradle.api.provider.Property<Boolean> Whether violations are reported but never fail the build, overridinggetFailOnViolation()/getMaxAllowedViolations().org.gradle.api.provider.Property<String> JUnit version used for thetestArchitecturesuite.org.gradle.api.provider.Property<Integer> Violation count tolerated before failing, whengetFailOnViolation()istrue.org.gradle.api.provider.ListProperty<String> Rule names to skip, whether from the built-in hexagonal rule pack, an external rule pack, or a hand-written test.org.gradle.api.file.DirectoryPropertyDirectory holding hand-written architecture tests, compiled into thetestArchitecturesuite alongside the generated ones.org.gradle.api.provider.Property<Boolean> Whether the built-in hexagonal rule pack is generated, in addition to any external rule packs and hand-written tests.voidhexagonalArchitecture(org.gradle.api.Action<? super HexagonalArchitectureExtension> action) ConfiguresgetHexagonalArchitecture().voidsetJunitVersion(String junitVersion) Convenience setter forgetJunitVersion(), for a build script pulling the version from a version catalog (e.g.
-
Field Details
-
NAME
Extension DSL block name, i.e. the name used to register the extension with the project.- See Also:
-
-
Constructor Details
-
ArchitectureValidatorExtension
@Inject public ArchitectureValidatorExtension(org.gradle.api.model.ObjectFactory objects, org.gradle.api.file.ProjectLayout layout) Creates the extension, with every property already set to its default. Instantiated by Gradle's extension-creation infrastructure.- Parameters:
objects- Gradle's object factorylayout- the project's layout, used to defaultgetTestDirectory()
-
-
Method Details
-
getTestDirectory
public org.gradle.api.file.DirectoryProperty getTestDirectory()Directory holding hand-written architecture tests, compiled into thetestArchitecturesuite alongside the generated ones.- Returns:
- mutable directory property for the hand-written test directory
-
getBasePackage
Root package ArchUnit rules are scoped to. Defaults to the empty string; the plugin further defaults an unset value to the project's owngroupat apply time.- Returns:
- mutable property for the base package
-
getFailOnViolation
Whether the build fails when a rule is violated.- Returns:
- mutable property for the fail-on-violation flag
-
getMaxAllowedViolations
Violation count tolerated before failing, whengetFailOnViolation()istrue.- Returns:
- mutable property for the allowed violation count
-
getIgnoreFailures
Whether violations are reported but never fail the build, overridinggetFailOnViolation()/getMaxAllowedViolations().- Returns:
- mutable property for the ignore-failures flag
-
getFailOnDuplicateRules
Whether the build fails when duplicate rules are discovered across the built-in rule pack, external rule packs, and hand-written tests.- Returns:
- mutable property for the fail-on-duplicate-rules flag
-
getUseBuiltInHexagonalRulePack
Whether the built-in hexagonal rule pack is generated, in addition to any external rule packs and hand-written tests.- Returns:
- mutable property for the use-built-in-hexagonal-rule-pack flag
-
getJunitVersion
JUnit version used for thetestArchitecturesuite. The plugin maps JUnit Platform Suite dependencies to the matching line automatically.- Returns:
- mutable property for the JUnit version
-
setJunitVersion
Convenience setter forgetJunitVersion(), for a build script pulling the version from a version catalog (e.g.setJunitVersion(libs.versions.junit.get())).- Parameters:
junitVersion- the value to setgetJunitVersion()to
-
getRulesDisabled
Rule names to skip, whether from the built-in hexagonal rule pack, an external rule pack, or a hand-written test.- Returns:
- mutable list property of disabled rule names
-
getHexagonalArchitecture
Package-pattern overrides for the built-in hexagonal rule pack.- Returns:
- the nested hexagonal-architecture configuration block
-
hexagonalArchitecture
public void hexagonalArchitecture(org.gradle.api.Action<? super HexagonalArchitectureExtension> action) ConfiguresgetHexagonalArchitecture().- Parameters:
action- the configuration block
-