Java Code Examples for org.gradle.api.Project#getBuildDir()

The following examples show how to use org.gradle.api.Project#getBuildDir() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSassJavaPlugin.java    From gradle-plugins with MIT License 6 votes vote down vote up
@Override
public void apply(Project project) {
    project.getPlugins().apply(JSassWebjarsPlugin.class);

    project.getPlugins().apply(JavaPlugin.class);

    File baseDestinationDir = new File(project.getBuildDir(), "jsass");

    project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> {
        String taskName = sourceSet.getCompileTaskName("Sass");

        TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register(taskName, SassCompile.class, sassCompile -> {
            sassCompile.setSource(sourceSet.getResources());
            sassCompile.getDestinationDir().set(new File(baseDestinationDir, sourceSet.getName()));
            sassCompile.setGroup(BasePlugin.BUILD_GROUP);
            sassCompile.setDescription("Compile sass and scss files for the " + sourceSet.getName() + " source set");
        });

        project.getTasks().named(sourceSet.getProcessResourcesTaskName(), ProcessResources.class)
                .configure(processResources -> processResources.from(sassCompileTaskProvider));
    });
}
 
Example 2
Source File: JSassJavaPlugin.java    From gradle-plugins with MIT License 6 votes vote down vote up
@Override
public void apply(Project project) {
    project.getPlugins().apply(JSassWebjarsPlugin.class);

    project.getPlugins().apply(JavaPlugin.class);

    File baseDestinationDir = new File(project.getBuildDir(), "jsass");

    project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> {
        String taskName = sourceSet.getCompileTaskName("Sass");

        TaskProvider<SassCompile> sassCompileTaskProvider = project.getTasks().register(taskName, SassCompile.class, sassCompile -> {
            sassCompile.setSource(sourceSet.getResources());
            sassCompile.getDestinationDir().set(new File(baseDestinationDir, sourceSet.getName()));
            sassCompile.setGroup(BasePlugin.BUILD_GROUP);
            sassCompile.setDescription("Compile sass and scss files for the " + sourceSet.getName() + " source set");
        });

        project.getTasks().named(sourceSet.getProcessResourcesTaskName(), ProcessResources.class)
                .configure(processResources -> processResources.from(sassCompileTaskProvider));
    });
}
 
Example 3
Source File: AzPlugin.java    From gradle-plugins with Apache License 2.0 6 votes vote down vote up
public void apply(Project project) {
	File azureConfigDir = new File(project.getBuildDir(), ".azure");

	AzExtension extension = project.getExtensions().create("az", AzExtension.class);
	extension.setProject(project);
	// TODO azure-cli image insufficient by default: https://github.com/Azure/AKS/issues/469
	//extension.getCli().setImageName("microsoft/azure-cli");
	extension.getCli().setImageName("remmeier/azure-cli-kubectl");
	extension.getCli().setImageTag("2.0.38");

	AzLoginTask login = project.getTasks().create("azLogin", AzLoginTask.class);
	AzGetKubernetesCredentialsTask getCredentials =
			project.getTasks().create("azGetKubernetesCredentials", AzGetKubernetesCredentialsTask.class);
	getCredentials.dependsOn(login);

	extension.setSubscriptionId(System.getenv("AZ_SUBSCRIPTION_ID"));
	extension.setServicePrincipal(Boolean.parseBoolean(System.getenv("AZ_SERVICE_PRINCIPLE")));
	extension.setUserName(System.getenv("AZ_USER"));
	extension.setPassword(System.getenv("AZ_PASS"));
	extension.setTenantId(System.getenv("AZ_TENANT_ID"));
	extension.getAks().setKubeDir(new File(project.getRootProject().getProjectDir(), "build/.kube"));

	CliExecExtension cliExec = project.getExtensions().getByType(CliExecExtension.class);
	cliExec.register("az", extension.getCli());
}
 
