當前位置: 首頁>>代碼示例>>Java>>正文


Java TaskAction類代碼示例

本文整理匯總了Java中org.gradle.api.tasks.TaskAction的典型用法代碼示例。如果您正苦於以下問題:Java TaskAction類的具體用法?Java TaskAction怎麽用?Java TaskAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TaskAction類屬於org.gradle.api.tasks包,在下文中一共展示了TaskAction類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCircleReport

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void createCircleReport() throws IOException, TransformerException {
    if (!styleTask.getDidWork()) {
        setDidWork(false);
        return;
    }

    File rootDir = getProject().getRootProject().getProjectDir();
    String projectName = getProject().getName();
    File sourceReport = reporting.getReports().findByName("xml").getDestination();

    List<Failure> failures = reportParser.loadFailures(new FileInputStream(sourceReport));
    long taskTimeNanos = styleTaskTimer.getTaskTimeNanos(styleTask);
    Document report = reportToXml(failuresReport(
            rootDir, projectName, styleTask.getName(), taskTimeNanos, failures));
    targetFile.getParentFile().mkdirs();
    try (FileWriter writer = new FileWriter(targetFile)) {
        XmlUtils.write(writer, report);
    }
}
 
開發者ID:palantir,項目名稱:gradle-circle-style,代碼行數:21,代碼來源:CircleStyleFinalizer.java

