本文整理汇总了Java中org.gradle.tooling.model.GradleTask类的典型用法代码示例。如果您正苦于以下问题:Java GradleTask类的具体用法?Java GradleTask怎么用?Java GradleTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GradleTask类属于org.gradle.tooling.model包,在下文中一共展示了GradleTask类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: newIdeaGradleProject
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
/**
* Creates a new {@link IdeaGradleProject}.
* @param moduleName the name of the IDEA module.
* @param gradleProject the Gradle project.
* @param buildFile the build.gradle file.
* @param gradleVersion the version of Gradle used to sync the project.
*/
public static IdeaGradleProject newIdeaGradleProject(@NotNull String moduleName,
@NotNull GradleProject gradleProject,
@Nullable File buildFile,
@Nullable String gradleVersion) {
List<String> taskNames = Lists.newArrayList();
DomainObjectSet<? extends GradleTask> tasks = gradleProject.getTasks();
if (!tasks.isEmpty()) {
for (GradleTask task : tasks) {
String name = task.getName();
if (isNotEmpty(name)) {
taskNames.add(task.getProject().getPath() + SdkConstants.GRADLE_PATH_SEPARATOR + task.getName());
}
}
}
return new IdeaGradleProject(moduleName, taskNames, gradleProject.getPath(), buildFile, gradleVersion);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IdeaGradleProject.java
示例2: buildRecursively
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private List<BasicGradleTaskSelector> buildRecursively(GradleProject project) {
Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();
for (GradleProject childProject : project.getChildren()) {
List<BasicGradleTaskSelector> childSelectors = buildRecursively(childProject);
for (BasicGradleTaskSelector childSelector : childSelectors) {
aggregatedTasks.putAll(childSelector.getName(), childSelector.getTaskNames());
}
}
for (GradleTask task : project.getTasks()) {
aggregatedTasks.put(task.getName(), task.getPath());
}
List<BasicGradleTaskSelector> selectors = Lists.newArrayList();
for (String selectorName : aggregatedTasks.keySet()) {
SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
selectorTasks.addAll(aggregatedTasks.get(selectorName));
selectors.add(new BasicGradleTaskSelector().
setName(selectorName).
setTaskNames(selectorTasks).
setDescription(project.getParent() != null
? String.format("%s:%s task selector", project.getPath(), selectorName)
: String.format("%s task selector", selectorName)).
setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
}
return selectors;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:26,代码来源:BuildInvocationsConverter.java
示例3: runSelectedTask
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private void runSelectedTask(String[] arguments) {
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj == null) {
return;
}
final GradleTask task = (GradleTask) obj;
GradleBuildJob buildJob = new GradleBuildJob("Running task " + task.getName(), project, task.getName()) {
@Override
protected void handleException(final Exception ex) {
displayErrorInProperThread(getSite().getShell(), "Task run Error", "Could not run task " + task.getName() + " : " + ex.getCause().getMessage());
}
};
buildJob.setArguments(arguments);
buildJob.doSchedule();
}
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:22,代码来源:TasksView.java
示例4: applyCompatibilityMapping
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public <T> ViewBuilder<T> applyCompatibilityMapping(ViewBuilder<T> viewBuilder, DefaultProjectIdentifier projectIdentifier) {
viewBuilder.mixInTo(GradleProject.class, new GradleProjectIdentifierMixin(projectIdentifier.getBuildIdentifier()));
viewBuilder.mixInTo(BasicGradleProject.class, new BasicGradleProjectIdentifierMixin(projectIdentifier.getBuildIdentifier()));
FixedBuildIdentifierProvider identifierProvider = new FixedBuildIdentifierProvider(projectIdentifier);
identifierProvider.applyTo(viewBuilder);
viewBuilder.mixInTo(GradleTask.class, TaskDisplayNameMixin.class);
viewBuilder.mixInTo(IdeaProject.class, IdeaProjectJavaLanguageSettingsMixin.class);
viewBuilder.mixInTo(IdeaDependency.class, IdeaModuleDependencyTargetNameMixin.class);
viewBuilder.mixInTo(GradleBuild.class, new IncludedBuildsMixin());
return viewBuilder;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:HasCompatibilityMapping.java
示例5: collectTasks
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private void collectTasks(GradleProject project, Multimap<String, String> aggregatedTasks) {
for (GradleProject childProject : project.getChildren()) {
collectTasks(childProject, aggregatedTasks);
}
for (GradleTask task : project.getTasks()) {
aggregatedTasks.put(task.getName(), task.getPath());
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:BuildInvocationsConverter.java
示例6: convertTasks
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private List<ConsumerProvidedTask> convertTasks(Iterable<? extends GradleTask> tasks) {
List<ConsumerProvidedTask> result = Lists.newArrayList();
for (GradleTask task : tasks) {
result.add(new ConsumerProvidedTask()
.setName(task.getName())
.setPath(task.getPath())
.setDescription(task.getDescription()));
}
return result;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:BuildInvocationsConverter.java
示例7: getTaskList
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
/**
* Return a list of all task names of the project.
*/
public List<String> getTaskList() {
ProjectConnection connection = getProjectConnection();
try {
GradleProject project = connection.getModel(GradleProject.class);
List<String> tasks = Lists.newArrayList();
for (GradleTask gradleTask : project.getTasks()) {
tasks.add(gradleTask.getName());
}
return tasks;
} finally {
connection.close();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GradleTestProject.java
示例8: isAndroidProject
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private static boolean isAndroidProject(@NotNull IdeaModule module) {
// A Gradle project is an Android project is if has at least one task with name starting with 'android'.
for (GradleTask task : module.getGradleProject().getTasks()) {
String taskName = task.getName();
if (taskName != null && taskName.startsWith(ANDROID_TASK_NAME_PREFIX)) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ProjectImportAction.java
示例9: isBuildable
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private static boolean isBuildable(@NotNull IdeaModule ideaModule) {
for (GradleTask task : ideaModule.getGradleProject().getTasks()) {
if (COMPILE_JAVA_TASK_NAME.equals(task.getName())) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:IdeaJavaProject.java
示例10: testGetGradleBuildFileFromModuleWithGradleFacet
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public void testGetGradleBuildFileFromModuleWithGradleFacet() {
GradleProject project = createMock(GradleProject.class);
expect(project.getPath()).andReturn(myModule.getName());
//noinspection unchecked
DomainObjectSet<? extends GradleTask> tasks = createMock(DomainObjectSet.class);
project.getTasks();
expectLastCall().andReturn(tasks);
expect(tasks.isEmpty()).andReturn(true);
replay(project, tasks);
IdeaGradleProject gradleProject = IdeaGradleProject.newIdeaGradleProject(myModule.getName(), project, myBuildFile, "2.2.1");
FacetManager facetManager = FacetManager.getInstance(myModule);
ModifiableFacetModel model = facetManager.createModifiableModel();
try {
AndroidGradleFacet facet = facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null);
model.addFacet(facet);
facet.setGradleProject(gradleProject);
}
finally {
model.commit();
}
VirtualFile buildFile = GradleUtil.getGradleBuildFile(myModule);
assertIsGradleBuildFile(buildFile);
verify(project, tasks);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GradleUtilIdeaTest.java
示例11: getTaskGroup
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
@Nullable
private static String getTaskGroup(GradleTask task) {
String taskGroup;
try {
taskGroup = task.getGroup();
}
catch (UnsupportedMethodException e) {
taskGroup = null;
}
return taskGroup;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BaseGradleProjectResolverExtension.java
示例12: convertTasks
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private List<DefaultGradleTask> convertTasks(Iterator<? extends GradleTask> tasks) {
return Lists.newArrayList(Iterators.transform(
tasks,
new Function<GradleTask, DefaultGradleTask>() {
public DefaultGradleTask apply(GradleTask task) {
return new DefaultGradleTask()
.setName(task.getName())
.setPath(task.getPath())
.setDescription(task.getDescription());
}
}
));
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:14,代码来源:BuildInvocationsConverter.java
示例13: isEclipseSupported
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
private boolean isEclipseSupported(ProjectEntry entry) {
EclipseProject model = entry.getModel();
DomainObjectSet<? extends GradleTask> tasks = model.getGradleProject().getTasks();
for (GradleTask task : tasks) {
if (task.getName().equals(GradleBuildTask.TASK_CONFIGURE_ECLIPSE)) {
return true;
}
}
return false;
}
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:11,代码来源:SelectGradleProjectsPage.java
示例14: getText
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public String getText(Object obj) {
if (obj instanceof GradleTask) {
GradleTask task = (GradleTask) obj;
String text = task.getName();
if (task.getDescription() != null) {
text = text + " - " + task.getDescription();
}
return text;
}
return obj.toString();
}
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:15,代码来源:TasksView.java
示例15: buildFilteredTaskList
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<GradleTask> buildFilteredTaskList(GradleProject project) {
Set<GradleTask> tasks = (Set<GradleTask>) project.getTasks();
List<GradleTask> callableTasks = new ArrayList<GradleTask>();
for (GradleTask task : tasks) {
if (!ArrayUtils.contains(TASK_BLACKLIST, task.getName())) {
callableTasks.add(task);
}
}
return callableTasks;
}
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:15,代码来源:GradlePluginUtils.java
示例16: TaskDisplayNameMixin
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public TaskDisplayNameMixin(GradleTask task) {
this.task = task;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:TaskDisplayNameMixin.java
示例17: getTasks
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
@Override
public DomainObjectSet<? extends GradleTask> getTasks() {
return ImmutableDomainObjectSet.of(myTasks);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GradleProjectStub.java
示例18: GradleTaskDisplayNameMixInHandler
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public GradleTaskDisplayNameMixInHandler(GradleTask task) {
this.task = task;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:4,代码来源:GradleTaskDisplayNameMixInHandler.java
示例19: execute
import org.gradle.tooling.model.GradleTask; //导入依赖的package包/类
public void execute(SourceObjectMapping mapping) {
if (GradleTask.class.isAssignableFrom(mapping.getTargetType()) && !versionDetails.supportsTaskDisplayName()) {
mapping.mixIn(GradleTaskDisplayNameMixInHandler.class);
}
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:6,代码来源:TaskPropertyHandlerFactory.java
注:本文中的org.gradle.tooling.model.GradleTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论