Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libraries #1299

Merged
merged 8 commits into from
Jul 24, 2021
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.5.20'
ext.spotless = "5.14.0"
ext.anvil_version = "2.3.3"

Expand All @@ -16,7 +14,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:_"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aitorvs I think this is the way we can avoid having to duplicate the kotlin version in 2 files, but not 100% sure.

By executing ./gradlew buildEnvironment seems this will work: org.jetbrains.kotlin:kotlin-gradle-plugin:{require 1.5.20; reject _} -> 1.5.20, so I guess is ok

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting! I seems it works because the _ is not really a valid version and then it falls back to any other (latest) version we might have. I think a more secure approach might be the following, in the root build.gradle

buildscript {
    def versionPropsFile = file('versions.properties')
    Properties versionProps = new Properties()

    if (versionPropsFile.canRead()) {
        versionProps.load(new FileInputStream(versionPropsFile))
    }

    ext.kotlin_version = versionProps['version.kotlin']
    ...

classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless"
classpath "com.squareup.anvil:gradle-plugin:$anvil_version"

Expand Down