【发布时间】:2018-05-08 23:28:28
【问题描述】:
我正在寻找编写一个 bash 脚本来解析 gradle 构建文件并生成其中包含的依赖项列表。 我还需要考虑依赖版本号是变量(在根级 gradle 文件中定义。
任何有关我如何解决此问题的建议将不胜感激。谢谢。
示例 gradle:
apply plugin: 'com.android.application'
android {
....
}
dependencies {
compile "com.android.support:design:$support"
compile "com.android.support:cardview-v7:$support"
compile "com.mixpanel.android:mixpanel-android:$mixpanel"
compile "com.google.firebase:firebase-core:$playServices"
compile 'io.reactivex:rxandroid:1.2.0'
}
示例输出:
com.android.support:design:25.3.1
com.android.support:cardview-v7:25.3.1
com.mixpanel.android:mixpanel-android:4.8.7
com.google.firebase:firebase-core:11.0.2
io.reactivex:rxandroid:1.2.0
【问题讨论】:
-
有一个
sed命令,虽然很糟糕,但很有效,这取决于你想如何解决这个问题,我个人会创建一个小python脚本来用一个arg调用它。 -
我考虑过使用 python(并且更喜欢它),但这将在我不完全确定是否有 python 的 jenkins 服务器上运行。所以我在考虑使用 bash 脚本来保证安全。
-
Python 预装在大多数 Linux 发行版中,
-
嗯,这是真的.. 我会研究这个 sed 命令
标签: android python bash shell gradle