github.com/beauknowssoftware/makehcl@v0.0.0-20200322000747-1b9bb1e1c008/build/tools.hcl (about)

     1  var {
     2    toolPaths = split(" ", shell("go list -f '{{ join .Imports \" \" }}' -tags tools ./internal"))
     3    tools = [
     4      for toolPath in var.toolPaths : {
     5        path: toolPath,
     6        binPath: path("tools", basename(toolPath)),
     7        name: basename(toolPath),
     8      }
     9    ]
    10  }
    11  
    12  dynamic rule {
    13    for_each = var.tools
    14    as = "tool"
    15  
    16    target = tool.binPath
    17    command = "go build -o ${target} ${tool.path}"
    18  }