Skip to content

Instantly share code, notes, and snippets.

@zskamljic
Last active July 19, 2018 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zskamljic/40439cb7e9b22c9d91e0884570bcb021 to your computer and use it in GitHub Desktop.
Save zskamljic/40439cb7e9b22c9d91e0884570bcb021 to your computer and use it in GitHub Desktop.
public class CustomTransform extends Transform {
@Override
public String getName() {
return "CustomProc";
}
@Override
public Set<QualifiedContent.ContentType> getInputTypes() {
return ImmutableSet.of(QualifiedContent.DefaultContentType.CLASSES);
}
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
return ImmutableSet.of(QualifiedContent.Scope.PROJECT);
}
@Override
public void transform(TransformInvocation transformInvocation) {
Set<String> classNames = getClassNames(transformInvocation.getInputs());
ClassPool classPool = createClassPool(transformInvocation.getInputs(),
transformInvocation.getReferencedInputs());
Set<CtClass> ctClasses = getCtClasses(classPool, classNames);
processClasses(new ProviderGenerator(), classPool, ctClasses);
String outputPath = getOutputPath(transformInvocation.getOutputProvider());
saveClasses(outputPath, ctClasses);
}
@Override
public boolean isIncremental() {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment