2017-05-09 101 views
0

外部属性特征从SonarQube扫描仪,可以从sonar-project.properties中引用变量的2.9版本开始:使用SonarQube扫描器

https://www.sonarsource.com/resources/product-news/2017/03/2017-03-15-sonarqube-scanner-2.9-released.html

对我来说,这个功能的明显的使用情况是避免必须申报两次项目的版本(一次在代码中,一次在sonar-project.properties)。

例如,在Swift项目中,版本在.plist文件中定义为XML值。 是否有一个明显简单的方法来检索该值并在sonar-project.properties文件中引用它?

更新:我设法得到这个在TeamCity的构建工作(命令行构建步骤):

echo "##teamcity[setParameter name='env.APP_VERSION' value='$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "MyApp/Info.plist")']" 

,然后引用变量sonar-project.properties

sonar.projectVersion=${env.APP_VERSION} 

回答

2

没有'明显简单的方法',我可以想到。一种方法可能是让一个小脚本从.plist中选取版本并将其设置为环境变量。环境变量,然后可以从sonar-project.propertiesbe referenced