Skip to content

Commit

Permalink
Added inputRootSet functionality to TreeShaker
Browse files Browse the repository at this point in the history
	Change on 2016/12/01 by malvania <malvania@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140778842
  • Loading branch information
priyankmal authored and kstanger committed Dec 5, 2016
1 parent 53a9de7 commit c903df5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 1 addition & 14 deletions translator/src/main/java/com/google/devtools/j2objc/J2ObjC.java
Expand Up @@ -18,7 +18,6 @@

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.google.devtools.j2objc.Options.TimingLevel;
import com.google.devtools.j2objc.pipeline.AnnotationPreProcessor;
import com.google.devtools.j2objc.pipeline.GenerationBatch;
Expand All @@ -33,7 +32,6 @@
import com.google.devtools.j2objc.util.UnicodeUtils;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -83,18 +81,7 @@ public static Parser createParser() {
}

private static CodeReferenceMap loadDeadCodeMap() {
return parseDeadCodeFile(Options.getProGuardUsageFile());
}

private static CodeReferenceMap parseDeadCodeFile(File file) {
if (file != null) {
try {
return ProGuardUsageParser.parse(Files.asCharSource(file, Charset.defaultCharset()));
} catch (IOException e) {
throw new AssertionError(e);
}
}
return null;
return ProGuardUsageParser.parseDeadCodeFile(Options.getProGuardUsageFile());
}

/**
Expand Down
Expand Up @@ -114,6 +114,17 @@ private static String buildMethodSignature(String returnType, String argumentLis
return signature.toString();
}

public static CodeReferenceMap parseDeadCodeFile(File file) {
if (file != null) {
try {
return ProGuardUsageParser.parse(Files.asCharSource(file, Charset.defaultCharset()));
} catch (IOException e) {
throw new AssertionError(e);
}
}
return null;
}

public static CodeReferenceMap parse(CharSource listing) throws IOException {
LineProcessor<CodeReferenceMap> processor = new LineProcessor<CodeReferenceMap>() {
CodeReferenceMap.Builder dead = CodeReferenceMap.builder();
Expand Down

0 comments on commit c903df5

Please sign in to comment.