|
| 1 | +# Releasing the `analyzer` package and related packages |
| 2 | + |
| 3 | +The `analyzer` package is released simultaneously with several other packages. |
| 4 | +This is because we generally do not have tooling in the Dart SDK repository |
| 5 | +that shows us when code from a given package starts using _unreleased_ |
| 6 | +functionality from the `analyzer` package. Similarly, we do not have tooling |
| 7 | +that shows us when code from the `analyzer` package starts using _unreleased_ |
| 8 | +functionality from the `_fe_analyzer_shared` package. |
| 9 | + |
| 10 | +This document describes the publishing policies for the `analyzer` package and |
| 11 | +related packages which are developed in the Dart SDK repository, including: |
| 12 | + |
| 13 | +* `_fe_analyzer_shared` ([source][_fe_analyzer_shared source], [pub package][_fe_analyzer_shared pub package]), |
| 14 | +* `analyzer` ([source][analyzer source], [pub package][analyzer pub package]), |
| 15 | +* `analyzer_plugin` ([source][analyzer_plugin source], [pub package][analyzer_plugin pub package]), |
| 16 | +* `analyzer_testing` ([source][analyzer_testing source], (not yet published)), |
| 17 | +* `analysis_server_plugin` ([source][analysis_server_plugin source], [pub package][analysis_server_plugin pub package]), |
| 18 | + |
| 19 | +## Depending on unreleased code |
| 20 | + |
| 21 | +The main concern in these release policies is that all of these packages are |
| 22 | +developed in the Dart SDK repository, and so they all depend on each other "at |
| 23 | +main branch HEAD." We also don't track when one package depends on new, |
| 24 | +_unreleased_ code in another package. Any commit that touches one package and a |
| 25 | +dependant package could be introducing a dependency on unreleased code. Because |
| 26 | +we do not manually track commits like this (and even if we did, it would be |
| 27 | +error-prone), it should be assumed that at any given point in time, code in one |
| 28 | +of these packages depends on unreleased code in another package. To safely keep |
| 29 | +such packages in sync, they should be released simultaneously. |
| 30 | + |
| 31 | +## The `analyzer` and `_fe_analyzer_shared` packages |
| 32 | + |
| 33 | +The `_fe_analyzer_shared` package is published to pub, so that the `analyzer` |
| 34 | +package can use it, but it is not meant to be consumed by any other packages on |
| 35 | +pub. The policy is to just call _every_ new release of the |
| 36 | +`_fe_analyzer_shared` package a breaking release. The `_fe_analyzer_shared` |
| 37 | +package must be released each time the `analyzer` package is released, with a |
| 38 | +major version bump. The version of the `analyzer` package being released must |
| 39 | +then depend on exactly that new version of the `_fe_analyzer_shared` package. |
| 40 | +(Technically a caret dependency, like `_fe_analyzer_shared: ^82.0.0` would |
| 41 | +work, but it doesn't really make sense given that we only version the |
| 42 | +`_fe_analyzer_shared` package with major version releases.) |
| 43 | + |
| 44 | +One way the `_fe_analyzer_shared` package discourages anyone from depending on |
| 45 | +it directly is that the `lib` directory contains no files or directories except |
| 46 | +the `src` directory. Importing directly from the `_fe_analyzer_shared` |
| 47 | +package's `lib/src` directory is a strong signal that a user is doing something |
| 48 | +ill-advised. |
| 49 | + |
| 50 | +See for example: |
| 51 | + |
| 52 | +* Commit that prepares analyzer 7.4.0 and `_fe_analyzer_shared` 81.0.0: |
| 53 | + https://github.com/dart-lang/sdk/commit/1f4fddd023ee9fe2c5565b5606b3f7bb7be6287b |
| 54 | +* Commit that prepares analyzer 7.4.1 and `_fe_analyzer_shared` 82.0.0: |
| 55 | + https://github.com/dart-lang/sdk/commit/f8399893021b017ee57edbda49f5fec9db57b1bc |
| 56 | + |
| 57 | +## The `analyzer_plugin` and `analyzer` packages |
| 58 | + |
| 59 | +The `analyzer_plugin` package is published to pub for developers of _legacy_ |
| 60 | +analyzer plugins and developers of _new_ analyzer plugins. The code in the |
| 61 | +`analyzer_plugin` package depends on private implementation code of the |
| 62 | +`analyzer` package, so it must be released whenever the `analyzer` package is |
| 63 | +released. |
| 64 | + |
| 65 | +The versioning of the `analyzer_plugin` package can follow basic semantic |
| 66 | +versioning based on its own API. |
| 67 | + |
| 68 | +TODO: Should we also have an "exact version dependency" policy for the |
| 69 | +`analyzer_plugin` package's dependency on the `analyzer` package? I believe so, |
| 70 | +given the "freely use private implementation" situation. |
| 71 | + |
| 72 | +## The `analyzer_testing` and `analyzer` packages |
| 73 | + |
| 74 | +The `analyzer_testing` package will be published to pub for developers of _new_ |
| 75 | +analyzer plugins. The code in the `analyzer_testing` package depends on private |
| 76 | +implementation code of the `analyzer` package, so it must be released whenever |
| 77 | +the `analyzer` package is released. |
| 78 | + |
| 79 | +The versioning of the `analyzer_testing` package can follow basic semantic |
| 80 | +versioning based on its own API. |
| 81 | + |
| 82 | +TODO: Should we also have an "exact version dependency" policy for the |
| 83 | +`analyzer_testing` package's dependency on the `analyzer` package? I believe |
| 84 | +so, given the "freely use private implementation" situation. |
| 85 | + |
| 86 | +## The `analysis_server_plugin` and `analyzer` packages |
| 87 | + |
| 88 | +The `analysis_server_plugin` package will be published to pub for developers of |
| 89 | +_new_ analyzer plugins. The code in the `analysis_server_plugin` package |
| 90 | +depends on private implementation code of the `analyzer` package, so it must be |
| 91 | +released whenever the `analyzer` package is released. |
| 92 | + |
| 93 | +The versioning of the `analysis_server_plugin` package can follow basic |
| 94 | +semantic versioning based on its own API. |
| 95 | + |
| 96 | +TODO: Should we also have an "exact version dependency" policy for the |
| 97 | +`analysis_server_plugin` package's dependency on the `analyzer` package? I |
| 98 | +believe so, given the "freely use private implementation" situation. |
| 99 | + |
| 100 | +[_fe_analyzer_shared source]: https://github.com/dart-lang/sdk/tree/main/pkg/_fe_analyzer_shared |
| 101 | +[_fe_analyzer_shared pub package]: https://pub.dev/packages/_fe_analyzer_shared |
| 102 | +[analyzer source]: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer |
| 103 | +[analyzer pub package]: https://pub.dev/packages/analyzer |
| 104 | +[analyzer_plugin source]: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer_plugin |
| 105 | +[analyzer_plugin pub package]: https://pub.dev/packages/analyzer_plugin |
| 106 | +[analyzer_testing source]: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer_testing |
| 107 | +[analysis_server_plugin source]: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_plugin |
| 108 | +[analysis_server_plugin pub package]: https://pub.dev/packages/analysis_server_plugin |
0 commit comments