Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize the source tree #443

Merged
merged 15 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelci/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rolling: &rolling

common: &common
platform: ubuntu1804
working_directory: /workdir/pkg
working_directory: /workdir
build_targets:
- "distro:*"

Expand Down
18 changes: 11 additions & 7 deletions .bazelci/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

common: &common
working_directory: ../pkg
working_directory: ..

#
# Bazel releases
Expand All @@ -16,20 +16,24 @@ rolling: &rolling
#
default_tests: &default_tests
test_targets:
- "..."
- "//distro/..."
- "//pkg/..."
- "//tests/..."
- "//toolchains/..."
- "-//pkg/legacy/tests/rpm/..."
- "-//tests/rpm/..."
- "-//legacy/tests/rpm/..."

# rpmbuild(8) is not available on most platforms
skip_rpm: &skip_rpm
- "-//tests/rpm/..."
- "-//legacy/tests/rpm/..."
- "-//pkg/legacy/tests/rpm/..."

win_tests: &win_tests
test_targets:
- "..."
- "-//distro/..."
- "-//legacy/tests/rpm/..."
- "//pkg/..."
- "//tests/..."
- "//toolchains/..."
- "-//pkg/legacy/tests/rpm/..."
- "-//tests:make_rpm_test"
- "-//tests:package_naming_aggregate_test"
- "-//tests:path_test"
Expand Down
36 changes: 36 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

exports_files(
["WORKSPACE"],
visibility = ["//visibility:public"],
)

exports_files(
glob([
"*.bzl",
]),
visibility = ["//visibility:public"],
)

filegroup(
name = "standard_package",
srcs = glob([
"*.bzl",
]) + [
"BUILD",
"LICENSE",
],
visibility = ["//distro:__pkg__"],
)
9 changes: 5 additions & 4 deletions pkg/WORKSPACE → WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 The Bazel Authors. All rights reserved.
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,8 +14,7 @@

workspace(name = "rules_pkg")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:deps.bzl", "rules_pkg_dependencies")
load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

Expand All @@ -27,6 +26,8 @@ bazel_skylib_workspace()
#
# Include dependencies which are only needed for development here.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Find rpmbuild if it exists.
load("@rules_pkg//toolchains:rpmbuild_configure.bzl", "find_system_rpmbuild")

Expand Down Expand Up @@ -57,7 +58,7 @@ stardoc_repositories()
# TODO(nacl): remove this when the "new" framework is ready.
local_repository(
name = "experimental_test_external_repo",
path = "experimental/tests/external_repo",
path = "pkg/experimental/tests/external_repo",
)

