/*
 * Copyright 2016 the original author or authors.
 *
 * 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 org.gradle.api.internal.project;

import groovy.lang.Closure;
import org.gradle.api.Project;
import org.gradle.api.initialization.dsl.ScriptHandler;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.LoggingManager;
import org.gradle.groovy.scripts.DefaultScript;
import org.gradle.internal.logging.StandardOutputCapture;

import java.util.Map;

public abstract class ProjectScript extends DefaultScript {
    public void apply(Closure closure) {
        ((Project) getScriptTarget()).apply(closure);
    }

    @SuppressWarnings("unchecked")
    public void apply(Map options) {
        ((Project) getScriptTarget()).apply(options);
    }

    public Project getProject() {
        return (Project) getScriptTarget();
    }

    public ScriptHandler getBuildscript() {
        return ((Project) getScriptTarget()).getBuildscript();
    }

    public void buildscript(Closure configureClosure) {
        ((Project) getScriptTarget()).buildscript(configureClosure);
    }

    public StandardOutputCapture getStandardOutputCapture() {
        return ((ProjectInternal) getScriptTarget()).getStandardOutputCapture();
    }

    public LoggingManager getLogging() {
        return ((Project) getScriptTarget()).getLogging();
    }

    public Logger getLogger() {
        return ((Project) getScriptTarget()).getLogger();
    }

    public String toString() {
        return getScriptTarget().toString();
    }
}

@@ -683,39 +683,8 @@
 re;%0A
-import org.gradle.api.Project;%0A
 impo
@@ -1053,35 +1053,24 @@
 e) %7B%0A       
- ((Project)
  getScriptTa
@@ -1071,25 +1071,24 @@
 riptTarget()
-)
 .apply(closu
@@ -1174,35 +1174,24 @@
 s) %7B%0A       
- ((Project)
  getScriptTa
@@ -1196,17 +1196,16 @@
 Target()
-)
 .apply(o
@@ -1224,93 +1224,8 @@
  %7D%0A%0A
-    public Project getProject() %7B%0A        return (Project) getScriptTarget();%0A    %7D%0A%0A
     
@@ -1274,35 +1274,24 @@
       return
- ((Project)
  getScriptTa
@@ -1292,25 +1292,24 @@
 riptTarget()
-)
 .getBuildscr
@@ -1385,27 +1385,16 @@
 %0A       
- ((Project)
  getScri
@@ -1403,17 +1403,16 @@
 Target()
-)
 .buildsc
@@ -1522,27 +1522,8 @@
 turn
- ((ProjectInternal)
  get
@@ -1532,25 +1532,24 @@
 riptTarget()
-)
 .getStandard
@@ -1623,35 +1623,24 @@
       return
- ((Project)
  getScriptTa
@@ -1637,33 +1637,32 @@
 etScriptTarget()
-)
 .getLogging();%0A 
@@ -1717,19 +1717,8 @@
 turn
- ((Project)
  get
@@ -1731,17 +1731,16 @@
 Target()
-)
 .getLogg
@@ -1833,11 +1833,137 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public ProjectInternal getScriptTarget() %7B%0A        return (ProjectInternal) super.getScriptTarget();%0A    %7D
 %0A%7D%0A

Clean up `ProjectScript`