Skip to content

Commit

Permalink
Update Mockito project for Java 11 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
markro49 authored Dec 1, 2023
1 parent 4e6168b commit 3ecc2ff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions framework/core/Project/Mockito.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ sub _post_checkout {
or confess("Couldn't apply patch ($mockito_junit_runner_patch_file): $!");
}

# only bid with release notes and doesn't compile with newer Gradle
if ($vid == 21) {
system("rm -rf $work_dir/buildSrc/src/main/groovy/org/mockito/release/notes");
system("rm -rf $work_dir/buildSrc/src/test/groovy/org/mockito/release/notes");
system("sed -i '/apply.from:..gradle.release.gradle./d' $work_dir/build.gradle");
}

# Change Url to Gradle distribution
my $prop = "$work_dir/gradle/wrapper/gradle-wrapper.properties";
my $lib_dir = "$BUILD_SYSTEMS_LIB_DIR/gradle/dists";
Expand Down
4 changes: 2 additions & 2 deletions framework/projects/Mockito/Mockito.build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
</condition>

<!-- Location of compiled classes changes in older builds -->
<condition property="test.home" value="${basedir}/target/test-classes" else="${basedir}/build/classes/test">
<condition property="test.home" value="${basedir}/target/test-classes" else="${basedir}/build/classes/java/test">
<istrue value="${use.ant}"/>
</condition>
<condition property="classes.dir" value="${basedir}/target/classes" else="${basedir}/build/classes/main">
<condition property="classes.dir" value="${basedir}/target/classes" else="${basedir}/build/classes/java/main">
<istrue value="${use.ant}"/>
</condition>
<condition property="test.src.home" value="${basedir}/src/test" else="${basedir}/test">
Expand Down
12 changes: 12 additions & 0 deletions framework/test/test_verify_bugs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,19 @@ for bid in $(echo $BUGS); do
Math)
sed_cmd "s/value=\"1\.[1-5]\"/value=\"1.6\"/" $work_dir/build.xml
;;
Mockito)
# some bids use gradle
sed_cmd "s/sourceCompatibility = 1\.[1-5]/sourceCompatibility=1.6/" $work_dir/build.gradle
sed_cmd "s/targetCompatibility = 1\.[1-5]/targetCompatibility=1.6/" $work_dir/build.gradle
sed_cmd "s/gradle-1.12-bin/gradle-4.9-bin/" $work_dir/gradle/wrapper/gradle-wrapper.properties
sed_cmd "s/gradle-2.2.1-all/gradle-4.9-bin/" $work_dir/gradle/wrapper/gradle-wrapper.properties
sed_cmd "s/0.7-groovy-1.8/1.1-groovy-2.4/" $work_dir/buildSrc/build.gradle
# and some bids don't
sed_cmd "s/source=\"1\.[1-5]\"/source=\"1.6\"/" $work_dir/build.xml
sed_cmd "s/target=\"1\.[1-5]\"/target=\"1.6\"/" $work_dir/build.xml
;;
esac

defects4j compile -w "$work_dir" || die "compile: $PID-$vid"
defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid"

Expand Down

0 comments on commit 3ecc2ff

Please sign in to comment.