mirror of
https://github.com/google/nomulus
synced 2026-01-05 13:07:04 +00:00
Improve error handling for environment property (#295)
* Improve error handling for environment property Improve the error messages that we get for a bad or missing environment property. Move the property processing into the main build so that we do it only once and configure all of the appengine deployment tasks to check that a project has been defined and print a friendly error if it hasn't. Note that even if the check isn't configured, this change prevents deployment because the gcpProject will be set to null. It just won't print as useful an error message. Tested: ran appengineDeployAll with and without the environment property, ran "build" to verify that we don't get any complaints for non-deployment targets. * Changes for review. * Changes for review * Changes for review. * Changes for review.
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
// Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
def environments = ['production', 'sandbox', 'alpha', 'crash']
|
||||
|
||||
def projects = ['production': 'domain-registry',
|
||||
'sandbox' : 'domain-registry-sandbox',
|
||||
'alpha' : 'domain-registry-alpha',
|
||||
'crash' : 'domain-registry-crash']
|
||||
|
||||
|
||||
def environment = rootProject.findProperty("environment")
|
||||
|
||||
if (environment == null) {
|
||||
environment = 'production'
|
||||
}
|
||||
|
||||
def gcpProject = projects[environment]
|
||||
|
||||
if (gcpProject == null) {
|
||||
throw new GradleException("-Penvironment must be one of ${environments}.")
|
||||
}
|
||||
|
||||
rootProject.ext.environment = environment
|
||||
rootProject.ext.gcpProject = gcpProject
|
||||
rootProject.ext.prodOrSandboxEnv = ['production', 'sandbox'].contains(environment)
|
||||
Reference in New Issue
Block a user