org.gradle.api.plugins.quality.JDepend Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.plugins.quality;
import groovy.lang.Closure;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.FileCollection;
import org.gradle.api.internal.ClosureBackedAction;
import org.gradle.api.internal.project.IsolatedAntBuilder;
import org.gradle.api.plugins.quality.internal.JDependInvoker;
import org.gradle.api.plugins.quality.internal.JDependReportsImpl;
import org.gradle.api.reporting.Reporting;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.OrderSensitive;
import org.gradle.api.tasks.SkipWhenEmpty;
import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.reflect.Instantiator;
import javax.inject.Inject;
import java.io.File;
/**
* Analyzes code with JDepend.
*/
public class JDepend extends DefaultTask implements Reporting {
private FileCollection jdependClasspath;
private File classesDir;
private final JDependReports reports;
/**
* Returns the directory containing the classes to be analyzed.
*/
/**
* The directory containing the classes to be analyzed.
*/
@InputDirectory
@SkipWhenEmpty
public File getClassesDir() {
return classesDir;
}
public JDepend() {
reports = getInstantiator().newInstance(JDependReportsImpl.class, this);
}
@Inject
public Instantiator getInstantiator() {
throw new UnsupportedOperationException();
}
@Inject
public IsolatedAntBuilder getAntBuilder() {
throw new UnsupportedOperationException();
}
/**
* Configures the reports to be generated by this task.
*
* The contained reports can be configured by name and closures. Example:
*
*
* jdependTask {
* reports {
* xml {
* destination "build/jdepend.xml"
* }
* }
* }
*
*
* @param closure The configuration
* @return The reports container
*/
public JDependReports reports(Closure closure) {
return reports(new ClosureBackedAction(closure));
}
/**
* Configures the reports to be generated by this task.
*
* The contained reports can be configured by name and closures. Example:
*
*
* jdependTask {
* reports {
* xml {
* destination "build/jdepend.xml"
* }
* }
* }
*
*
* @param configureAction The configuration
* @return The reports container
*/
@Override
public JDependReports reports(Action super JDependReports> configureAction) {
configureAction.execute(reports);
return reports;
}
@TaskAction
public void run() {
JDependInvoker.invoke(this);
}
/**
* The class path containing the JDepend library to be used.
*/
@OrderSensitive
@InputFiles
public FileCollection getJdependClasspath() {
return jdependClasspath;
}
public void setJdependClasspath(FileCollection jdependClasspath) {
this.jdependClasspath = jdependClasspath;
}
public void setClassesDir(File classesDir) {
this.classesDir = classesDir;
}
/**
* The reports to be generated by this task.
*/
@Nested
public final JDependReports getReports() {
return reports;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy