Skip to content

Commit

Permalink
update Closure project for Java 11 (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
markro49 authored Nov 10, 2023
1 parent b958c37 commit bb457b6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
15 changes: 15 additions & 0 deletions framework/core/Project/Closure.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ sub determine_layout {
sub _post_checkout {
@_ == 3 or die $ARG_ERROR;
my ($self, $rev_id, $work_dir) = @_;
my $vid = $self->{_vcs}->lookup_vid($rev_id);

open FH, "$work_dir/build.xml" or die $!;
my $build_file = do { local $/; <FH> };
Expand All @@ -79,6 +80,20 @@ sub _post_checkout {
open FH, ">$work_dir/build.xml" or die $!;
print FH $build_file;
close FH;

# Fix compilation errors if necessary
my $compile_errors = "$PROJECTS_DIR/$self->{pid}/compile-errors/";
opendir(DIR, $compile_errors) or die "Could not find compile-errors directory.";
my @entries = readdir(DIR);
closedir(DIR);
foreach my $file (@entries) {
if ($file =~ /-(\d+)-(\d+).diff/) {
if ($vid >= $1 && $vid <= $2) {
$self->apply_patch($work_dir, "$compile_errors/$file")
or confess("Couldn't apply patch ($file): $!");
}
}
}
}

1;
13 changes: 13 additions & 0 deletions framework/projects/Closure/compile-errors/test-134-154.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java b/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
index e07b13513..0dd914e4b 100644
--- a/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
+++ b/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
@@ -659,7 +659,7 @@ public class DataFlowAnalysisTest extends TestCase {
assertTrue(outEdges.size() < 2);
ConstPropLatticeElement aResult = flowThroughArithmeticInstruction(
(ArithmeticInstruction) node, input);
- for (DiGraphEdge<Instruction, Branch> _ : outEdges) {
+ for (int i = 0; i < outEdges.size(); i++) {
result.add(aResult);
}
} else {
13 changes: 13 additions & 0 deletions framework/projects/Closure/compile-errors/test-79-105.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java b/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
index e07b13513..0dd914e4b 100644
--- a/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
+++ b/test/com/google/javascript/jscomp/DataFlowAnalysisTest.java
@@ -659,7 +659,7 @@ public class DataFlowAnalysisTest extends TestCase {
assertTrue(outEdges.size() < 2);
ConstPropLatticeElement aResult = flowThroughArithmeticInstruction(
(ArithmeticInstruction) node, input);
- for (DiGraphEdge<Instruction, Branch> _ : outEdges) {
+ for (int i = 0; i < outEdges.size(); i++) {
result.add(aResult);
}
} else {
6 changes: 4 additions & 2 deletions framework/test/test_verify_bugs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ work_dir="$test_dir/$PID"
function sed_cmd()
{
if [ $(uname -s) = "Darwin" ]; then
sed -i '' $1 $2
sed -i '' "$1" $2
else
sed -i $1 $2
sed -i "$1" $2
fi
}

Expand Down Expand Up @@ -133,6 +133,8 @@ for bid in $(echo $BUGS); do
Closure)
sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/build.properties
sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/build.properties
sed_cmd "s/target-jvm: 1\.[1-5]/target-jvm 1.6/" $work_dir/lib/rhino/src/mozilla/js/rhino/build.properties
sed_cmd "s/source-level: 1\.[1-5]/source-level 1.6/" $work_dir/lib/rhino/src/mozilla/js/rhino/build.properties
;;
Codec)
sed_cmd "s/1\.[1-5]/1.6/" $work_dir/default.properties
Expand Down

0 comments on commit bb457b6

Please sign in to comment.