Class GenerateArchitectureTestsTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.arc_e_tect.gradle.architecture.GenerateArchitectureTestsTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
@DisableCachingByDefault(because="Generates test sources from extension configuration")
public abstract class GenerateArchitectureTestsTask
extends org.gradle.api.DefaultTask
Generates the built-in hexagonal architecture test, and a bridge suite for any external rule
pack tests discovered on
getRulePackClasspath(), under getOutputDirectory().-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Generates the built-in hexagonal architecture test and the external rule pack bridge suite.abstract org.gradle.api.provider.ListProperty<String> Adapter package patterns, matching both inbound and outbound adapters not already covered bygetInboundAdapters()/getOutboundAdapters().abstract org.gradle.api.provider.Property<String> The explicitly configured base package, i.e.abstract org.gradle.api.provider.ListProperty<String> Shared/common package patterns, excluded from layer-boundary rules.abstract org.gradle.api.provider.ListProperty<String> Package patterns holding DI-framework wiring/configuration classes.abstract org.gradle.api.provider.ListProperty<String> JDK package patterns the domain model is allowed to depend on, in addition to its owngetDomainModel()packages.abstract org.gradle.api.provider.ListProperty<String> Domain model package patterns.abstract org.gradle.api.provider.ListProperty<String> Domain service package patterns.abstract org.gradle.api.provider.Property<Boolean> Whether generation fails when duplicate rules are discovered.abstract org.gradle.api.provider.Property<String> Base package used only whengetBasePackage()is blank and no package could be inferred fromgetMainSourceDirectory()'s own layout - the project's owngroup, resolved by the plugin at apply time.abstract org.gradle.api.provider.ListProperty<String> Framework/library package patterns the domain model, domain services, and ports must never depend on.abstract org.gradle.api.provider.ListProperty<String> Inbound adapter package patterns.abstract org.gradle.api.provider.ListProperty<String> Inbound port package patterns.abstract org.gradle.api.file.DirectoryPropertyThe project's main Java source directory, used to infer a base package from its own directory layout whengetBasePackage()is blank.abstract org.gradle.api.provider.Property<Boolean> Whether bidirectional naming-convention rules are generated in addition to the layer-boundary rules.abstract org.gradle.api.provider.ListProperty<String> Outbound adapter package patterns.abstract org.gradle.api.provider.ListProperty<String> Outbound port package patterns.abstract org.gradle.api.file.DirectoryPropertyDirectory generated test sources are written to.abstract org.gradle.api.provider.ListProperty<String> Package patterns nested inside a port package that hold pure data-transfer types.abstract org.gradle.api.file.ConfigurableFileCollectionClasspath scanned for external rule pack tests to bridge into a generated JUnit Platform suite.abstract org.gradle.api.provider.Property<Boolean> Whether the built-in hexagonal architecture test is generated at all.abstract org.gradle.api.file.DirectoryPropertyDirectory holding hand-written architecture tests, scanned only to detect duplicate rules against the generated ones - not itself compiled by this task.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
GenerateArchitectureTestsTask
@Inject public GenerateArchitectureTestsTask()Creates a new task instance. Instantiated by Gradle infrastructure.
-
-
Method Details
-
getBasePackage
The explicitly configured base package, i.e.architectureValidator.basePackage. Takes priority over both an inferred package (fromgetMainSourceDirectory()'s own layout) andgetFallbackBasePackage()when non-blank.- Returns:
- mutable property for the configured base package
-
getFallbackBasePackage
Base package used only whengetBasePackage()is blank and no package could be inferred fromgetMainSourceDirectory()'s own layout - the project's owngroup, resolved by the plugin at apply time.- Returns:
- mutable property for the fallback base package
-
getInPorts
Inbound port package patterns.- Returns:
- mutable list property of inbound port package patterns
-
getOutPorts
Outbound port package patterns.- Returns:
- mutable list property of outbound port package patterns
-
getDomainModel
Domain model package patterns.- Returns:
- mutable list property of domain model package patterns
-
getDomainServices
Domain service package patterns.- Returns:
- mutable list property of domain service package patterns
-
getAdapters
Adapter package patterns, matching both inbound and outbound adapters not already covered bygetInboundAdapters()/getOutboundAdapters().- Returns:
- mutable list property of adapter package patterns
-
getInboundAdapters
Inbound adapter package patterns.- Returns:
- mutable list property of inbound adapter package patterns
-
getOutboundAdapters
Outbound adapter package patterns.- Returns:
- mutable list property of outbound adapter package patterns
-
getCommonPackages
Shared/common package patterns, excluded from layer-boundary rules.- Returns:
- mutable list property of common package patterns
-
getPortDataTypePackages
Package patterns nested inside a port package that hold pure data-transfer types.- Returns:
- mutable list property of port data-type package patterns
-
getConfigurationPackages
Package patterns holding DI-framework wiring/configuration classes.- Returns:
- mutable list property of configuration package patterns
-
getDomainAllowedPackages
JDK package patterns the domain model is allowed to depend on, in addition to its owngetDomainModel()packages.- Returns:
- mutable list property of JDK package patterns allowed from the domain model
-
getFrameworkDenylistPackages
Framework/library package patterns the domain model, domain services, and ports must never depend on.- Returns:
- mutable list property of denylisted framework package patterns
-
getNamingConventionsEnabled
Whether bidirectional naming-convention rules are generated in addition to the layer-boundary rules.- Returns:
- mutable property for the naming-conventions-enabled flag
-
getFailOnDuplicateRules
Whether generation fails when duplicate rules are discovered.- Returns:
- mutable property for the fail-on-duplicate-rules flag
-
getUseBuiltInHexagonalRulePack
Whether the built-in hexagonal architecture test is generated at all.- Returns:
- mutable property for the use-built-in-hexagonal-rule-pack flag
-
getUserTestsDirectory
@Internal public abstract org.gradle.api.file.DirectoryProperty getUserTestsDirectory()Directory holding hand-written architecture tests, scanned only to detect duplicate rules against the generated ones - not itself compiled by this task.- Returns:
- read-only directory property for the hand-written test directory
-
getMainSourceDirectory
@Internal public abstract org.gradle.api.file.DirectoryProperty getMainSourceDirectory()The project's main Java source directory, used to infer a base package from its own directory layout whengetBasePackage()is blank.- Returns:
- read-only directory property for the main source directory
-
getRulePackClasspath
@Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getRulePackClasspath()Classpath scanned for external rule pack tests to bridge into a generated JUnit Platform suite.- Returns:
- read-only file collection for the rule pack classpath
-
getOutputDirectory
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()Directory generated test sources are written to.- Returns:
- mutable directory property for the output directory
-
generate
public void generate()Generates the built-in hexagonal architecture test and the external rule pack bridge suite.
-