Example 4
Source File: CodeGeneratorPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
@Override
public void apply(Project project) {
    CodeGeneratorConfiguration codeGenerator = project.getExtensions().create("codeGenerator", CodeGeneratorConfiguration.class, project.getObjects());
    Configuration codeGeneratorConfiguration = project.getConfigurations().create("codeGenerator");

    JavaPluginConvention plugin = project.getConvention().getPlugin(JavaPluginConvention.class);
    for (SourceSet sourceSet : plugin.getSourceSets()) {
        String outputDir = project.getBuildDir() + "/generated-src/generator/" + sourceSet.getName();
        File outputDirFile = new File(outputDir);
        project.getLogger().debug("Using output dir {}", outputDir);

        File inputDir = new File(project.getProjectDir() + "/src/code-generator/" + sourceSet.getName());
        sourceSet.getJava().srcDir(inputDir);
        sourceSet.getJava().srcDir(outputDirFile);

        project.getLogger().debug("Using input dir {}", inputDir);

        String taskName = sourceSet.getTaskName("generate", "Code");

        TaskProvider<GenerateCodeTask> generate = project.getTasks().register(taskName, GenerateCodeTask.class, s -> {
            s.setGroup("generate");
            s.getOutputDir().set(outputDirFile);
            if(inputDir.isDirectory()) {
                s.getInputDir().set(inputDir);
            }
            s.getSourceSet().set(sourceSet.getName());
            s.getCodeGeneratorClasspath().from(codeGeneratorConfiguration);
            s.getConfigurationValues().set(codeGenerator.getConfigurationValues());
            s.dependsOn(codeGeneratorConfiguration);
        });
        project.getTasks().named(sourceSet.getCompileJavaTaskName(), t -> t.dependsOn(generate));
    }
}
 
Example 5
Source File: CompilerOption.java    From putnami-gradle-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void init(Project project) {
	final File buildDir = new File(project.getBuildDir(), "putnami");

	this.war = new File(buildDir, "out");
	this.workDir = new File(buildDir, "work");
	this.gen = new File(buildDir, "extra/gen");
	this.deploy = new File(buildDir, "extra/deploy");
	this.extra = new File(buildDir, "extra");
	this.saveSourceOutput = new File(buildDir, "extra/source");
	this.missingDepsFile = new File(buildDir, "extra/missingDepsFile");
}
 
Example 6
Source File: ProbeVenvInfoAction.java    From pygradle with Apache License 2.0 5 votes vote down vote up
private static void doProbe(Project project, PythonDetails pythonDetails,
                      EditablePythonAbiContainer editablePythonAbiContainer) throws IOException {
    InputStream wheelApiResource = ProbeVenvInfoAction.class.getClassLoader()
        .getResourceAsStream("templates/wheel-api.py");

    byte[] buffer = new byte[wheelApiResource.available()];
    wheelApiResource.read(buffer);

    File probeDir = new File(project.getBuildDir(), PROBE_DIR_NAME);
    probeDir.mkdirs();

    OutputStream outStream = new FileOutputStream(getPythonFileForSupportedWheels(probeDir));
    outStream.write(buffer);

    File supportedAbiFormatsFile = getSupportedAbiFormatsFile(probeDir, pythonDetails);
    project.exec(execSpec -> {
        execSpec.commandLine(pythonDetails.getVirtualEnvInterpreter());
        execSpec.args(getPythonFileForSupportedWheels(probeDir));
        execSpec.args(supportedAbiFormatsFile.getAbsolutePath());
    });

    /*
     * The code for this function was originally here.
     * Still making this call to benefit AbstractPythonInfrastructureDefaultTask,
     * although it's not necessary for InstallVirtualEnvironmentTask because
     * GetProbedTagsTask will get the tags.
     */
    getSavedTags(pythonDetails, editablePythonAbiContainer, supportedAbiFormatsFile);
}
 
Example 7
Source File: JBBPExtension.java    From java-binary-block-parser with Apache License 2.0 5 votes vote down vote up
public void prepare(@Nonnull final Project project) {
  if (this.source == null) {
    this.source = project.fileTree("src/jbbp");
  }
  if (this.source.getIncludes().isEmpty()) {
    this.source.include("**/*.jbbp");
  }
  if (this.output == null) {
    this.output = new File(project.getBuildDir(), "generated-jbbp-dir");
  }
}
 
