kevcodez / gradle-upgrade-interactive

CLI to interactively upgrade gradle dependencies, inspired by yarn.
MIT License
56 stars 9 forks source link

in multi-project case the version in the sub-project's build.gradle files do not replaced #4

Closed lfarkas closed 4 years ago

lfarkas commented 4 years ago

even if i select all dependencies to update, only the toplevel build.gradle was edited and all others remain the seme (even without an error or warning message).

kevcodez commented 4 years ago

@lfarkas thanks for the report. Could you create a small reproducible project? It doesn't need any source code, just some directory hierarchy and the gradle files containing the dependency that you want to upgrade . I'd greatly appreciate that.

lfarkas commented 4 years ago

here is a small example: https://guides.gradle.org/creating-multi-project-builds/ or this one https://docs.gradle.org/current/userguide/multi_project_builds.html. but here is a full example: https://rominirani.com/gradle-tutorial-part-3-multiple-java-projects-5b1c4d1fbd8d in the download link: https://drive.google.com/file/d/0B49Q1BZG4BXcbzFOUHU1clR5TWM/view?usp=sharing or this one: https://github.com/chhh/testing-multi-level-gradle-projects

kevcodez commented 4 years ago

@lfarkas Thanks. I'll have a look during the weekend

kevcodez commented 4 years ago

@lfarkas Released version 0.5.0 with multi-project support. Could you give it a spin?

npm install -g gradle-upgrade-interactive

Run gradle-upgrade-interactive in the gradle project root directory

lfarkas commented 4 years ago

now something strange happened. it can'f find the local gradlew:

# ./gradlew --version

------------------------------------------------------------
Gradle 6.1.1
------------------------------------------------------------

Build time:   2020-01-24 22:30:24 UTC
Revision:     a8c3750babb99d1894378073499d6716a1a1fa5d

Kotlin:       1.3.61
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_242 (Oracle Corporation 25.242-b08)
OS:           Linux 5.4.17-200.fc31.x86_64 amd64

# gradle-upgrade-interactive
Unable to find Gradle Wrapper or Gradle CLI.
kevcodez commented 4 years ago

@lfarkas Published version 0.5.1. Please install the latest version and try again.

If it does not work, please run gradle-upgrade-interactive -d and post the output.

lfarkas commented 4 years ago
# gradle-upgrade-interactive -d
Determining gradle command
isWindows: false
Checking if wrapper file gradlew exists
Determined gradle command: null, wrapper: false
Unable to find Gradle Wrapper or Gradle CLI.
# ls -al gradlew
-rwxrwxr-x 1 lfarkas lfarkas 5764 Jan 30 15:07 gradlew*
kevcodez commented 4 years ago

Released 0.5.2, please upgrade again. I was actually missing an import after the internal refactorings.

Sorry for the hustle.

lfarkas commented 4 years ago

still the same.

kevcodez commented 4 years ago

Same output with gradle-upgrade-interactive -d?

gradle-upgrade-interactive --version showing 0.5.2?

lfarkas commented 4 years ago

ops sorry run in a wrong directory! now just check it's working properly...but seems to very slow...

kevcodez commented 4 years ago

The initial call to get dependencyUpdates (using the versions plugin) can be rather slow. After the first call, it should be way faster. I will also investigate whether it's an issue in my code. I am pretty much just delegating the call to the gradle plugin and getting the results.

It may also depend on your maven repositories. Run ./gradlew dependencyUpdates to see if it's fast. If ./gradlew dependencyUpdates is fast and gradle-upgrade-interactive is slow, then that's my bad.

I'll have a look.

lfarkas commented 4 years ago

working:-) except the for som unknown reasone it's always find me this update:

kevcodez commented 4 years ago

Thanks for sticking by @lfarkas !

kevcodez commented 4 years ago

By the way, you can also configure the versions plugin to reject certain versions. Check https://github.com/ben-manes/gradle-versions-plugin

