com.github.mictaege.jitter.plugin.OnlyIfClassProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jitter-plugin Show documentation
Show all versions of jitter-plugin Show documentation
The jitter-plugin is a Gradle plugin to build and distribute different flavours of an application from a single source base.
package com.github.mictaege.jitter.plugin;
import com.github.mictaege.jitter.api.OnlyIf;
import spoon.processing.AbstractAnnotationProcessor;
import spoon.reflect.declaration.CtClass;
import java.util.List;
import static java.lang.System.out;
import static java.util.Arrays.asList;
public class OnlyIfClassProcessor extends AbstractAnnotationProcessor> {
@Override
public void process(final OnlyIf annotation, final CtClass> clazz) {
final List flavours = asList(annotation.value());
if (flavours.stream().noneMatch(FlavourUtil::active)) {
out.println("[jitter] Remove class " + clazz.getSimpleName());
clazz.delete();
}
}
}