bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
108 stars 45 forks source link

Change release structure #70

Closed pilkjaer closed 4 years ago

pilkjaer commented 4 years ago

When fetching sratdoc release there is additional stardoc-0.4.0 folder created inside of it. As a result, when fetching files using http_archive rule you can't reference code by just using startdoc, you need to include version number as well. Example:

  1. When fetching via git_repository rule you can use following: load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
  2. When fetching via http_archive you must use following: load("@bazel_stardoc//stardoc-0.4.0/stardoc:stardoc.bzl", "stardoc") I was using files provided on https://github.com/bazelbuild/stardoc/releases/tag/0.4.0

In general, Bazel recommends using http_archive rules instead of git_repository rules (see here). Maybe you can update the instructions in getting_started_stardoc.md as well.

pilkjaer commented 4 years ago

Rule example that can be used (for 0.4.0 release): http_archive( name = "bazel_stardoc", sha256 = "6d07d18c15abb0f6d393adbd6075cd661a2219faab56a9517741f0fc755f6f3c", type = "tar.gz", urls = [ "https://github.com/bazelbuild/stardoc/archive/0.4.0.tar.gz", ],

achew22 commented 4 years ago

Have you considered using http_archive's trim_prefix attribute to address this? The documentation calls out this exact use case and I hypothesize it would solve your issue.

pilkjaer commented 4 years ago

@achew22 Thank you for the tips. Indeed having strip_prefix line in http_archive rule removed the need for the extra values when loading. Then release structure probably can be kept as is and change from git_repository to http_archive can be seen as an improvement suggestion.