Skip to content

Commit 3c7782a

Browse files
committed
Document tag_pattern for git dependencies
1 parent c146985 commit 3c7782a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/content/tools/pub/dependencies.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,29 @@ The ref can be anything that Git allows to [identify a commit.][commit]
171171

172172
[commit]: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#naming-commits
173173

174+
If the package you depend on has tagged the revision of each version of the
175+
package, you can use `tag_pattern` instead of `ref`, together with a version
176+
constraint.
177+
178+
Pub will then query Git for all matching tags, and feed those version to the
179+
version solver.
180+
181+
```yaml
182+
dependencies:
183+
kittens:
184+
git:
185+
url: [email protected]:munificent/kittens.git
186+
tag_pattern: v{{version}} # Find version-tag prefixed by 'v'.
187+
version: ^2.0.1
188+
```
189+
190+
:::version-note
191+
Support for `tag_pattern` was introduced in Dart 3.9.0.
192+
193+
To use pub workspaces, the including pubspec (but not the dependency)
194+
must have an SDK version constraint of `^3.9.0` or higher.
195+
:::
196+
174197
Pub assumes that the package is in the root of the Git repository. To specify a
175198
different location in the repo, specify a `path` relative to the repository
176199
root:

0 commit comments

Comments
 (0)