Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect bzlmod in swift_update_packages.bzl #698

Conversation

luispadron
Copy link
Collaborator

Fixes #686

In swift_update_packages.bzl we need to detect if bzlmod is enabled to forward the -bzlmod flag to the gazelle generator.

This should stop gazelle from requiring a swift_deps.bzl file when bzlmod is enabled and generate_swift_deps_for_workspace == False

@luispadron luispadron requested a review from cgrindel October 30, 2023 04:59
@luispadron luispadron force-pushed the luis/fix-generate_swift_deps_for_workspace-generating-file-when-false branch 3 times, most recently from de1ef11 to c011e4e Compare October 30, 2023 05:06
@cgrindel
Copy link
Owner

@luispadron Can you ping me when you have these tests green?

@luispadron
Copy link
Collaborator Author

Yeah oops copied the comment with tabs, I'll get to a laptop soon

@luispadron luispadron force-pushed the luis/fix-generate_swift_deps_for_workspace-generating-file-when-false branch from c011e4e to ba721f3 Compare October 30, 2023 14:53
@luispadron luispadron force-pushed the luis/fix-generate_swift_deps_for_workspace-generating-file-when-false branch from ba721f3 to 6632a8b Compare October 30, 2023 14:54
@luispadron
Copy link
Collaborator Author

@cgrindel should be good now. Do we have tests for swift_update_packages in Starlark, I may have missed them

@cgrindel
Copy link
Owner

Do we have tests for swift_update_packages in Starlark

The examples/integration tests ensure that the output continues to work. We do tidy_check on the workspace, but we probably should add it to the child workspaces. I just added #701, to track the work.

@cgrindel cgrindel merged commit 737d06c into main Oct 30, 2023
33 checks passed
@cgrindel cgrindel deleted the luis/fix-generate_swift_deps_for_workspace-generating-file-when-false branch October 30, 2023 15:32
renovate bot referenced this pull request in bazel-contrib/rules_bazel_integration_test Nov 6, 2023
…#243)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| rules_swift_package_manager | bazel_dep | minor | `0.19.0` -> `0.20.0`
|
|
[rules_swift_package_manager](https://togithub.com/cgrindel/rules_swift_package_manager)
| http_archive | minor | `v0.19.0` -> `v0.20.0` |

---

### Release Notes

<details>
<summary>cgrindel/rules_swift_package_manager
(rules_swift_package_manager)</summary>

###
[`v0.20.0`](https://togithub.com/cgrindel/rules_swift_package_manager/releases/tag/v0.20.0)

[Compare
Source](https://togithub.com/cgrindel/rules_swift_package_manager/compare/v0.19.0...v0.20.0)

#### What's Changed

- chore: update README.md for v0.19.0 by
[@&#8203;cgrindel-app-token-generator](https://togithub.com/cgrindel-app-token-generator)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/699](https://togithub.com/cgrindel/rules_swift_package_manager/pull/699)
- fix: detect bzlmod in swift_update_packages.bzl by
[@&#8203;luispadron](https://togithub.com/luispadron) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/698](https://togithub.com/cgrindel/rules_swift_package_manager/pull/698)
- chore(deps): update dependency apple/swift-nio to v2.61.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/695](https://togithub.com/cgrindel/rules_swift_package_manager/pull/695)
- chore(deps): update dependency onevcat/kingfisher to from: "7.10.0" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/697](https://togithub.com/cgrindel/rules_swift_package_manager/pull/697)
- chore(deps): update dependency apple/swift-markdown to v0.3.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/704](https://togithub.com/cgrindel/rules_swift_package_manager/pull/704)
- chore(deps): update dependency cocoalumberjack/cocoalumberjack to
from: "3.8.2" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/708](https://togithub.com/cgrindel/rules_swift_package_manager/pull/708)
- chore(deps): update dependency stripe/stripe-ios to from: "23.18.1" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/706](https://togithub.com/cgrindel/rules_swift_package_manager/pull/706)
- chore: Add tca_example to CI tests by
[@&#8203;luispadron](https://togithub.com/luispadron) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/702](https://togithub.com/cgrindel/rules_swift_package_manager/pull/702)
- chore(deps): update dependency rules_xcodeproj to v1.13.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/705](https://togithub.com/cgrindel/rules_swift_package_manager/pull/705)
- chore(deps): update dependency apple/swift-nio to v2.61.1 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/711](https://togithub.com/cgrindel/rules_swift_package_manager/pull/711)
- fix: respect exclude paths when searching for resource files by
[@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/709](https://togithub.com/cgrindel/rules_swift_package_manager/pull/709)
- chore(deps): update dependency firebase/firebase-ios-sdk to from:
"10.17.0" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/707](https://togithub.com/cgrindel/rules_swift_package_manager/pull/707)
- docs: add question about rules_xcodeproj and spawn strategy by
[@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/713](https://togithub.com/cgrindel/rules_swift_package_manager/pull/713)
- chore(deps): update dependency vapor/vapor to v4.85.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/715](https://togithub.com/cgrindel/rules_swift_package_manager/pull/715)
- chore(deps): update dependency vapor/vapor to v4.85.1 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/716](https://togithub.com/cgrindel/rules_swift_package_manager/pull/716)
- docs: move legacy quickstart to its own file by
[@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/714](https://togithub.com/cgrindel/rules_swift_package_manager/pull/714)
- fix: do not generate a modulemap for Objc targets, if they provide one
by [@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/710](https://togithub.com/cgrindel/rules_swift_package_manager/pull/710)
- fix: link type detection for frameworks by
[@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/717](https://togithub.com/cgrindel/rules_swift_package_manager/pull/717)

**Full Changelog**:
cgrindel/rules_swift_package_manager@v0.19.0...v0.20.0

#### Bazel Module Snippet

```python
bazel_dep(name = "rules_swift_package_manager", version = "0.20.0")
```

#### Workspace Snippet

```python
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_swift_package_manager",
    sha256 = "7408bde4c30b175b2f026d9fc84a9ea8270100ca6e5517c3bba00f287416097c",
    urls = [
        "https://github.com/cgrindel/rules_swift_package_manager/releases/download/v0.20.0/rules_swift_package_manager.v0.20.0.tar.gz",
    ],
)

load("@&#8203;rules_swift_package_manager//:deps.bzl", "swift_bazel_dependencies")

swift_bazel_dependencies()

load("@&#8203;cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies")

bazel_starlib_dependencies()

### MARK: - Gazelle
### gazelle:repo bazel_gazelle

load("@&#8203;bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@&#8203;rules_swift_package_manager//:go_deps.bzl", "swift_bazel_go_dependencies")
load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

### Declare Go dependencies before calling go_rules_dependencies.
swift_bazel_go_dependencies()

go_rules_dependencies()

go_register_toolchains(version = "1.19.1")

gazelle_dependencies()

### MARK: - Swift Toolchain

http_archive(
    name = "build_bazel_rules_swift",

### Populate with your preferred release 
### https://github.com/bazelbuild/rules_swift/releases
)

load(
    "@&#8203;build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)
load("//:swift_deps.bzl", "swift_dependencies")

### gazelle:repository_macro swift_deps.bzl%swift_dependencies
swift_dependencies()

swift_rules_dependencies()

load(
    "@&#8203;build_bazel_rules_swift//swift:extras.bzl",
    "swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()
```

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bazel-contrib/rules_bazel_integration_test).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate_swift_deps_for_workspace = False still requires a swift_deps.bzl file
2 participants