mockito / shipkit

Toolkit for shipping it used by Mockito library
http://shipkit.org
MIT License
158 stars 35 forks source link

upgradeDownstream fails when executed twice #438

Open mockitoguy opened 7 years ago

mockitoguy commented 7 years ago

Problem 1

When I ran upgradeDownstream twice I got an error. Let's make the task work gracefully if executed few times. This is especially useful if the first execution failed, we are retrying.

~/mockito/release$ ./gradlew upgradeDownstream
Download https://plugins.gradle.org/m2/org/shipkit/shipkit/0.9.81/shipkit-0.9.81.pom
Download https://plugins.gradle.org/m2/org/shipkit/shipkit/0.9.81/shipkit-0.9.81.jar
  Building version '0.9.82' (value loaded from 'version.properties' file).
  [INCUBATING] upgrade-dependency plugin is incubating and may change in any version.
  [INCUBATING] downstream-testing plugin is incubating and may change in any version.
:cloneMockitoShipkit
  Cloning repository https://github.com/mockito/shipkit
    into /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
  Executing:
    git clone https://github.com/mockito/shipkit /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
:cloneMockitoShipkit FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cloneMockitoShipkit'.
> Execution of command failed (exit code 128):
    git clone https://github.com/mockito/shipkit /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
    Captured command output:
  fatal: destination path '/Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit' already exists and is not an empty directory.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Problem 2

I've tried to work around by running "clean" task but I noticed that build dir is not cleaned. Let's make sure that when users run "./gradlew clean" the output generated by Shipkit from previous build is cleared.

~/mockito/release$ ./gradlew clean upgradeDownstream
  Building version '0.9.82' (value loaded from 'version.properties' file).
  [INCUBATING] upgrade-dependency plugin is incubating and may change in any version.
  [INCUBATING] downstream-testing plugin is incubating and may change in any version.
:shipkit:clean
:testDownstream:clean
:cloneMockitoShipkit
  Cloning repository https://github.com/mockito/shipkit
    into /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
  Executing:
    git clone https://github.com/mockito/shipkit /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
:cloneMockitoShipkit FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cloneMockitoShipkit'.
> Execution of command failed (exit code 128):
    git clone https://github.com/mockito/shipkit /Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit
    Captured command output:
  fatal: destination path '/Users/sfaber/mockito/release/build/downstream-upgrade/mockitoShipkit' already exists and is not an empty directory.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
epeee commented 7 years ago

thx for reporting this one! I also had the same problems while testing locally.

epeee commented 7 years ago

Problem 1 can be solved in different ways. The easiest solution would be to just delete the directory in the TaskAction of CloneGitRepositoryTask. That's not great but it will work. The 2nd solution would be to have a look at the status of the directory/repo and just do a pull if it is not modified locally.

Problem 2 seems to be solved by moving upgrade-downstream to the subproject (because it is a groovy/java project and therefore has a clean task).

wwilk commented 7 years ago

It should be fixed while doing #435