@@ -39,9 +39,10 @@ inputs:
3939 version :
4040 description : |
4141 The desired version of the [clang-tools](https://github.com/cpp-linter/clang-tools-pip) to use.
42- Accepted options are strings which can be 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12 or 11.
42+ Accepted options include major versions like 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12 or 11.
4343
4444 - Set this option to a blank string (`''`) to use the platform's default installed version.
45+ - Semantic version strings like `20.1` or `20.1.7` are also supported.
4546 - This value can also be a path to where the clang tools are installed (if using a custom install location).
4647 required : false
4748 default : ' 20'
@@ -384,13 +385,17 @@ runs:
384385 let version = try {
385386 $version_str | into int
386387 } catch {
387- print "Version is not an integer"
388- if not ($version_str | path exists) {
389- print "::error title=Invalid version input::Version must be a blank string, an integer, or a valid path"
390- exit 1
391- } else {
392- print $"(ansi yellow)Using custom clang tools installation at path: ($version_str)(ansi reset)"
393- exit 0
388+ try {
389+ $version_str | split row '.' | first | into int
390+ } catch {
391+ print "Version does not have an integer major component"
392+ if not ($version_str | path exists) {
393+ print "::error title=Invalid version input::Version must be a blank string, an integer, a semantic version string, or a valid path"
394+ exit 1
395+ } else {
396+ print $"(ansi yellow)Using custom clang tools installation at path: ($version_str)(ansi reset)"
397+ exit 0
398+ }
394399 }
395400 }
396401
@@ -411,7 +416,13 @@ runs:
411416
412417 print $"\n(ansi purple)Ensuring ($tools | str join ' and ') ($version_str) are present(ansi reset)"
413418 for tool in $tools {
414- print $"Installing ($tool) ($version)"
419+ let installed_tool = $"($tool)-($version_str)"
420+ if not ((which $installed_tool) | is-empty) {
421+ print $"(ansi yellow)Using existing ($installed_tool) from a prior installation source(ansi reset)"
422+ continue
423+ }
424+
425+ print $"Installing ($tool) ($version_str)"
415426 let cmd = if (
416427 (($version < 13) and ($tool | str ends-with "tidy"))
417428 or (
@@ -420,9 +431,9 @@ runs:
420431 and not ((version | get "build_os") | str starts-with "linux")
421432 )
422433 ) {
423- [clang-tools --tool $tool --install $version ]
434+ [clang-tools --tool $tool --install $version_str ]
424435 } else {
425- [clang-tools-wheel --tool $tool --version $version ]
436+ [clang-tools-wheel --tool $tool --version $version_str ]
426437 }
427438 ^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args ...$cmd
428439 }
0 commit comments