Skip to content

Commit

Permalink
Merge pull request #7 from dmayle/release_rules
Browse files Browse the repository at this point in the history
Add rules to facilitate creating a release package
  • Loading branch information
dmayle authored Dec 9, 2020
2 parents ccd1d8c + 070da47 commit 8870f29
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
31 changes: 31 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,34 @@
# 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("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")

pkg_tar(
name = "release",
testonly = True,
srcs = [
":all_files",
],
extension = "tar.gz",
package_base = "",
package_dir = "/",
package_file_name = "rules_sqlc-VERSION.tar.gz",
strip_prefix = "NONE", # Prevent flattening of archive
visibility = [":__subpackages__"],
)

filegroup(
name = "all_files",
testonly = True,
srcs = [
"BUILD.bazel",
"LICENSE",
"README.md",
"WORKSPACE",
"//docs:sqlc_package-docs",
"//docs:sqlc_provider-docs",
"//sqlc:all_files",
],
visibility = ["//visibility:public"],
)
14 changes: 13 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
workspace(name = "com_plezentek_rules_sqlc")

load("@com_plezentek_rules_sqlc//sqlc:deps.bzl", "sqlc_register_toolchains", "sqlc_rules_dependencies")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# sqlc_rules_dependencies declares the dependencies of com_plezentek_rules_sqlc.
# Any project that depends on com_plezentek_rules_sqlc should call this.
Expand All @@ -46,6 +45,19 @@ load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()

git_repository(
name = "rules_pkg",
branch = "issue_50",
patch_cmds = ["mv pkg/* ."],
remote = "https://github.com/dmayle/rules_pkg",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

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

# Download the Go rules.
http_archive(
name = "io_bazel_rules_go",
Expand Down
4 changes: 3 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ stardoc(
symbol_names = [
"sqlc_package",
],
visibility = ["//:__subpackages__"],
deps = [":docs"],
)

stardoc(
name = "sqlc_provder-docs",
name = "sqlc_provider-docs",
out = "providers.md",
input = "docs.bzl",
symbol_names = [
"SQLCRelease",
],
visibility = ["//:__subpackages__"],
deps = [":docs"],
)

0 comments on commit 8870f29

Please sign in to comment.