Skip to content

Commit

Permalink
Clean up and rename to rules_helm_external
Browse files Browse the repository at this point in the history
  • Loading branch information
yujunz committed Aug 12, 2019
1 parent 68f2b10 commit d7e602f
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 202 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace(name = "com_github_yujunz_rules_helm")
workspace(name = "com_github_yujunz_rules_helm_external")

load(
"@com_github_yujunz_rules_helm//helm:deps.bzl",
"@com_github_yujunz_rules_helm_external//helm:deps.bzl",
"helm_register_toolchains",
"helm_rules_dependencies",
)
Expand Down
6 changes: 0 additions & 6 deletions examples/helm_chart/BUILD.bazel

This file was deleted.

Empty file removed examples/helm_chart/Chart.yaml
Empty file.
36 changes: 2 additions & 34 deletions helm/def.bzl
Original file line number Diff line number Diff line change
@@ -1,45 +1,13 @@
load(
"@com_github_yujunz_rules_helm//helm/private:context.bzl",
"helm_context",
)
load(
"@com_github_yujunz_rules_helm//helm/private:helm_toolchain.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:helm_toolchain.bzl",
_declare_toolchains = "declare_toolchains",
_helm_toolchain = "helm_toolchain",
)
load(
"@com_github_yujunz_rules_helm//helm/private:rules/cli.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:rules/cli.bzl",
_helm_cli = "helm_cli",
)

def _helm_chart_impl(ctx):
"""Implementes the helm_chart() rule."""
helm = helm_context(ctx)
chart = helm.new_chart(helm)
source = helm.chart_to_source(helm, ctx.attr, chart)
package = helm.package(helm, source)

return [
chart,
source,
package,
DefaultInfo(
files = depset([package.data.file]),
),
OutputGroupInfo(
packaged_outputs = [package.data.file],
),
]

helm_chart = rule(
implementation = _helm_chart_impl,
attrs = {
"data": attr.label_list(allow_files = True),
"srcs": attr.label_list(allow_files = True),
},
toolchains = ["@com_github_yujunz_rules_helm//helm:toolchain"],
)

declare_toolchains = _declare_toolchains
helm_cli = _helm_cli
helm_toolchain = _helm_toolchain
8 changes: 4 additions & 4 deletions helm/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
load(
"@com_github_yujunz_rules_helm//helm/private:cli.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:cli.bzl",
_helm_download_cli = "helm_download_cli",
_helm_register_toolchains = "helm_register_toolchains",
)
load(
"@com_github_yujunz_rules_helm//helm/private:cli_list.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:cli_list.bzl",
"DEFAULT_VERSION",
"MIN_SUPPORTED_VERSION",
)
load(
"@com_github_yujunz_rules_helm//helm/private:skylib/lib/versions.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:skylib/lib/versions.bzl",
"versions",
)
load(
"@com_github_yujunz_rules_helm//helm/private:repositories.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:repositories.bzl",
_helm_rules_dependencies = "helm_rules_dependencies",
)

Expand Down
2 changes: 1 addition & 1 deletion helm/private/BUILD.cli.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@com_github_yujunz_rules_helm//helm:def.bzl", "declare_toolchains", "helm_cli")
load("@com_github_yujunz_rules_helm_external//helm:def.bzl", "declare_toolchains", "helm_cli")

package(default_visibility = ["//visibility:public"])

Expand Down
2 changes: 0 additions & 2 deletions helm/private/actions/package.bzl

This file was deleted.

8 changes: 4 additions & 4 deletions helm/private/cli.bzl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
load(
"@com_github_yujunz_rules_helm//helm/private:cli_list.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:cli_list.bzl",
"BINARY_REPOSITORIES",
"DEFAULT_VERSION",
"MIN_SUPPORTED_VERSION",
)
load(
"@com_github_yujunz_rules_helm//helm/private:platforms.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:platforms.bzl",
"generate_toolchain_names",
)
load(
"@com_github_yujunz_rules_helm//helm/private:skylib/lib/versions.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:skylib/lib/versions.bzl",
"versions",
)

