Skip to content

Commit cc09bcd

Browse files
committed
refactor: initial update renaming post-template
also sets up pre-commits and commitizen
1 parent 8ae3d03 commit cc09bcd

38 files changed

+4261
-562
lines changed

.bazelrc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Bazel settings that apply to this repository.
2-
# Take care to document any settings that you expect users to apply.
32
# Settings that apply only to CI are in .github/workflows/ci.bazelrc
43

5-
# Required until this is the default; expected in Bazel 7
6-
common --enable_bzlmod
7-
8-
# Don’t want to push a rules author to update their deps if not needed.
4+
# As a rules repo, don't force updates unexpectedly.
95
# https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies
106
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
117
common --check_direct_dependencies=off
128

9+
# Set up local caching of repos and actions.
10+
build --repository_cache=.cache/bazel/repo
11+
build --disk_cache=.cache/bazel/actions
12+
1313
# Load any settings specific to the current user.
1414
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
1515
# This needs to be last statement in this

.bazelversion

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
7.2.1
2-
# The first line of this file is used by Bazelisk and Bazel to be sure
3-
# the right version of Bazel is used to build and test this repo.
4-
# This also defines which version is used on CI.
5-
#
6-
# Note that you should also run integration_tests against other Bazel
7-
# versions you support.
2+

.bcr/metadata.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"homepage": "https://github.com/myorg/rules_mylang",
2+
"homepage": "https://github.com/fullstorydev/rules_android",
33
"maintainers": [],
4-
"repository": ["github:myorg/rules_mylang"],
4+
"repository": ["github:fullstorydev/rules_android"],
55
"versions": [],
66
"yanked_versions": {}
77
}

.cz.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
commitizen:
3+
major_version_zero: true
4+
name: cz_conventional_commits
5+
tag_format: $version
6+
update_changelog_on_bump: true
7+
version: 0.0.1
8+
version_scheme: semver2

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ examples export-ignore
1111

1212
# Occasionally there's a need to "stamp" the release version into a file
1313
# See https://blog.aspect.build/releasing-bazel-rulesets-rust for details if you need this.
14-
# mylang/version.bzl export-subst
14+
# android/version.bzl export-subst

.github/workflows/buildifier.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: buildifier
19-
run: bazel run --enable_bzlmod //.github/workflows:buildifier.check
19+
run: bazel run //.github/workflows:buildifier.check

.github/workflows/ci.bazelrc

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44
# Debug where options came from
55
build --announce_rc
6-
# This directory is configured in GitHub actions to be persisted between runs.
7-
# We do not enable the repository cache to cache downloaded external artifacts
8-
# as these are generally faster to download again than to fetch them from the
9-
# GitHub actions cache.
10-
build --disk_cache=~/.cache/bazel
6+
117
# Don't rely on test logs being easily accessible from the test runner,
128
# though it makes the log noisier.
139
test --test_output=errors
10+
1411
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
1512
test --test_env=XDG_CACHE_HOME

.github/workflows/ci.yaml

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ on:
1111
workflow_dispatch:
1212

1313
concurrency:
14-
# Cancel previous actions from the same PR or branch except 'main' branch.
15-
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
16-
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
17-
cancel-in-progress: ${{ github.ref_name != 'main' }}
14+
# Cancel previous actions from the same PR or branch except 'main' branch.
15+
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
16+
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
17+
cancel-in-progress: ${{ github.ref_name != 'main' }}
1818

1919
jobs:
2020
test:
21-
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6
21+
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7
2222
with:
2323
folders: |
2424
[
@@ -27,7 +27,8 @@ jobs:
2727
]
2828
exclude: |
2929
[
30-
{"folder": ".", "bzlmodEnabled": false}
30+
{"folder": ".", "bzlmodEnabled": false},
31+
{"bazelversion": "8.0.0rc1", "os": "ubuntu-latest"}
3132
]
3233
# For branch protection settings, this job provides a "stable" name that can be used to gate PR merges
3334
# on "all matrix jobs were successful".

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ permissions:
1313

1414
jobs:
1515
release:
16-
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6
16+
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7
1717
with:
1818
release_files: rules_mylang-*.tar.gz

.github/workflows/release_prep.sh

+8-9
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,33 @@ TAG=${GITHUB_REF_NAME}
88
# The prefix is chosen to match what GitHub generates for source archives
99
# This guarantees that users can easily switch from a released artifact to a source archive
1010
# with minimal differences in their code (e.g. strip_prefix remains the same)
11-
PREFIX="rules_mylang-${TAG:1}"
12-
ARCHIVE="rules_mylang-$TAG.tar.gz"
11+
PREFIX="rules_android-${TAG:1}"
12+
ARCHIVE="rules_android-$TAG.tar.gz"
1313

1414
# NB: configuration for 'git archive' is in /.gitattributes
1515
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
1616
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
1717

