Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle ERROR: ProductFlavor names cannot start with 'test'

Tried to name my productFlavor as "test" and received the error:

 ERROR: ProductFlavor names cannot start with 'test'

From the source code I see the simple check:

 private void addBuildType(BuildType buildType) {
    if (buildType.name.startsWith("test")) {
        throw new RuntimeException("BuildType names cannot start with 'test'")
    }...
}

Appears I can use names like "myTest", "aTest", etc., but not "test1", "test2" etc. Any possible reason for this? Thanks.

like image 509
Evgeniy Mishustin Avatar asked Jan 01 '23 06:01

Evgeniy Mishustin


1 Answers

As you can see in this Google repository line 93

private void addBuildType(BuildType buildType) {
    if (buildType.name.startsWith("test")) {
        throw new RuntimeException("BuildType names cannot start with 'test'")
    }
    if (productFlavors.containsKey(buildType.name)) {
        throw new RuntimeException("BuildType names cannot collide with ProductFlavor names")
    }
    def sourceSet = project.sourceSets.add(buildType.name)
    BuildTypeData buildTypeData = new BuildTypeData(buildType, sourceSet, project)
    project.tasks.assemble.dependsOn buildTypeData.assembleTask
    buildTypes[buildType.name] = buildTypeData
}

So addBuildType method has its own exception about not using test name . you can't use this . and why they made this decision. No one can answer except google.

like image 178
Tejas Pandya Avatar answered Jan 03 '23 18:01

Tejas Pandya