Class BinaryResolver

java.lang.Object
dev.dimlight.maven.plugin.shellcheck.BinaryResolver

public class BinaryResolver extends Object
Groups differents ways of getting hold of the correct shellcheck binary.
  • Constructor Details

    • BinaryResolver

      public BinaryResolver(org.apache.maven.project.MavenProject mavenProject, org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.plugin.BuildPluginManager pluginManager, Path mavenTargetDirectory, Optional<Path> externalBinaryPath, Map<String,URL> releaseArchiveUrl, org.apache.maven.plugin.logging.Log log)
      Parameters:
      mavenProject - maven component for the delegated plugin download
      mavenSession - maven component for the delegated plugin download
      pluginManager - maven component for the delegated plugin download
      mavenTargetDirectory - the path to the current project target directory
      externalBinaryPath - the path to the external binary
      releaseArchiveUrl - the url where to find the wanted release of shellcheck
      log - a maven logger
  • Method Details

    • resolve

      public Path resolve(BinaryResolutionMethod resolutionMethod) throws org.apache.maven.plugin.MojoExecutionException, IOException
      Performs binary resolution.
      Parameters:
      resolutionMethod - the desiderd resolution method.
      Returns:
      a executable shellcheck binary path
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if there are problems while resolving
      IOException - in case some io operation fails (e.g download or permission change)
    • guessUnpackedBinary

      public static Path guessUnpackedBinary(Path fromPath, Architecture arch) throws IOException
      Walks the files in fromPath to find what is likely the shellcheck binary. This is done cause the windows released archive has a different structure (directory and binary-name wise).

      No actual check inspecting the binary is done, the likely binary is "found" only by name.

      Parameters:
      fromPath - the root path from which to start the search.
      arch - the current detected architecture
      Returns:
      the path to the binary, if found
      Throws:
      FileNotFoundException - if the binary is not found
      IOException - if the there is an IO problem while walking the filesystem