Skip to content

Commit 8a22541

Browse files
authored
Merge branch 'master' into patch-1
2 parents fa50869 + e2575a3 commit 8a22541

File tree

431 files changed

+20040
-6113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

431 files changed

+20040
-6113
lines changed

.bazelci/presubmit.yml

+21-12
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ tasks:
3030
- sudo apt update && sudo apt install --reinstall libxml2-utils -y
3131
- "./test_rules_scala.sh"
3232
test_rules_scala_linux_last_green:
33-
name: "./test_rules_scala (Bazel green head)"
33+
name: "./test_rules_scala (last_green Bazel)"
3434
platform: ubuntu2004
3535
bazel: last_green
3636
shell_commands:
3737
# Install xmllint
3838
- sudo apt update && sudo apt install --reinstall libxml2-utils -y
39-
- "./test_rules_scala.sh || buildkite-agent annotate --style 'warning' \"Optional build with latest Bazel version failed, [see here](${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}) (It is not mandatory but worth checking)\""
39+
- "./test_rules_scala.sh || buildkite-agent annotate --style 'warning' \"Optional build with last_green Bazel version failed, [see here](${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}) (It is not mandatory but worth checking)\""
4040
test_rules_scala_macos:
4141
name: "./test_rules_scala"
4242
platform: macos
@@ -45,18 +45,22 @@ tasks:
4545
test_rules_scala_win:
4646
name: "./test_rules_scala"
4747
platform: windows
48-
shell_commands:
48+
environment:
49+
MSYS2_ARG_CONV_EXCL: "*"
50+
batch_commands:
51+
- "set PATH=/usr/bin;%PATH%" #Make sure bash uses msys commands over windows commands. (i.e. find).
52+
- "bash -lc \"pacman --noconfirm --needed -S libxml2\"" #tests require xmllint
4953
- "bash test_rules_scala.sh"
50-
test_coverage_linux_6_3_0:
54+
test_coverage_linux_7_6_1:
5155
name: "./test_coverage"
5256
platform: ubuntu2004
53-
bazel: 6.3.0
57+
bazel: 7.6.1
5458
shell_commands:
5559
- "./test_coverage.sh"
56-
test_coverage_macos_6.3.0:
60+
test_coverage_macos_7.6.1:
5761
name: "./test_coverage"
5862
platform: macos
59-
bazel: 6.3.0
63+
bazel: 7.6.1
6064
shell_commands:
6165
- "./test_coverage.sh"
6266
test_reproducibility_linux:
@@ -79,23 +83,28 @@ tasks:
7983
platform: macos
8084
shell_commands:
8185
- "./test_version.sh"
86+
thirdparty_version_linux:
87+
name: "./test_thirdparty_version.sh"
88+
platform: ubuntu2204_java17
89+
shell_commands:
90+
- "./test_thirdparty_version.sh"
8291
examples_linux:
8392
name: "./test_examples"
8493
platform: ubuntu2004
85-
bazel: 6.3.0
94+
bazel: 7.6.1
8695
shell_commands:
8796
- "./test_examples.sh"
8897
cross_build_linux:
8998
name: "./test_cross_build"
9099
platform: ubuntu2004
91-
bazel: 6.3.0
100+
bazel: 7.6.1
92101
shell_commands:
93102
- "./test_cross_build.sh"
94103
lint_linux:
95-
name: "bazel //tools:lint_check"
104+
name: "./test_lint.sh"
96105
platform: ubuntu2004
97-
run_targets:
98-
- "//tools:lint_check"
106+
shell_commands:
107+
- "./test_lint.sh"
99108
test_rules_scala_jdk21:
100109
name: "./test_rules_scala with jdk21"
101110
platform: ubuntu2004

.bazelignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Remove once the following is fixed:
2+
# - bazelbuild/bazel: Loading top-level targets in local_path_override modules
3+
# in child directory breaks the build #22208
4+
# https://github.com/bazelbuild/bazel/issues/22208
5+
deps/
6+
dt_patches/compiler_sources
7+
dt_patches/test_dt_patches
8+
dt_patches/test_dt_patches_user_srcjar
9+
examples/crossbuild
10+
examples/overridden_artifacts
11+
examples/scala3
12+
examples/semanticdb
13+
examples/testing/multi_frameworks_toolchain
14+
examples/testing/scalatest_repositories
15+
examples/testing/specs2_junit_repositories
16+
test/proto_cross_repo_boundary/repo
17+
test_cross_build
18+
third_party/test/example_external_workspace
19+
third_party/test/new_local_repo
20+
third_party/test/proto

.bazelrc

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Remove once Bazel 8 becomes the minimum supported version.
2+
common --noenable_workspace --incompatible_use_plus_in_repo_names
3+
4+
# Remove if protocol compiler toolchainization ever becomes the default.
5+
# - https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution
6+
# - https://docs.google.com/document/d/1CE6wJHNfKbUPBr7-mmk_0Yo3a4TaqcTPE0OWNuQkhPs/edit
7+
common --incompatible_enable_proto_toolchain_resolution
8+
19
build --enable_platform_specific_config
210

