You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
896 B

// ----
// How to use Profiles with -P arguments
// ----
//
// Run gradle tasks with the -P argument to utilize a profile.
//
def prodProfiles = 'prod'
def stagingProfiles = 'staging'
def defaultProfiles = 'default'
def propertyDrivenProfiles
if (project.hasProperty('prod')) {
// Used for production environment
propertyDrivenProfiles = prodProfiles
apply from: rootProject.file('gradle/profile_prod.gradle');
} else if (project.hasProperty('staging')) {
// Used for local development
propertyDrivenProfiles = stagingProfiles
apply from: rootProject.file('gradle/profile_staging.gradle');
} else {
// Default when no profile property is specified, used for testing
propertyDrivenProfiles = defaultProfiles
apply from: rootProject.file('gradle/profile_default.gradle');
}
println 'Using profile: "' + propertyDrivenProfiles + '" for ' + project.getName()