Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get SourceSet full path string or path directory

I would like to know if there is a property that returns a SourceSet full path string or file directory, something like ${project.projectDir}/src/${sourceSet.name}.

apply plugin: 'java'

sourceSets {
    foo {
        java {
            srcDir 'example/dir/java'
        }
    }
}

// For example, this could return pathToProject/src/example/dir
println sourceSets.foo.srcDir
like image 852
Caio Avatar asked Aug 30 '25 17:08

Caio


1 Answers

Try this:

productFlavors {
    admin { }
    customer { }
}

sourceSets {
    main {
        java.srcDirs = ['src/main']
        //other typical sourceSets stuff
    }

    admin.java.srcDirs = ['src/admin']
    customer.java.srcDirs = ['src/customer']
}
like image 57
Riya Solanki Avatar answered Sep 02 '25 09:09

Riya Solanki