Class BinaryResolver
java.lang.Object
dev.dimlight.maven.plugin.shellcheck.BinaryResolver
Groups differents ways of getting hold of the correct shellcheck binary.
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryResolver(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) -
Method Summary
Modifier and TypeMethodDescriptionstatic PathguessUnpackedBinary(Path fromPath, Architecture arch) Walks the files in fromPath to find what is likely the shellcheck binary.resolve(BinaryResolutionMethod resolutionMethod) Performs binary resolution.
-
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 downloadmavenSession- maven component for the delegated plugin downloadpluginManager- maven component for the delegated plugin downloadmavenTargetDirectory- the path to the current project target directoryexternalBinaryPath- the path to the external binaryreleaseArchiveUrl- the url where to find the wanted release of shellchecklog- 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 resolvingIOException- in case some io operation fails (e.g download or permission change)
-
guessUnpackedBinary
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 foundIOException- if the there is an IO problem while walking the filesystem
-