-
Notifications
You must be signed in to change notification settings - Fork 15
Project Sync Feature
lmj0011 edited this page Jun 21, 2020
·
5 revisions
Project Sync gives you the ability to track the versions of the androidx.* libraries used in your Android projects.
- know when a newer library version is available
- for each of your projects, decide whether to track stable or pre-release versions
First you will need to configure your app's build.gradle
to produce a text file that will have a list of your app's gradle dependencies. Put the following snippet inside the android{}
block of your app's build.gradle
file
task generateDependencyListFile {
configurations.implementation.setCanBeResolved(true)
configurations.androidTestImplementation.setCanBeResolved(true)
doLast {
def str = "# auto-generated from ${this.name}; this file should be checked into version control\n"
def resolvedImplementationConfig = configurations.implementation.resolvedConfiguration
def resolvedAndroidTestImplementationConfig = configurations.androidTestImplementation.resolvedConfiguration
resolvedImplementationConfig.firstLevelModuleDependencies.each { dep ->
str += "${dep.moduleGroup}:${dep.moduleName}:${dep.moduleVersion}\n"
}
resolvedAndroidTestImplementationConfig.firstLevelModuleDependencies.each { dep ->
str += "${dep.moduleGroup}:${dep.moduleName}:${dep.moduleVersion}\n"
}
new File(projectDir, "deps.list.txt").text = str
}
}
preBuild.dependsOn(generateDependencyListFile)
note: You may need to update this snippet to suite your project.
Once you have included the snippet and rebuilt the app, there should be a new text file in the app's root directory with a list of your app's dependencies, like for example:
# auto-generated from app; this file should be checked into version control
androidx.databinding:databinding-common:3.6.3
androidx.databinding:databinding-runtime:3.6.3
androidx.databinding:databinding-adapters:3.6.3
org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.71
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71
androidx.appcompat:appcompat:1.0.0
androidx.core:core-ktx:1.2.0
com.google.android.material:material:1.1.0
androidx.constraintlayout:constraintlayout:1.1.3
androidx.navigation:navigation-fragment:2.2.2
androidx.navigation:navigation-fragment-ktx:2.2.2
androidx.navigation:navigation-ui:2.2.2
androidx.navigation:navigation-ui-ktx:2.2.2
androidx.room:room-runtime:2.2.5
com.google.code.gson:gson:2.8.6
androidx.lifecycle:lifecycle-extensions:2.2.0
androidx.preference:preference-ktx:1.1.1
androidx.work:work-runtime-ktx:2.3.4
com.google.firebase:firebase-analytics-ktx:17.4.3
com.google.firebase:firebase-crashlytics:17.0.1
com.jakewharton.timber:timber:4.7.1
com.vdurmont:semver4j:3.1.0
br.com.simplepass:loading-button-android:2.2.0
androidx.vectordrawable:vectordrawable:1.1.0
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0
That's it, you should now check the file into version control and/or host it publicly to allow tracking it in Jetpack Release Tracker