Class AwsEmulatorExtension

java.lang.Object
io.github.gregwhitaker.awsemulator.emulator.EmulatorRuntimeConfiguration
io.github.gregwhitaker.awsemulator.emulator.AwsEmulatorExtension

public abstract class AwsEmulatorExtension extends EmulatorRuntimeConfiguration
Configuration for the AWS Emulator runtime and its opted-in consumers.
  • Constructor Details

    • AwsEmulatorExtension

      public AwsEmulatorExtension()
  • Method Details

    • getDefaultMode

      public abstract org.gradle.api.provider.Property<EmulatorMode> getDefaultMode()
      Default lifecycle mode for custom resource tasks in this project, across all runtime names. Defaults to EmulatorMode.MANAGED; task-level modes and command-line overrides take precedence. Convenience tasks, resource-set attachments, useWith consumers, and Spring Boot retain their own mode selection.
    • getRuntimes

      public org.gradle.api.NamedDomainObjectContainer<NamedEmulatorRuntime> getRuntimes()
      Independent runtimes in this project. The reserved default runtime is configured on this extension. Named runtimes inherit common settings, use automatic ports and separate working directories, and configure external connections independently.
    • runtimes

      public void runtimes(org.gradle.api.Action<? super org.gradle.api.NamedDomainObjectContainer<NamedEmulatorRuntime>> action)
      Configures named runtimes without starting Docker or connecting to external endpoints.
    • getDefaultScenario

      public abstract org.gradle.api.provider.Property<String> getDefaultScenario()
      Scenario used by seedAwsEmulator and resetAwsEmulator unless -PawsEmulator.scenario is set.
    • getScenarios

      public org.gradle.api.NamedDomainObjectContainer<EmulatorScenario> getScenarios()
    • scenarios

      public void scenarios(org.gradle.api.Action<? super org.gradle.api.NamedDomainObjectContainer<EmulatorScenario>> action)
    • getResourceSets

      public org.gradle.api.NamedDomainObjectContainer<EmulatorResourceSet> getResourceSets()
      Named definitions that can be attached to consumers or development scenarios.
    • resourceSets

      public void resourceSets(org.gradle.api.Action<? super org.gradle.api.NamedDomainObjectContainer<EmulatorResourceSet>> action)
    • useSharedRuntime

      public void useSharedRuntime(String ownerProject, String... resourceSets)
      Uses an explicitly selected project's runtime and optional named resource sets in this build. The owner must apply the core plugin and own its runtime directly. Its runtime settings, named runtime definitions, working directories, and lifecycles are authoritative for this project's emulator tasks and opted-in consumers. This method does not opt ordinary tasks into the emulator.

      Selected resource sets are resolved in the owner's project and attached automatically to every useWith consumer, including the Spring Boot companion's local run tasks. They execute once per owner, runtime name, and mode in an invocation. Managed and development instances remain separate unless the owner selects an external connection, where both modes use the same endpoint. Managed cleanup waits for consumers across all participating projects.

      The owner's immutable runtime metadata is resolved through a project dependency when a consumer is selected. Shared setup is attached by task path, supporting Gradle Isolated Projects. Configure the owner's plugin and resources in its own build script. Repeated calls may add resource sets for the same owner; changing owners, selecting oneself, and chaining shared owners are rejected. Consumer runtime settings are ignored. Declare the core plugin with apply false in the root plugins block when participating projects have different plugin classpaths, for example when mixing core and Spring Boot plugins.

      Parameters:
      ownerProject - absolute Gradle project path, for example :local-aws
      resourceSets - names of resource sets declared in the owner; omit to share only the runtime
    • useWith

      public void useWith(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider)
      Configures a Test, JavaExec, or Exec task's child process using the managed mode. Starts a build-owned emulator unless an external connection is enabled.
    • useWith

      public void useWith(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, EmulatorMode mode, Object... setupTasks)
      Connects a consumer to the selected runtime after its setup tasks complete. Setup accepts resource sets (including providers) and Gradle dependency notation. Resource sets create separate task instances for each runtime name and mode and run their fixtures in order. Resource setup tasks and their local prerequisites must use the same mode as the consumer; mismatches fail while resolving the selected task graph, before setup executes. Ordinary task modes are validated rather than reassigned; resource sets select the mode for their generated tasks. When an external connection is enabled, both modes use that endpoint without lifecycle management or state isolation.
    • useWith

      public void useWith(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, org.gradle.api.provider.Provider<EmulatorMode> mode, Object... setupTasks)
      Lazily selects the default runtime's mode, allowing framework integrations to supply their own mode property. Repeated calls update the mode and add setup dependencies without installing another startup action.
    • useWith

      public void useWith(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, String runtimeName, Object... setupTasks)
      Connects a consumer and its setup definitions to the named runtime in managed mode.
    • useWith

      public void useWith(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, String runtimeName, EmulatorMode mode, Object... setupTasks)
      Connects a consumer and its setup definitions to a named runtime and lifecycle mode.
    • useWithRuntime

      public void useWithRuntime(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, org.gradle.api.provider.Provider<String> runtimeName, org.gradle.api.provider.Provider<EmulatorMode> mode, Object... setupTasks)
      Lazily selects both the runtime name and lifecycle mode; the final selection applies to all setup definitions. Uses a distinct method name so Groovy can distinguish lazy runtime selection from mode-plus-setup calls.