Skip to content

Commit b27e495

Browse files
Enable bzlmod support (#139)
* Enable bzlmod support * Disable bazel 7.x from presubmit * remove workspace
1 parent ef2f994 commit b27e495

File tree

16 files changed

+182
-134
lines changed

16 files changed

+182
-134
lines changed

.bazelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
startup --output_base=./bazel-output-base
22

3+
common --enable_bzlmod
4+
35
build --announce_rc
46
build --spawn_strategy=local
57
build --strategy=SwiftCompile=worker
68
build --verbose_failures
79
build --compilation_mode=fastbuild
8-
build --experimental_multi_threaded_digest
910
build --verbose_failures
10-
build:rules_xcodeproj --xcode_version_config=@local_config_xcode//:host_xcodes
1111

1212
common:ci --isatty=1
1313
common:ci --terminal_columns=127
1414

15-
import %workspace%/.env_bazelrc
15+
try-import %workspace%/.env_bazelrc

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
7.1.1

.bcr/metadata.template.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"homepage": "https://github.com/sergeykhliustin/BazelPods",
3+
"maintainers": [
4+
{
5+
"email": "sergey.khliustin@gmail.com",
6+
"github": "sergeykhliustin",
7+
"name": "Sergii Khliustin"
8+
}
9+
],
10+
"repository": [
11+
"github:sergeykhliustin/BazelPods"
12+
],
13+
"versions": [],
14+
"yanked_versions": {}
15+
}

.bcr/presubmit.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
matrix:
2+
bazel: ["6.x"]
3+
platform: ["macos_arm64", "macos"]
4+
tasks:
5+
verify_build:
6+
name: Verify Build
7+
platform: ${{ platform }}
8+
bazel: ${{ bazel }}
9+
build_targets:
10+
- "@bazelpods//:bazelpods"
11+
build_flags:
12+
- "--enable_bzlmod"

.bcr/source.template.json

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

