本文整理了Java中org.gradle.api.Task.getPath()
方法的一些代码示例,展示了Task.getPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getPath()
方法的具体详情如下:
包路径:org.gradle.api.Task
类名称:Task
方法名:getPath
暂无
代码示例来源:origin: org.shipkit/shipkit
@Override
public void run() {
throw new GradleException("Dependency project property not set. It is required for task '" + task.getPath() + "'.\n" +
"You can pass project property via command line: -Pdependency=\"org.shipkit:shipkit:1.2.3\"");
}
});
代码示例来源:origin: mockito/shipkit
@Override
public void run() {
throw new GradleException("Dependency project property not set. It is required for task '" + task.getPath() + "'.\n" +
"You can pass project property via command line: -Pdependency=\"org.shipkit:shipkit:1.2.3\"");
}
});
代码示例来源:origin: gradle.plugin.org.mockito/release
public boolean isSatisfiedBy(Task task) {
try {
return allower.call();
} catch (Throwable t) {
throw new RuntimeException("Unhandled exception thrown when release workflow" +
" attempted to evaluate whether to allow execution of task '" + task.getPath() + "' ", t);
}
}
}
代码示例来源:origin: org.gradle/gradle-core
public boolean hasTask(String path) {
ensurePopulated();
assert path != null && path.length() > 0;
for (Task task : taskExecutionPlan.getTasks()) {
if (task.getPath().equals(path)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.gradle/gradle-core
public File getBaseDirectory(Object scope, String key, VersionStrategy versionStrategy) {
if (key.equalsIgnoreCase("projects") || key.equalsIgnoreCase("tasks") || !key.matches("\\p{Alpha}+[-//.\\w]*")) {
throw new IllegalArgumentException(String.format("Unsupported cache key '%s'.", key));
}
File cacheRootDir = getRootDirectory(scope);
String subDir = key;
if (scope instanceof Project) {
Project project = (Project) scope;
subDir = "projects/" + project.getPath().replace(':', '_') + "/" + key;
}
if (scope instanceof Task) {
Task task = (Task) scope;
subDir = "tasks/" + task.getPath().replace(':', '_') + "/" + key;
}
return getCacheDir(cacheRootDir, versionStrategy, subDir);
}
代码示例来源:origin: org.gradle/gradle-core
@Override
public int compareTo(Task otherTask) {
int depthCompare = project.compareTo(otherTask.getProject());
if (depthCompare == 0) {
return getPath().compareTo(otherTask.getPath());
} else {
return depthCompare;
}
}
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
private static void configurePublicationRepo(Project project, String bintrayRepo) {
//not using 'getTasks().withType()' because I don't want to create too many task configuration rules
//TODO add information about it in the development guide
for (Task t : project.getTasks()) {
if (t instanceof UpdateReleaseNotesTask) {
UpdateReleaseNotesTask task = (UpdateReleaseNotesTask) t;
if (task.getPublicationRepository() == null) {
LOG.info("Configuring publication repository '{}' on task: {}", bintrayRepo, t.getPath());
task.setPublicationRepository(bintrayRepo);
}
}
}
//TODO unit test coverage
}
}
代码示例来源:origin: com.android.tools.build/gradle-core
@Override
public void beforeExecute(@NonNull Task task) {
GradleBuildProfileSpan.Builder builder = GradleBuildProfileSpan.newBuilder();
builder.setType(ExecutionType.TASK_EXECUTION);
builder.setId(recordWriter.allocateRecordId());
builder.setStartTimeInMs(System.currentTimeMillis());
taskRecords.put(task.getPath(), builder);
}
代码示例来源:origin: org.shipkit/shipkit
static boolean configureTask(Task snapshotTask, List<String> taskNames) {
boolean isSnapshot = taskNames.contains(SNAPSHOT_TASK);
if (isSnapshot) {
snapshotTask.getProject().getTasks().matching(withName("javadoc", "groovydoc")).all(doc -> {
LOG.info("{} - disabled to speed up the 'snapshot' build", snapshotTask.getPath());
doc.setEnabled(false);
});
}
return isSnapshot;
}
代码示例来源:origin: mockito/shipkit
static boolean configureTask(Task snapshotTask, List<String> taskNames) {
boolean isSnapshot = taskNames.contains(SNAPSHOT_TASK);
if (isSnapshot) {
snapshotTask.getProject().getTasks().matching(withName("javadoc", "groovydoc")).all(doc -> {
LOG.info("{} - disabled to speed up the 'snapshot' build", snapshotTask.getPath());
doc.setEnabled(false);
});
}
return isSnapshot;
}
代码示例来源:origin: gradle.plugin.com.github.SeelabFhdo/CodeGeneratorPlugin
project.getTasks().getByName(s.getCompileJavaTaskName()).dependsOn(t.getPath());
t.doLast(t2 -> {
Set<File> resolve = Collections.singleton(null);
代码示例来源:origin: org.gradle/gradle-core
public void beforeExecute(Task task) {
long now = clock.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
projectProfile.getTaskProfile(task.getPath()).setStart(now);
}
代码示例来源:origin: gradle.plugin.com.github.gradle-guides/gradle-site-plugin
@Override
public void execute(Task task) {
if (task.getGroup() != null) {
projectDescriptor.addTask(new TaskDescriptor(task.getName(), task.getPath(), task.getGroup(), task.getDescription()));
}
}
});
代码示例来源:origin: org.gradle/gradle-core
} catch (CommandLineArgumentException e) {
throw new TaskConfigurationException(task.getPath(), "Problem configuring task " + task.getPath() + " from command line.", e);
commandLineOptionDescriptor.apply(task, o.getValues());
} catch (TypeConversionException ex) {
throw new TaskConfigurationException(task.getPath(),
String.format("Problem configuring option '%s' on task '%s' from command line.", name, task.getPath()), ex);
代码示例来源:origin: org.gradle/gradle-core
public void afterExecute(Task task, TaskState state) {
long now = clock.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath());
taskExecution.setFinish(now);
taskExecution.completed(state);
}
代码示例来源:origin: SonarSource/sonar-scanner-gradle
public boolean matches(Object o) {
Task task = (Task) o;
Set<String> names = new HashSet<>();
Set<? extends Task> depTasks = task.getTaskDependencies().getDependencies(task);
for (Task depTask : depTasks) {
names.add(matchOnPaths ? depTask.getPath() : depTask.getName());
}
boolean matches = matcher.matches(names);
if (!matches) {
StringDescription description = new StringDescription();
matcher.describeTo(description);
System.out.println(String.format("expected %s, got %s.", description.toString(), names));
}
return matches;
}
代码示例来源:origin: com.android.tools.build/gradle-core
@Override
public void afterExecute(@NonNull Task task, @NonNull TaskState taskState) {
GradleBuildProfileSpan.Builder record = taskRecords.remove(task.getPath());
record.setDurationInMs(System.currentTimeMillis() - record.getStartTimeInMs());
//noinspection ThrowableResultOfMethodCallIgnored Just logging the failure.
record.setTask(
GradleTaskExecution.newBuilder()
.setType(AnalyticsUtil.getTaskExecutionType(task.getClass()))
.setDidWork(taskState.getDidWork())
.setSkipped(taskState.getSkipped())
.setUpToDate(taskState.getUpToDate())
.setFailed(taskState.getFailure() != null));
recordWriter.writeRecord(task.getProject().getPath(), getVariantName(task), record);
ProcessProfileWriter.recordMemorySample();
}
内容来源于网络,如有侵权,请联系作者删除!