NAnt:返回/设置对象集合的任务?
我想通过添加 p4 标签
NAntContrib 的 Perforce 任务集> 任务。
p4labels
任务必须返回标签集合,甚至理想情况下,返回标签信息集合:名称、日期/时间、描述。
查看 NAntContrib 的其他调用代码 (p4info
< /a> 例如),看起来从任务返回简单字符串相当容易,但我还没有找到返回标签集合的方法。例如,潜在的用途是稍后将此集合传递给函数以获取集合中的最新标签,或传递给 foreach 任务以迭代以处理集合中的每个标签。
这在 NAnt 中可能吗?从我所看到的来看,您似乎可以声明集合和集合,但不能从任务或函数中返回它们。
作为记录,我声明了一个 LabelInfo
NAnt 类型以及一个 LabelInfoCollection
,但实际上我不知道如何从任务中返回一个类型。
欢迎任何提示。
I'd like to augment NAntContrib's set of Perforce tasks by adding the p4 labels
task.
The p4labels
task would have to return a collection of labels, or even ideally, a collection of label info: name, date/time, description.
Looking into NAntContrib's code for other call (p4info
for example), it looks like it's rather easy to return simple strings from a task, but I've not managed to find a way to return a collection of labels. A potential use would be to later pass this collection to a function to get the latest label in the collection or to a foreach
task to iterate over to deal with each within the collection, for example.
Is this even possible in NAnt? From all I've seen, it seems you can declare sets and collections, but not return them from a task or a function.
For the record, I've declared a LabelInfo
NAnt type as well as a LabelInfoCollection
, but really I don't know how I would return one from a task.
Any tips are welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 NAntContrib 的
sql
task 处理返回一组值的策略,似乎解决方案是将数据存储在文件并将该文件传递给需要数据的任何函数或任务。然后可以将其传递到文件
foreach< /code> 任务
可以迭代 行。以 CSV 格式存储的数据非常容易解析:
Looking at NAntContrib's
sql
task's strategy to deal with returning a set of values, it seems a solution would be to store the data in a file and pass that file to whatever function or task requiring the data.It'd then possible to pass this to file to a
foreach
task that can iterate over the lines in the file. Data stored in CSV format is very easy to parse: