Caio
Caio

Reputation: 3215

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

Upvotes: 4

Views: 4543

Answers (1)

Riya Solanki
Riya Solanki

Reputation: 46

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']
}

Upvotes: 2

Related Questions