Skip to content

Commit

Permalink
Set default Java target to 6
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Sep 5, 2024
1 parent 96f5eb1 commit c294067
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 3 deletions.
8 changes: 8 additions & 0 deletions framework/core/Project/Cli.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
8 changes: 8 additions & 0 deletions framework/core/Project/Closure.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions framework/core/Project/Codec.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
4 changes: 4 additions & 0 deletions framework/core/Project/Compress.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
4 changes: 4 additions & 0 deletions framework/core/Project/Csv.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
4 changes: 4 additions & 0 deletions framework/core/Project/Gson.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
4 changes: 4 additions & 0 deletions framework/core/Project/Jsoup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
7 changes: 7 additions & 0 deletions framework/core/Project/Lang.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#
Expand Down
16 changes: 15 additions & 1 deletion framework/core/Project/Math.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
#
Expand Down
12 changes: 10 additions & 2 deletions framework/core/Project/Mockito.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions framework/core/Project/Time.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c294067

Please sign in to comment.