@Test public void parsesPluginType_Unknown() throws Exception { File buildFile = TestUtils.getTestDataFile(PROJECT_BUILD_FILE); String content = Files.asCharSource(buildFile, UTF_8).read(); GradleContext context = GroovyGradleParser.parseGradleBuildFile(content, 1, null).build(); assertThat(context.getPluginType()).isEqualTo(GradleContext.PluginType.UNKNOWN); }
public static GradleContext.Builder parseGradleBuildFile( String content, int defaultMinSdkVersion, @Nullable AndroidPluginVersion defaultAndroidPluginVersion) { List<ASTNode> astNodes = new AstBuilder().buildFromString(CompilePhase.CONVERSION, content); GroovyGradleParser parser = new GroovyGradleParser(content, defaultMinSdkVersion, defaultAndroidPluginVersion); for (ASTNode node : astNodes) { if (node instanceof ClassNode) { continue; } node.visit(parser); } return parser.getGradleContextBuilder(); }
GroovyGradleParser extends CodeVisitorSupport { public static GradleContext.Builder parseGradleBuildFile( String content, int defaultMinSdkVersion, @Nullable AndroidPluginVersion defaultAndroidPluginVersion) { List<ASTNode> astNodes = new AstBuilder().buildFromString(CompilePhase.CONVERSION, content); GroovyGradleParser parser = new GroovyGradleParser(content, defaultMinSdkVersion, defaultAndroidPluginVersion); for (ASTNode node : astNodes) { if (node instanceof ClassNode) { continue; } node.visit(parser); } return parser.getGradleContextBuilder(); } }
GroovyGradleParser extends CodeVisitorSupport { public static GradleContext.Builder parseGradleBuildFile( String content, int defaultMinSdkVersion, @Nullable AndroidPluginVersion defaultAndroidPluginVersion) { List<ASTNode> astNodes = new AstBuilder().buildFromString(CompilePhase.CONVERSION, content); GroovyGradleParser parser = new GroovyGradleParser(content, defaultMinSdkVersion, defaultAndroidPluginVersion); for (ASTNode node : astNodes) { if (node instanceof ClassNode) { continue; } node.visit(parser); } return parser.getGradleContextBuilder(); } private  GroovyGradleParser(
      String content, int defaultMinSdkVersion, AndroidPluginVersion defaultAndroidPluginVersion); }
GroovyGradleParser extends CodeVisitorSupport { public static GradleContext.Builder parseGradleBuildFile( String content, int defaultMinSdkVersion, @Nullable AndroidPluginVersion defaultAndroidPluginVersion) { List<ASTNode> astNodes = new AstBuilder().buildFromString(CompilePhase.CONVERSION, content); GroovyGradleParser parser = new GroovyGradleParser(content, defaultMinSdkVersion, defaultAndroidPluginVersion); for (ASTNode node : astNodes) { if (node instanceof ClassNode) { continue; } node.visit(parser); } return parser.getGradleContextBuilder(); } private  GroovyGradleParser(
      String content, int defaultMinSdkVersion, AndroidPluginVersion defaultAndroidPluginVersion); static GradleContext.Builder parseGradleBuildFile(
      String content,
      int defaultMinSdkVersion,
      @Nullable AndroidPluginVersion defaultAndroidPluginVersion); GradleContext.Builder getGradleContextBuilder(); @Override void visitMethodCallExpression(MethodCallExpression expression); @Override void visitTupleExpression(TupleExpression tupleExpression); @Override void visitBinaryExpression(BinaryExpression binaryExpression); }
GroovyGradleParser extends CodeVisitorSupport { public static GradleContext.Builder parseGradleBuildFile( String content, int defaultMinSdkVersion, @Nullable AndroidPluginVersion defaultAndroidPluginVersion) { List<ASTNode> astNodes = new AstBuilder().buildFromString(CompilePhase.CONVERSION, content); GroovyGradleParser parser = new GroovyGradleParser(content, defaultMinSdkVersion, defaultAndroidPluginVersion); for (ASTNode node : astNodes) { if (node instanceof ClassNode) { continue; } node.visit(parser); } return parser.getGradleContextBuilder(); } private  GroovyGradleParser(
      String content, int defaultMinSdkVersion, AndroidPluginVersion defaultAndroidPluginVersion); static GradleContext.Builder parseGradleBuildFile(
      String content,
      int defaultMinSdkVersion,
      @Nullable AndroidPluginVersion defaultAndroidPluginVersion); GradleContext.Builder getGradleContextBuilder(); @Override void visitMethodCallExpression(MethodCallExpression expression); @Override void visitTupleExpression(TupleExpression tupleExpression); @Override void visitBinaryExpression(BinaryExpression binaryExpression);  }