.github/workflows/release.yml

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Get latest release tag
1616
id: latesttag
1717
run: |
18-
CURRENT_VERSION=$(gh release list --limit 1 --json version | jq .[0].tagName | tr -d '"')
18+
CURRENT_VERSION=$(gh release list --limit 1 --json tagName | jq .[0].tagName | tr -d '"')
1919
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
2020
2121
- name: Validate new version
@@ -33,44 +33,38 @@ jobs:
3333
3434
- name: Archive sources
3535
run: |
36-
tar czvf release.tar.gz Sources BUILD repositories.bzl
36+
tar czvf release.tar.gz Sources BUILD.bazel repositories.bzl MODULE.bazel
3737
3838
- name: Calculate SHA256
3939
run: |
4040
echo "SHA256=$(shasum -a 256 release.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV
4141
4242
- name: Create Release
43-
id: create_release
44-
uses: actions/create-release@v1
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
with:
48-
tag_name: ${{ github.ref }}
49-
release_name: ${{ github.ref }}
50-
body: |
51-
## Workspace Snippet
52-
53-
```starlark
54-
http_archive(
55-
name = "bazelpods",
56-
sha256 = "${{ env.SHA256 }}",
57-
url = "https://github.com/sergeykhliustin/BazelPods/releases/download/${{ env.NEW_VERSION }}/release.tar.gz"
58-
)
59-
60-
load("@bazelpods//:repositories.bzl", "bazelpods_dependencies")
43+
run: |
44+
set -euo pipefail
6145
62-
bazelpods_dependencies()
63-
```
64-
draft: true
65-
prerelease: false
46+
git config user.name "Release Workflow"
47+
git config user.email "noreply@github.com"
6648
67-
- name: Upload Release Asset
68-
id: upload_release_asset
69-
uses: actions/upload-release-asset@v1
49+
gh release create "${{ github.ref }}" \
50+
--title "${{ env.NEW_VERSION }}" \
51+
--target "$GITHUB_SHA" \
52+
--generate-notes \
53+
--prerelease \
54+
--notes "### Bzlmod Snippet
55+
\`\`\`starlark
56+
bazel_dep(name = \"bazelpods\", version = \"${{ env.NEW_VERSION }}\")
57+
\`\`\`
58+
## Workspace Snippet
59+
\`\`\`starlark
60+
http_archive(
61+
name = \"bazelpods\",
62+
sha256 = \"${{ env.SHA256 }}\",
63+
url = \"https://github.com/sergeykhliustin/BazelPods/releases/download/${{ env.NEW_VERSION }}/release.tar.gz\"
64+
)
65+
load(\"@bazelpods//:repositories.bzl\", \"bazelpods_dependencies\")
66+
bazelpods_dependencies()
67+
\`\`\`" \
68+
"release.tar.gz"
7069
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
with:
73-
upload_url: ${{ steps.create_release.outputs.upload_url }}
74-
asset_path: ./release.tar.gz
75-
asset_name: release.tar.gz
76-
asset_content_type: application/gzip
70+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Tests/Podfile
1010
Tests/Podfile.lock
1111
Tests/Pods
1212
.env_bazelrc
13+
MODULE.bazel.lock

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 3.3.1

BUILD renamed to BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ swift_library(
3434
"Sources/BazelPods/**/*.swift",
3535
"Sources/Shared/**/*.swift"
3636
]),
37-
deps = [":BazelPodsCore", ":Logger", "@bazelpods-swift-argument-parser//:ArgumentParser"],
37+
deps = [":BazelPodsCore", ":Logger", "@bazelpods_swift_argument_parser//:ArgumentParser"],
3838
copts = ["-swift-version", SWIFT_VERSION]
3939
)
4040

@@ -65,6 +65,6 @@ swift_library(
6565
"Sources/Analyzer/**/*.swift",
6666
"Sources/Shared/**/*.swift"
6767
]),
68-
deps = [":BazelPodsCore", ":Logger", "@bazelpods-swift-argument-parser//:ArgumentParser"],
68+
deps = [":BazelPodsCore", ":Logger", "@bazelpods_swift_argument_parser//:ArgumentParser"],
6969
copts = ["-swift-version", SWIFT_VERSION],
7070
)

MODULE.bazel

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module(
2+
name = "bazelpods",
3+
version = "0.0.0",
4+
compatibility_level = 1,
5+
bazel_compatibility = [">=6.0.0"],
6+
repo_name = "bazelpods"
7+
)
8+
9+
bazel_dep(
10+
name = "apple_support",
11+
version = "1.15.1",
12+
repo_name = "build_bazel_apple_support",
13+
)
14+
bazel_dep(
15+
name = "rules_apple",
16+
version = "3.5.1",
17+
repo_name = "build_bazel_rules_apple",
18+
)
19+
bazel_dep(
20+
name = "rules_cc",
21+
version = "0.0.9",
22+
)
23+
bazel_dep(
24+
name = "rules_swift",
25+
version = "1.18.0",
26+
repo_name = "build_bazel_rules_swift",
27+
)
28+
bazel_dep(
29+
name = "rules_ios",
30+
version = "4.4.0",
31+
repo_name = "build_bazel_rules_ios"
32+
)
33+
34+
non_module_deps = use_extension(
35+
"//:repositories.bzl",
36+
"non_module_deps",
37+
)
38+
use_repo(non_module_deps, "bazelpods_swift_argument_parser")
39+
40+
bazel_dep(name = "rules_xcodeproj", version = "2.2.0")

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Core idea, Podspec parser, Starlark compiler are forked from [PodToBUILD](https:
2929
### 🎸 Let's rock
3030
Don't forget to setup [`rules_ios`](https://github.com/bazel-ios/rules_ios) and [`rules_apple`](https://github.com/bazelbuild/rules_apple) first.
3131

32+
Add `BazelPods` to your `MODULE.bazel`
33+
```starlark
34+
bazel_dep(name = "bazelpods", version = "<version>")
35+
```
36+
3237
Add `BazelPods` to your `WORKSPACE`
3338
```starlark
3439
http_archive(

TestTools/Pods.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@
604604
"SwiftyDropboxObjC": {
605605
"version": "10.0.1"
606606
},
607+
"SwiftyGif": {
608+
"version": "5.4.5"
609+
},
607610
"TABAnimated": {
608611
"version": "2.6.5"
609612
},

Tests/Recorded/SwiftyGif/BUILD.bazel

Lines changed: 60 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)