@Override public int describe(InputStream contents, IContentDescription description) throws IOException { try { GradleScriptASTParser parser = new GradleScriptASTParser(contents); PluginsSyntaxDescriberVisitor pluginsVisitor = new PluginsSyntaxDescriberVisitor(); ApplySyntaxDescriberVisitor visitor = new ApplySyntaxDescriberVisitor(); parser.walkScript(pluginsVisitor); if (pluginsVisitor.isFoundPlugin()) { return IContentDescriber.VALID; } parser.walkScript(visitor); if (visitor.isFoundplugin()) { return IContentDescriber.VALID; } } catch (MultipleCompilationErrorsException ex) { return IContentDescriber.INDETERMINATE; } return IContentDescriber.INVALID; }
public int describe(InputStream contents, IContentDescription description) throws IOException { int result = IContentDescriber.INDETERMINATE; if (description == null) { result = computeValidity(contents); } else { calculateSupportedOptions(contents, description); result = computeValidity(contents); } return result; }
public int describe(Reader contents, IContentDescription description) throws IOException { int result = IContentDescriber.INDETERMINATE; if (description == null) { result = computeValidity(contents); } else { calculateSupportedOptions(contents, description); result = computeValidity(contents); } return result; }
private int computeValidity(InputStream inputStream) { // currently no specific check for validilty // based on contents. return IContentDescriber.INDETERMINATE; }
private int computeValidity(Reader reader) { // currently no specific check for validilty // based on contents. return IContentDescriber.INDETERMINATE; }
@Override public int describe(Reader contents, IContentDescription description) throws IOException { return IContentDescriber.INDETERMINATE; }