@@ -0,0 +1,2917 @@
+/*%0A * Copyright 2009 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.gradle.testing.internal.util;%0A%0Aimport java.io.*;%0A%0A/**%0A * This is used to launch Gradle from within IDEA. See gradle/idea.gradle.%0A */%0Apublic class GradlewRunner %7B%0A    public static void main(String%5B%5D args) %7B%0A        Process process = null;%0A%0A        String%5B%5D combinedArgs;%0A        %0A        if (System.getProperty(%22os.name%22).startsWith(%22Windows%22)) %7B%0A            combinedArgs = new String%5B3 + args.length%5D;%0A            combinedArgs%5B0%5D = %22cmd%22;%0A            combinedArgs%5B1%5D = %22/C%22;%0A            combinedArgs%5B2%5D = new File(%22gradlew%22).getAbsolutePath();%0A            System.arraycopy(args, 0, combinedArgs, 3, args.length);%0A        %7D else %7B%0A            combinedArgs = new String%5B1 + args.length%5D;%0A            File gradlew = new File(%22gradlew%22);%0A            combinedArgs%5B0%5D = gradlew.getAbsolutePath();%0A            System.arraycopy(args, 0, combinedArgs, 1, args.length);%0A        %7D%0A%0A        try %7B%0A            ProcessBuilder builder = new ProcessBuilder().command(combinedArgs);%0A            process = builder.start();%0A            final Process finalProcess = process;%0A            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() %7B%0A                public void run() %7B%0A                    finalProcess.destroy();%0A                %7D%0A            %7D));%0A            forwardAsync(process.getInputStream(), System.out);%0A            forwardAsync(process.getErrorStream(), System.err);%0A            process.waitFor();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A            process.destroy();%0A        %7D%0A    %7D%0A    %0A    private static void forwardAsync(final InputStream input, final OutputStream output) %7B%0A        new Thread(new Runnable() %7B%0A            public void run() %7B%0A                int bufferSize = 4096;%0A                byte%5B%5D buffer = new byte%5BbufferSize%5D;%0A%0A                int read = 0;%0A                try %7B%0A                    read = input.read(buffer);%0A                    while(read != -1) %7B%0A                        output.write(buffer, 0, read);%0A                        read = input.read(buffer);%0A                    %7D%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace(new PrintWriter(output));%0A                %7D%0A            %7D%0A        %7D).start();%0A    %7D%0A%0A%7D

Add back the driver used to run Gradle from inside IDEA.