示例2: run

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void run() throws IOException, InterruptedException {
    new FindBugsClasspathValidator(JavaVersion.current()).validateClasspath(
        Iterables.transform(getFindbugsClasspath().getFiles(), new Function<File, String>() {
            @Override
            public String apply(File input) {
                return input.getName();
            }
        }));
    FindBugsSpec spec = generateSpec();
    FindBugsWorkerManager manager = new FindBugsWorkerManager();

    getLogging().captureStandardOutput(LogLevel.DEBUG);
    getLogging().captureStandardError(LogLevel.DEBUG);

    FindBugsResult result = manager.runWorker(getProject().getProjectDir(), getWorkerProcessBuilderFactory(), getFindbugsClasspath(), spec);
    evaluateResult(result);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:FindBugs.java

示例3: generateModel

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void generateModel() throws Exception {
	getLogger().info("Running schema generation...");
	GeneratorSettings settings = getSettings();
	URL[] urls = outputClassesDirs.stream()
			.map(path -> {
				try {
					return path.toURI().toURL();
				} catch (MalformedURLException e) {
					throw new IllegalStateException("Cannot build URL from sourceSets", e);
				}
			})
			.toArray(URL[]::new);
	ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
	URLClassLoader urlClassLoader = new URLClassLoader(urls, originalClassLoader);
	Thread.currentThread().setContextClassLoader(urlClassLoader);
	new SchemaGenerator().generate(settings);
	Thread.currentThread().setContextClassLoader(originalClassLoader);
	getLogger().info("Schema saved to " + extension.getOutputPath());
}
 
開發者ID:Devskiller,項目名稱:jpa2ddl,代碼行數:21,代碼來源:GenerateTask.java

示例4: generate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
void generate() {
    File jarFileDestination = getJarFile();
    File unixScript = getScriptFile();
    FileResolver resolver = getFileLookup().getFileResolver(unixScript.getParentFile());
    String jarFileRelativePath = resolver.resolveAsRelativePath(jarFileDestination);

    writeProperties(getPropertiesFile());
    writeWrapperTo(jarFileDestination);

    StartScriptGenerator generator = new StartScriptGenerator();
    generator.setApplicationName("Gradle");
    generator.setMainClassName(GradleWrapperMain.class.getName());
    generator.setClasspath(WrapUtil.toList(jarFileRelativePath));
    generator.setOptsEnvironmentVar("GRADLE_OPTS");
    generator.setExitEnvironmentVar("GRADLE_EXIT_CONSOLE");
    generator.setAppNameSystemProperty("org.gradle.appname");
    generator.setScriptRelPath(unixScript.getName());
    generator.generateUnixScript(unixScript);
    generator.generateWindowsScript(getBatchScript());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:22,代碼來源:Wrapper.java

示例5: setupProjectLayout

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void setupProjectLayout() {
    final String type = getType();
    BuildInitTestFramework testFramework = BuildInitTestFramework.fromName(getTestFramework());
    final ProjectLayoutSetupRegistry projectLayoutRegistry = getProjectLayoutRegistry();
    if (!projectLayoutRegistry.supports(type)) {
        String supportedTypes = Joiner.on(", ").join(Iterables.transform(projectLayoutRegistry.getSupportedTypes(), new Function<String, String>() {
            @Override
            public String apply(String input) {
                return "'" + input + "'";
            }
        }));
        throw new GradleException("The requested build setup type '" + type + "' is not supported. Supported types: " + supportedTypes + ".");
    }

    ProjectInitDescriptor initDescriptor = projectLayoutRegistry.get(type);
    if (!testFramework.equals(BuildInitTestFramework.NONE) && !initDescriptor.supports(testFramework)) {
        throw new GradleException("The requested test framework '" + testFramework.getId() + "' is not supported in '" + type + "' setup type");
    }

    initDescriptor.generate(testFramework);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:23,代碼來源:InitBuild.java

示例6: installLocal

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void installLocal() {
	getLogger().info("Entering installLocal task class");


	getLogger().info("Preparing command " + CommandsAndParams.COMMAND_INSTALL_LOCAL);
	List<String> command = new ArrayList<>();

	command.add(CommandsAndParams.COMMAND_INSTALL_LOCAL);
	command.add(CommandsAndParams.PARAM_LOCATION);
	try {
		command.add(getExtension().getServerLocation());
		getLogger().info("Intstalling Server to: " + getExtension().getServerLocation() );
	} catch (Throwable e) {
		throw new TaskExecutionException(this, e);
	}
	
	
	getLogger().info("Running command " + CommandsAndParams.COMMAND_INSTALL_LOCAL + " with params. " + command.toString());
	cliRunner(command);
}
 
開發者ID:TTS-TMC,項目名稱:neo-java-web-gradle-plugin,代碼行數:22,代碼來源:InstallLocal.java

示例7: generate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void generate() {
    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()
    );
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:18,代碼來源:JacocoReport.java

示例8: link

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void link() {
    SimpleStaleClassCleaner cleaner = new SimpleStaleClassCleaner(getOutputs());
    cleaner.setDestinationDir(getDestinationDir());
    cleaner.execute();

    if (getSource().isEmpty()) {
        setDidWork(false);
        return;

    }


    LinkerSpec spec = createLinkerSpec();
    spec.setTargetPlatform(getTargetPlatform());
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getOutputFile());

    spec.objectFiles(getSource());
    spec.libraries(getLibs());
    spec.args(getLinkerArgs());

    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);

    Compiler<LinkerSpec> compiler = Cast.uncheckedCast(toolChain.select(targetPlatform).newCompiler(spec.getClass()));
    compiler = BuildOperationLoggingCompilerDecorator.wrap(compiler);
    WorkResult result = compiler.execute(spec);
    setDidWork(result.getDidWork());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:31,代碼來源:AbstractLinkTask.java

示例9: link

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void link() {

    StaticLibraryArchiverSpec spec = new DefaultStaticLibraryArchiverSpec();
    spec.setTempDir(getTemporaryDir());
    spec.setOutputFile(getOutputFile());
    spec.objectFiles(getSource());
    spec.args(getStaticLibArgs());

    BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
    spec.setOperationLogger(operationLogger);

    Compiler<StaticLibraryArchiverSpec> compiler = Cast.uncheckedCast(toolChain.select(targetPlatform).newCompiler(spec.getClass()));
    WorkResult result = BuildOperationLoggingCompilerDecorator.wrap(compiler).execute(spec);
    setDidWork(result.getDidWork());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:CreateStaticLibrary.java

示例10: report

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void report() {
    Project project = getProject();
    StyledTextOutput textOutput = getTextOutputFactory().create(ModelReport.class);
    ModelNodeRenderer renderer = new ModelNodeRenderer(isShowHidden(), getFormat());

    TextModelReportRenderer textModelReportRenderer = new TextModelReportRenderer(renderer);

    textModelReportRenderer.setOutput(textOutput);
    textModelReportRenderer.startProject(project);

    ModelRegistry modelRegistry = getModelRegistry();
    ModelNode rootNode = modelRegistry.realizeNode(ModelPath.ROOT);
    // Ensure binding validation has been done. This should happen elsewhere
    modelRegistry.bindAllReferences();
    textModelReportRenderer.render(rootNode);

    textModelReportRenderer.completeProject(project);
    textModelReportRenderer.complete();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:21,代碼來源:ModelReport.java

示例11: report

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void report() {
     // Output reports per execution, not mixed.
     // Cross-project ModelRegistry operations do not happen concurrently.
    synchronized (DependentComponentsReport.class) {
        Project project = getProject();
        ModelRegistry modelRegistry = getModelRegistry();
        DependentBinariesResolver dependentBinariesResolver = modelRegistry.find("dependentBinariesResolver", DependentBinariesResolver.class);

        StyledTextOutput textOutput = getTextOutputFactory().create(DependentComponentsReport.class);
        TextDependentComponentsReportRenderer reportRenderer = new TextDependentComponentsReportRenderer(dependentBinariesResolver, showNonBuildable, showTestSuites);

        reportRenderer.setOutput(textOutput);
        reportRenderer.startProject(project);

        Set<ComponentSpec> allComponents = getAllComponents(modelRegistry);
        if (showTestSuites) {
            allComponents.addAll(getAllTestSuites(modelRegistry));
        }
        reportRenderer.renderComponents(getReportedComponents(allComponents));
        reportRenderer.renderLegend();

        reportRenderer.completeProject(project);
        reportRenderer.complete();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:27,代碼來源:DependentComponentsReport.java

示例12: generate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void generate() {
    ProjectReportGenerator projectReportGenerator = new ProjectReportGenerator() {
        @Override
        public void generateReport(Project project) throws IOException {
            Configuration configuration = getProject().getBuildscript().getConfigurations().getByName(ScriptHandler.CLASSPATH_CONFIGURATION);
            renderer.startConfiguration(configuration);
            renderer.render(configuration);
            renderer.completeConfiguration(configuration);
        }
    };

    ReportGenerator reportGenerator = new ReportGenerator(renderer, getClientMetaData(), null,
        getTextOutputFactory(), projectReportGenerator);
    reportGenerator.generateReport(Collections.singleton(getProject()));
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:BuildEnvironmentReportTask.java

示例13: validate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void validate() {
    log = LogEnvironment.getLogger(ShpValidator.class);

    if (dataFiles==null || dataFiles.size()==0) {
        return;
    }
    List<String> files=new ArrayList<String>();
    for(Object fileObj:dataFiles) {
        String fileName=this.getProject().file(fileObj).getPath();
        files.add(fileName);
    }
    
    Settings settings=new Settings();
    initSettings(settings);
    if(encoding!=null) {
        settings.setValue(ShapeReader.ENCODING, encoding);
    }
    
    validationOk=new ShpValidatorImpl().validate(files.toArray(new String[files.size()]), settings);
    if(!validationOk && failOnError) {
        throw new TaskExecutionException(this,new Exception("validation failed"));
    }
}
 
開發者ID:sogis,項目名稱:gretl,代碼行數:25,代碼來源:ShpValidator.java

示例14: doGenerate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@TaskAction
public void doGenerate() {
    IvyModuleDescriptorSpecInternal descriptorInternal = toIvyModuleDescriptorInternal(getDescriptor());

    IvyDescriptorFileGenerator ivyGenerator = new IvyDescriptorFileGenerator(descriptorInternal.getProjectIdentity());
    ivyGenerator.setStatus(descriptorInternal.getStatus());
    ivyGenerator.setBranch(descriptorInternal.getBranch());
    ivyGenerator.setExtraInfo(descriptorInternal.getExtraInfo().asMap());

    for (IvyConfiguration ivyConfiguration : descriptorInternal.getConfigurations()) {
        ivyGenerator.addConfiguration(ivyConfiguration);
    }

    for (IvyArtifact ivyArtifact : descriptorInternal.getArtifacts()) {
        ivyGenerator.addArtifact(ivyArtifact);
    }

    for (IvyDependencyInternal ivyDependency : descriptorInternal.getDependencies()) {
        ivyGenerator.addDependency(ivyDependency);
    }

    ivyGenerator.withXml(descriptorInternal.getXmlAction()).writeTo(getDestination());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:24,代碼來源:GenerateIvyDescriptor.java

示例15: generate

import org.gradle.api.tasks.TaskAction; //導入依賴的package包/類
@SuppressWarnings("UnusedDeclaration")
@TaskAction
void generate() {
    File inputFile = getInputFileIfExists();
    if (inputFile != null) {
        try {
            domainObject = generator.read(inputFile);
        } catch (RuntimeException e) {
            throw new GradleException(String.format("Cannot parse file '%s'.\n"
                    + "       Perhaps this file was tinkered with? In that case try delete this file and then retry.",
                    inputFile), e);
        }
    } else {
        domainObject = generator.defaultInstance();
    }
    beforeConfigured.execute(domainObject);
    generator.configure(domainObject);
    afterConfigured.execute(domainObject);

    generator.write(domainObject, getOutputFile());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:22,代碼來源:GeneratorTask.java


注:本文中的org.gradle.api.tasks.TaskAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。