Search in sources :

Example 6 with DefaultTask

use of org.gradle.api.DefaultTask in project gradle by gradle.

the class JavaBasePlugin method configureBuildDependents.

private void configureBuildDependents(Project project) {
    DefaultTask buildTask = project.getTasks().create(BUILD_DEPENDENTS_TASK_NAME, DefaultTask.class);
    buildTask.setDescription("Assembles and tests this project and all projects that depend on it.");
    buildTask.setGroup(BasePlugin.BUILD_GROUP);
    buildTask.dependsOn(BUILD_TASK_NAME);
    buildTask.doFirst(new Action<Task>() {

        @Override
        public void execute(Task task) {
            if (!task.getProject().getGradle().getIncludedBuilds().isEmpty()) {
                task.getProject().getLogger().warn("[composite-build] Warning: `" + task.getPath() + "` task does not build included builds.");
            }
        }
    });
}
Also used : Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) DefaultTask(org.gradle.api.DefaultTask)

Example 7 with DefaultTask

use of org.gradle.api.DefaultTask in project gradle by gradle.

the class JavaBasePlugin method configureBuildNeeded.

private void configureBuildNeeded(Project project) {
    DefaultTask buildTask = project.getTasks().create(BUILD_NEEDED_TASK_NAME, DefaultTask.class);
    buildTask.setDescription("Assembles and tests this project and all projects it depends on.");
    buildTask.setGroup(BasePlugin.BUILD_GROUP);
    buildTask.dependsOn(BUILD_TASK_NAME);
}
Also used : DefaultTask(org.gradle.api.DefaultTask)

Example 8 with DefaultTask

use of org.gradle.api.DefaultTask in project atlas by alibaba.

the class DataBindingExportBuildInfoAwbsConfigAction method execute.

@Override
public void execute(MtlParallelTask parallelTask) {
    super.execute(parallelTask);
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
    if (null == androidDependencyTree) {
        return;
    }
    DataBindingBuilder dataBindingBuilder = new DataBindingBuilder();
    dataBindingBuilder.setPrintMachineReadableOutput(false);
    dataBindingBuilder.setDebugLogEnabled(appVariantContext.getProject().getLogger().isDebugEnabled());
    List<DefaultTask> tasks = new ArrayList<DefaultTask>();
    for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        AwbDataBindingExportBuildInfoConfigAction exportBuildInfoConfigAction = new AwbDataBindingExportBuildInfoConfigAction(appVariantContext, awbBundle, dataBindingBuilder.getPrintMachineReadableOutput(), dataBindingBuilder);
        DataBindingExportBuildInfoTask exportBuildInfoTask = TaskCreater.create(appVariantContext.getProject(), exportBuildInfoConfigAction.getName(), exportBuildInfoConfigAction.getType());
        exportBuildInfoConfigAction.execute(exportBuildInfoTask);
        tasks.add(exportBuildInfoTask);
    }
    parallelTask.parallelTask = tasks;
    parallelTask.uniqueTaskName = getName();
    parallelTask.concurrent = true;
}
Also used : ArrayList(java.util.ArrayList) DefaultTask(org.gradle.api.DefaultTask) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) DataBindingExportBuildInfoTask(com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask) DataBindingBuilder(android.databinding.tool.DataBindingBuilder) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle)

Example 9 with DefaultTask

use of org.gradle.api.DefaultTask in project atlas by alibaba.

the class MergeManifestAwbsConfigAction method execute.

@Override
public void execute(MtlParallelTask parallelTask) {
    super.execute(parallelTask);
    AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
    if (null == androidDependencyTree) {
        return;
    }
    List<DefaultTask> tasks = new ArrayList<DefaultTask>();
    AppVariantOutputContext appVariantOutputContext = getAppVariantOutputContext();
    for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
        List<ManifestMerger2.Invoker.Feature> optionalFeatures = ImmutableList.<ManifestMerger2.Invoker.Feature>of();
        MergeAwbManifests.ConfigAction configAction = new MergeAwbManifests.ConfigAction(appVariantOutputContext.getOutputScope(), awbBundle, optionalFeatures, appVariantOutputContext);
        MergeAwbManifests mergeAwbManifests = TaskCreater.create(appVariantContext.getProject(), configAction.getName(), configAction.getType());
        configAction.execute(mergeAwbManifests);
        tasks.add(mergeAwbManifests);
    }
    parallelTask.parallelTask = tasks;
    parallelTask.uniqueTaskName = getName();
}
Also used : ArrayList(java.util.ArrayList) DefaultTask(org.gradle.api.DefaultTask) ManifestMerger2(com.android.manifmerger.ManifestMerger2) AndroidDependencyTree(com.taobao.android.builder.dependency.AndroidDependencyTree) AppVariantOutputContext(com.android.build.gradle.internal.api.AppVariantOutputContext) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle)

Aggregations

DefaultTask (org.gradle.api.DefaultTask)9 ArrayList (java.util.ArrayList)6 AndroidDependencyTree (com.taobao.android.builder.dependency.AndroidDependencyTree)5 AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)5 DataBindingBuilder (android.databinding.tool.DataBindingBuilder)2 Task (org.gradle.api.Task)2 AppVariantOutputContext (com.android.build.gradle.internal.api.AppVariantOutputContext)1 DataBindingExportBuildInfoTask (com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask)1 DataBindingProcessLayoutsTask (com.android.build.gradle.internal.tasks.databinding.DataBindingProcessLayoutsTask)1 MergeResources (com.android.build.gradle.tasks.MergeResources)1 MergeSourceSetFolders (com.android.build.gradle.tasks.MergeSourceSetFolders)1 ManifestMerger2 (com.android.manifmerger.ManifestMerger2)1 MtlParallelTask (com.taobao.android.builder.tasks.app.MtlParallelTask)1 MergeAwbAssetConfigAction (com.taobao.android.builder.tasks.bundle.MergeAwbAssetConfigAction)1 MergeAwbResourceConfigAction (com.taobao.android.builder.tasks.bundle.MergeAwbResourceConfigAction)1 ExecutorServicesHelper (com.taobao.android.builder.tools.concurrent.ExecutorServicesHelper)1 File (java.io.File)1 IOException (java.io.IOException)1 TaskAction (org.gradle.api.tasks.TaskAction)1 NativeComponentSpec (org.gradle.nativeplatform.NativeComponentSpec)1