Example 8
Source File: PlayDistributionPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private void createDistributionZipTasks(Project project, Distribution distribution, TaskProvider<Task> stageLifecycleTask, TaskProvider<Task> distLifecycleTask) {
    final String capitalizedDistName = capitalizeDistributionName(distribution.getName());
    final String stageTaskName = "stage" + capitalizedDistName + "Dist";
    final File stageDir = new File(project.getBuildDir(), "stage");
    final String baseName = (distribution.getBaseName() != null && "".equals(distribution.getBaseName())) ? distribution.getBaseName() : distribution.getName();

    TaskProvider<Sync> stageSyncTask = project.getTasks().register(stageTaskName, Sync.class, sync -> {
        sync.setDescription("Copies the '" + distribution.getName() + "' distribution to a staging directory.");
        sync.setDestinationDir(stageDir);

        sync.into(baseName, copySpec -> copySpec.with(distribution.getContents()));
    });

    stageLifecycleTask.configure(task -> task.dependsOn(stageSyncTask));

    final String distributionZipTaskName = "create" + capitalizedDistName + "ZipDist";
    TaskProvider<Zip> distZipTask = project.getTasks().register(distributionZipTaskName, Zip.class, zip -> {
        zip.setDescription("Packages the '" + distribution.getName() + "' distribution as a zip file.");
        zip.setBaseName(baseName);
        zip.setDestinationDir(new File(project.getBuildDir(), "distributions"));
        zip.from(stageSyncTask);
    });

    final String distributionTarTaskName = "create" + capitalizedDistName + "TarDist";
    TaskProvider<Tar> distTarTask = project.getTasks().register(distributionTarTaskName, Tar.class, tar -> {
        tar.setDescription("Packages the '" + distribution.getName() + "' distribution as a tar file.");
        tar.setBaseName(baseName);
        tar.setDestinationDir(new File(project.getBuildDir(), "distributions"));
        tar.from(stageSyncTask);
    });

    distLifecycleTask.configure(task -> {
        task.dependsOn(distZipTask);
        task.dependsOn(distTarTask);
    });
}
 
Example 9
Source File: ProbeVenvInfoAction.java    From pygradle with Apache License 2.0 5 votes vote down vote up
/**
 * Populate the ABI container with supported wheel tags from probed environment.
 *
 * @param project current project
 * @param pythonDetails current python details
 * @param editablePythonAbiContainer the ABI container object to populate
 */
public static void getProbedTags(Project project,
                                PythonDetails pythonDetails,
                                EditablePythonAbiContainer editablePythonAbiContainer) {
    File probeDir = new File(project.getBuildDir(), PROBE_DIR_NAME);
    File supportedAbiFormatsFile = getSupportedAbiFormatsFile(probeDir, pythonDetails);
    try {
        getSavedTags(pythonDetails, editablePythonAbiContainer, supportedAbiFormatsFile);
    } catch (IOException e) {
        logger.info("Unable to probe venv for supported wheel tags. Ignoring the error. May slow the build.");
    }
}
 
Example 10
Source File: ModelBuilder.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Object buildAll(String modelName, Project project) {
    Collection<? extends SigningConfig> signingConfigs = config.getSigningConfigs();

    // Get the boot classpath. This will ensure the target is configured.
    List<String> bootClasspath = androidBuilder.getBootClasspathAsStrings();

    List<File> frameworkSource = Collections.emptyList();

    // List of extra artifacts, with all test variants added.
    List<ArtifactMetaData> artifactMetaDataList = Lists.newArrayList(
            extraModelInfo.getExtraArtifacts());

    LintOptions lintOptions = com.android.build.gradle.internal.dsl.LintOptions.create(
            config.getLintOptions());

    AaptOptions aaptOptions = AaptOptionsImpl.create(config.getAaptOptions());

    List<SyncIssue> syncIssues = Lists.newArrayList(extraModelInfo.getSyncIssues().values());

    List<String> flavorDimensionList = (config.getFlavorDimensionList() != null ?
            config.getFlavorDimensionList() : Lists.<String>newArrayList());


    DefaultAndroidProject androidProject = new DefaultAndroidProject(
            Version.ANDROID_GRADLE_PLUGIN_VERSION,
            project.getName(),
            flavorDimensionList,
            androidBuilder.getTarget() != null ? androidBuilder.getTarget().hashString() : "",
            bootClasspath,
            frameworkSource,
            cloneSigningConfigs(config.getSigningConfigs()),
            aaptOptions,
            artifactMetaDataList,
            findUnresolvedDependencies(syncIssues),
            syncIssues,
            config.getCompileOptions(),
            lintOptions,
            project.getBuildDir(),
            config.getResourcePrefix(),
            isLibrary,
            Version.BUILDER_MODEL_API_VERSION);

    androidProject.setDefaultConfig(ProductFlavorContainerImpl.createProductFlavorContainer(
            variantManager.getDefaultConfig(),
            extraModelInfo.getExtraFlavorSourceProviders(
                    variantManager.getDefaultConfig().getProductFlavor().getName())));

    for (BuildTypeData btData : variantManager.getBuildTypes().values()) {
        androidProject.addBuildType(BuildTypeContainerImpl.create(
                btData,
                extraModelInfo.getExtraBuildTypeSourceProviders(btData.getBuildType().getName())));
    }
    for (ProductFlavorData pfData : variantManager.getProductFlavors().values()) {
        androidProject.addProductFlavors(ProductFlavorContainerImpl.createProductFlavorContainer(
                pfData,
                extraModelInfo.getExtraFlavorSourceProviders(pfData.getProductFlavor().getName())));
    }

    for (BaseVariantData<? extends BaseVariantOutputData> variantData : variantManager.getVariantDataList()) {
        androidProject.addVariant(createVariant(variantData));
    }

    return androidProject;
}
 
