public void stageArchive()

in appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/operations/AppYamlProjectStaging.java [63:109]


  public void stageArchive(AppYamlProjectStageConfiguration config) throws AppEngineException {
    Preconditions.checkNotNull(config);
    Path stagingDirectory = config.getStagingDirectory();

    if (!Files.exists(stagingDirectory)) {
      throw new AppEngineException(
          "Staging directory does not exist. Location: " + stagingDirectory);
    }
    if (!Files.isDirectory(stagingDirectory)) {
      throw new AppEngineException(
          "Staging location is not a directory. Location: " + stagingDirectory);
    }

    try {
      String env = findEnv(config);
      String runtime = findRuntime(config);
      if ("flex".equals(env)) {
        stageFlexibleArchive(config, runtime);
        return;
      }
      if (GEN2_RUNTIMES.contains(runtime)) {
        boolean isJar = config.getArtifact().getFileName().toString().endsWith(".jar");
        if (isJar) {
          stageStandardArchive(config);
          return;
        }
        if (hasCustomEntrypoint(config)) {
          stageStandardBinary(config);
          return;
        }
        // I cannot deploy non-jars without custom entrypoints
        throw new AppEngineException(
            "Cannot process application with runtime: "
                + runtime
                + "."
                + " A custom entrypoint must be defined in your app.yaml for non-jar artifact: "
                + config.getArtifact().toString());
      }
      // I don't know how to deploy this
      throw new AppEngineException(
          "Cannot process application with runtime: "
              + runtime
              + (Strings.isNullOrEmpty(env) ? "" : " and env: " + env));
    } catch (IOException ex) {
      throw new AppEngineException(ex);
    }
  }