Skip to content

Instantly share code, notes, and snippets.

@cbeams
Last active April 13, 2016 04:50
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 cbeams/a50d9dcf5c2188272642981c76f591be to your computer and use it in GitHub Desktop.
Save cbeams/a50d9dcf5c2188272642981c76f591be to your computer and use it in GitHub Desktop.
class AndroidLanguageSourceSet extends BaseLanguageSourceSet {
}
class Rules {
@Defaults
public static void addDefaultAndroidSourceSet(@Path("android.sources") ModelMap<FunctionalSourceSet> sources) {
sources.all(new Action<FunctionalSourceSet>() {
@Override
public void execute(FunctionalSourceSet functionalSourceSet) {
functionalSourceSet.create(
"resources", AndroidLanguageSourceSet.class, new Action<AndroidLanguageSourceSet>() {
@Override
public void execute(AndroidLanguageSourceSet sourceSet) {
ComponentSpecIdentifier componentId = sourceSet.getIdentifier();
String parentName = componentId.getParent().getName();
String name = componentId.getName();
String srcDirPath = String.format("src/%s/%s", parentName, name);
sourceSet.getSource().srcDir(srcDirPath);
}
});
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment