问题描述
我有一个我想要导入到的Gradle项目来检查我的依赖关系是否达到日期,但它是一个复杂的配置文件(包含外部变量等),并且Versioneye无法正确处理依赖项。
我不想安装Versioneye gradle插件。
如何将依赖关系从我的repo导出到Versioneye?
gradle app:dependencies
。 通过一些字符串操作,您可以导出一个干净的依赖关系文件并手动将其上传到Versioneye。
#! / bin / bash
OUT_DIR ='versioneye'
OUT_FILE =$ {OUT_DIR} /build.gradle
mkdir -p$ {OUT_DIR}
touch$ {OUT_FILE}
#从build.gra复制你的maven仓库闭包dle
tee$ {OUT_FILE}<<< EOF> / dev / null
allprojects {
repositories {
maven {
url'https:/ /maven.google.com/maven-google-remote'
}
maven {
urlhttps://jitpack.io
}
}
}
EOF
echo'dependencies {'>> $ {OUT_FILE}
./gradlew app:dependencies | grep'^ + ---'| sed's | + --- | compile|'| sed's |(\ *)|| g'| sed's | $ ||'| sort -u>> $ {OUT_FILE}
echo'}'>> $ {OUT_FILE}
猫$ {OUT_FILE}
cd$ {OUT_DIR}
开始。
cd -
echo'现在,打开versioneye.com并手动上传genreated build.gradle文件。'
这会生成一个如下所示的文件:
allprojects {
存储库{
maven {
url'https://maven.google.com/maven-google-remote'
}
maven {
urlhttps://jitpack.io
}
...
}
}
依赖关系{
compilecom。 android.support.test.espresso:espresso-contrib:2.2.2
compilecom.android.support.test.espresso:espresso-core:2.2.2
compilecom.android。 support.test.espresso:espresso-intents:2.2.2
compilecom.facebook.android:facebook-android-sdk:4.17.0
compilecom.facebook.fresco:fresco: 1.5.0
compilecom.facebook.fresco:imagepipeline-okhttp3:1.5.0
...
}
这个文件可以导入d到带有文件上传的Versioneye,并且将被正确处理。
I have a Gradle project that I want to import to Versioneye to check if my dependencies are up to date, but it's a complex config file (with external variables etc.) and Versioneye does not manage to handle the dependencies properly.
I don't want to install the Versioneye gradle plugin.
How can I export the dependencies from my repo to Versioneye?
You can list all the dependencies gradle app:dependencies
.
With a bit of string manipulation, you can export a "clean" dependencies file and manually upload it to Versioneye.
#!/bin/bash
OUT_DIR='versioneye'
OUT_FILE="${OUT_DIR}/build.gradle"
mkdir -p "${OUT_DIR}"
touch "${OUT_FILE}"
# copy your maven repositories closure below from build.gradle
tee "${OUT_FILE}" <<EOF >/dev/null
allprojects {
repositories {
maven {
url 'https://maven.google.com/maven-google-remote'
}
maven {
url "https://jitpack.io"
}
}
}
EOF
echo 'dependencies {' >> "${OUT_FILE}"
./gradlew app:dependencies | grep '^+---' | sed 's|+--- |compile "|' | sed 's| (\*)||g' | sed 's|$|"|' | sort -u >> "${OUT_FILE}"
echo '}' >> "${OUT_FILE}"
cat "${OUT_FILE}"
cd "${OUT_DIR}"
start .
cd -
echo 'Now, open versioneye.com and manually upload the genreated build.gradle file.'
This will generate a file that looks like this:
allprojects {
repositories {
maven {
url 'https://maven.google.com/maven-google-remote'
}
maven {
url "https://jitpack.io"
}
...
}
}
dependencies {
compile "com.android.support.test.espresso:espresso-contrib:2.2.2"
compile "com.android.support.test.espresso:espresso-core:2.2.2"
compile "com.android.support.test.espresso:espresso-intents:2.2.2"
compile "com.facebook.android:facebook-android-sdk:4.17.0"
compile "com.facebook.fresco:fresco:1.5.0"
compile "com.facebook.fresco:imagepipeline-okhttp3:1.5.0"
...
}
This file can be imported to Versioneye with a file upload and will be processed correctly.
这篇关于如何制作一个Gradle项目versioneye友好的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!