/*
 *  Copyright (c) 2016 Google Inc. All Right 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.
 */

package com.google.cloud.tools.gradle.endpoints.framework.server;

import org.gradle.api.Project;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Plugin extension for endpoints server plugin
 */
public class EndpointsServerExtension {

  private final File discoveryDocDir;
  private final File clientLibDir;
  private List<String> serviceClasses;

  public EndpointsServerExtension(Project project) {
    discoveryDocDir = new File(project.getBuildDir(), "endpointsDiscoveryDocs");
    clientLibDir = new File(project.getBuildDir(), "endpointsClientLibs");
    serviceClasses = new ArrayList<>();
  }

  public File getDiscoveryDocDir() {
    return discoveryDocDir;
  }

  public File getClientLibDir() {
    return clientLibDir;
  }

  public List<String> getServiceClasses() {
    return serviceClasses;
  }

  public void setServiceClasses(List<String> serviceClasses) {
    this.serviceClasses = serviceClasses;
  }
}

@@ -887,16 +887,49 @@
 sion %7B%0A%0A
+  private final Project project;%0A
   privat
@@ -954,24 +954,25 @@
 veryDocDir;%0A
+%0A
   private fi
@@ -965,30 +965,24 @@
 %0A%0A  private 
-final 
 File clientL
@@ -1077,24 +1077,52 @@
  project) %7B%0A
+    this.project = project;%0A
     discover
@@ -1436,32 +1436,142 @@
 entLibDir;%0A  %7D%0A%0A
+  public void setClientLibDir(Object clientLibDir) %7B%0A    this.clientLibDir = project.file(clientLibDir);%0A  %7D%0A%0A
   public List%3CSt
@@ -1735,14 +1735,15 @@
 lasses;%0A
-
   %7D%0A
+%0A
 %7D%0A

Allow server-plugin clientLibrary-output dir to be configurable (#23)