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

multimodule gradle (kotlin) with versions defined as constants in buildSrc #5480

Closed
toelen opened this issue Feb 14, 2020 · 7 comments · Fixed by #21892
Closed

multimodule gradle (kotlin) with versions defined as constants in buildSrc #5480

toelen opened this issue Feb 14, 2020 · 7 comments · Fixed by #21892
Assignees
Labels
auto:reproduction A minimal reproduction is necessary to proceed help wanted Help is needed or welcomed on this issue manager:gradle Gradle package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)

Comments

@toelen
Copy link

toelen commented Feb 14, 2020

When using gradle multimodule in kotlin, it is common practice to define dependency versions as constants in the buildSrc.

buildSrc/src/main/kotlin/Dependencies.kt:

object Libraries {
        object Versions {
            const val jackson = "2.9.10"
        }

    const val jacksonAnnotations = "com.fasterxml.jackson.core:jackson-annotations:${Versions.jackson}"
    const val jCache = "javax.cache:cache-api:1.1.0"
}

this constant can be used like this

build.gradle.kts:

implementation(Libraries.jacksonAnnotations)

Right now this is not picked up by renovatebot. gradle useLatestVersions does pick it up however, so I assume renovatebot does not look at the buildSrc directory

@rarkins rarkins added manager:gradle Gradle package manager type:feature Feature (new functionality) help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others ready labels Feb 14, 2020
@ikesyo
Copy link
Collaborator

ikesyo commented Feb 17, 2020

Yes this is not supported yet. See the discussion in #4086 (comment) for the details.

@toelen
Copy link
Author

toelen commented Feb 17, 2020

Does this mean the following syntax is supported const val jCache = "javax.cache:cache-api:1.1.0" (without the separate constant with only the version) but we need to add buildSrc to the fileMatch ourselves?

@ikesyo
Copy link
Collaborator

ikesyo commented Feb 17, 2020

@toelen Exactly.

const val jCacheVersion = "1.1.0"
const val jCache = "javax.cache:cache-api:$jCacheVersion"

is also supported (without property access).

@rarkins
Copy link
Collaborator

rarkins commented Mar 6, 2020

As a workaround it should be possible to add a custom rule using our new regex-based manager: https://docs.renovatebot.com/modules/manager/regex/

@rarkins
Copy link
Collaborator

rarkins commented Dec 30, 2021

FYI we have migrated to a JS-based parser for Gradle now, and would implement it there instead of the previous approach

@vaclavbenes
Copy link

Hi, Does it work with the latest version or its still unresolved? I have similar setup with dependencies store in buildSrc and latest 32.82.0 cant find them.

DEBUG: Applying enabledManagers filtering (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: \.gradle(\.kts)?$ for manager gradle (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: (^|\/)gradle\.properties$ for manager gradle (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: (^|\/)gradle\/.+\.toml$ for manager gradle (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: \.versions\.toml$ for manager gradle (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: (^|/)buildSrc/.*.kt for manager gradle (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: (^|/)gradle/wrapper/gradle-wrapper.properties$ for manager gradle-wrapper (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: (^|/|\.)pom\.xml$ for manager maven (repository=benesv/avast-android-test-utils)
DEBUG: Using file match: ^(((\.mvn)|(\.m2))/)?settings\.xml$ for manager maven (repository=benesv/avast-android-test-utils)
DEBUG: Matched 8 file(s) for manager gradle: build.gradle.kts, buildSrc/build.gradle.kts, buildSrc/settings.gradle.kts, buildSrc/src/main/kotlin/Dependencies.kt, demoTest/build.gradle, gradle.properties, settings.gradle.kts, utils/build.gradle.kts (repository=benesv/avast-android-test-utils)
DEBUG: Matched 1 file(s) for manager gradle-wrapper: gradle/wrapper/gradle-wrapper.properties (repository=benesv/avast-android-test-utils)
DEBUG: Found gradle-wrapper package files (repository=benesv/avast-android-test-utils)
DEBUG: Found 1 package file(s) (repository=benesv/avast-android-test-utils)
DEBUG: Manager explicitly enabled in "enabledManagers" config, but found no results. Possible config error? (repository=benesv/avast-android-test-utils)
"manager": "gradle"
DEBUG: Manager explicitly enabled in "enabledManagers" config, but found no results. Possible config error? (repository=benesv/avast-android-test-utils)
"manager": "maven"
INFO: Dependency extraction complete (repository=benesv/avast-android-test-utils)
"baseBranch": "master",
"stats": {
"managers": {"gradle-wrapper": {"fileCount": 1, "depCount": 1}},
"total": {"fileCount": 1, "depCount": 1}
}

@rarkins rarkins added auto:reproduction A minimal reproduction is necessary to proceed status:requirements Full requirements are not yet known, so implementation should not be started and removed status:ready labels Jun 11, 2022
@github-actions
Copy link
Contributor

Hi there,

Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible.

Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction.

We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:reproduction A minimal reproduction is necessary to proceed help wanted Help is needed or welcomed on this issue manager:gradle Gradle package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants