use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class GenerateModuleMetadata method run.
@TaskAction
void run() {
File file = outputFile.get().getAsFile();
PublicationInternal publication = (PublicationInternal) this.publication.get();
List<PublicationInternal> publications = Cast.uncheckedCast(this.publications.get());
try {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "utf8"));
try {
new ModuleMetadataFileGenerator(getBuildInvocationScopeId(), getProjectDependencyPublicationResolver()).generateTo(publication, publications, writer);
} finally {
writer.close();
}
} catch (IOException e) {
throw new UncheckedIOException("Could not generate metadata file " + outputFile.get(), e);
}
}
use of org.gradle.api.tasks.TaskAction in project tomee by apache.
the class TomEEEmbeddedTask method runTomEEEmbedded.
@TaskAction
public void runTomEEEmbedded() {
fixConfig();
final Thread thread = Thread.currentThread();
final ClassLoader tccl = thread.getContextClassLoader();
thread.setContextClassLoader(createLoader(tccl));
try {
doRun();
} finally {
thread.setContextClassLoader(tccl);
}
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class JacocoReport method generate.
@TaskAction
public void generate() {
final Spec<File> fileExistsSpec = new Spec<File>() {
@Override
public boolean isSatisfiedBy(File file) {
return file.exists();
}
};
new AntJacocoReport(getAntBuilder()).execute(getJacocoClasspath(), getProject().getName(), getAllClassDirs().filter(fileExistsSpec), getAllSourceDirs().filter(fileExistsSpec), getExecutionData(), getReports());
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class PublishToIvyRepository method publish.
@TaskAction
public void publish() {
IvyPublicationInternal publicationInternal = getPublicationInternal();
if (publicationInternal == null) {
throw new InvalidUserDataException("The 'publication' property is required");
}
IvyArtifactRepository repository = getRepository();
if (repository == null) {
throw new InvalidUserDataException("The 'repository' property is required");
}
doPublish(publicationInternal, repository);
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class JacocoCoverageVerification method check.
@TaskAction
public void check() {
final Spec<File> fileExistsSpec = new Spec<File>() {
@Override
public boolean isSatisfiedBy(File file) {
return file.exists();
}
};
JacocoCheckResult checkResult = new AntJacocoCheck(getAntBuilder()).execute(getJacocoClasspath(), getProject().getName(), getAllClassDirs().filter(fileExistsSpec), getAllSourceDirs().filter(fileExistsSpec), getExecutionData(), getViolationRules());
if (!checkResult.isSuccess()) {
throw new GradleException(checkResult.getFailureMessage());
}
}
Aggregations