That way, that specific version wouldn't pop up all the time.

lfarkas commented 4 years ago

still not working in subprojects...ie. show there are nbewer version i can select the but do not replace the version

kevcodez commented 4 years ago

@lfarkas Can you please attach the parent build.gradle and the child build.gradle and tell me which version doesn't get replaced?

It's also enough if you only include the affected dependency/variables from the two files in the gradle build files, you can remove the rest.

The CLI is mostly doing string replacements, so there might be some patterns that are not matched yet and simply need to be added.

kevcodez commented 4 years ago

Released 0.6.0 that has better support for multi-project builds better. Still, without an example it is going to be hard to reproduce, it might just be a missing pattern.

lfarkas commented 4 years ago

sorry i forget about it. what should i have to show? this's a multi level gradle build but here are the relevant part as you can see eg in face/app/build.gradle tika-core - 1.23 => 1.24 but it's not working.

kevcodez commented 4 years ago

Released 0.6.1

Build file search is now recursively. Previously, only build files below the current directory were found.

lfarkas commented 4 years ago

now i've got and error for a broken link: gradle-upgrade-interactive internal/fs/utils.js:230 throw err; ^

Error: ENOENT: no such file or directory, stat './vidux/data/vhv/var/www/html/vhv/data' at Object.statSync (fs.js:932:3) at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:41:14 at Array.forEach () at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:40:11) at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:42:24 at Array.forEach () at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:40:11) at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:42:24 at Array.forEach () at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:40:11) { errno: -2, syscall: 'stat', code: 'ENOENT', path: './vidux/data/vhv/var/www/html/vhv/data'

kevcodez commented 4 years ago

I released 0.6.4 with a few fixes. I was able to test this successfully on a multi-project build on windows.

But seems to very slow...

I was able to pinpoint one issue that hopefully resolves the "hanging" completely.

The build files should also properly resolve on linux now, in case they don't, you can also paste the debug log here using gradle-upgrade-interactive -d after upgrading to 0.6.4.

Thank you for not giving up on me yet and helping me troubleshoot :see_no_evil:

lfarkas commented 4 years ago

same error for broken link

kevcodez commented 4 years ago

Can you please run it using -d so I can see the debug output?

lfarkas commented 4 years ago

nothing else:

gradle-upgrade-interactive -d
Determining gradle command
isWindows: false
Checking if wrapper file gradlew exists
Wrapper file exists
Determined gradle command: ./gradlew, wrapper: true
Recursively looking for build files in directory /home/lfarkas/work/vidux/vidux/java
internal/fs/utils.js:230
    throw err;
    ^

Error: ENOENT: no such file or directory, stat '/home/lfarkas/work/vidux/vidux/java/vidux/data/vhv/var/www/html/vhv/data'
    at Object.statSync (fs.js:932:3)
    at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:42:27
    at Array.forEach (<anonymous>)
    at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:41:11)
    at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:45:28
    at Array.forEach (<anonymous>)
    at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:41:11)
    at /home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:45:28
    at Array.forEach (<anonymous>)
    at getAllBuildFiles (/home/lfarkas/.npm-packages/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:41:11) {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '/home/lfarkas/work/vidux/vidux/java/vidux/data/vhv/var/www/html/vhv/data'
}
kevcodez commented 4 years ago

What linux distribution are you using? I do not know, how those paths are resolved.

I changed the search for build file paths to use resolve rather than join, hoping it helps.

I cannot reproduce this issue on Windows/Mac.

Released 0.6.5, but that's just a blind shot. I'll try a linux docker image similar to your distribution.

lfarkas commented 4 years ago

fedora-31

kevcodez commented 4 years ago

I couldn't reproduce on a fedora-32 docker image. What version of NodeJS are you using?

lfarkas commented 4 years ago

fedora-31's default nodejs-12.16.1-1.fc31.x86_64 and it seems to working now:-)