public static List<BuilderClassDef> parse(String path) throws Exception { DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(SmaliParser.DEFAULT_API_LEVEL)); return parseFiles(new File(path), dexBuilder); }
private static String buildFrameworkCache(String resPath) throws Exception { List<File> resFiles = new LinkedList<>(); try { URL url = FrameworkJarBuilder.class.getResource(resPath); File file = new File(url.toURI()); resFiles.addAll(Utils.getFilesWithSmaliExtension(file)); } catch (URISyntaxException e) { e.printStackTrace(); } DexBuilder dexBuilder = new DexBuilder(Opcodes.getDefault()); StringBuilder sb = new StringBuilder(); for (File resFile : resFiles) { String absPath = resFile.getAbsolutePath(); String path = absPath.substring(absPath.lastIndexOf(FRAMEWORK_ROOT)); InputStream is = FrameworkJarBuilder.class.getResourceAsStream(path); BuilderClassDef classDef = SmaliParser.parse(path, is, dexBuilder); sb.append(ReferenceUtil.getReferenceString(classDef)); sb.append(':').append(path.substring(1)).append('\n'); } return sb.toString(); }
/** * Create a ClassManager with no input Smali classes. It will only contain parse library * classes. */ public ClassManager build() throws IOException { DexBuilder dexBuilder = new DexBuilder(Opcodes.getDefault()); return build(dexBuilder); }
/** * @param smaliPath Path to Smali file or folder */ public ClassManager build(String smaliPath) throws IOException { return build(smaliPath, new DexBuilder(Opcodes.getDefault())); }
/** * Create a ClassManager with no input Smali classes. It will only contain parse library * classes. */ public ClassManager build(int outputAPILevel) throws IOException { DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(outputAPILevel)); return build(dexBuilder); }
/** * @param smaliPath Path to Smali file or folder */ public ClassManager build(File smaliPath, int outputAPILevel) throws IOException { return build(smaliPath, new DexBuilder(Opcodes.forApi(outputAPILevel))); }
private void build() throws AndrolibException { try { DexBuilder dexBuilder; if (mApiLevel > 0) { dexBuilder = new DexBuilder(Opcodes.forApi(mApiLevel)); } else { dexBuilder = new DexBuilder(Opcodes.getDefault()); } for (String fileName : mSmaliDir.getDirectory().getFiles(true)) { buildFile(fileName, dexBuilder); } dexBuilder.writeTo(new FileDataStore( new File(mDexFile.getAbsolutePath()))); } catch (IOException | DirectoryException ex) { throw new AndrolibException(ex); } }
final DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(options.apiLevel));
public static DexBuilder getDexBuilder() { return new DexBuilder(Opcodes.forApi(SmaliParser.DEFAULT_API_LEVEL)); }
public static DexBuilder makeDexBuilder() { BuilderContext context = new BuilderContext(); return new DexBuilder(15, context); }
public static DexBuilder makeDexBuilder(int api) { BuilderContext context = new BuilderContext(); return new DexBuilder(api, context); }
final DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(options.apiLevel));
CommonTokenStream tokens; LexerErrorInterface lexer; DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(apiLevel));
CommonTokenStream tokens; LexerErrorInterface lexer; DexBuilder dexBuilder = new DexBuilder(Opcodes.forApi(apiLevel));
@Test public void testJumboStringConversion_NonMethodBuilder() throws IOException { DexBuilder dexBuilder = new DexBuilder(Opcodes.getDefault());
@Test public void testBuilderCallSite() throws IOException { DexBuilder dexBuilder = new DexBuilder(Opcodes.forArtVersion(111)); BuilderCallSiteReference callSite = dexBuilder.internCallSite(new ImmutableCallSiteReference("call_site_1", new ImmutableMethodHandleReference( MethodHandleType.INVOKE_STATIC, new ImmutableMethodReference("Lcls1", "loader", ImmutableList.of("Ljava/lang/invoke/Lookup;", "Ljava/lang/String;", "Ljava/lang/invoke/MethodType;"), "Ljava/lang/invoke/CallSite;")), "someMethod", new ImmutableMethodProtoReference(ImmutableList.of(), "V"), ImmutableList.of())); MethodImplementationBuilder methodImplementationBuilder = new MethodImplementationBuilder(10); methodImplementationBuilder.addInstruction(new BuilderInstruction35c(Opcode.INVOKE_CUSTOM, 0, 0, 0, 0, 0, 0, callSite)); BuilderMethod method = dexBuilder.internMethod("Lcls1", "method1", null, "V", 0, ImmutableSet.of(), methodImplementationBuilder.getMethodImplementation()); dexBuilder.internClassDef("Lcls1;", AccessFlags.PUBLIC.getValue(), "Ljava/lang/Object;", null, null, ImmutableSet.of(), null, ImmutableList.of(method)); File tempFile = File.createTempFile("dex", ".dex"); dexBuilder.writeTo(new FileDataStore(tempFile)); verifyDexFile(DexFileFactory.loadDexFile(tempFile, Opcodes.forArtVersion(111))); }
@Test public void testJumboStringConversion() throws IOException { DexBuilder dexBuilder = new DexBuilder(Opcodes.getDefault());