Class RomeStepConfig<Self extends RomeStepConfig<Self>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected RomeStepConfig​(Project project, java.util.function.Consumer<FormatterStep> replaceStep, java.lang.String version)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      Self configPath​(java.lang.Object configPath)
      Optional path to the directory with configuration file for Rome.
      protected FormatterStep createStep()
      Creates a new formatter step that formats code by calling the Rome executable, using the current configuration.
      Self downloadDir​(java.lang.Object downloadDir)
      Optional directory where the downloaded Rome executable is placed.
      protected abstract java.lang.String getLanguage()
      Gets the language (syntax) of the input files to format.
      protected abstract Self getThis()  
      Self pathToExe​(java.lang.Object pathToExe)
      Optional path to the Rome executable.
      protected void replaceStep()
      Creates a new Rome step and replaces the existing Rome step in the list of format steps.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RomeStepConfig

        protected RomeStepConfig​(Project project,
                                 java.util.function.Consumer<FormatterStep> replaceStep,
                                 java.lang.String version)
    • Method Detail

      • configPath

        public Self configPath​(java.lang.Object configPath)
        Optional path to the directory with configuration file for Rome. The file must be named rome.json. When none is given, the default configuration is used. If this is a relative path, it is resolved against the project's base directory.
        Returns:
        This step for further configuration.
      • downloadDir

        public Self downloadDir​(java.lang.Object downloadDir)
        Optional directory where the downloaded Rome executable is placed. If this is a relative path, it is resolved against the project's base directory. Defaults to ~/.m2/repository/com/diffplug/spotless/spotless-data/rome.
        Returns:
        This step for further configuration.
      • pathToExe

        public Self pathToExe​(java.lang.Object pathToExe)
        Optional path to the Rome executable. Overwrites the configured version. No attempt is made to download the Rome executable from the network.

        When an absolute path is given, that path is used as-is. When a relative path is given, it is resolved against the project's base directory. When only a file name (i.e. without any slashes or back slash path separators such as rome) is given, this is interpreted as the name of a command with executable that is in your path environment variable. Use ./executable-name if you want to use an executable in the project's base directory.

        Returns:
        This step for further configuration.
      • createStep

        protected FormatterStep createStep()
        Creates a new formatter step that formats code by calling the Rome executable, using the current configuration.
        Returns:
        A new formatter step for the Rome formatter.
      • getLanguage

        protected abstract java.lang.String getLanguage()
        Gets the language (syntax) of the input files to format. When null or the empty string, the language is detected automatically from the file name. Currently the following languages are supported by Rome:
        • js (JavaScript)
        • jsx (JavaScript + JSX)
        • js? (JavaScript or JavaScript + JSX, depending on the file extension)
        • ts (TypeScript)
        • tsx (TypeScript + JSX)
        • ts? (TypeScript or TypeScript + JSX, depending on the file extension)
        • json (JSON)
        Returns:
        The language of the input files.
      • getThis

        protected abstract Self getThis()
        Returns:
        This Rome config instance.
      • replaceStep

        protected void replaceStep()
        Creates a new Rome step and replaces the existing Rome step in the list of format steps.