Interface IndraSpotlessLicenserExtension

  • All Known Implementing Classes:
    IndraSpotlessLicenserExtensionImpl

    public interface IndraSpotlessLicenserExtension
    Configuration options determining how license header contents should be applied to Spotless's licenser.
    Since:
    2.2.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void extraConfig​(@NotNull org.gradle.api.Action<com.diffplug.gradle.spotless.FormatExtension.LicenseHeaderConfig> configureStep)
      Add an extra configure step to modify applied license header configurations.
      @NotNull org.gradle.api.provider.Property<HeaderFormat> headerFormat()
      A property containing the header format to use.
      default void headerFormat​(@NotNull HeaderFormat format)
      Set the header format to use.
      default void headerFormat​(@NotNull org.gradle.api.Action<HeaderFormatApplier> configurer)
      Set the header format to use.
      void languageFormatOverride​(@NotNull java.lang.String language, @NotNull HeaderFormat headerFormat)
      Set a language format override for a specific formatter task.
      void languageFormatOverride​(@NotNull java.lang.String language, @NotNull org.gradle.api.Action<HeaderFormatApplier> configurer)
      Set a language format override for a specific formatter task.
      @NotNull org.gradle.api.provider.MapProperty<java.lang.String,​HeaderFormat> languageFormatOverrides()
      A property providing language-specific header format overrides.
      @NotNull org.gradle.api.provider.Property<org.gradle.api.resources.TextResource> licenseHeaderFile()
      A property holding the file to use for a license header.
      void licenseHeaderFile​(@NotNull java.lang.Object file)
      Set the license header file to use.
      @NotNull org.gradle.api.provider.Property<java.lang.Boolean> newLine()
      Get whether to append an additional newline at the end of files.
      default void newLine​(boolean newLine)
      Get whether to append an additional newline at the end of files.
      @NotNull org.gradle.api.provider.MapProperty<java.lang.String,​java.lang.Object> properties()
      Properties to replace within license header contents.
      default @NotNull IndraSpotlessLicenserExtension property​(@NotNull java.lang.String key, @NotNull java.lang.String value)
      Add a property to be expanded.
      default @NotNull IndraSpotlessLicenserExtension property​(@NotNull java.lang.String key, @NotNull org.gradle.api.provider.Provider<?> value)
      Add a property to be expanded.
    • Method Detail

      • licenseHeaderFile

        @NotNull
        @NotNull org.gradle.api.provider.Property<org.gradle.api.resources.TextResource> licenseHeaderFile()
        A property holding the file to use for a license header.
        Returns:
        the license header file property
        Since:
        2.2.0
      • licenseHeaderFile

        void licenseHeaderFile​(@NotNull
                               @NotNull java.lang.Object file)
        Set the license header file to use.

        The contents of this file will be processed to apply a comment style and expand template parameters.

        Parameters:
        file - the file to read, via Project.file()
        Since:
        2.2.0
      • headerFormat

        @NotNull
        @NotNull org.gradle.api.provider.Property<HeaderFormat> headerFormat()
        A property containing the header format to use.

        Language-specific overrides can be set using languageFormatOverride(String, HeaderFormat).

        Returns:
        the header format property
        Since:
        2.2.0
      • headerFormat

        default void headerFormat​(@NotNull
                                  @NotNull HeaderFormat format)
        Set the header format to use.
        Parameters:
        format - the header format
        Since:
        2.2.0
      • headerFormat

        default void headerFormat​(@NotNull
                                  @NotNull org.gradle.api.Action<HeaderFormatApplier> configurer)
        Set the header format to use.
        Parameters:
        configurer - an action that will be passed callbacks for common header format presets
        Since:
        2.2.0
      • languageFormatOverrides

        @NotNull
        @NotNull org.gradle.api.provider.MapProperty<java.lang.String,​HeaderFormat> languageFormatOverrides()
        A property providing language-specific header format overrides.
        Returns:
        the map property containing overrides
        Since:
        2.2.0
      • languageFormatOverride

        void languageFormatOverride​(@NotNull
                                    @NotNull java.lang.String language,
                                    @NotNull
                                    @NotNull HeaderFormat headerFormat)
        Set a language format override for a specific formatter task.
        Parameters:
        language - the formatter task to configure
        headerFormat - the header format to apply
        Since:
        2.2.0
      • languageFormatOverride

        void languageFormatOverride​(@NotNull
                                    @NotNull java.lang.String language,
                                    @NotNull
                                    @NotNull org.gradle.api.Action<HeaderFormatApplier> configurer)
        Set a language format override for a specific formatter task.
        Parameters:
        language - the formatter task to configure
        configurer - an action that will be passed callbacks for common header format presets
        Since:
        2.2.0
      • properties

        @NotNull
        @NotNull org.gradle.api.provider.MapProperty<java.lang.String,​java.lang.Object> properties()
        Properties to replace within license header contents.

        The Groovy SimpleTemplateEngine is used to pre-process license headers.

        Returns:
        the properties map
        Since:
        2.2.0
      • property

        @NotNull
        default @NotNull IndraSpotlessLicenserExtension property​(@NotNull
                                                                 @NotNull java.lang.String key,
                                                                 @NotNull
                                                                 @NotNull java.lang.String value)
        Add a property to be expanded.
        Parameters:
        key - the property key
        value - the value to resolve to
        Returns:
        this extension, for chaining
        Since:
        2.2.0
      • property

        @NotNull
        default @NotNull IndraSpotlessLicenserExtension property​(@NotNull
                                                                 @NotNull java.lang.String key,
                                                                 @NotNull
                                                                 @NotNull org.gradle.api.provider.Provider<?> value)
        Add a property to be expanded.
        Parameters:
        key - the property key
        value - the value provider to resolve to
        Returns:
        this extension, for chaining
        Since:
        2.2.0
      • newLine

        @NotNull
        @NotNull org.gradle.api.provider.Property<java.lang.Boolean> newLine()
        Get whether to append an additional newline at the end of files.
        Returns:
        the newline property
        Since:
        2.2.0
      • newLine

        default void newLine​(boolean newLine)
        Get whether to append an additional newline at the end of files.
        Parameters:
        newLine - the newline value
        Since:
        2.2.0
      • extraConfig

        void extraConfig​(@NotNull
                         @NotNull org.gradle.api.Action<com.diffplug.gradle.spotless.FormatExtension.LicenseHeaderConfig> configureStep)
        Add an extra configure step to modify applied license header configurations.
        Parameters:
        configureStep - the extra configuration step
        Since:
        2.2.0