什么是 Eclipse PDT 中的“API 基线"

2022-01-16 00:00:00 eclipse-plugin java eclipse eclipse-pde pde

自从升级到 Eclipse 3.7 后,Eclipse PDE 插件希望我为我的所有 Eclipse 插件项目指定一个API 基线".

Since upgrading to Eclipse 3.7, the Eclipse PDE plugin wants me to specify an 'API Baseline' for all my Eclipse Plugin projects.

但是,似乎没有任何文档能够真正解释API Baseline"在这里代表什么以及它的用途.

However there seems to be no documentation which actually explains what 'API Baseline' stands for here, and what is it used for.

谁能解释一下?

推荐答案

API Baseline 旨在帮助您维护其他人可以使用的插件.API 工具可帮助您创建兼容的 API 版本.按照 Sumit Singh 发布的链接获取有关如何使用它们的说明.

API Baseline are intended to help you maintain plugins that others can use. The API Tools help you create compatible API versions. Follow the link that Sumit Singh posted to get an explanation on how to use them.

  1. 您创建插件并向公众发布版本 1.
  2. 数百万人将使用您的插件并根据您插件的 API 创建自己的代码.
  3. 您向公众发布了第 2 版.错误地您更改了插件的 API.
  4. 数百万人更新到新版本并不得不调整他们的代码.数以千计的程序失败.人们很伤心.
  1. You create your plugin and release version 1 to the public.
  2. Millions of people will use your plugin and create their own code that depends on the API of your plugin.
  3. You release version 2 to the public. By mistake you change the API of your plugin.
  4. Millions of people update to the new version and have to adapt their code. Thousands of programs fail. People are sad.

解决方案:

  1. 您创建插件,注释其 API 并向公众发布版本 1.
  2. 数百万人将使用您的插件并根据您插件的 API 创建自己的代码.
  3. 您将插件的第 1 版声明为 API-Baseline,您的代码更改会自动与之进行比较.API 中的任何中断都会在您发布插件或运行测试之前呈现给您.您发布的第 2 版没有任何 API 更改.
  4. 数百万人可以在他们的应用程序中更新您的插件,因为新的插件版本与之前的版本兼容.
  5. 您声明了您的插件的版本 2 ....
  1. You create your plugin, annotate its API and release version 1 to the public.
  2. Millions of people will use your plugin and create their own code that depends on the API of your plugin.
  3. You declare version 1 of your plugin to be the API-Baseline that your code changes are automatically compared against. Any break in the API is presented to you before you release your plugin or run your tests. You release version 2 without any API changes.
  4. Millions of people can update your plugin in their application, because the new plugin release is binary compatible to the previous one.
  5. You declare version 2 of your plugin ....

总结

如果您开发的插件仅供您个人使用,并且对维护兼容的 API 不感兴趣,您可以按照建议禁用警告.

Summary

If you develop a plugin just for your personal use and are not interested to maintain a compatible API, you can follow the advices to disable the warnings.

当您为社区开发插件时,例如.G.Eclipse 插件本身,必须将 API 不兼容性降至最低.然后你会按照建议,在为 4.3 开发时将基线设置为 4.2.API 工具将帮助您让 4.3 成为所有当前 4.2 用户的享受.

When you develop plugins for a community, e. g. the eclipse plugins themselves, it is essential that you keep API incompatibilities to a minimum. Then you will follow the advice and set the baseline to 4.2 when you develop for 4.3. The API tools will help you make 4.3 an enjoyment for all current 4.2 users.

请注意,API 工具是供其他人使用的插件的开发人员使用的.它们不是针对这些插件的用户的.

Please note, that the API Tools are for the developers of the plugins that will be used by others. They are not addressed at the users of those plugins.

相关文章