private void configureFactories()

in app-gradle-plugin/src/main/java/com/google/cloud/tools/gradle/appengine/core/AppEngineCorePluginConfiguration.java [86:120]


  private void configureFactories() {
    project.afterEvaluate(
        projectAfterEvaluated -> {
          try {
            if (toolsExtension.getCloudSdkHome() == null) {
              managedCloudSdk =
                  new ManagedCloudSdkFactory(toolsExtension.getCloudSdkVersion()).newManagedSdk();
              toolsExtension.setCloudSdkHome(managedCloudSdk.getSdkHome().toFile());
            }
          } catch (UnsupportedOsException ex) {
            throw new RuntimeException(ex.getMessage(), ex);
          } catch (BadCloudSdkVersionException ex) {
            throw new RuntimeException(
                "Failed to auto-configure Cloud Sdk at cloudSdkVersion = '"
                    + toolsExtension.getCloudSdkVersion()
                    + "': "
                    + ex.getMessage(),
                ex);
          }

          try {
            cloudSdkOperations =
                new CloudSdkOperations(
                    toolsExtension.getCloudSdkHome(),
                    toolsExtension.getServiceAccountKeyFile(),
                    toolsExtension.getVerbosity());
          } catch (CloudSdkNotFoundException ex) {
            // this should never happen, not found exception only occurs when auto-discovery fails,
            // but we don't use that mechanism anymore.
            throw new AssertionError("Failed when attempting to discover SDK: ", ex);
          }

          deployExtension.setDeployTargetResolver(new DeployTargetResolver(cloudSdkOperations));
        });
  }