local_repository(
Expand Down
25 changes: 25 additions & 0 deletions deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

aiuto marked this conversation as resolved.
Show resolved Hide resolved
# Workspace dependencies for rules_pkg/pkg
# This is for backwards compatibility with existing usage. Please use
# load("//pkg:deps.bzl", "rules_pkg_dependencies")
# going forward.

load("//pkg:deps.bzl", _rules_pkg_dependencies = "rules_pkg_dependencies")

rules_pkg_dependencies = _rules_pkg_dependencies

def rules_pkg_register_toolchains():
pass
41 changes: 21 additions & 20 deletions pkg/distro/BUILD → distro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:pkg.bzl", "pkg_tar")
load("//:version.bzl", "version")
load("//releasing:defs.bzl", "print_rel_notes")
load("//releasing:git.bzl", "git_changelog")
load("//pkg:pkg.bzl", "pkg_tar")
load("//pkg/releasing:defs.bzl", "print_rel_notes")
load("//pkg/releasing:git.bzl", "git_changelog")
load("@rules_python//python:defs.bzl", "py_test")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
load("@rules_python//python:defs.bzl", "py_test")

licenses(["notice"])

Expand All @@ -37,8 +37,9 @@ pkg_tar(
srcs = [
":small_workspace",
"//:standard_package",
"//private:standard_package",
"//releasing:standard_package",
"//pkg:standard_package",
"//pkg/private:standard_package",
"//pkg/releasing:standard_package",
"//toolchains:standard_package",
"//toolchains/git:standard_package",
],
Expand Down Expand Up @@ -92,7 +93,7 @@ py_test(
"noci",
],
deps = [
"//releasing:release_utils",
"//pkg/releasing:release_utils",
"@bazel_tools//tools/python/runfiles",
],
)
Expand All @@ -106,15 +107,15 @@ genrule(
bzl_library(
name = "rules_pkg_lib",
srcs = [
"//:mappings.bzl",
"//:package_variables.bzl",
"//:path.bzl",
"//:pkg.bzl",
"//:providers.bzl",
"//:rpm.bzl",
"//:version.bzl",
"//private:pkg_files.bzl",
"//private:util.bzl",
"//pkg:mappings.bzl",
"//pkg:package_variables.bzl",
"//pkg:path.bzl",
"//pkg:pkg.bzl",
"//pkg:providers.bzl",
"//pkg:rpm.bzl",
"//pkg/private:pkg_files.bzl",
"//pkg/private:util.bzl",
"@bazel_skylib//lib:paths",
],
visibility = ["//visibility:private"],
Expand All @@ -123,7 +124,7 @@ bzl_library(
stardoc(
name = "docs_deb",
out = "pkg_deb.md",
input = "//:pkg.bzl",
input = "//pkg:pkg.bzl",
symbol_names = [
"pkg_deb",
"pkg_deb_impl",
Expand All @@ -134,7 +135,7 @@ stardoc(
stardoc(
name = "docs_tar",
out = "pkg_tar.md",
input = "//:pkg.bzl",
input = "//pkg:pkg.bzl",
symbol_names = [
"pkg_tar",
"pkg_tar_impl",
Expand All @@ -145,7 +146,7 @@ stardoc(
stardoc(
name = "docs_zip",
out = "pkg_zip.md",
input = "//:pkg.bzl",
input = "//pkg:pkg.bzl",
symbol_names = [
"pkg_zip",
"pkg_zip_impl",
Expand All @@ -156,14 +157,14 @@ stardoc(
stardoc(
name = "docs_legacy_rpm",
out = "legacy_pkg_rpm.md",
input = "//legacy:rpm.bzl",
input = "//pkg/legacy:rpm.bzl",
deps = [":rules_pkg_lib"],
)

stardoc(
name = "mappings",
out = "mappings.md",
input = "//:mappings.bzl",
input = "//pkg:mappings.bzl",
deps = [
":rules_pkg_lib",
],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from releasing import release_tools
from pkg.releasing import release_tools
from distro import release_version

_VERBOSE = True
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/naming_package_files/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "rules_pkg",
path = "../../pkg",
path = "../..",
)

http_archive
Expand Down
2 changes: 1 addition & 1 deletion examples/prebuilt_rpmbuild/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace(name = "rules_pkg_example_prebuilt_rpmbuild")

local_repository(
name = "rules_pkg",
path = "../../pkg",
path = "../..",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
Expand Down
2 changes: 1 addition & 1 deletion examples/rich_structure/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "rules_pkg",
path = "../../pkg",
path = "../..",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
Expand Down
2 changes: 1 addition & 1 deletion examples/time_stamping/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace(name = "rules_pkg_examples")

local_repository(
name = "rules_pkg",
path = "../../pkg",
path = "../..",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
Expand Down
2 changes: 1 addition & 1 deletion examples/where_is_my_output/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "rules_pkg",
path = "../../pkg",
path = "../..",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
Expand Down
Empty file added install.bzl
Empty file.
38 changes: 38 additions & 0 deletions mappings.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load(
"//pkg:mappings.bzl",
_filter_directory = "filter_directory",
_pkg_attributes = "pkg_attributes",
_pkg_filegroup = "pkg_filegroup",
_pkg_files = "pkg_files",
_pkg_mkdirs = "pkg_mkdirs",
_pkg_mklink = "pkg_mklink",
_strip_prefix = "strip_prefix",
)

filter_directory = _filter_directory

pkg_attributes = _pkg_attributes

pkg_filegroup = _pkg_filegroup

pkg_files = _pkg_files

pkg_mkdirs = _pkg_mkdirs

pkg_mklink = _pkg_mklink

strip_prefix = _strip_prefix
18 changes: 18 additions & 0 deletions package_variables.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//pkg/package_variables.bzl",
_add_ctx_variables = "add_ctx_variables",
)
add_ctx_variables = _add_ctx_variables
24 changes: 24 additions & 0 deletions pkg.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load(
"//pkg:pkg.bzl",
_pkg_deb = "pkg_deb",
_pkg_tar = "pkg_tar",
_pkg_zip = "pkg_zip",
)

pkg_deb = _pkg_deb
pkg_tar = _pkg_tar
pkg_zip = _pkg_zip
Loading