diff --git a/.bazelrc b/.bazelrc index 62897d1..8209a4e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,2 @@ build --verbose_failures test --test_output=errors - -try-import %workspace%/.bazelrc.local - diff --git a/.bazelversion b/.bazelversion index c7cb131..19b860c 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -5.3.1 +6.4.0 diff --git a/README.md b/README.md index e11c90d..2dc969c 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,24 @@ Add to `WORKSPACE` file. ```starlark load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +# The actual snippet see in Releases. http_archive( - name = "com_github_ebay_rules_ytt", - sha256 = "0232522fd7a07d2eb0a47fe4ec3a6dc8bc8e0bcbaa8abd658c6be53a34f5bd76", - strip_prefix = "rules_ytt-0.1.0", + name = "rules_ytt", + sha256 = "", + strip_prefix = "rules_ytt-X.Y.Z", urls = [ - "https://github.com/eBay/rules_ytt/releases/download/v0.1.0/rules_ytt-0.1.0.zip", + "https://github.com/ekhabarov/rules_ytt/releases/download/vX.Y.X/rules_ytt-X.Y.Z.zip", ], ) -load("@com_github_ebay_rules_ytt//:deps.bzl", "ytt_rules_dependencies") +load("@rules_ytt//ytt:repositories.bzl", + "rules_ytt_dependencies", + "ytt_register_toolchains", +) + +rules_ytt_dependencies() -ytt_rules_dependencies() +ytt_register_toolchains() ``` ## Usage @@ -25,7 +31,10 @@ ytt_rules_dependencies() Add to `BUILD` file: ```starlark -load("@com_github_ebay_rules_ytt//:def.bzl", "ytt") +load("@rules_ytt//:defs.bzl", "ytt") + +# Build an image with rules_docker + load("@io_bazel_rules_docker//go:image.bzl", "go_image") go_image( @@ -34,6 +43,17 @@ go_image( importpath = "...", ) +# or with rules_oci + +load("@rules_oci//oci:defs.bzl", "oci_image") + +oci_image( + name = "image", + ... +) + +# Generate YAML manifests + ytt( name = "manifests", srcs = [ @@ -41,6 +61,8 @@ ytt( ":defaults.yaml", ":values.yaml", ], + # or + # srcs = glob(["*.yaml"]), image = ":image.digest", ) ``` @@ -57,10 +79,6 @@ ytt -f base.yaml -f defaults.yaml -f values.yaml --dangerous-allow-all-symlink-d Image digest is available inside yaml templates as `data.values.image_digest`. -## Commands - -[Here](./ytt.md) - ## LICENSE Copyright 2023 eBay Inc. Developer: Evgeny Khabarov diff --git a/WORKSPACE b/WORKSPACE index 1a1a580..7e38145 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,37 +1,13 @@ -workspace(name = "com_github_ebay_rules_ytt") +workspace(name = "rules_ytt") -load(":deps.bzl", "ytt_rules_dependencies") - -ytt_rules_dependencies() - -load("@io_bazel_rules_go//go:deps.bzl", - "go_register_toolchains", - "go_rules_dependencies", -) - -go_rules_dependencies() - -go_register_toolchains(version = "1.20.3") - -load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") - -stardoc_repositories() - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") -gazelle_dependencies() - -load( - "@io_bazel_rules_docker//repositories:repositories.bzl", - container_repositories = "repositories", +load("//ytt:repositories.bzl", + "rules_ytt_dependencies", + "rules_ytt_internal_dependencies", + "ytt_register_toolchains", ) -container_repositories() - -load("@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories") +rules_ytt_dependencies() -_go_image_repos() +rules_ytt_internal_dependencies() +ytt_register_toolchains() diff --git a/buildpatches/build_files b/buildpatches/build_files deleted file mode 100644 index 9aa39ed..0000000 --- a/buildpatches/build_files +++ /dev/null @@ -1,1906 +0,0 @@ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cmd/ytt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,19 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -+ -+go_library( -+ name = "ytt_lib", -+ srcs = ["ytt.go"], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/cmd/ytt", -+ visibility = ["//visibility:private"], -+ deps = [ -+ "//pkg/cmd", -+ "//vendor/github.com/cppforlife/go-cli-ui/errors", -+ ], -+) -+ -+go_binary( -+ name = "ytt", -+ embed = [":ytt_lib"], -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cmd/ytt-lambda-website/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,24 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -+ -+go_library( -+ name = "ytt-lambda-website_lib", -+ srcs = [ -+ "main.go", -+ "request.go", -+ "response.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/cmd/ytt-lambda-website", -+ visibility = ["//visibility:private"], -+ deps = [ -+ "//pkg/cmd", -+ "//vendor/github.com/aws/aws-lambda-go/events", -+ "//vendor/github.com/aws/aws-lambda-go/lambda", -+ ], -+) -+ -+go_binary( -+ name = "ytt-lambda-website", -+ embed = [":ytt-lambda-website_lib"], -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ examples/integrating-with-ytt/internal-templating/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,26 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") -+ -+go_library( -+ name = "internal-templating_lib", -+ srcs = ["main.go"], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/examples/integrating-with-ytt/internal-templating", -+ visibility = ["//visibility:private"], -+ deps = [ -+ "//pkg/cmd/template", -+ "//pkg/cmd/ui", -+ "//pkg/files", -+ ], -+) -+ -+go_binary( -+ name = "internal-templating", -+ embed = [":internal-templating_lib"], -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "internal-templating_test", -+ srcs = ["main_test.go"], -+ embed = [":internal-templating_lib"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/cmd/template/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,62 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "template", -+ srcs = [ -+ "bulk_input.go", -+ "cmd.go", -+ "cmd_flags.go", -+ "data_values_file.go", -+ "data_values_flags.go", -+ "doc.go", -+ "file_marks.go", -+ "regular_input.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/cmd/template", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/cmd/ui", -+ "//pkg/filepos", -+ "//pkg/files", -+ "//pkg/schema", -+ "//pkg/template", -+ "//pkg/workspace", -+ "//pkg/workspace/datavalues", -+ "//pkg/workspace/ref", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibrary/overlay", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":template", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "template_test", -+ srcs = [ -+ "cmd_data_values_file_test.go", -+ "cmd_data_values_test.go", -+ "cmd_library_module_test.go", -+ "cmd_overlays_test.go", -+ "cmd_root_library_test.go", -+ "cmd_test.go", -+ "regular_input_test.go", -+ "schema_author_test.go", -+ "schema_consumer_test.go", -+ "schema_inspect_test.go", -+ ], -+ deps = [ -+ ":template", -+ "//pkg/cmd/ui", -+ "//pkg/experiments", -+ "//pkg/files", -+ "//vendor/github.com/google/gofuzz", -+ "//vendor/github.com/stretchr/testify/assert", -+ "//vendor/github.com/stretchr/testify/require", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/cmd/ui/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,19 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "ui", -+ srcs = [ -+ "doc.go", -+ "tty.go", -+ "ui.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/cmd/ui", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":ui", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/cmd/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,35 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "cmd", -+ srcs = [ -+ "doc.go", -+ "fmt.go", -+ "template.go", -+ "version.go", -+ "website.go", -+ "ytt.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/cmd", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/cmd/template", -+ "//pkg/cmd/ui", -+ "//pkg/experiments", -+ "//pkg/files", -+ "//pkg/version", -+ "//pkg/website", -+ "//pkg/yamlfmt", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibraryext", -+ "//vendor/github.com/cppforlife/cobrautil", -+ "//vendor/github.com/spf13/cobra", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":cmd", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/experiments/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,25 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "experiments", -+ srcs = [ -+ "doc.go", -+ "flags.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/experiments", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":experiments", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "experiments_test", -+ srcs = ["flags_test.go"], -+ embed = [":experiments"], -+ deps = ["//vendor/github.com/stretchr/testify/assert"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/filepos/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,18 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "filepos", -+ srcs = [ -+ "doc.go", -+ "position.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/filepos", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":filepos", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/files/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,33 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "files", -+ srcs = [ -+ "doc.go", -+ "file.go", -+ "output_directory.go", -+ "output_file.go", -+ "sources.go", -+ "stdin.go", -+ "symlink.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/files", -+ visibility = ["//visibility:public"], -+ deps = ["//pkg/cmd/ui"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":files", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "files_test", -+ srcs = ["sources_test.go"], -+ deps = [ -+ ":files", -+ "//vendor/github.com/stretchr/testify/require", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/orderedmap/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,19 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "orderedmap", -+ srcs = [ -+ "convert.go", -+ "doc.go", -+ "map.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/orderedmap", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":orderedmap", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/schema/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,34 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "schema", -+ srcs = [ -+ "annotations.go", -+ "assign.go", -+ "check.go", -+ "doc.go", -+ "error.go", -+ "openapi.go", -+ "schema.go", -+ "type.go", -+ "yamlmeta.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/schema", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/spell", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/validations", -+ "//pkg/yamlmeta", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":schema", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/spell/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,18 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "spell", -+ srcs = [ -+ "doc.go", -+ "spell.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/spell", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":spell", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/template/core/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,27 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "core", -+ srcs = [ -+ "args.go", -+ "doc.go", -+ "errs.go", -+ "go_value.go", -+ "starlark_noop.go", -+ "starlark_struct.go", -+ "starlark_value.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/template/core", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/orderedmap", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":core", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/template/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,48 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "template", -+ srcs = [ -+ "ancestors.go", -+ "annotations.go", -+ "compiled_template.go", -+ "compiled_template_error.go", -+ "compiled_template_loader.go", -+ "doc.go", -+ "evaluation_ctx.go", -+ "instructions.go", -+ "meta.go", -+ "nodes.go", -+ "program_ast.go", -+ "source.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/template", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/template/core", -+ "//vendor/github.com/k14s/starlark-go/resolve", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":template", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "template_test", -+ srcs = [ -+ "ancestors_test.go", -+ "compiled_template_test.go", -+ "error_hints_test.go", -+ ], -+ deps = [ -+ ":template", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/texttemplate/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,36 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "texttemplate", -+ srcs = [ -+ "ast.go", -+ "doc.go", -+ "evaluation_ctx.go", -+ "metas.go", -+ "parser.go", -+ "template.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/texttemplate", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/template", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":texttemplate", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "texttemplate_test", -+ srcs = ["template_test.go"], -+ deps = [ -+ ":texttemplate", -+ "//pkg/template", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/validations/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,42 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "validations", -+ srcs = [ -+ "annotations.go", -+ "doc.go", -+ "validate.go", -+ "yamlmeta.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/validations", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/orderedmap", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/yamlmeta", -+ "//pkg/yamltemplate", -+ "//pkg/yttlibrary", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":validations", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "validations_test", -+ srcs = ["validations_test.go"], -+ deps = [ -+ ":validations", -+ "//pkg/experiments", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibraryext", -+ "//test/filetests", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/version/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,18 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "version", -+ srcs = [ -+ "doc.go", -+ "version.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/version", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":version", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/website/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,19 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "website", -+ srcs = [ -+ "doc.go", -+ "files.go", -+ "server.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/website", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":website", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/workspace/datavalues/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,27 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "datavalues", -+ srcs = [ -+ "doc.go", -+ "envelope.go", -+ "schema.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/workspace/datavalues", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/schema", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/workspace/ref", -+ "//pkg/yamlmeta", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":datavalues", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/workspace/ref/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,22 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "ref", -+ srcs = [ -+ "doc.go", -+ "library_ref.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/workspace/ref", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/template", -+ "//pkg/template/core", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":ref", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/workspace/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,45 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "workspace", -+ srcs = [ -+ "data_loader.go", -+ "data_values_pre_processing.go", -+ "data_values_schema_pre_processing.go", -+ "doc.go", -+ "doc_extractor.go", -+ "library.go", -+ "library_execution.go", -+ "library_execution_factory.go", -+ "library_module.go", -+ "overlay_post_processing.go", -+ "template_loader.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/workspace", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/cmd/ui", -+ "//pkg/filepos", -+ "//pkg/files", -+ "//pkg/schema", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/texttemplate", -+ "//pkg/validations", -+ "//pkg/workspace/datavalues", -+ "//pkg/workspace/ref", -+ "//pkg/yamlmeta", -+ "//pkg/yamltemplate", -+ "//pkg/yttlibrary", -+ "//pkg/yttlibrary/overlay", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/starlarkstruct", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":workspace", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yamlfmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,30 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "yamlfmt", -+ srcs = [ -+ "doc.go", -+ "printer.go", -+ "writer.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yamlfmt", -+ visibility = ["//visibility:public"], -+ deps = ["//pkg/yamlmeta"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yamlfmt", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "yamlfmt_test", -+ srcs = ["printer_test.go"], -+ deps = [ -+ ":yamlfmt", -+ "//pkg/yamlmeta", -+ "//vendor/github.com/k14s/difflib", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yamlmeta/internal/yaml.v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,44 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "yaml_v2", -+ srcs = [ -+ "apic.go", -+ "decode.go", -+ "emitterc.go", -+ "encode.go", -+ "parserc.go", -+ "readerc.go", -+ "resolve.go", -+ "scannerc.go", -+ "sorter.go", -+ "strict_scalar_resolve.go", -+ "writerc.go", -+ "yaml.go", -+ "yamlh.go", -+ "yamlprivateh.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta/internal/yaml.v2", -+ visibility = ["//pkg/yamlmeta:__subpackages__"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yaml_v2", -+ visibility = ["//pkg/yamlmeta:__subpackages__"], -+) -+ -+go_test( -+ name = "yaml_v2_test", -+ srcs = [ -+ "decode_test.go", -+ "encode_test.go", -+ "example_embedded_test.go", -+ "suite_test.go", -+ ], -+ deps = [ -+ ":yaml_v2", -+ "//vendor/gopkg.in/check.v1:check_v1", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yamlmeta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,52 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "yamlmeta", -+ srcs = [ -+ "ast.go", -+ "construct.go", -+ "convert.go", -+ "deep_copy.go", -+ "doc.go", -+ "document.go", -+ "document_set.go", -+ "file_position_printer.go", -+ "map_key_overrides.go", -+ "node.go", -+ "parser.go", -+ "plain.go", -+ "printer.go", -+ "printers.go", -+ "walk.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/orderedmap", -+ "//pkg/yamlmeta/internal/yaml.v2:yaml_v2", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yamlmeta", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "yamlmeta_test", -+ srcs = [ -+ "map_key_overrides_test.go", -+ "parser_strict_test.go", -+ "parser_test.go", -+ "plain_test.go", -+ ], -+ deps = [ -+ ":yamlmeta", -+ "//pkg/filepos", -+ "//pkg/orderedmap", -+ "//vendor/github.com/k14s/difflib", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yamltemplate/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,45 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "yamltemplate", -+ srcs = [ -+ "doc.go", -+ "evaluation_ctx.go", -+ "go_value_with_yaml.go", -+ "map_key_overrides.go", -+ "metas.go", -+ "starlark_fragment.go", -+ "template.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yamltemplate", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/orderedmap", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/texttemplate", -+ "//pkg/yamlmeta", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yamltemplate", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "yamltemplate_test", -+ srcs = ["template_test.go"], -+ deps = [ -+ "//pkg/experiments", -+ "//pkg/orderedmap", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibraryext", -+ "//test/filetests", -+ ], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yttlibrary/overlay/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,42 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "overlay", -+ srcs = [ -+ "annotations.go", -+ "api.go", -+ "array.go", -+ "array_item_match_annotation.go", -+ "assert_annotation.go", -+ "compare.go", -+ "doc.go", -+ "document.go", -+ "document_match_annotation.go", -+ "insert_annotation.go", -+ "map.go", -+ "map_item_match_annotation.go", -+ "match_annotation_expects_kwarg.go", -+ "match_child_defaults_annotation.go", -+ "op.go", -+ "plain_merge.go", -+ "replace_annotation.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yttlibrary/overlay", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/filepos", -+ "//pkg/template", -+ "//pkg/template/core", -+ "//pkg/yamlmeta", -+ "//pkg/yamltemplate", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/starlarkstruct", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":overlay", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yttlibrary/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,45 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "yttlibrary", -+ srcs = [ -+ "all.go", -+ "assert.go", -+ "base64.go", -+ "data.go", -+ "doc.go", -+ "ip.go", -+ "json.go", -+ "math.go", -+ "md5.go", -+ "module.go", -+ "regexp.go", -+ "sha256.go", -+ "struct.go", -+ "template.go", -+ "url.go", -+ "version.go", -+ "yaml.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yttlibrary", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/cmd/ui", -+ "//pkg/orderedmap", -+ "//pkg/template/core", -+ "//pkg/version", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibrary/overlay", -+ "//vendor/github.com/hashicorp/go-version", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/starlarkstruct", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yttlibrary", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yttlibraryext/toml/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,27 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "toml", -+ srcs = [ -+ "doc.go", -+ "toml.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yttlibraryext/toml", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/orderedmap", -+ "//pkg/template/core", -+ "//pkg/yamlmeta", -+ "//pkg/yttlibrary", -+ "//vendor/github.com/BurntSushi/toml", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/starlarkstruct", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":toml", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/yttlibraryext/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,19 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "yttlibraryext", -+ srcs = [ -+ "all.go", -+ "doc.go", -+ ], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg/yttlibraryext", -+ visibility = ["//visibility:public"], -+ deps = ["//pkg/yttlibraryext/toml"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yttlibraryext", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,15 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "pkg", -+ srcs = ["doc.go"], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/pkg", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":pkg", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ test/e2e/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,8 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_test") -+ -+go_test( -+ name = "e2e_test", -+ srcs = ["e2e_test.go"], -+ deps = ["//vendor/github.com/stretchr/testify/require"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ test/filetests/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,30 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -+ -+go_library( -+ name = "filetests", -+ srcs = ["filetests.go"], -+ importpath = "github.com/vmware-tanzu/carvel-ytt/test/filetests", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//pkg/template", -+ "//pkg/version", -+ "//pkg/yamlmeta", -+ "//pkg/yamltemplate", -+ "//pkg/yttlibrary", -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":filetests", -+ visibility = ["//visibility:public"], -+) -+ -+go_test( -+ name = "filetests_test", -+ srcs = ["filetests_test.go"], -+ embed = [":filetests"], -+ deps = ["//vendor/github.com/stretchr/testify/assert"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/BurntSushi/toml/internal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "internal", -+ srcs = ["tz.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/BurntSushi/toml/internal", -+ importpath = "github.com/BurntSushi/toml/internal", -+ visibility = ["//vendor/github.com/BurntSushi/toml:__subpackages__"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":internal", -+ visibility = ["//vendor/github.com/BurntSushi/toml:__subpackages__"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/BurntSushi/toml/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,29 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "toml", -+ srcs = [ -+ "decode.go", -+ "decode_go116.go", -+ "deprecated.go", -+ "doc.go", -+ "encode.go", -+ "error.go", -+ "lex.go", -+ "meta.go", -+ "parse.go", -+ "type_fields.go", -+ "type_toml.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/BurntSushi/toml", -+ importpath = "github.com/BurntSushi/toml", -+ visibility = ["//visibility:public"], -+ deps = ["//vendor/github.com/BurntSushi/toml/internal"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":toml", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/aws/aws-lambda-go/events/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,59 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "events", -+ srcs = [ -+ "activemq.go", -+ "alb.go", -+ "apigw.go", -+ "appsync.go", -+ "attributevalue.go", -+ "autoscaling.go", -+ "chime_bot.go", -+ "clientvpn.go", -+ "cloudwatch_events.go", -+ "cloudwatch_logs.go", -+ "code_commit.go", -+ "codebuild.go", -+ "codedeploy.go", -+ "codepipeline.go", -+ "codepipeline_cloudwatch.go", -+ "codepipeline_job.go", -+ "cognito.go", -+ "config.go", -+ "connect.go", -+ "duration.go", -+ "dynamodb.go", -+ "ecr_scan.go", -+ "epoch_time.go", -+ "firehose.go", -+ "iam.go", -+ "iot.go", -+ "iot_1_click.go", -+ "iot_button.go", -+ "iot_deprecated.go", -+ "kafka.go", -+ "kinesis.go", -+ "kinesis_analytics.go", -+ "lambda_function_urls.go", -+ "lex.go", -+ "rabbitmq.go", -+ "s3.go", -+ "s3_batch_job.go", -+ "ses.go", -+ "sns.go", -+ "sqs.go", -+ "streams.go", -+ "time_window.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/aws/aws-lambda-go/events", -+ importpath = "github.com/aws/aws-lambda-go/events", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":events", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/aws/aws-lambda-go/lambda/handlertrace/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "handlertrace", -+ srcs = ["trace.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/aws/aws-lambda-go/lambda/handlertrace", -+ importpath = "github.com/aws/aws-lambda-go/lambda/handlertrace", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":handlertrace", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/aws/aws-lambda-go/lambda/messages/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "messages", -+ srcs = ["messages.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/aws/aws-lambda-go/lambda/messages", -+ importpath = "github.com/aws/aws-lambda-go/lambda/messages", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":messages", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/aws/aws-lambda-go/lambda/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,31 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "lambda", -+ srcs = [ -+ "entry.go", -+ "errors.go", -+ "extensions_api_client.go", -+ "handler.go", -+ "invoke_loop.go", -+ "panic.go", -+ "rpc_function.go", -+ "runtime_api_client.go", -+ "sigterm.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/aws/aws-lambda-go/lambda", -+ importpath = "github.com/aws/aws-lambda-go/lambda", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/aws/aws-lambda-go/lambda/handlertrace", -+ "//vendor/github.com/aws/aws-lambda-go/lambda/messages", -+ "//vendor/github.com/aws/aws-lambda-go/lambdacontext", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":lambda", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/aws/aws-lambda-go/lambdacontext/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "lambdacontext", -+ srcs = ["context.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/aws/aws-lambda-go/lambdacontext", -+ importpath = "github.com/aws/aws-lambda-go/lambdacontext", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":lambdacontext", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/cppforlife/cobrautil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,25 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "cobrautil", -+ srcs = [ -+ "flag_help_sections.go", -+ "help_sections.go", -+ "misc.go", -+ "resolvable_flags.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/cppforlife/cobrautil", -+ importpath = "github.com/cppforlife/cobrautil", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/spf13/cobra", -+ "//vendor/github.com/spf13/pflag", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":cobrautil", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/cppforlife/go-cli-ui/errors/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,20 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "errors", -+ srcs = [ -+ "error_piece.go", -+ "multi_line_error.go", -+ "semi_structured_error.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/cppforlife/go-cli-ui/errors", -+ importpath = "github.com/cppforlife/go-cli-ui/errors", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":errors", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/davecgh/go-spew/spew/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,25 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "spew", -+ srcs = [ -+ "bypass.go", -+ "bypasssafe.go", -+ "common.go", -+ "config.go", -+ "doc.go", -+ "dump.go", -+ "format.go", -+ "spew.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/davecgh/go-spew/spew", -+ importpath = "github.com/davecgh/go-spew/spew", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":spew", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/google/gofuzz/bytesource/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "bytesource", -+ srcs = ["bytesource.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/google/gofuzz/bytesource", -+ importpath = "github.com/google/gofuzz/bytesource", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":bytesource", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/google/gofuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,20 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "gofuzz", -+ srcs = [ -+ "doc.go", -+ "fuzz.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/google/gofuzz", -+ importpath = "github.com/google/gofuzz", -+ visibility = ["//visibility:public"], -+ deps = ["//vendor/github.com/google/gofuzz/bytesource"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":gofuzz", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/hashicorp/go-version/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,20 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "go-version", -+ srcs = [ -+ "constraint.go", -+ "version.go", -+ "version_collection.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/hashicorp/go-version", -+ importpath = "github.com/hashicorp/go-version", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":go-version", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/inconshreveable/mousetrap/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,20 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "mousetrap", -+ srcs = [ -+ "trap_others.go", -+ "trap_windows.go", -+ "trap_windows_1.4.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/inconshreveable/mousetrap", -+ importpath = "github.com/inconshreveable/mousetrap", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":mousetrap", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/difflib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "difflib", -+ srcs = ["difflib.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/difflib", -+ importpath = "github.com/k14s/difflib", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":difflib", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/internal/compile/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,23 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "compile", -+ srcs = [ -+ "compile.go", -+ "serial.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/internal/compile", -+ importpath = "github.com/k14s/starlark-go/internal/compile", -+ visibility = ["//vendor/github.com/k14s/starlark-go:__subpackages__"], -+ deps = [ -+ "//vendor/github.com/k14s/starlark-go/resolve", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":compile", -+ visibility = ["//vendor/github.com/k14s/starlark-go:__subpackages__"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/internal/spell/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "spell", -+ srcs = ["spell.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/internal/spell", -+ importpath = "github.com/k14s/starlark-go/internal/spell", -+ visibility = ["//vendor/github.com/k14s/starlark-go:__subpackages__"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":spell", -+ visibility = ["//vendor/github.com/k14s/starlark-go:__subpackages__"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/resolve/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,23 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "resolve", -+ srcs = [ -+ "binding.go", -+ "resolve.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/resolve", -+ importpath = "github.com/k14s/starlark-go/resolve", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/k14s/starlark-go/internal/spell", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":resolve", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/starlark/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,33 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "starlark", -+ srcs = [ -+ "debug.go", -+ "empty.s", -+ "eval.go", -+ "hashtable.go", -+ "int.go", -+ "interp.go", -+ "library.go", -+ "profile.go", -+ "unpack.go", -+ "value.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/starlark", -+ importpath = "github.com/k14s/starlark-go/starlark", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/k14s/starlark-go/internal/compile", -+ "//vendor/github.com/k14s/starlark-go/internal/spell", -+ "//vendor/github.com/k14s/starlark-go/resolve", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":starlark", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/starlarkstruct/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,23 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "starlarkstruct", -+ srcs = [ -+ "module.go", -+ "struct.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/starlarkstruct", -+ importpath = "github.com/k14s/starlark-go/starlarkstruct", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/k14s/starlark-go/starlark", -+ "//vendor/github.com/k14s/starlark-go/syntax", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":starlarkstruct", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/k14s/starlark-go/syntax/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,23 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "syntax", -+ srcs = [ -+ "block_scanner.go", -+ "parse.go", -+ "quote.go", -+ "scan.go", -+ "syntax.go", -+ "walk.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/k14s/starlark-go/syntax", -+ importpath = "github.com/k14s/starlark-go/syntax", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":syntax", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/kr/pretty/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,22 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "pretty", -+ srcs = [ -+ "diff.go", -+ "formatter.go", -+ "pretty.go", -+ "zero.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/kr/pretty", -+ importpath = "github.com/kr/pretty", -+ visibility = ["//visibility:public"], -+ deps = ["//vendor/github.com/kr/text"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":pretty", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/kr/text/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,20 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "text", -+ srcs = [ -+ "doc.go", -+ "indent.go", -+ "wrap.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/kr/text", -+ importpath = "github.com/kr/text", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":text", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/pmezard/go-difflib/difflib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,16 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "difflib", -+ srcs = ["difflib.go"], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/pmezard/go-difflib/difflib", -+ importpath = "github.com/pmezard/go-difflib/difflib", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":difflib", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/spf13/cobra/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,39 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "cobra", -+ srcs = [ -+ "active_help.go", -+ "args.go", -+ "bash_completions.go", -+ "bash_completionsV2.go", -+ "cobra.go", -+ "command.go", -+ "command_notwin.go", -+ "command_win.go", -+ "completions.go", -+ "fish_completions.go", -+ "flag_groups.go", -+ "powershell_completions.go", -+ "shell_completions.go", -+ "zsh_completions.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/spf13/cobra", -+ importpath = "github.com/spf13/cobra", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/spf13/pflag", -+ ] + select({ -+ "@io_bazel_rules_go//go/platform:windows": [ -+ "//vendor/github.com/inconshreveable/mousetrap", -+ ], -+ "//conditions:default": [], -+ }), -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":cobra", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/spf13/pflag/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,53 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "pflag", -+ srcs = [ -+ "bool.go", -+ "bool_slice.go", -+ "bytes.go", -+ "count.go", -+ "duration.go", -+ "duration_slice.go", -+ "flag.go", -+ "float32.go", -+ "float32_slice.go", -+ "float64.go", -+ "float64_slice.go", -+ "golangflag.go", -+ "int.go", -+ "int16.go", -+ "int32.go", -+ "int32_slice.go", -+ "int64.go", -+ "int64_slice.go", -+ "int8.go", -+ "int_slice.go", -+ "ip.go", -+ "ip_slice.go", -+ "ipmask.go", -+ "ipnet.go", -+ "string.go", -+ "string_array.go", -+ "string_slice.go", -+ "string_to_int.go", -+ "string_to_int64.go", -+ "string_to_string.go", -+ "uint.go", -+ "uint16.go", -+ "uint32.go", -+ "uint64.go", -+ "uint8.go", -+ "uint_slice.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/spf13/pflag", -+ importpath = "github.com/spf13/pflag", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":pflag", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/stretchr/testify/assert/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,33 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "assert", -+ srcs = [ -+ "assertion_compare.go", -+ "assertion_compare_can_convert.go", -+ "assertion_compare_legacy.go", -+ "assertion_format.go", -+ "assertion_forward.go", -+ "assertion_order.go", -+ "assertions.go", -+ "doc.go", -+ "errors.go", -+ "forward_assertions.go", -+ "http_assertions.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/stretchr/testify/assert", -+ importpath = "github.com/stretchr/testify/assert", -+ visibility = ["//visibility:public"], -+ deps = [ -+ "//vendor/github.com/davecgh/go-spew/spew", -+ "//vendor/github.com/pmezard/go-difflib/difflib", -+ "//vendor/gopkg.in/yaml.v3:yaml_v3", -+ ], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":assert", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/github.com/stretchr/testify/require/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,23 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "require", -+ srcs = [ -+ "doc.go", -+ "forward_requirements.go", -+ "require.go", -+ "require_forward.go", -+ "requirements.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/github.com/stretchr/testify/require", -+ importpath = "github.com/stretchr/testify/require", -+ visibility = ["//visibility:public"], -+ deps = ["//vendor/github.com/stretchr/testify/assert"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":require", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/gopkg.in/check.v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,25 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "check_v1", -+ srcs = [ -+ "benchmark.go", -+ "check.go", -+ "checkers.go", -+ "helpers.go", -+ "printer.go", -+ "reporter.go", -+ "run.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/gopkg.in/check.v1", -+ importpath = "gopkg.in/check.v1", -+ visibility = ["//visibility:public"], -+ deps = ["//vendor/github.com/kr/pretty"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":check_v1", -+ visibility = ["//visibility:public"], -+) -+ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ vendor/gopkg.in/yaml.v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000 -@@ -0,0 +1,30 @@ -+load("@io_bazel_rules_go//go:def.bzl", "go_library") -+ -+go_library( -+ name = "yaml_v3", -+ srcs = [ -+ "apic.go", -+ "decode.go", -+ "emitterc.go", -+ "encode.go", -+ "parserc.go", -+ "readerc.go", -+ "resolve.go", -+ "scannerc.go", -+ "sorter.go", -+ "writerc.go", -+ "yaml.go", -+ "yamlh.go", -+ "yamlprivateh.go", -+ ], -+ importmap = "github.com/vmware-tanzu/carvel-ytt/vendor/gopkg.in/yaml.v3", -+ importpath = "gopkg.in/yaml.v3", -+ visibility = ["//visibility:public"], -+) -+ -+alias( -+ name = "go_default_library", -+ actual = ":yaml_v3", -+ visibility = ["//visibility:public"], -+) -+ diff --git a/buildpatches/delete_print b/buildpatches/delete_print deleted file mode 100644 index b6a07fd..0000000 --- a/buildpatches/delete_print +++ /dev/null @@ -1,11 +0,0 @@ ---- pkg/files/output_directory.go 1970-01-01 00:00:00.000000000 +0000 -+++ pkg/files/output_directory.go 1970-01-01 00:00:00.000000000 +0000 -@@ -60,8 +60,6 @@ func (d *OutputDirectory) WriteFiles() error { - } - - for _, file := range d.files { -- d.ui.Printf("creating: %s\n", file.Path(d.path)) -- - err := file.Create(d.path) - if err != nil { - return err diff --git a/def.bzl b/def.bzl deleted file mode 100644 index 14a5f7b..0000000 --- a/def.bzl +++ /dev/null @@ -1,3 +0,0 @@ -load("//internal:rules.bzl", _ytt="ytt") - -ytt = _ytt diff --git a/defs.bzl b/defs.bzl new file mode 100644 index 0000000..1b7c276 --- /dev/null +++ b/defs.bzl @@ -0,0 +1,3 @@ +load("//ytt/private:ytt.bzl", _ytt = "ytt") + +ytt = _ytt diff --git a/deps.bzl b/deps.bzl deleted file mode 100644 index e757266..0000000 --- a/deps.bzl +++ /dev/null @@ -1,61 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -def ytt_rules_dependencies(workspace_name = "com_github_ebay_rules_ytt"): - if "io_bazel_rules_go" not in native.existing_rules().keys(): - http_archive( - name = "io_bazel_rules_go", - sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", - ], - ) - - if "com_github_vmware_tanzu_carvel_ytt" not in native.existing_rules().keys(): - http_archive( - name = "com_github_vmware_tanzu_carvel_ytt", - sha256 = "27cce7c58bbd761808fb2eb17cf402e062d33b337749499279b07504383b4080", - strip_prefix = "ytt-0.45.0", - urls = ["https://github.com/vmware-tanzu/carvel-ytt/archive/v0.45.0.zip"], - patches = [ - "@%s//buildpatches:delete_print" % workspace_name, - "@%s//buildpatches:build_files" % workspace_name, - ], - patch_args = ["-s", "-p0"], - ) - - if "bazel_skylib" not in native.existing_rules().keys(): - http_archive( - name = "bazel_skylib", - sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], - ) - - if "io_bazel_rules_docker" not in native.existing_rules().keys(): - http_archive( - name = "io_bazel_rules_docker", - sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf", - urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"], - ) - - http_archive( - name = "bazel_gazelle", - sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", - ], - ) - - if "io_bazel_stardoc" not in native.existing_rules().keys(): - http_archive( - name = "io_bazel_stardoc", - sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", - "https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", - ], - ) diff --git a/tests/BUILD.bazel b/examples/minimal/BUILD.bazel similarity index 50% rename from tests/BUILD.bazel rename to examples/minimal/BUILD.bazel index 9d1567e..a5c64a3 100644 --- a/tests/BUILD.bazel +++ b/examples/minimal/BUILD.bazel @@ -1,13 +1,8 @@ -load("//internal:rules.bzl", "ytt") +load("//:defs.bzl", "ytt") ytt( name = "manifests", - srcs = [ - "//tests/testdata:base.yaml", - "//tests/testdata:defaults.yaml", - "//tests/testdata:values.yaml", - ], - image = "//tests/testdata:image.digest", + srcs = glob(["*.yaml"]), ) sh_library( @@ -16,8 +11,9 @@ sh_library( ) sh_test( - name = "ytt_test", srcs = [":validator.sh"], + size = "small", + name = "ytt_test", args = ["$(location :ytt_lib)"], data = [":ytt_lib"], ) diff --git a/examples/minimal/base.yaml b/examples/minimal/base.yaml new file mode 100644 index 0000000..a1d9c5f --- /dev/null +++ b/examples/minimal/base.yaml @@ -0,0 +1,5 @@ +#@ load("@ytt:data", "data") +--- +name: #@ data.values.name +default: #@ data.values.default +static: 1 diff --git a/examples/minimal/defaults.yaml b/examples/minimal/defaults.yaml new file mode 100644 index 0000000..3398eb8 --- /dev/null +++ b/examples/minimal/defaults.yaml @@ -0,0 +1,4 @@ +#@data/values-schema +--- +name: default name +default: default value diff --git a/tests/validator.sh b/examples/minimal/validator.sh similarity index 60% rename from tests/validator.sh rename to examples/minimal/validator.sh index 32268e9..fd98565 100755 --- a/tests/validator.sh +++ b/examples/minimal/validator.sh @@ -1,6 +1,7 @@ got="$(cat $1)" -expected="name: valueable_name -image_digest: my-repo/my-image@sha256:d048a282a0dcc753d9416bc29bda673892d8ea3e0344d394fd64105e4975e835" +expected="name: YTT +default: default value +static: 1" if [ "$got" = "$expected" ]; then echo "Passed" diff --git a/examples/minimal/values.yaml b/examples/minimal/values.yaml new file mode 100644 index 0000000..751f7e8 --- /dev/null +++ b/examples/minimal/values.yaml @@ -0,0 +1,3 @@ +#@data/values +--- +name: YTT diff --git a/internal/BUILD.bazel b/internal/BUILD.bazel deleted file mode 100644 index 16e4f3d..0000000 --- a/internal/BUILD.bazel +++ /dev/null @@ -1,7 +0,0 @@ -load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") - -stardoc( - name = "ytt-docs", - input = "rules.bzl", - out = "ytt.md", -) diff --git a/internal/rules.bzl b/internal/rules.bzl deleted file mode 100644 index 38af0df..0000000 --- a/internal/rules.bzl +++ /dev/null @@ -1,81 +0,0 @@ -def _impl(ctx): - runtools = [] - dv = [] - runfiles = ctx.runfiles() - - if ctx.file.image: - image_digest = ctx.actions.declare_file("image_digest.out") - - ctx.actions.run_shell( - inputs = [ctx.file.image], - outputs = [image_digest], - command = "sed -e 's/^/image_digest: /g' {} > {}".format(ctx.file.image.path, image_digest.path), - ) - - runfiles = runfiles.merge(ctx.runfiles(files = [ctx.file.image, image_digest])) - runtools = [image_digest] - dv = ["--data-values-file", image_digest.path] - - files = [] - for f in ctx.files.srcs: - files += ["-f", f.path] - - tree = ctx.actions.declare_directory(ctx.label.name + "_out") - - ctx.actions.run( - inputs = ctx.files.srcs, - outputs = [tree], - arguments = files + dv + [ - "--dangerous-allow-all-symlink-destinations", - "--output-files", tree.path, - ], - executable = ctx.executable._ytt, - tools = runtools, - ) - - out = ctx.actions.declare_file(ctx.label.name + ".yaml") - - args = ctx.actions.args() - args.add_all("", depset([tree])) - - ctx.actions.run_shell( - inputs = depset([tree]), - arguments = [args], - outputs = [out], - command = "cat $@ > {}".format(out.path), - ) - - ctx.actions.write( - output = ctx.outputs.executable, - content = "cat {}".format(out.short_path), - is_executable = True, - ) - - return [DefaultInfo( - files = depset([out]), - runfiles = runfiles.merge(ctx.runfiles(files = [out])), - executable = ctx.outputs.executable, - )] - -ytt = rule( - implementation = _impl, - attrs = { - "srcs": attr.label_list( - allow_files = True, - mandatory = True, - doc = "List of files that will be passed to ytt with -f param.", - ), - "image": attr.label( - allow_single_file = True, - doc = "Target that generates a Docker image. Used for extracting image digest.", - ), - "_ytt": attr.label( - executable = True, - cfg = "host", - allow_files = True, - doc = "Link to ytt binary.", - default = Label("@com_github_vmware_tanzu_carvel_ytt//cmd/ytt"), - ), - }, - executable = True, -) diff --git a/tests/testdata/BUILD.bazel b/tests/testdata/BUILD.bazel deleted file mode 100644 index 7085f6c..0000000 --- a/tests/testdata/BUILD.bazel +++ /dev/null @@ -1,32 +0,0 @@ -load("@io_bazel_rules_docker//go:image.bzl", "go_image") - -genrule( - name = "main_go", - outs = ["main.go"], - cmd = """ - cat << EOF >> $@ -package main - -import "fmt" - -func main() { - fmt.Printf("Hello World!") -} -EOF -""", -) - -go_image( - name = "image", - srcs = ["main.go"], - goos = "linux", - goarch= "amd64", - importpath = "github.com/ebay/rules_ytt", - visibility = ["//tests:__pkg__"], -) - -exports_files([ - "base.yaml", - "defaults.yaml", - "values.yaml", -]) diff --git a/tests/testdata/base.yaml b/tests/testdata/base.yaml deleted file mode 100644 index b77ac76..0000000 --- a/tests/testdata/base.yaml +++ /dev/null @@ -1,4 +0,0 @@ -#@ load("@ytt:data", "data") ---- -name: #@ data.values.name -image_digest: #@ "my-repo/my-image@{}".format(data.values.image_digest) diff --git a/tests/testdata/defaults.yaml b/tests/testdata/defaults.yaml deleted file mode 100644 index c855dbc..0000000 --- a/tests/testdata/defaults.yaml +++ /dev/null @@ -1,4 +0,0 @@ -#@data/values-schema ---- -name: "default_name" -image_digest: "" diff --git a/tests/testdata/values.yaml b/tests/testdata/values.yaml deleted file mode 100644 index 076815e..0000000 --- a/tests/testdata/values.yaml +++ /dev/null @@ -1,3 +0,0 @@ -#@data/values ---- -name: "valueable_name" diff --git a/ytt.md b/ytt.md deleted file mode 100755 index 13eacd7..0000000 --- a/ytt.md +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -## ytt - -
-ytt(name, image, srcs)
-
- - - -**ATTRIBUTES** - - -| Name | Description | Type | Mandatory | Default | -| :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| image | Target that generates a Docker image. Used for extracting image digest. | Label | optional | None | -| srcs | List of files that will be passed to ytt with -f param. | List of labels | required | | - - diff --git a/ytt/BUILD.bazel b/ytt/BUILD.bazel new file mode 100644 index 0000000..e794c12 --- /dev/null +++ b/ytt/BUILD.bazel @@ -0,0 +1,17 @@ +load("//ytt/private:resolved_toolchains.bzl", "resolved_toolchain") + +# This is the target rule authors should put in their "toolchains" +# attribute in order to get a runtime for the correct platform. +# See https://docs.bazel.build/versions/main/toolchains.html#writing-rules-that-use-toolchains +toolchain_type( + name = "toolchain_type", + visibility = ["//visibility:public"], +) + +resolved_toolchain( + name = "resolved_toolchain", + # Marked manual so that `bazel test //...` passes + # even if no toolchain is registered. + tags = ["manual"], + visibility = ["//visibility:public"], +) diff --git a/buildpatches/BUILD.bazel b/ytt/private/BUILD.bazel similarity index 100% rename from buildpatches/BUILD.bazel rename to ytt/private/BUILD.bazel diff --git a/ytt/private/resolved_toolchains.bzl b/ytt/private/resolved_toolchains.bzl new file mode 100644 index 0000000..cce14f5 --- /dev/null +++ b/ytt/private/resolved_toolchains.bzl @@ -0,0 +1,27 @@ +"""This module implements an alias rule to the resolved toolchain. +""" + +DOC = """\ +Exposes a concrete toolchain which is the result of Bazel resolving the +toolchain for the execution or target platform. +Workaround for https://github.com/bazelbuild/bazel/issues/14009 +""" + +# Forward all the providers +def _resolved_toolchain_impl(ctx): + toolchain_info = ctx.toolchains["//ytt:toolchain_type"] + return [ + toolchain_info, + toolchain_info.default, + toolchain_info.yttinfo, + toolchain_info.template_variables, + ] + +# Copied from java_toolchain_alias +# https://cs.opensource.google/bazel/bazel/+/master:tools/jdk/java_toolchain_alias.bzl +resolved_toolchain = rule( + implementation = _resolved_toolchain_impl, + toolchains = ["//ytt:toolchain_type"], + incompatible_use_toolchain_transition = True, + doc = DOC, +) diff --git a/ytt/private/toolchains_repo.bzl b/ytt/private/toolchains_repo.bzl new file mode 100644 index 0000000..d43503e --- /dev/null +++ b/ytt/private/toolchains_repo.bzl @@ -0,0 +1,85 @@ +"""Create a repository to hold the toolchains + +This follows guidance here: +https://docs.bazel.build/versions/main/skylark/deploying.html#registering-toolchains +" +Note that in order to resolve toolchains in the analysis phase +Bazel needs to analyze all toolchain targets that are registered. +Bazel will not need to analyze all targets referenced by toolchain.toolchain attribute. +If in order to register toolchains you need to perform complex computation in the repository, +consider splitting the repository with toolchain targets +from the repository with _toolchain targets. +Former will be always fetched, +and the latter will only be fetched when user actually needs to build code. +" +The "complex computation" in our case is simply downloading large artifacts. +This guidance tells us how to avoid that: we put the toolchain targets in the alias repository +with only the toolchain attribute pointing into the platform-specific repositories. +""" + +# Add more platforms as needed to mirror all the binaries +# published by the upstream project. +PLATFORMS = { + "darwin_amd64": struct( + compatible_with = [ + "@platforms//os:macos", + "@platforms//cpu:x86_64", + ], + ), + "darwin_arm64": struct( + compatible_with = [ + "@platforms//os:macos", + "@platforms//cpu:aarch64", + ], + ), + "linux_amd64": struct( + compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], + ), + "linux_arm64": struct( + compatible_with = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], + ), +} + +def _toolchains_repo_impl(repository_ctx): + build_content = """# Generated by toolchains_repo.bzl +# +# These can be registered in the workspace file or passed to --extra_toolchains flag. +# By default all these toolchains are registered by the ytt_register_toolchains macro +# so you don't normally need to interact with these targets. + +""" + + for [platform, meta] in PLATFORMS.items(): + build_content += """ +# Declare a toolchain Bazel will select for running the tool in an action +# on the execution platform. +toolchain( + name = "{platform}_toolchain", + exec_compatible_with = {compatible_with}, + toolchain = "@{ytt}_{platform}//:ytt_toolchain", + toolchain_type = "@rules_ytt//ytt:toolchain_type", +) +""".format( + platform = platform, + name = repository_ctx.attr.name, + ytt = repository_ctx.attr.ytt, + compatible_with = meta.compatible_with, + ) + + # Base BUILD file for this repository + repository_ctx.file("BUILD.bazel", build_content) + +toolchains_repo = repository_rule( + _toolchains_repo_impl, + doc = """Creates a repository with toolchain definitions for all known platforms + which can be registered or selected.""", + attrs = { + "ytt": attr.string(doc = "what the user chose for the base name"), + }, +) diff --git a/ytt/private/versions.bzl b/ytt/private/versions.bzl new file mode 100644 index 0000000..07bffa3 --- /dev/null +++ b/ytt/private/versions.bzl @@ -0,0 +1,8 @@ +YTT_VERSIONS = { + "0.46.2": { + "darwin_arm64": "sha256-qXuuLnoGkDJALWazAsBzxZWiut8sP/xu7IZCfuwhYZs=", + "darwin_amd64": "sha256-resY2qX6CIEj/72eMuMlKq8ygQ7HDl4bWhhve//IwfU=", + "linux_amd64": "sha256-rpvGalV1bu1g24b4wPjFVwSzq4RlE61FAhEcKoZz7Kw=", + "linux_arm64": "sha256-5DpSTbigxppUvFYTKsDPjVWgScSPY6kEfdaYTcialA4=", + } +} diff --git a/ytt/private/ytt.bzl b/ytt/private/ytt.bzl new file mode 100644 index 0000000..3e54a30 --- /dev/null +++ b/ytt/private/ytt.bzl @@ -0,0 +1,70 @@ +def _impl(ctx): + ytt = ctx.toolchains["//ytt:toolchain_type"] + runtools = [] + dv = [] + runfiles = ctx.runfiles() + + if ctx.file.image: + image_digest = ctx.actions.declare_file("image_digest.out") + + ctx.actions.run_shell( + inputs = [ctx.file.image], + outputs = [image_digest], + command = "sed -e 's/^/image_digest: /g' {} > {}".format(ctx.file.image.path, image_digest.path), + ) + + runfiles = runfiles.merge(ctx.runfiles(files = [ctx.file.image, image_digest])) + runtools = [image_digest] + dv = ["--data-values-file", image_digest.path] + + yttargs = ctx.actions.args() + yttargs.add("--dangerous-allow-all-symlink-destinations") + yttargs.add_all("", dv) + + for f in ctx.files.srcs: + yttargs.add("-f", f.path) + + manifest = ctx.actions.declare_file(ctx.label.name + ".yaml") + + ctx.actions.run_shell( + inputs = ctx.files.srcs, + outputs = [manifest], + arguments = [yttargs], + command = "{ytt} $@ > {manifest}".format( + ytt = ytt.ytt_info.binary.path, + manifest = manifest.path, + ), + tools = [ytt.ytt_info.binary] + runtools, + ) + + sh = ctx.actions.declare_file("{}_render.sh".format(ctx.label.name)) + + ctx.actions.write( + output = sh, + content = "cat {}".format(manifest.short_path), + is_executable = True, + ) + + return [DefaultInfo( + files = depset([manifest]), + runfiles = runfiles.merge(ctx.runfiles(files = [manifest])), + executable = sh, + )] + +ytt = rule( + implementation = _impl, + attrs = { + "srcs": attr.label_list( + allow_files = True, + mandatory = True, + doc = "List of files that will be passed to ytt with -f param.", + ), + "image": attr.label( + allow_single_file = True, + doc = "(DEPRECATED) Target that generates a Docker image. Used for extracting image digest.", + ), + }, + toolchains = ["//ytt:toolchain_type"], + executable = True, +) + diff --git a/ytt/providers.bzl b/ytt/providers.bzl new file mode 100644 index 0000000..3836db7 --- /dev/null +++ b/ytt/providers.bzl @@ -0,0 +1,6 @@ +YttInfo = provider( + doc = "Information about how to invoke the Ytt", + fields = { + "binary": "Ytt executable binary." + }, +) diff --git a/ytt/repositories.bzl b/ytt/repositories.bzl new file mode 100644 index 0000000..2e04d89 --- /dev/null +++ b/ytt/repositories.bzl @@ -0,0 +1,101 @@ +"""Declare runtime dependencies + +These are needed for local dev, and users must install them as well. +See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") +load("//ytt/private:toolchains_repo.bzl", "PLATFORMS", "toolchains_repo") +load("//ytt/private:versions.bzl", "YTT_VERSIONS") + +def http_archive(name, **kwargs): + maybe(_http_archive, name = name, **kwargs) + +# WARNING: any changes in this function may be BREAKING CHANGES for users +# because we'll fetch a dependency which may be different from one that +# they were previously fetching later in their WORKSPACE setup, and now +# ours took precedence. Such breakages are challenging for users, so any +# changes in this function should be marked as BREAKING in the commit message +# and released only in semver majors. +# This is all fixed by bzlmod, so we just tolerate it for now. +def rules_ytt_dependencies(): + pass + +def rules_ytt_internal_dependencies(): + pass + +######## +# Remaining content of the file is only used to support toolchains. +######## +_DOC = "Fetch external tools needed for ytt toolchain" +_ATTRS = { + "ytt_version": attr.string(mandatory = True, values = YTT_VERSIONS.keys()), + "platform": attr.string(mandatory = True, values = PLATFORMS.keys()), +} + +_YTT_BUILD_TPL = """\ +#Generated by ytt/repositories.bzl +load("@rules_ytt//ytt:toolchains.bzl", "ytt_toolchain") + +ytt_toolchain( + name = "ytt_toolchain", + ytt = select({ + "@bazel_tools//src/conditions:host_windows": "ytt.exe", + "//conditions:default": "ytt", + }), + version = "%s", +) +""" + +def _ytt_repo_impl(rctx): + url = "https://github.com/carvel-dev/ytt/releases/download/v{version}/ytt-{platform}".format( + version = rctx.attr.ytt_version, + platform = rctx.attr.platform.replace("_", "-"), + ) + + rctx.download( + url = url, + output = "ytt", + integrity = YTT_VERSIONS[rctx.attr.ytt_version][rctx.attr.platform], + executable = True, + ) + + # Base BUILD file for this repository + rctx.file("BUILD.bazel", _YTT_BUILD_TPL % rctx.attr.ytt_version) + +ytt_repositories = repository_rule( + _ytt_repo_impl, + doc = _DOC, + attrs = _ATTRS, +) + +# Wrapper macro around everything above, this is the primary API +def ytt_register_toolchains(name = "ytt", version = "0.46.2", register = True, **kwargs): + """Convenience macro for users which does typical setup. + + - create a repository for each built-in platform like "ytt_linux_amd64" - + this repository is lazily fetched when node is needed for that platform. + - create a repository exposing toolchains for each platform like "ytt_platforms" + - register a toolchain pointing at each platform + Users can avoid this macro and do these steps themselves, if they want more control. + Args: + name: base name for all created repos, like "ytt1_14" + register: whether to call through to native.register_toolchains. + Should be True for WORKSPACE users, but false when used under bzlmod extension + **kwargs: passed to each node_repositories call + """ + for platform in PLATFORMS.keys(): + ytt_repositories( + name = name + "_" + platform, + platform = platform, + ytt_version = version, + **kwargs + ) + if register: + native.register_toolchains("@%s_toolchains//:%s_toolchain" % (name, platform)) + + toolchains_repo( + name = name + "_toolchains", + ytt = name, + ) diff --git a/ytt/toolchains.bzl b/ytt/toolchains.bzl new file mode 100644 index 0000000..ba02b87 --- /dev/null +++ b/ytt/toolchains.bzl @@ -0,0 +1,47 @@ +"""This module implements the Ytt toolchain rule. +""" + +load("//ytt:providers.bzl", "YttInfo") + +def _ytt_toolchain_impl(ctx): + binary = ctx.executable.ytt + template_variables = platform_common.TemplateVariableInfo({ + "YTT_BIN": binary.path, + }) + default = DefaultInfo( + files = depset([binary]), + runfiles = ctx.runfiles(files = [binary]), + ) + ytt_info = YttInfo( + binary = binary, + ) + # Export all the providers inside our ToolchainInfo + # so the resolved_toolchain rule can grab and re-export them. + toolchain_info = platform_common.ToolchainInfo( + ytt_info = ytt_info, + template_variables = template_variables, + default = default, + ) + return [ + default, + toolchain_info, + template_variables, + ] + +ytt_toolchain = rule( + implementation = _ytt_toolchain_impl, + attrs = { + "ytt": attr.label( + doc = "A hermetically downloaded executable target for the target platform.", + mandatory = False, + allow_single_file = True, + executable = True, + cfg = "exec", + ), + "version": attr.string(mandatory = True, doc = "Version of the Ytt binary") + }, + doc = """Defines a ytt runtime toolchain. + +For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains. +""", +)