diff --git a/framework/core/Project/Cli.pm b/framework/core/Project/Cli.pm index d5ffb86ae..81e4fba8c 100644 --- a/framework/core/Project/Cli.pm +++ b/framework/core/Project/Cli.pm @@ -145,6 +145,14 @@ sub _post_checkout { print OUT $converted_file; close(OUT); } + + # Set default Java target to 6. + # either these: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + # or these: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/build.xml"); } # diff --git a/framework/core/Project/Closure.pm b/framework/core/Project/Closure.pm index 4065552d9..4e1286148 100644 --- a/framework/core/Project/Closure.pm +++ b/framework/core/Project/Closure.pm @@ -79,6 +79,14 @@ sub _post_checkout { open FH, ">$work_dir/build.xml" or die $!; print FH $build_file; close FH; + + # Set default Java target to 6. + # either these: + Utils::sed_cmd("s/source-level: 1\.[1-5]/source-level 1.6/", "$work_dir/lib/rhino/build.properties"); + Utils::sed_cmd("s/target-jvm: 1\.[1-5]/target-jvm 1.6/", "$work_dir/lib/rhino/build.properties"); + # or these: + Utils::sed_cmd("s/source-level: 1\.[1-5]/source-level 1.6/", "$work_dir/lib/rhino/src/mozilla/js/rhino/build.properties"); + Utils::sed_cmd("s/target-jvm: 1\.[1-5]/target-jvm 1.6/", "$work_dir/lib/rhino/src/mozilla/js/rhino/build.properties"); } 1; diff --git a/framework/core/Project/Codec.pm b/framework/core/Project/Codec.pm index b3f325be6..32da1b56f 100644 --- a/framework/core/Project/Codec.pm +++ b/framework/core/Project/Codec.pm @@ -125,6 +125,9 @@ sub _post_checkout { close(OUT); } } + + # Set default Java target to 6. + Utils::sed_cmd("s/1\.[1-5]/1.6/", "$work_dir/default.properties"); } # diff --git a/framework/core/Project/Compress.pm b/framework/core/Project/Compress.pm index aa808a0a0..44362adbe 100644 --- a/framework/core/Project/Compress.pm +++ b/framework/core/Project/Compress.pm @@ -91,6 +91,10 @@ sub _post_checkout { Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; } } + + # Set default Java target to 6. + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); } # diff --git a/framework/core/Project/Csv.pm b/framework/core/Project/Csv.pm index 98e456a3f..14617f074 100644 --- a/framework/core/Project/Csv.pm +++ b/framework/core/Project/Csv.pm @@ -92,6 +92,10 @@ sub _post_checkout { Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; } } + + # Set default Java target to 6. + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); } # diff --git a/framework/core/Project/Gson.pm b/framework/core/Project/Gson.pm index df324dba5..d8755c3cb 100644 --- a/framework/core/Project/Gson.pm +++ b/framework/core/Project/Gson.pm @@ -73,6 +73,10 @@ sub _post_checkout { Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; } } + + # Set default Java target to 6. + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); } # diff --git a/framework/core/Project/Jsoup.pm b/framework/core/Project/Jsoup.pm index 4290634c2..e224435d1 100644 --- a/framework/core/Project/Jsoup.pm +++ b/framework/core/Project/Jsoup.pm @@ -71,6 +71,10 @@ sub _post_checkout { Utils::exec_cmd("cp -r $build_files_dir/* $work_dir", "Copy generated Ant build file") or die; } } + + # Set default Java target to 6. + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); } # diff --git a/framework/core/Project/Lang.pm b/framework/core/Project/Lang.pm index 0f8056846..abf36e258 100644 --- a/framework/core/Project/Lang.pm +++ b/framework/core/Project/Lang.pm @@ -112,6 +112,13 @@ sub _post_checkout { unless (-e "$work_dir/build.xml") { system("cp $PROJECTS_DIR/$PID/build_files/$revision_id/* $work_dir"); } + + # Set default Java target to 6. + # either these: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + # or this + Utils::sed_cmd("s/1\.[1-5]/1.6/", "$work_dir/default.properties"); } # diff --git a/framework/core/Project/Math.pm b/framework/core/Project/Math.pm index 19eaeea0c..e0f895840 100644 --- a/framework/core/Project/Math.pm +++ b/framework/core/Project/Math.pm @@ -50,7 +50,8 @@ sub new { my $name = "commons-math"; my $vcs = Vcs::Git->new($PID, "$REPO_DIR/$name.git", - "$PROJECTS_DIR/$PID/$BUGS_CSV_ACTIVE"); + "$PROJECTS_DIR/$PID/$BUGS_CSV_ACTIVE", + \&_post_checkout); return $class->SUPER::new($PID, $name, $vcs); } @@ -101,6 +102,19 @@ sub _layout2 { return {src=>$src, test=>$test}; } +sub _post_checkout { + my ($self, $revision_id, $work_dir) = @_; + my $vid = $self->{_vcs}->lookup_vid($revision_id); + + # Convert the file encoding of problematic files + my $result = determine_layout($self, $revision_id); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/math3/stat/correlation/StorelessBivariateCovariance.java"); + Utils::convert_file_encoding($work_dir."/".$result->{src}."/org/apache/commons/math3/stat/correlation/StorelessCovariance.java"); + + # Set default Java target to 6. + Utils::sed_cmd("s/value=\\\"1\.[1-5]\\\"/value=\\\"1.6\\\"/", "$work_dir/build.xml"); +} + # # Remove looping tests in addition to the broken ones # diff --git a/framework/core/Project/Mockito.pm b/framework/core/Project/Mockito.pm index ac901f12b..a575bc522 100644 --- a/framework/core/Project/Mockito.pm +++ b/framework/core/Project/Mockito.pm @@ -97,8 +97,16 @@ sub _post_checkout { system("sed -i.bak s/org.gradle.daemon=true/org.gradle.daemon=false/g \"$work_dir/gradle.properties\""); } - # Enable local repository - system("find $work_dir -type f -name \"build.gradle\" -exec sed -i.bak 's|jcenter()|maven { url \"$BUILD_SYSTEMS_LIB_DIR/gradle/deps\" }\\\n maven { url \"https://jcenter.bintray.com/\" }\\\n|g' {} \\;"); + # Set default Java target to 6. + # some bids use gradle: + Utils::sed_cmd("s/sourceCompatibility = 1\.[1-5]/sourceCompatibility=1.6/", "$work_dir/build.gradle"); + Utils::sed_cmd("s/targetCompatibility = 1\.[1-5]/targetCompatibility=1.6/", "$work_dir/build.gradle"); + Utils::sed_cmd("s/gradle-1.12-bin/gradle-4.9-bin/", "$work_dir/gradle/wrapper/gradle-wrapper.properties"); + Utils::sed_cmd("s/gradle-2.2.1-all/gradle-4.9-bin/", "$work_dir/gradle/wrapper/gradle-wrapper.properties"); + Utils::sed_cmd("s/0.7-groovy-1.8/1.1-groovy-2.4/", "$work_dir/buildSrc/build.gradle"); + # and some don't: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/build.xml"); } sub determine_layout { diff --git a/framework/core/Project/Time.pm b/framework/core/Project/Time.pm index a9e552321..56f6c10a2 100644 --- a/framework/core/Project/Time.pm +++ b/framework/core/Project/Time.pm @@ -81,6 +81,14 @@ sub _post_checkout { Utils::exec_cmd("cp $filename $work_dir/build.xml", "Fix broken build") or die; } + + # Set default Java target to 6. + # either these: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/maven-build.xml"); + # or these: + Utils::sed_cmd("s/source=\\\"1\.[1-5]\\\"/source=\\\"1.6\\\"/", "$work_dir/build.xml"); + Utils::sed_cmd("s/target=\\\"1\.[1-5]\\\"/target=\\\"1.6\\\"/", "$work_dir/build.xml"); } sub determine_layout {