Expand Down Expand Up @@ -39,7 +39,7 @@ def _cli_build_file(ctx, platform):
os, _, arch = platform.partition("_")
ctx.template(
"BUILD.bazel",
Label("@com_github_yujunz_rules_helm//helm/private:BUILD.cli.bazel"),
Label("@com_github_yujunz_rules_helm_external//helm/private:BUILD.cli.bazel"),
executable = False,
substitutions = {
"{os}": os,
Expand Down
76 changes: 0 additions & 76 deletions helm/private/context.bzl

This file was deleted.

17 changes: 5 additions & 12 deletions helm/private/helm_toolchain.bzl
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
load(
"@com_github_yujunz_rules_helm//helm/private:providers.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:providers.bzl",
"HelmCLI",
)
load(
"@com_github_yujunz_rules_helm//helm/private:platforms.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:platforms.bzl",
"PLATFORMS",
)
load(
"@com_github_yujunz_rules_helm//helm/private:actions/package.bzl",
"emit_package",
)

"""
Toolchain rules used by helm
Expand All @@ -24,9 +20,6 @@ def _helm_toolchain_impl(ctx):
cross_compile = cross_compile,
default_os = ctx.attr.os,
default_arch = ctx.attr.arch,
actions = struct(
package = emit_package,
),
cli = cli,
)]

Expand Down Expand Up @@ -70,10 +63,10 @@ def declare_toolchains(host, cli):
)
native.toolchain(
name = toolchain_name,
toolchain_type = "@com_github_yujunz_rules_helm//helm:toolchain",
toolchain_type = "@com_github_yujunz_rules_helm_external//helm:toolchain",
exec_compatible_with = [
"@com_github_yujunz_rules_helm//helm/toolchain:" + host_os,
"@com_github_yujunz_rules_helm//helm/toolchain:" + host_arch,
"@com_github_yujunz_rules_helm_external//helm/toolchain:" + host_os,
"@com_github_yujunz_rules_helm_external//helm/toolchain:" + host_arch,
],
target_compatible_with = constraints,
toolchain = ":" + impl_name,
Expand Down
2 changes: 1 addition & 1 deletion helm/private/platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ HELM_OS_ARCH = (

def _generate_constraints(names, bazel_constraints):
return {
name: bazel_constraints.get(name, "@com_github_yujunz_rules_helm//helm/toolchain:" + name)
name: bazel_constraints.get(name, "@com_github_yujunz_rules_helm_external//helm/toolchain:" + name)
for name in names
}

Expand Down
2 changes: 1 addition & 1 deletion helm/private/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@com_github_yujunz_rules_helm//helm/private:skylib/lib/versions.bzl", "versions")
load("@com_github_yujunz_rules_helm_external//helm/private:skylib/lib/versions.bzl", "versions")

MINIMUM_BAZEL_VERSION = "0.27"

Expand Down
13 changes: 0 additions & 13 deletions helm/private/rule.bzl

This file was deleted.

2 changes: 1 addition & 1 deletion helm/private/rules/cli.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load(
"@com_github_yujunz_rules_helm//helm/private:providers.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:providers.bzl",
"HelmCLI",
)

Expand Down
42 changes: 0 additions & 42 deletions helm/private/rules/info.bzl

This file was deleted.

6 changes: 3 additions & 3 deletions helm/toolchain/toolchains.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load(
"@com_github_yujunz_rules_helm//helm/private:platforms.bzl",
"@com_github_yujunz_rules_helm_external//helm/private:platforms.bzl",
"HELM_ARCH_CONSTRAINTS",
"HELM_OS_CONSTRAINTS",
"PLATFORMS",
Expand All @@ -20,7 +20,7 @@ def declare_constraints():
@bazel_tools//platforms:default_platform will be used most of the time).
"""
for os, constraint in HELM_OS_CONSTRAINTS.items():
if constraint.startswith("@com_github_yujunz_rules_helm//helm/toolchain:"):
if constraint.startswith("@com_github_yujunz_rules_helm_external//helm/toolchain:"):
native.constraint_value(
name = os,
constraint_setting = "@bazel_tools//platforms:os",
Expand All @@ -32,7 +32,7 @@ def declare_constraints():
)

for arch, constraint in HELM_ARCH_CONSTRAINTS.items():
if constraint.startswith("@com_github_yujunz_rules_helm//helm/toolchain:"):
if constraint.startswith("@com_github_yujunz_rules_helm_external//helm/toolchain:"):
native.constraint_value(
name = arch,
constraint_setting = "@bazel_tools//platforms:cpu",
Expand Down

0 comments on commit d7e602f

Please sign in to comment.