当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTask类代码示例

本文整理汇总了Java中org.gradle.api.DefaultTask的典型用法代码示例。如果您正苦于以下问题:Java DefaultTask类的具体用法?Java DefaultTask怎么用?Java DefaultTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultTask类属于org.gradle.api包,在下文中一共展示了DefaultTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBuildDependentComponentsTasks

import org.gradle.api.DefaultTask; //导入依赖的package包/类
public static void createBuildDependentComponentsTasks(ModelMap<Task> tasks, ComponentSpecContainer components) {
    for (final VariantComponentSpec component : components.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class)) {
        tasks.create(getAssembleDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
            @Override
            public void execute(DefaultTask assembleDependents) {
                assembleDependents.setGroup("Build Dependents");
                assembleDependents.setDescription("Assemble dependents of " + component.getDisplayName() + ".");
            }
        });
        tasks.create(getBuildDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
            @Override
            public void execute(DefaultTask buildDependents) {
                buildDependents.setGroup("Build Dependents");
                buildDependents.setDescription("Build dependents of " + component.getDisplayName() + ".");
            }
        });
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:NativeComponents.java

示例2: configurePreCompiledHeaderCompileTasks

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Mutate
void configurePreCompiledHeaderCompileTasks(final TaskContainer tasks, BinaryContainer binaries, final LanguageTransformContainer languageTransforms, final ServiceRegistry serviceRegistry) {
    for (final NativeBinarySpecInternal nativeBinarySpec : binaries.withType(NativeBinarySpecInternal.class)) {
        for (final PchEnabledLanguageTransform<?> transform : languageTransforms.withType(PchEnabledLanguageTransform.class)) {
            nativeBinarySpec.getInputs().withType(transform.getSourceSetType(), new Action<LanguageSourceSet>() {
                @Override
                public void execute(final LanguageSourceSet languageSourceSet) {
                    final DependentSourceSet dependentSourceSet = (DependentSourceSet) languageSourceSet;
                    if (dependentSourceSet.getPreCompiledHeader() != null) {
                        nativeBinarySpec.addPreCompiledHeaderFor(dependentSourceSet);
                        final SourceTransformTaskConfig pchTransformTaskConfig = transform.getPchTransformTask();
                        String pchTaskName = pchTransformTaskConfig.getTaskPrefix() + StringUtils.capitalize(nativeBinarySpec.getProjectScopedName()) + StringUtils.capitalize(dependentSourceSet.getName()) + "PreCompiledHeader";
                        Task pchTask = tasks.create(pchTaskName, pchTransformTaskConfig.getTaskType(), new Action<DefaultTask>() {
                            @Override
                            public void execute(DefaultTask task) {
                                pchTransformTaskConfig.configureTask(task, nativeBinarySpec, dependentSourceSet, serviceRegistry);
                            }
                        });
                        nativeBinarySpec.getTasks().add(pchTask);
                    }
                }
            });
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:NativeComponentModelPlugin.java

示例3: create

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public <S extends TaskInternal> S create(String name, final Class<S> type) {
    if (!Task.class.isAssignableFrom(type)) {
        throw new InvalidUserDataException(String.format(
                "Cannot create task of type '%s' as it does not implement the Task interface.",
                type.getSimpleName()));
    }

    final Class<? extends Task> generatedType;
    if (type.isAssignableFrom(DefaultTask.class)) {
        generatedType = generator.generate(DefaultTask.class);
    } else {
        generatedType = generator.generate(type);
    }

    return type.cast(AbstractTask.injectIntoNewInstance(project, name, type, new Callable<Task>() {
        public Task call() throws Exception {
            try {
                return instantiator.newInstance(generatedType);
            } catch (ObjectInstantiationException e) {
                throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()),
                        e.getCause());
            }
        }
    }));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:27,代码来源:TaskFactory.java

示例4: apply

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public void apply(Project target) {
    super.apply(target);

    makeTask("download", DownloadTask.class);
    makeTask("mapJars", MapJarsTask.class).dependsOn("download");
    makeTask("mergeJars", MergeJarsTask.class).dependsOn("mapJars");
    makeTask("decompile", DecompileTask.class).dependsOn("mergeJars");
    makeTask("applyPatches", PatchMinecraftTask.class).dependsOn("decompile");
    makeTask("setupOML", DefaultTask.class).dependsOn("applyPatches");

    makeTask("genPatches", GenPatchesTask.class);

    makeTask("extractNatives", ExtractNativesTask.class).dependsOn("download");
    makeTask("genIdeaRuns", GenIdeaProjectTask.class).dependsOn("cleanIdea").dependsOn("idea").dependsOn("extractNatives");
}
 
开发者ID:OpenModLoader,项目名称:ModGradle,代码行数:17,代码来源:ModGradlePlugin.java

示例5: apply

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public void apply(Project target) {
	super.apply(target);

	makeTask("download", DownloadTask.class);
	makeTask("mergeJars", MergeJarsTask.class).dependsOn("download");
	makeTask("mapJars", MapJarsTask.class).dependsOn("mergeJars");
	makeTask("processMods", ProcessModsTask.class).dependsOn("mapJars");
	makeTask("setupFabric", DefaultTask.class).dependsOn("processMods");

	makeTask("extractNatives", ExtractNativesTask.class).dependsOn("download");
	makeTask("genIdeaWorkspace", GenIdeaProjectTask.class).dependsOn("idea");

	makeTask("vscode", GenVSCodeProjectTask.class).dependsOn("extractNatives");

	makeTask("runClient", RunClientTask.class).dependsOn("buildNeeded");
	makeTask("runServer", RunServerTask.class).dependsOn("buildNeeded");
}
 
开发者ID:FabricMC,项目名称:fabric-loom,代码行数:19,代码来源:LoomGradlePlugin.java

示例6: addAssemble

import org.gradle.api.DefaultTask; //导入依赖的package包/类
private void addAssemble(ProjectInternal project) {
    addPlaceholderAction(project, ASSEMBLE_TASK_NAME, DefaultTask.class, new Action<TaskInternal>() {
        @Override
        public void execute(TaskInternal assembleTask) {
            assembleTask.setDescription("Assembles the outputs of this project.");
            assembleTask.setGroup(BUILD_GROUP);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:LifecycleBasePlugin.java

示例7: addCheck

import org.gradle.api.DefaultTask; //导入依赖的package包/类
private void addCheck(ProjectInternal project) {
    addPlaceholderAction(project, CHECK_TASK_NAME, DefaultTask.class, new Action<TaskInternal>() {
        @Override
        public void execute(TaskInternal checkTask) {
            checkTask.setDescription("Runs all checks.");
            checkTask.setGroup(VERIFICATION_GROUP);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:LifecycleBasePlugin.java

示例8: addBuild

import org.gradle.api.DefaultTask; //导入依赖的package包/类
private void addBuild(final ProjectInternal project) {
    addPlaceholderAction(project, BUILD_TASK_NAME, DefaultTask.class, new Action<DefaultTask>() {
        @Override
        public void execute(DefaultTask buildTask) {
            buildTask.setDescription("Assembles and tests this project.");
            buildTask.setGroup(BUILD_GROUP);
            buildTask.dependsOn(ASSEMBLE_TASK_NAME);
            buildTask.dependsOn(CHECK_TASK_NAME);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:LifecycleBasePlugin.java

示例9: defineBinariesCheckTasks

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Finalize
public void defineBinariesCheckTasks(@Each BinarySpecInternal binary, ITaskFactory taskFactory) {
    if (binary.isLegacyBinary()) {
        return;
    }
    TaskInternal binaryLifecycleTask = taskFactory.create(binary.getNamingScheme().getTaskName("check"), DefaultTask.class);
    binaryLifecycleTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
    binaryLifecycleTask.setDescription("Check " + binary);
    binary.setCheckTask(binaryLifecycleTask);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:TestingModelBasePlugin.java

示例10: getDeclaredTaskType

import org.gradle.api.DefaultTask; //导入依赖的package包/类
private Class getDeclaredTaskType(Task original) {
    Class clazz = new DslObject(original).getDeclaredType();
    if (clazz.equals(DefaultTask.class)) {
        return org.gradle.api.Task.class;
    } else {
        return clazz;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:TaskDetailPrinter.java

示例11: getTransformTask

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public SourceTransformTaskConfig getTransformTask() {
    return new SourceTransformTaskConfig() {
        public String getTaskPrefix() {
            return "compile";
        }

        public Class<? extends DefaultTask> getTaskType() {
            return RoutesCompile.class;
        }

        public void configureTask(Task task, BinarySpec binarySpec, LanguageSourceSet sourceSet, ServiceRegistry serviceRegistry) {
            PlayApplicationBinarySpecInternal binary = (PlayApplicationBinarySpecInternal) binarySpec;
            RoutesSourceSet routesSourceSet = (RoutesSourceSet) sourceSet;
            RoutesCompile routesCompile = (RoutesCompile) task;
            ScalaLanguageSourceSet routesScalaSources = binary.getGeneratedScala().get(routesSourceSet);
            File generatedSourceDir = binary.getNamingScheme().getOutputDirectory(task.getProject().getBuildDir(), "src");
            File routesCompileOutputDirectory = new File(generatedSourceDir, routesScalaSources.getName());

            routesCompile.setDescription("Generates routes for the '" + routesSourceSet.getName() + "' source set.");
            routesCompile.setPlatform(binary.getTargetPlatform());
            routesCompile.setAdditionalImports(new ArrayList<String>());
            routesCompile.setSource(routesSourceSet.getSource());
            routesCompile.setOutputDirectory(routesCompileOutputDirectory);
            routesCompile.setInjectedRoutesGenerator(binary.getApplication().getInjectedRoutesGenerator());

            routesScalaSources.getSource().srcDir(routesCompileOutputDirectory);
            routesScalaSources.builtBy(routesCompile);
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:32,代码来源:PlayRoutesPlugin.java

示例12: getTransformTask

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public SourceTransformTaskConfig getTransformTask() {
    return new SourceTransformTaskConfig() {
        public String getTaskPrefix() {
            return "compile";
        }

        public Class<? extends DefaultTask> getTaskType() {
            return TwirlCompile.class;
        }

        public void configureTask(Task task, BinarySpec binarySpec, LanguageSourceSet sourceSet, ServiceRegistry serviceRegistry) {
            PlayApplicationBinarySpecInternal binary = (PlayApplicationBinarySpecInternal) binarySpec;
            TwirlSourceSet twirlSourceSet = (TwirlSourceSet) sourceSet;
            TwirlCompile twirlCompile = (TwirlCompile) task;
            ScalaLanguageSourceSet twirlScalaSources = binary.getGeneratedScala().get(twirlSourceSet);

            File generatedSourceDir = binary.getNamingScheme().getOutputDirectory(task.getProject().getBuildDir(), "src");
            File twirlCompileOutputDirectory = new File(generatedSourceDir, twirlScalaSources.getName());

            twirlCompile.setDescription("Compiles twirl templates for the '" + twirlSourceSet.getName() + "' source set.");
            twirlCompile.setPlatform(binary.getTargetPlatform());
            twirlCompile.setSource(twirlSourceSet.getSource());
            twirlCompile.setOutputDirectory(twirlCompileOutputDirectory);
            twirlCompile.setDefaultImports(twirlSourceSet.getDefaultImports());

            twirlScalaSources.getSource().srcDir(twirlCompileOutputDirectory);
            twirlScalaSources.builtBy(twirlCompile);
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:32,代码来源:PlayTwirlPlugin.java

示例13: configureBuildDependents

import org.gradle.api.DefaultTask; //导入依赖的package包/类
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.");
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:JavaBasePlugin.java

示例14: addDependenciesToPrepareTask

import org.gradle.api.DefaultTask; //导入依赖的package包/类
public void addDependenciesToPrepareTask(
        @NonNull TaskFactory tasks,
        @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData,
        @NonNull AndroidTask<PrepareDependenciesTask> prepareDependenciesTask) {
    VariantDependencies variantDeps = variantData.getVariantDependency();

    final AndroidTask<DefaultTask> preBuildTask = variantData.getScope().getPreBuildTask();

    final ImmutableList<AndroidDependency> compileLibraries = variantDeps
            .getCompileDependencies().getAllAndroidDependencies();
    final ImmutableList<AndroidDependency> packageLibraries = variantDeps
            .getPackageDependencies().getAllAndroidDependencies();


    // gather all the libraries first, then make the task depend on the list in a single
    // pass.
    List<PrepareLibraryTask> prepareLibraryTasks = Lists
            .newArrayListWithCapacity(compileLibraries.size() + packageLibraries.size());

    for (AndroidDependency dependency : Iterables.concat(compileLibraries, packageLibraries)) {
        // skip sub-module since we don't extract them anymore.
        if (dependency.getProjectPath() == null) {
            PrepareLibraryTask prepareLibTask = prepareLibTaskMap
                    .get(dependency.getCoordinates().toString());
            if (prepareLibTask != null) {
                prepareLibraryTasks.add(prepareLibTask);
                prepareLibTask.dependsOn(preBuildTask.getName());
            }
        }
    }

    if (!prepareLibraryTasks.isEmpty()) {
        prepareDependenciesTask.dependsOn(tasks, prepareLibraryTasks.toArray());
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:36,代码来源:DependencyManager.java

示例15: apply

import org.gradle.api.DefaultTask; //导入依赖的package包/类
@Override
public void apply(Project project) {

	if (!project.getPlugins().hasPlugin(AppPlugin.class)) {
		throw new RuntimeException("should be declared after 'com.android.application'");
	}

	AppExtension ext = project.getExtensions().getByType(AppExtension.class);

	ext.getApplicationVariants().all(v -> {
		String taskName = "open"+capitalize(v.getName());
		DefaultTask parentTask = v.getInstall();
		File adb = ext.getAdbExe();

		if (v.isSigningReady()) {

			String packageId = v.getApplicationId();

			HashMap variantAction = new HashMap();
			variantAction.put("dependsOn", parentTask);
			variantAction.put("description", "Installs and opens " + v.getDescription());
			variantAction.put("type", Exec.class);
			variantAction.put("group", "Open");

			Exec t = (Exec) project.task(variantAction, taskName);

			t.setCommandLine(adb, "shell", "monkey", "-p", packageId, "-c", "android.intent.category.LAUNCHER", "1");
		}
	});

}
 
开发者ID:cesarferreira,项目名称:android-rocket-launcher,代码行数:32,代码来源:RocketLauncher.java


注:本文中的org.gradle.api.DefaultTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。