1818
cat << EOF
19-
## Using Bzlmod with Bazel 6 or greater
19+
## Using Bzlmod
2020
21-
1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
22-
2. Add to your \`MODULE.bazel\` file:
21+
1. Add to your \`MODULE.bazel\` file:
2322
2423
\`\`\`starlark
25-
bazel_dep(name = "com_myorg_rules_mylang", version = "${TAG:1}")
24+
bazel_dep(name = "fullstory_rules_android", version = "${TAG:1}")
2625
\`\`\`
2726
28-
## Using WORKSPACE
27+
## Using WORKSPACE (Bazel 8 or less)
2928
3029
Paste this snippet into your \`WORKSPACE.bazel\` file:
3130
3231
\`\`\`starlark
3332
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3433
http_archive(
35-
name = "com_myorg_rules_mylang",
34+
name = "fullstory_rules_android",
3635
sha256 = "${SHA}",
3736
strip_prefix = "${PREFIX}",
38-
url = "https://github.com/myorg/rules_mylang/releases/download/${TAG}/${ARCHIVE}",
37+
url = "https://github.com/fullstorydev/rules_android/releases/download/${TAG}/${ARCHIVE}",
3938
)
4039
EOF
4140

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ bazel-*
22
.bazelrc.user
33
.idea/
44
.ijwb/
5+
.cache/

.pre-commit-config.yaml

+32-24
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
# See CONTRIBUTING.md for instructions.
2-
# See https://pre-commit.com for more information
3-
# See https://pre-commit.com/hooks.html for more hooks
4-
5-
# Commitizen runs in commit-msg stage
6-
# but we don't want to run the other hooks on commit messages
7-
default_stages: [commit]
8-
9-
# Use a slightly older version of node by default
10-
# as the default uses a very new version of GLIBC
111
default_language_version:
122
node: 16.18.0
13-
3+
default_stages:
4+
- pre-commit
145
repos:
15-
# Check formatting and lint for starlark code
16-
- repo: https://github.com/keith/pre-commit-buildifier
17-
rev: 6.1.0.1
18-
hooks:
6+
- hooks:
7+
- entry: ./tools/update_bzlmod_lockfile.sh
8+
files: MODULE.bazel
9+
id: update-bzlmod-lock
10+
language: script
11+
name: Update MODULE.bazel.lock
12+
pass_filenames: false
13+
- args:
14+
- e2e/smoke
15+
entry: ./tools/update_bzlmod_lockfile.sh
16+
files: e2e/smoke/MODULE.bazel
17+
id: update-e2e-bzlmod-lock
18+
language: script
19+
name: Update e2e/MODULE.bazel.lock
20+
pass_filenames: false
21+
repo: local
22+
- hooks:
1923
- id: buildifier
2024
- id: buildifier-lint
21-
# Enforce that commit messages allow for later changelog generation
22-
- repo: https://github.com/commitizen-tools/commitizen
23-
rev: v2.18.0
24-
hooks:
25-
# Requires that commitizen is already installed
25+
repo: https://github.com/keith/pre-commit-buildifier
26+
rev: 6.1.0.1
27+
- hooks:
2628
- id: commitizen
27-
stages: [commit-msg]
28-
- repo: https://github.com/pre-commit/mirrors-prettier
29-
rev: "v2.4.0"
30-
hooks:
29+
stages:
30+
- commit-msg
31+
- id: commitizen-branch
32+
stages:
33+
- pre-push
34+
repo: https://github.com/commitizen-tools/commitizen
35+
rev: v3.30.0
36+
- hooks:
3137
- id: prettier
38+
repo: https://github.com/pre-commit/mirrors-prettier
39+
rev: v2.4.0

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ Run `bazel run //:gazelle` to keep them up-to-date.
2828
## Using this as a development dependency of other rules
2929

3030
You'll commonly find that you develop in another WORKSPACE, such as
31-
some other ruleset that depends on rules_mylang, or in a nested
31+
some other ruleset that depends on rules_android, or in a nested
3232
WORKSPACE in the integration_tests folder.
3333

3434
To always tell Bazel to use this directory rather than some release
3535
artifact or a version fetched from the internet, run this from this
3636
directory:
3737

3838
```sh
39-
OVERRIDE="--override_repository=rules_mylang=$(pwd)/rules_mylang"
39+
OVERRIDE="--override_repository=fullstory_rules_android=/path/to/local/rules_android"
4040
echo "common $OVERRIDE" >> ~/.bazelrc
4141
```
4242

43-
This means that any usage of `@rules_mylang` on your system will point to this folder.
43+
This means that any usage of `@fullstory_rules_android` on your system will point to this folder.
4444

4545
## Releasing
4646

MODULE.bazel

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
"Bazel dependencies"
22

33
module(
4-
name = "com_myorg_rules_mylang",
4+
name = "fullstory_rules_android",
55
version = "0.0.0",
66
compatibility_level = 1,
77
)
88

9-
bazel_dep(name = "bazel_skylib", version = "1.4.1")
10-
bazel_dep(name = "platforms", version = "0.0.5")
9+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
10+
bazel_dep(name = "platforms", version = "0.0.10")
1111

12-
bazel_dep(name = "gazelle", version = "0.35.0", dev_dependency = True, repo_name = "bazel_gazelle")
13-
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
14-
bazel_dep(name = "aspect_bazel_lib", version = "1.32.1", dev_dependency = True)
15-
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2", dev_dependency = True)
16-
17-
mylang = use_extension("//mylang:extensions.bzl", "mylang")
18-
mylang.toolchain(mylang_version = "1.14.2")
19-
use_repo(mylang, "mylang_toolchains")
20-
21-
register_toolchains("@mylang_toolchains//:all")
12+
bazel_dep(name = "gazelle", version = "0.39.1", dev_dependency = True, repo_name = "bazel_gazelle")
13+
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
14+
bazel_dep(name = "aspect_bazel_lib", version = "2.9.3", dev_dependency = True)
15+
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)

0 commit comments

Comments
 (0)