当前位置: 首页>>代码示例>>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;未经允许,请勿转载。