如何确定需要哪个平台版本?
这种情况经常出现:我已经构建了软件,并且可能使用了某些版本(例如 Java 1.6.10 或 PHP 5.2)以上版本中可用的一些新语言/平台/标准库功能,但我当然不能完全做到这一点。记住。 我只确定它至少可以在我正在使用的版本上运行(通常是可用的最新版本),但它也可能在较旧的版本上运行。
手动检查代码、保留列表并将其与平台发行说明进行比较显然不是非常复杂的选择。 有没有办法自动执行此操作(除了烘焙您自己的版本检查器解析器之外)? 就我个人而言,我至少对以下语言感兴趣,但请自由添加:
- Java
- Python
- PHP
- C++(也许还有 C)
- 添加您最喜欢的语言。
简单地在旧版本上进行测试是一种蛮力方法,它的优点是您可以知道代码是否实际上工作,而不仅仅是它应该工作。 但这可能很乏味,所以我仍然对某种自动机感兴趣,它可以遍历源代码并检查正在使用哪些平台功能。
This frequently comes up: I've built software, and possibly used some new language / platform / standard library features that are available on some version (say, Java 1.6.10 or PHP 5.2) upwards, but of course I can't exactly remember. I'm only sure that it runs at least on the version I'm using (which is typically the newest version available), but it might well run on a bit older version too.
Going manually through the code, keeping a list and comparing it with platform release notes obviously isn't very sophisticated option. Is there a way to automatically do this (aside from baking your own version-checker parser)? Personally I'm interested in at least the following languages, but please add freely:
- Java
- Python
- PHP
- C++ (and maybe C)
- add your favorite.
Simply testing at the older versions is a brute force approach, and it has the advantage that you'll know whether the code actually works, not merely that it should work. But it can be tedious, so I'm still interested in some kind of automata that goes through the source and checks which platform features are being used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先想到的是持续集成的构建自动化。 如果您在不同的机器上进行测试,您会发现哪个版本破坏了您的代码。
Continuous integration's Build Automation is the first thing that comes to mind. If you're testing against different machines, you'll discover which version breaks your code.