311
#Windows needs --worker_quit_after_build due to workers not being shut down when the compiler tools need to be rebuilt (resulting in 'file in use' errors). See Bazel Issue#10498.

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.0
1+
7.6.1

.bcr/README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Bazel Central Registry publication
2+
3+
[.github/workflows/publish-to-bcr.yml](../.github/workflows/publish-to-bcr.yml)
4+
uses these files to configure the [Publish to BCR](
5+
https://github.com/bazel-contrib/publish-to-bcr) workflow for publishing to the
6+
[Bazel Central Registry (BCR)](https://registry.bazel.build/).
7+
8+
- [Publish to BCR workflow setup](
9+
https://github.com/bazel-contrib/publish-to-bcr?tab=readme-ov-file#setup)
10+
- [.bcr/ templates](
11+
https://github.com/bazel-contrib/publish-to-bcr/tree/main/templates)
12+
- [.github/workflows/publish.yaml reusable workflow](
13+
https://github.com/bazel-contrib/publish-to-bcr/blob/main/.github/workflows/publish.yaml)
14+
15+
Notice that the setup instructions suggest saving the Personal Access Token as
16+
`PUBLISH_TOKEN`. We save it as `BCR_PUBLISH_TOKEN` instead, as inspired by
17+
aspect-build/rules_lint#529, to make this value more self documenting.
18+
19+
## Provenance attestations
20+
21+
This workflow also produces attestations required by the [Supply chain Levels
22+
for Software Artifacts (SLSA)](https://slsa.dev/) framework for secure supply
23+
chain provenance.
24+
25+
Examples:
26+
27+
<!-- Replace these with rules_scala examples once they're available. -->
28+
- [aspect-build/rules_lint v1.3.4 release and publish run with attestations](
29+
https://github.com/aspect-build/rules_lint/actions/runs/14410869652/attempts/1)
30+
- [aspect-build/rules_lint v1.3.4 attestations](
31+
https://github.com/aspect-build/rules_lint/attestations/6280291)
32+
- [aspect-build/rules_lint attestations](
33+
https://github.com/aspect-build/rules_lint/attestations)
34+
35+
## Related documentation
36+
37+
- [bazelbuild/bazel-central-registry](
38+
https://github.com/bazelbuild/bazel-central-registry)
39+
- [SLSA: Provenance](https://slsa.dev/spec/v1.0/provenance)
40+
- [in-toto](https://in-toto.io/)
41+
- [GitHub Actions](https://docs.github.com/actions)
42+
- [Security for GitHub Actions](
43+
https://docs.github.com/en/actions/security-for-github-actions)
44+
- [Using secrets in a workflow](
45+
https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow)
46+
- [Using artifact attestations](
47+
https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations)
48+
- [Writing Workflows](
49+
https://docs.github.com/en/actions/writing-workflows)
50+
- [Accessing contextual information about workflow runs: 'secrets' context](
51+
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#secrets-context)
52+
- [Workflow syntax for GitHub Action: 'on.workflow_call.secrets'](
53+
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets)
54+
- [Sharing automations](https://docs.github.com/en/actions/sharing-automations)
55+
- [Passing inputs and secrets to a reusable workflow](
56+
https://docs.github.com/en/actions/sharing-automations/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow)
57+
- [actions/attest-build-provenance](
58+
https://github.com/actions/attest-build-provenance)
59+
- [in-toto/attestation](https://github.com/in-toto/attestation)
60+
- [slsa-framework/slsa-verifier](
61+
https://github.com/slsa-framework/slsa-verifier)
62+
63+
## Inspiration
64+
65+
Originally based on the examples from aspect-build/rules_lint#498 and
66+
aspect-build/rules_lint#501. See also:
67+
68+
- bazelbuild/bazel-central-registry#4060
69+
- bazelbuild/bazel-central-registry#4146
70+
- slsa-framework/slsa-verifier#840

.bcr/metadata.template.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"homepage": "https://github.com/bazelbuild/rules_scala",
3+
"maintainers": [
4+
{
5+
"name": "Simonas Pinevičius",
6+
"email": "[email protected]",
7+
"github": "simuons"
8+
},
9+
{
10+
"name": "Vaidas Pilkauskas",
11+
"email": "[email protected]",
12+
"github": "liucijus"
13+
}
14+
],
15+
"repository": [
16+
"github:bazelbuild/rules_scala"
17+
],
18+
"versions": [],
19+
"yanked_versions": {}
20+
}

.bcr/presubmit.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bcr_test_module:
2+
module_path: "examples/crossbuild"
3+
matrix:
4+
platform: ["debian10", "macos", "ubuntu2004", "windows"]
5+
bazel: [7.x, 8.x, rolling, last_green]
6+
tasks:
7+
run_tests:
8+
name: "Build and test the example module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
build_targets:
12+
- "//..."
13+
test_targets:
14+
- "//..."

.bcr/source.template.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
5+
}

.github/workflows/publish-to-bcr.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Publishes to the Bazel Central Registry.
2+
#
3+
# Based on .github/workflows/publish.yaml from aspect-build/rules_lint v1.3.5.
4+
# See .bcr/README.md.
5+
name: Publish to the Bazel Central Registry
6+
7+
on:
8+
# Run from release.yml.
9+
workflow_call:
10+
inputs:
11+
tag_name:
12+
required: true
13+
type: string
14+
secrets:
15+
bcr_publish_token:
16+
required: true
17+
18+
# In case of problems, enable manual dispatch from the GitHub UI.
19+
workflow_dispatch:
20+
inputs:
21+
tag_name:
22+
required: true
23+
type: string
24+
25+
jobs:
26+
publish-to-bcr:
27+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
28+
with:
29+
tag_name: ${{ inputs.tag_name }}
30+
# bazelbuild/bazel-central-registry fork used to open a pull request.
31+
registry_fork: bazel-contrib/bazel-central-registry
32+
permissions:
33+
attestations: write
34+
contents: write
35+
id-token: write
36+
secrets:
37+
# Necessary to push to the BCR fork and open a pull request.
38+
publish_token: ${{ secrets.bcr_publish_token }}

.github/workflows/release.yml

+33-16
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,38 @@ on:
77
tags:
88
- 'v*.*.*'
99

10-
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
10+
# In case of problems, enable manual dispatch from the GitHub UI.
11+
workflow_dispatch:
12+
inputs:
13+
tag_name:
14+
required: true
15+
type: string
16+
17+
# Uses the `release_ruleset` workflow to generate provenance attestation files
18+
# referenced by the `publish-to-bcr` workflow.
19+
#
20+
# Based on .github/workflows/release.yml from aspect-build/rules_lint v1.3.5.
21+
# See .bcr/README.md.
1622

17-
- name: Prepare workspace snippet
18-
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
23+
permissions:
24+
attestations: write # Needed to attest provenance
25+
contents: write # Needed to create release
26+
id-token: write # Needed to attest provenance
27+
28+
jobs:
29+
release:
30+
uses: bazel-contrib/.github/.github/workflows/[email protected]
31+
with:
32+
bazel_test_command: "bazel test //src/... //test/... //third_party/..."
33+
prerelease: false
34+
release_files: rules_scala-*.tar.gz
35+
release_prep_command: .github/workflows/workspace_snippet.sh
36+
tag_name: ${{ inputs.tag_name || github.ref_name }}
1937

20-
- name: Release
21-
uses: softprops/action-gh-release@v1
22-
with:
23-
# Use GH feature to populate the changelog automatically
24-
generate_release_notes: true
25-
body_path: release_notes.txt
26-
fail_on_unmatched_files: true
27-
files: rules_scala-*.tar.gz
38+
publish-to-bcr:
39+
needs: release
40+
uses: ./.github/workflows/publish-to-bcr.yml
41+
with:
42+
tag_name: ${{ inputs.tag_name || github.ref_name }}
43+
secrets:
44+
bcr_publish_token: ${{ secrets.bcr_publish_token }}

.github/workflows/workspace_snippet.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ set -o errexit -o nounset -o pipefail
44

55
# Set by GH actions, see
66
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
7-
TAG=${GITHUB_REF_NAME}
8-
PREFIX="rules_scala-${TAG:1}"
7+
TAG="${GITHUB_REF_NAME}"
8+
VERSION="${TAG:1}"
9+
PREFIX="rules_scala-${VERSION}"
910
ARCHIVE="rules_scala-$TAG.tar.gz"
1011
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
1112
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
1213

1314
cat << EOF
15+
## Using Bzlmod
16+
17+
Paste this snippet into your \`MODULE.bazel\` file:
18+
19+
\`\`\`starlark
20+
# Set \`repo_name = "io_bazel_rules_scala"\` if you still need it.
21+
bazel_dep(name = "rules_scala", version = "${VERSION}")
22+
\`\`\`
23+
1424
## Using WORKSPACE
1525
1626
Paste this snippet into your \`WORKSPACE\` file:
@@ -19,7 +29,7 @@ Paste this snippet into your \`WORKSPACE\` file:
1929
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2030
2131
http_archive(
22-
name = "io_bazel_rules_scala",
32+
name = "rules_scala", # Can be "io_bazel_rules_scala" if you still need it.
2333
sha256 = "${SHA}",
2434
strip_prefix = "${PREFIX}",
2535
url = "https://github.com/bazelbuild/rules_scala/releases/download/${TAG}/${ARCHIVE}",

.gitignore

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ hash2
66
.DS_store
77
.bazel_cache
88
.ijwb
9+
.bazelbsp
10+
.bsp
911
.metals
1012
.vscode
1113
unformatted-*.backup.scala
1214
.scala-build
13-
test/semanticdb/tempsrc
15+
test/semanticdb/tempsrc
16+
17+
# From scripts/create_repository.py
18+
repository-artifacts.json
19+
20+
# Until it settles down
21+
**/MODULE.bazel.lock
22+
23+
# Used by some tests, but can also be used for local experimentation.
24+
tmp/
25+
26+
# Not required by tests.
27+
deps/latest/.bazelversion

.markdownlint.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"default": true,
3+
"MD013": false,
4+
"MD033": false
5+
}

0 commit comments

Comments
 (0)