Skip to content

Commit

Permalink
Add dependencies version check plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Jun 6, 2020
1 parent 9b7e3b1 commit 51de2a2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ dependencies {
implementation "com.github.skydoves:sandwich:$versions.sandwichVersion"
implementation "com.squareup.retrofit2:retrofit:$versions.retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$versions.okhttpVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$versions.mockWebServerVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$versions.okhttpVersion"

// moshi
implementation "com.squareup.moshi:moshi-kotlin:$versions.moshiVersion"
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
apply from: './versionsPlugin.gradle'

buildscript {
apply from: './dependencies.gradle'
repositories {
Expand All @@ -27,6 +29,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
classpath "com.google.dagger:hilt-android-gradle-plugin:$versions.daggerHiltAndroidVersion"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$versions.spotlessGradle"
classpath "com.github.ben-manes:gradle-versions-plugin:$versions.versionPlugin"
}
}

Expand Down
12 changes: 6 additions & 6 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ext.versions = [
// gradle plugins
gradleBuildTool : '4.0.0',
spotlessGradle : '4.0.1',
versionPlugin : '0.28.0',

// kotlin
kotlin : '1.3.72',
Expand All @@ -42,8 +43,8 @@ ext.versions = [
daggerHiltVersion : '1.0.0-SNAPSHOT',

// network
retrofitVersion : '2.7.2',
okhttpVersion : '4.1.0',
retrofitVersion : '2.9.0',
okhttpVersion : '4.7.2',
sandwichVersion : '1.0.1',

// moshi
Expand All @@ -54,7 +55,7 @@ ext.versions = [
coroutinesVersion : '1.3.0',

// glide
glideVersion : '4.10.0',
glideVersion : '4.11.0',
glidePaletteVersion : '2.1.2',

// transformation
Expand All @@ -81,12 +82,11 @@ ext.versions = [
// unit test
truthVersion : '1.0.1',
junitVersion : '4.12',
robolectricVersion : '4.3',
robolectricVersion : '4.3.1',
androidxTest : '1.1.0',
androidxTestJunit : '1.1.2-rc01',
androidTestRunner : '1.3.0-beta01',
espressoVersion : '3.2.0',
mockWebServerVersion : '4.6.0',
mockitoKotlinVersion : '2.2.0',
mockitoInlineVersion : '2.21.0'
mockitoInlineVersion : '3.3.3'
]
14 changes: 14 additions & 0 deletions versionsPlugin.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apply plugin: "com.github.ben-manes.versions"

dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Not stable')
}
}
}
}

0 comments on commit 51de2a2

Please sign in to comment.