How to add a folder to an android project sourceset from a gradle plugin -


i'm writing plugin gradle, generate classes android projects.

i generate classes in projects src/gen/java folder, don't want them mixed real source code.

from project's build.gradle config, can add make build tools see generated classes :

android {     sourcesets {         main {             java {                 srcdir 'src/gen/java'             }         }     } }  

the problem want plugin set automatically. plugin tried followings :

public class myplugin implements plugin {

@override public void apply(project project) {     // ...      // test 1 : doesnt work     project.android.sourcesets.main.java.srcdirs += "src/gen/java"      // test 2 : doesnt work     project.android.sourcesets {         main {             java {                 srcdir 'src/gen/java'             }         }     } } 

}

each time plugin works, folder still not seen compiler , can't find generated classes when compiling. 1 know of way plugin ?

if move files to build/generated/sources dir of app module plugin generating code don't have add source set.

you @ sqldelight gradle plugin code generation or autovalue

edit:

you need call registerjavageneratingtask on buildvariant generate sources


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -