Package org.gradle.tooling

Examples of org.gradle.tooling.BuildLauncher


        ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(buildFile.getParentFile())
                .connect();

        try {
            BuildLauncher build = connection.newBuild();

            // select tasks to run:
            build.forTasks(taskName);

            List<String> buildArgs = new ArrayList<String>();
            // buildArgs.add("-b");
            // buildArgs.add(buildFilePath);
            buildArgs.add("-stacktrace");
            buildArgs.add("-info");
            if (params.length > 0) {
                for (int i = 0; i < params.length; i++) {
                    buildArgs.add("-P" + params[i]);
                }
            }

            build.withArguments(buildArgs.toArray(new String[] {}));

            // if you want to listen to the progress events:
            ProgressListener listener = null; // use your implementation

            // kick the build off:
            build.run();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
View Full Code Here


            ProjectConnection connection = GradleConnector.newConnector()
                    .forProjectDirectory(buildFile.getParentFile()).connect();

            try {
                BuildLauncher build = connection.newBuild();

                // select tasks to run:
                build.forTasks(taskName);

                List<String> buildArgs = new ArrayList<String>();
                // buildArgs.add("-b");
                // buildArgs.add(buildFilePath);
                buildArgs.add("-stacktrace");
                buildArgs.add("-info");
                if (params.length > 0) {
                    for (int i = 0; i < params.length; i++) {
                        buildArgs.add("-P" + params[i]);
                    }
                }

                logger.info(Arrays.toString(buildArgs.toArray()));

                build.withArguments(buildArgs.toArray(new String[] {}));

                // if you want to listen to the progress events:
                ProgressListener listener = null; // use your implementation
                // build.addProgressListener(listener);

                // kick the build off:
                build.run();
            } finally {
                connection.close();
            }
        }
View Full Code Here

         connector = connector.useGradleUserHomeDir(new File(gradleHome));
      }
     
      ProjectConnection connection = connector.connect();

      BuildLauncher launcher = connection.newBuild().forTasks(task);

      List<String> argList = Lists.newArrayList(arguments);

      if (!Strings.isNullOrEmpty(profile))
      {
         argList.add("-Pprofile=" + profile);
      }

      launcher = launcher.withArguments(argList.toArray(new String[argList.size()]));

      final ResultHolder holder = new ResultHolder();
      final CountDownLatch latch = new CountDownLatch(1);

      launcher.run(new ResultHandler<Object>()
      {
         @Override
         public void onComplete(Object result)
         {
            holder.result = true;
View Full Code Here

    public GradleHandle start(File directory, List<String> arguments) {
        GradleConnector connector = GradleConnector.newConnector();
        connector.forProjectDirectory(directory);
        ProjectConnection connection = connector.connect();
        BuildLauncher launcher = connection.newBuild();
        String[] argumentArray = new String[arguments.size()];
        arguments.toArray(argumentArray);
        launcher.withArguments(argumentArray);
        return new BuildLauncherBackedGradleHandle(launcher);
    }
View Full Code Here

        gradleConnector.forProjectDirectory(projectDir);
        ProjectConnection projectConnection = null;
        try {
            projectConnection = gradleConnector.connect();

            BuildLauncher buildLauncher = projectConnection.newBuild();
            List<TemporaryFileRef> initScripts = getAllInitScriptFiles(project);
            try {
                configureBuildLauncher(targetSetup, buildLauncher, taskDef, initScripts);

                TaskOutputDef outputDef = taskDef.getOutputDef();
View Full Code Here

        ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(buildFile.getParentFile())
                .connect();

        try {
            BuildLauncher build = connection.newBuild();

            // select tasks to run:
            build.forTasks(taskName);

            List<String> buildArgs = new ArrayList<String>();
            // buildArgs.add("-b");
            // buildArgs.add(buildFilePath);
            buildArgs.add("-stacktrace");
            buildArgs.add("-info");
            if (params.length > 0) {
                for (int i = 0; i < params.length; i++) {
                    buildArgs.add("-P" + params[i]);
                }
            }

            build.withArguments(buildArgs.toArray(new String[] {}));

            // if you want to listen to the progress events:
            // ProgressListener listener = null; // use your implementation

            // kick the build off:
            build.run();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
View Full Code Here

            ProjectConnection connection = GradleConnector.newConnector()
                    .forProjectDirectory(buildFile.getParentFile()).connect();

            try {
                BuildLauncher build = connection.newBuild();

                // select tasks to run:
                build.forTasks(taskName);

                List<String> buildArgs = new ArrayList<String>();
                // buildArgs.add("-b");
                // buildArgs.add(buildFilePath);
                buildArgs.add("-stacktrace");
                if (debug) {
                    buildArgs.add("-debug");
                }
                if (params.length > 0) {
                    for (int i = 0; i < params.length; i++) {
                        buildArgs.add("-P" + params[i]);
                    }
                }

                logger.info(Arrays.toString(buildArgs.toArray()));

                build.withArguments(buildArgs.toArray(new String[] {}));

                // if you want to listen to the progress events:
                ProgressListener listener = null; // use your implementation
                // build.addProgressListener(listener);

                // kick the build off:
                build.run();
            } finally {
                connection.close();
            }
        }
View Full Code Here

            return modelBuilder.
                    withArguments(arguments).
                    forTasks(tasks).
                    get();
        } else {
            BuildLauncher buildLauncher = connection.newBuild();
            buildLauncher.
                    withArguments(arguments).
                    forTasks(tasks).
                    run();

            return null;
View Full Code Here

        connector.forProjectDirectory(new File("."));

        ProjectConnection connection = connector.connect();
        try {
            // Configure the build
            BuildLauncher launcher = connection.newBuild();
            launcher.forTasks("help");
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
            launcher.setStandardOutput(outputStream);
            launcher.setStandardError(errorStream);

            // Run the build
            launcher.run();

            // Process the outputs
            System.out.println(outputStream.toString());
            System.err.println(errorStream.toString());
        } finally {
View Full Code Here

TOP

Related Classes of org.gradle.tooling.BuildLauncher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.