栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

仅处理更改的文件

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

仅处理更改的文件

我安装了Groovy插件,配置了Groovy语言,并创建了一个脚本,然后将其作为“系统Groovy脚本”执行。脚本看起来像:

import java.lang.ProcessBuilder.Redirectimport hudson.model.*import hudson.util.*import hudson.scm.*import hudson.scm.SubversionChangeLogSet.LogEntry// uncomment one of the following def build = ... lines// work with current builddef build = Thread.currentThread()?.executable// for testing, use last build or specific build number//def item = hudson.model.Hudson.instance.getItem("Update_SRC_Branch") //def build = item.getLastBuild()   //def build = item.getBuildByNumber(35)// get ChangesSets with all changed itemsdef changeSet= build.getChangeSet()List<LogEntry> items = changeSet.getItems()def affectedFiles = items.collect { it.paths }// get filtered file names (only fmb) without pathdef fileNames = affectedFiles.flatten().findResults {    if (it.path.substring(it.path.lastIndexOf(".") + 1) != "fmb") return null    it.path.substring(it.path.lastIndexOf("/") + 1)}.sort().unique()// setup log filesdef stdOutFile = "${build.rootDir}\stdout.txt"def stdErrFile = "${build.rootDir}\stderr.txt"// now execute the external transformingfileNames.each {    def params = [...]    def processBuilder = new ProcessBuilder(params)    // redirect stdout and stderr to log files    processBuilder.redirectOutput(new File(stdOutFile))    processBuilder.redirectError(new File(stdErrFile))    def process = processBuilder.start()    process.waitFor()    // print log files    println new File(stdOutFile).readLines()    System.err.println new File(stdErrFile).readLines()}

之后,我在命令行中使用“ svn commit”来提交更新的文件。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/413343.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号