如何在Gradle for Android中获得SVN修订版?

编程入门 行业动态 更新时间:2024-10-15 12:35:13
本文介绍了如何在Gradle for Android中获得SVN修订版?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在资源中有field(svn revision)。如何在Gradle中使用我的字段中的svn修订版,而不是通过我的手来完成这项工作? 您可以修改以下解决方案,此处解释,它打印出当前的SVN版本。

//文件:build.gradle 任务svninfo<< ; { new ByteArrayOutputStream()。withStream {os - > def result = exec { executable ='svn' args = ['info'] standardOutput = os } def outputAsString = os。 toString() def matchLastChangedRev = outputAsString =〜/ Last Lastd Rev:(\d +)/ println最新更改版本#:$ {matchLastChangedRev [0] [1]} } } // svn info输出示例: //路径:。 // URL:svn.host/svn/project //存储库根目录:svn.host/svn/ //存储库UUID:9de3ae54-a9c2 -4644-a1a1-838cb992bc8e //修正版本:33 //节点类型:目录 //计划:正常 //最后更改作者:mrhaki / / Last Changed Rev:33 //最后修改日期:2010-09-03 14:25:41 +0200(星期五,2010年9月3日)

I have field (svn revision) in resource. How can I get svn revision in my field using by Gradle, that not to do that by my hands?

解决方案

You could modify the following solution, explained here, which prints out the current SVN revision.

// File: build.gradle task svninfo << { new ByteArrayOutputStream().withStream { os -> def result = exec { executable = 'svn' args = ['info'] standardOutput = os } def outputAsString = os.toString() def matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/ println "Latest Changed Revision #: ${matchLastChangedRev[0][1]}" } } // Example output for svn info: // Path: . // URL: svn.host/svn/project // Repository Root: svn.host/svn/ // Repository UUID: 9de3ae54-a9c2-4644-a1a1-838cb992bc8e // Revision: 33 // Node Kind: directory // Schedule: normal // Last Changed Author: mrhaki // Last Changed Rev: 33 // Last Changed Date: 2010-09-03 14:25:41 +0200 (Fri, 03 Sep 2010)

更多推荐

如何在Gradle for Android中获得SVN修订版?

本文发布于:2023-11-06 20:36:53,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:修订版   如何在   Android   Gradle   SVN

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!