Example 11
Source File: DeployableExtension.java    From pygradle with Apache License 2.0 4 votes vote down vote up
public DeployableExtension(Project project) {
    deployableBuildDir = new File(project.getBuildDir(), "deployable");
    deployableBinDir = new File(deployableBuildDir, "bin");
    deployableEtcDir = new File(deployableBuildDir, "etc");
}
 
Example 12
Source File: PexExtension.java    From pygradle with Apache License 2.0 4 votes vote down vote up
public PexExtension(Project project) {
    this.cache = new File(project.getBuildDir(), "pex-cache");
    this.project = project;
}
 
Example 13
Source File: AntGroovydoc.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void execute(final FileCollection source, File destDir, boolean use, String windowTitle, String docTitle, String header, String footer, String overview, boolean includePrivate, final Set<Groovydoc.Link> links, final Iterable<File> groovyClasspath, Iterable<File> classpath, Project project) {

        final File tmpDir = new File(project.getBuildDir(), "tmp/groovydoc");
        FileOperations fileOperations = (ProjectInternal) project;
        fileOperations.delete(tmpDir);
        fileOperations.copy(new Action<CopySpec>() {
            public void execute(CopySpec copySpec) {
                copySpec.from(source).into(tmpDir);
            }
        });

        final Map<String, Object> args = Maps.newLinkedHashMap();
        args.put("sourcepath", tmpDir.toString());
        args.put("destdir", destDir);
        args.put("use", use);
        args.put("private", includePrivate);
        putIfNotNull(args, "windowtitle", windowTitle);
        putIfNotNull(args, "doctitle", docTitle);
        putIfNotNull(args, "header", header);
        putIfNotNull(args, "footer", footer);
        putIfNotNull(args, "overview", overview);

        List<File> combinedClasspath = ImmutableList.<File>builder()
                .addAll(classpath)
                .addAll(groovyClasspath)
                .build();

        ant.withClasspath(combinedClasspath).execute(new Closure<Object>(this, this) {
            @SuppressWarnings("UnusedDeclaration")
            public Object doCall(Object it) {
                final GroovyObjectSupport antBuilder = (GroovyObjectSupport) it;

                antBuilder.invokeMethod("taskdef", ImmutableMap.of(
                        "name", "groovydoc",
                        "classname", "org.codehaus.groovy.ant.Groovydoc"
                ));

                antBuilder.invokeMethod("groovydoc", new Object[]{args, new Closure<Object>(this, this) {
                    public Object doCall(Object ignore) {
                        for (Groovydoc.Link link : links) {
                            antBuilder.invokeMethod("link", new Object[]{
                                    ImmutableMap.of(
                                            "packages", Joiner.on(",").join(link.getPackages()),
                                            "href", link.getUrl()
                                    )
                            });
                        }

                        return null;
                    }
                }});

                return null;
            }
        });
    }
 
Example 14
Source File: DownloadAction.java    From gradle-download-task with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new download action
 * @param project the project to be built
 */
public DownloadAction(Project project) {
    this.project = project;
    this.downloadTaskDir = new File(project.getBuildDir(), "download-task");
}
 
Example 15
Source File: PlayDistributionPlugin.java    From playframework with Apache License 2.0 4 votes vote down vote up
private void createDistributionContentTasks(Project project, Distribution distribution) {
    PlayExtension playExtension = (PlayExtension) project.getExtensions().getByName(PlayApplicationPlugin.PLAY_EXTENSION_NAME);
    TaskProvider<Jar> mainJarTask = project.getTasks().named(JAR_TASK_NAME, Jar.class);
    TaskProvider<Jar> assetsJarTask = project.getTasks().named(PlayApplicationPlugin.ASSETS_JAR_TASK_NAME, Jar.class);

    final File distJarDir = new File(project.getBuildDir(), "distributionJars/" + distribution.getName());
    final String capitalizedDistName = capitalizeDistributionName(distribution.getName());
    final String jarTaskName = "create" + capitalizedDistName + "DistributionJar";

    TaskProvider<Jar> distributionJarTask = project.getTasks().register(jarTaskName, Jar.class, jar -> {
        jar.setDescription("Assembles an application jar suitable for deployment.");
        jar.dependsOn(mainJarTask, assetsJarTask);
        jar.from(project.zipTree(mainJarTask.get().getArchivePath()));
        jar.setDestinationDir(distJarDir);
        jar.setBaseName(mainJarTask.get().getBaseName());

        Map<String, Object> classpath = new HashMap<>();
        classpath.put("Class-Path", new PlayManifestClasspath(project.getConfigurations().getByName(RUNTIME_CLASSPATH_CONFIGURATION_NAME), assetsJarTask.get().getArchivePath()));
        jar.getManifest().attributes(classpath);
    });

    final File scriptsDir = new File(project.getBuildDir(), "scripts");
    String createStartScriptsTaskName = "create" + capitalizedDistName + "StartScripts";
    TaskProvider<CreateStartScripts> createStartScriptsTask = project.getTasks().register(createStartScriptsTaskName, CreateStartScripts.class, createStartScripts -> {
        createStartScripts.setDescription("Creates OS specific scripts to run the distribution.");
        createStartScripts.setClasspath(distributionJarTask.get().getOutputs().getFiles());
        createStartScripts.setMainClassName(getMainClass(playExtension.getPlatform()));
        createStartScripts.setApplicationName(distribution.getName());
        createStartScripts.setOutputDir(scriptsDir);
    });

    CopySpec distSpec = distribution.getContents();
    distSpec.into("lib", copySpec -> {
        copySpec.from(distributionJarTask);
        copySpec.from(assetsJarTask.get().getArchivePath());
        copySpec.from(project.getConfigurations().getByName(RUNTIME_CLASSPATH_CONFIGURATION_NAME));
        copySpec.eachFile(new PrefixArtifactFileNames(project.getConfigurations().getByName(RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
    });

    distSpec.into("bin", copySpec -> {
        copySpec.from(createStartScriptsTask);
        copySpec.setFileMode(0755);
    });

    distSpec.into("conf", copySpec -> copySpec.from("conf").exclude("routes"));
    distSpec.from("README");
}
 
Example 16
Source File: ProjectNativeBinaryInitializer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
ProjectNativeBinaryInitializer(Project project) {
    binariesOutputDir = new File(project.getBuildDir(), "binaries");
}
 
Example 17
Source File: DevOption.java    From putnami-gradle-plugin with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void init(Project project) {
	final File buildDir = new File(project.getBuildDir(), "putnami");

	this.war = new File(buildDir, "warDev");
	this.workDir = new File(buildDir, "work");
}
 
Example 18
Source File: WheelExtension.java    From pygradle with Apache License 2.0 4 votes vote down vote up
public WheelExtension(Project project) {
    wheelCache = new File(project.getBuildDir(), "wheel-cache");
}
 
Example 19
Source File: Coverage.java    From firebase-android-sdk with Apache License 2.0 4 votes vote down vote up
public static void apply(FirebaseLibraryExtension firebaseLibrary) {
  Project project = firebaseLibrary.project;
  project.apply(ImmutableMap.of("plugin", "jacoco"));
  File reportsDir = new File(project.getBuildDir(), "/reports/jacoco");
  JacocoPluginExtension jacoco = project.getExtensions().getByType(JacocoPluginExtension.class);

  jacoco.setToolVersion("0.8.5");
  jacoco.setReportsDir(reportsDir);
  project
      .getTasks()
      .withType(
          Test.class,
          test -> {
            JacocoTaskExtension testJacoco =
                test.getExtensions().getByType(JacocoTaskExtension.class);
            testJacoco.setExcludeClassLoaders(ImmutableList.of("jdk.internal.*"));
            testJacoco.setIncludeNoLocationClasses(true);
          });

  project
      .getTasks()
      .create(
          "checkCoverage",
          JacocoReport.class,
          task -> {
            task.dependsOn("check");
            task.setDescription("Generates JaCoCo check coverage report.");
            task.setGroup("verification");

            List<String> excludes =
                ImmutableList.<String>builder()
                    .add("**/R.class")
                    .add("**/R$*.class")
                    .add("**/BuildConfig.*")
                    .add("**/proto/**")
                    .add("**Manifest*.*")
                    .build();

            task.setClassDirectories(
                project.files(
                    project.fileTree(
                        ImmutableMap.of(
                            "dir",
                            project.getBuildDir() + "/intermediates/javac/release",
                            "excludes",
                            excludes)),
                    project.fileTree(
                        ImmutableMap.of(
                            "dir",
                            project.getBuildDir() + "/tmp/kotlin-classes/release",
                            "excludes",
                            excludes))));
            task.setSourceDirectories(project.files("src/main/java", "src/main/kotlin"));
            task.setExecutionData(
                project.fileTree(
                    ImmutableMap.of(
                        "dir",
                        project.getBuildDir(),
                        "includes",
                        ImmutableList.of("jacoco/*.exec"))));
            task.reports(
                reports -> {
                  reports
                      .getHtml()
                      .setDestination(
                          new File(reportsDir, firebaseLibrary.artifactId.get() + "/html"));
                  reports.getXml().setEnabled(true);
                  reports
                      .getXml()
                      .setDestination(
                          new File(reportsDir, firebaseLibrary.artifactId.get() + ".xml"));
                });
            task.getOutputs().upToDateWhen(t -> false);
          });
}
 
Example 20
Source File: AntGroovydoc.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void execute(final FileCollection source, File destDir, boolean use, String windowTitle, String docTitle, String header, String footer, String overview, boolean includePrivate, final Set<Groovydoc.Link> links, final Iterable<File> groovyClasspath, Iterable<File> classpath, Project project) {

        final File tmpDir = new File(project.getBuildDir(), "tmp/groovydoc");
        FileOperations fileOperations = (ProjectInternal) project;
        fileOperations.delete(tmpDir);
        fileOperations.copy(new Action<CopySpec>() {
            public void execute(CopySpec copySpec) {
                copySpec.from(source).into(tmpDir);
            }
        });

        final Map<String, Object> args = Maps.newLinkedHashMap();
        args.put("sourcepath", tmpDir.toString());
        args.put("destdir", destDir);
        args.put("use", use);
        args.put("private", includePrivate);
        putIfNotNull(args, "windowtitle", windowTitle);
        putIfNotNull(args, "doctitle", docTitle);
        putIfNotNull(args, "header", header);
        putIfNotNull(args, "footer", footer);
        putIfNotNull(args, "overview", overview);

        List<File> combinedClasspath = ImmutableList.<File>builder()
                .addAll(classpath)
                .addAll(groovyClasspath)
                .build();

        ant.withClasspath(combinedClasspath).execute(new Closure<Object>(this, this) {
            @SuppressWarnings("UnusedDeclaration")
            public Object doCall(Object it) {
                final GroovyObjectSupport antBuilder = (GroovyObjectSupport) it;

                antBuilder.invokeMethod("taskdef", ImmutableMap.of(
                        "name", "groovydoc",
                        "classname", "org.codehaus.groovy.ant.Groovydoc"
                ));

                antBuilder.invokeMethod("groovydoc", new Object[]{args, new Closure<Object>(this, this) {
                    public Object doCall(Object ignore) {
                        for (Groovydoc.Link link : links) {
                            antBuilder.invokeMethod("link", new Object[]{
                                    ImmutableMap.of(
                                            "packages", Joiner.on(",").join(link.getPackages()),
                                            "href", link.getUrl()
                                    )
                            });
                        }

                        return null;
                    }
                }});

                return null;
            }
        });
    }