当前位置: 首页>>代码示例>>Java>>正文


Java Action类代码示例

本文整理汇总了Java中org.gradle.api.Action的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Action类属于org.gradle.api包,在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createExecutableTask

import org.gradle.api.Action; //导入依赖的package包/类
public static void createExecutableTask(final NativeBinarySpecInternal binary, final File executableFile) {
    String taskName = binary.getNamingScheme().getTaskName("link");
    binary.getTasks().create(taskName, LinkExecutable.class, new Action<LinkExecutable>() {
        @Override
        public void execute(LinkExecutable linkTask) {
            linkTask.setDescription("Links " + binary.getDisplayName());
            linkTask.setToolChain(binary.getToolChain());
            linkTask.setTargetPlatform(binary.getTargetPlatform());
            linkTask.setOutputFile(executableFile);
            linkTask.setLinkerArgs(binary.getLinker().getArgs());

            linkTask.lib(new BinaryLibs(binary) {
                @Override
                protected FileCollection getFiles(NativeDependencySet nativeDependencySet) {
                    return nativeDependencySet.getLinkFiles();
                }
            });
            binary.builtBy(linkTask);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:NativeComponents.java

示例2: doRender

import org.gradle.api.Action; //导入依赖的package包/类
private void doRender(final RenderableDependency node, boolean last, Set<Object> visited) {
    Set<? extends RenderableDependency> children = node.getChildren();
    final boolean alreadyRendered = !visited.add(node.getId());
    if (alreadyRendered) {
        legendRenderer.setHasCyclicDependencies(true);
    }


    renderer.visit(new Action<StyledTextOutput>() {
        public void execute(StyledTextOutput output) {
            nodeRenderer.renderNode(output, node, alreadyRendered);
        }

    }, last);

    if (!alreadyRendered) {
        renderChildren(children, visited);
    }

}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DependencyGraphRenderer.java

示例3: onApply

import org.gradle.api.Action; //导入依赖的package包/类
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates all Eclipse files.");
    getCleanTask().setDescription("Cleans all Eclipse files.");

    EclipseModel model = project.getExtensions().create("eclipse", EclipseModel.class);

    configureEclipseProject(project, model);
    configureEclipseJdt(project, model);
    configureEclipseClasspath(project, model);

    postProcess("eclipse", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });

    applyEclipseWtpPluginOnWebProjects(project);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:EclipsePlugin.java

示例4: execute

import org.gradle.api.Action; //导入依赖的package包/类
public void execute(Action<? super BufferedWriter> action) {
    try {
        File parentFile = file.getParentFile();
        if (parentFile != null) {
            if (!parentFile.mkdirs() && !parentFile.isDirectory()) {
                throw new IOException(String.format("Unable to create directory '%s'", parentFile));
            }
        }
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding));
        try {
            action.execute(writer);
        } finally {
            writer.close();
        }
    } catch (Exception e) {
        throw new UncheckedIOException(String.format("Could not write to file '%s'.", file), e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:IoActions.java

示例5: internalCreateArtifactRepository

import org.gradle.api.Action; //导入依赖的package包/类
@Override
protected ArtifactRepository internalCreateArtifactRepository(RepositoryHandler repositoryHandler) {
    return repositoryHandler.ivy(new Action<IvyArtifactRepository>() {
        @Override
        public void execute(IvyArtifactRepository ivyArtifactRepository) {
            ivyArtifactRepository.setName(getArtifactRepositoryName());
            ivyArtifactRepository.setUrl(getUrl());
            Credentials credentials = authenticationSupport().getConfiguredCredentials();
            if (credentials != null) {
                ((AuthenticationSupportedInternal)ivyArtifactRepository).setConfiguredCredentials(credentials);
                ivyArtifactRepository.authentication(new Action<AuthenticationContainer>() {
                    @Override
                    public void execute(AuthenticationContainer authenticationContainer) {
                        authenticationContainer.addAll(authenticationSupport().getConfiguredAuthentication());
                    }
                });
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DefaultIvyPluginRepository.java

示例6: addPlaceholderAction

import org.gradle.api.Action; //导入依赖的package包/类
public <T extends TaskInternal> void addPlaceholderAction(final String placeholderName, final Class<T> taskType, final Action<? super T> configure) {
    if (!modelNode.hasLink(placeholderName)) {
        final ModelType<T> taskModelType = ModelType.of(taskType);
        ModelPath path = MODEL_PATH.child(placeholderName);
        modelNode.addLink(
            ModelRegistrations.of(path)
                .action(ModelActionRole.Create, new TaskCreator<T>(placeholderName, taskType, configure, taskModelType))
                .withProjection(new UnmanagedModelProjection<T>(taskModelType))
                .descriptor(new SimpleModelRuleDescriptor("tasks.addPlaceholderAction(" + placeholderName + ")"))
                .build()
        );
    }
    if (findByNameWithoutRules(placeholderName) == null) {
        placeholders.add(placeholderName);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:DefaultTaskContainer.java

示例7: configureExtensionRule

import org.gradle.api.Action; //导入依赖的package包/类
private void configureExtensionRule() {
    final ConventionMapping extensionMapping = conventionMappingOf(extension);
    extensionMapping.map("sourceSets", Callables.returning(new ArrayList()));
    extensionMapping.map("reportsDir", new Callable<File>() {
        @Override
        public File call() {
            return project.getExtensions().getByType(ReportingExtension.class).file(getReportName());
        }
    });
    withBasePlugin(new Action<Plugin>() {
        @Override
        public void execute(Plugin plugin) {
            extensionMapping.map("sourceSets", new Callable<SourceSetContainer>() {
                @Override
                public SourceSetContainer call() {
                    return getJavaPluginConvention().getSourceSets();
                }
            });
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:AbstractCodeQualityPlugin.java

示例8: render

import org.gradle.api.Action; //导入依赖的package包/类
private void render(final Project project, GraphRenderer renderer, boolean lastChild,
                    final StyledTextOutput textOutput) {
    renderer.visit(new Action<StyledTextOutput>() {
        public void execute(StyledTextOutput styledTextOutput) {
            styledTextOutput.text(StringUtils.capitalize(project.toString()));
            if (GUtil.isTrue(project.getDescription())) {
                textOutput.withStyle(Description).format(" - %s", project.getDescription());
            }
        }
    }, lastChild);
    renderer.startChildren();
    List<Project> children = getChildren(project);
    for (Project child : children) {
        render(child, renderer, child == children.get(children.size() - 1), textOutput);
    }
    renderer.completeChildren();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ProjectReportTask.java

示例9: configureConfigurations

import org.gradle.api.Action; //导入依赖的package包/类
private void configureConfigurations(final Project project) {
    ConfigurationContainer configurations = project.getConfigurations();
    project.setProperty("status", "integration");

    Configuration archivesConfiguration = configurations.maybeCreate(Dependency.ARCHIVES_CONFIGURATION).
            setDescription("Configuration for archive artifacts.");

    configurations.maybeCreate(Dependency.DEFAULT_CONFIGURATION).
            setDescription("Configuration for default artifacts.");

    final DefaultArtifactPublicationSet defaultArtifacts = project.getExtensions().create(
            "defaultArtifacts", DefaultArtifactPublicationSet.class, archivesConfiguration.getArtifacts()
    );

    configurations.all(new Action<Configuration>() {
        public void execute(Configuration configuration) {
            configuration.getArtifacts().all(new Action<PublishArtifact>() {
                public void execute(PublishArtifact artifact) {
                    defaultArtifacts.addCandidate(artifact);
                }
            });
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:BasePlugin.java

示例10: execute

import org.gradle.api.Action; //导入依赖的package包/类
@Override
public WorkResult execute(final LinkerSpec spec) {
    LinkerSpec transformedSpec = specTransformer.transform(spec);
    List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });

    return new SimpleWorkResult(true);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:LinkExeLinker.java

示例11: process

import org.gradle.api.Action; //导入依赖的package包/类
public void process(SerializableCoffeeScriptCompileSpec spec) {
    Scriptable coffeeScriptScope = parse(spec.getCoffeeScriptJs(), "UTF-8", new Action<Context>() {
        public void execute(Context context) {
            context.setOptimizationLevel(-1);
        }
    });

    String encoding = spec.getOptions().getEncoding();

    CoffeeScriptCompileDestinationCalculator destinationCalculator = new CoffeeScriptCompileDestinationCalculator(spec.getDestinationDir());

    for (RelativeFile target : spec.getSource()) {
        String source = readFile(target.getFile(), encoding);
        String output = compile(coffeeScriptScope, source, target.getRelativePath().getPathString());
        writeFile(output, destinationCalculator.transform(target.getRelativePath()), encoding);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:CoffeeScriptCompilerWorker.java

示例12: configureCompileDefaults

import org.gradle.api.Action; //导入依赖的package包/类
private static void configureCompileDefaults(final Project project, final ScalaRuntime scalaRuntime) {
    project.getTasks().withType(ScalaCompile.class, new Action<ScalaCompile>() {
        @Override
        public void execute(final ScalaCompile compile) {
            compile.getConventionMapping().map("scalaClasspath", new Callable<FileCollection>() {
                @Override
                public FileCollection call() throws Exception {
                    return scalaRuntime.inferScalaClasspath(compile.getClasspath());
                }
            });
            compile.getConventionMapping().map("zincClasspath", new Callable<Configuration>() {
                @Override
                public Configuration call() throws Exception {
                    Configuration config = project.getConfigurations().getAt(ZINC_CONFIGURATION_NAME);
                    if (config.getDependencies().isEmpty()) {
                        project.getDependencies().add("zinc", "com.typesafe.zinc:zinc:" + DefaultScalaToolProvider.DEFAULT_ZINC_VERSION);
                    }
                    return config;
                }
            });
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:ScalaBasePlugin.java

示例13: parse

import org.gradle.api.Action; //导入依赖的package包/类
public static Scriptable parse(File source, String encoding, Action<Context> contextConfig) {
    Context context = Context.enter();
    if (contextConfig != null) {
        contextConfig.execute(context);
    }

    Scriptable scope = context.initStandardObjects();
    try {
        Reader reader = new InputStreamReader(new FileInputStream(source), encoding);
        try {
            context.evaluateReader(scope, reader, source.getName(), 0, null);
        } finally {
            reader.close();
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    } finally {
        Context.exit();
    }

    return scope;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:RhinoWorkerUtils.java

示例14: apply

import org.gradle.api.Action; //导入依赖的package包/类
@Override
public void apply(Project rootProject) {
    final String circleReportsDir = System.getenv("CIRCLE_TEST_REPORTS");
    if (circleReportsDir == null) {
        return;
    }

    configureBuildFailureFinalizer(rootProject, circleReportsDir);

    final StyleTaskTimer timer = new StyleTaskTimer();
    rootProject.getGradle().addListener(timer);

    rootProject.allprojects(new Action<Project>() {
        @Override
        public void execute(final Project project) {
            project.getTasks().withType(Checkstyle.class, new Action<Checkstyle>() {
                @Override
                public void execute(Checkstyle checkstyleTask) {
                    configureCheckstyleTask(project, checkstyleTask, circleReportsDir, timer);
                }
            });
            project.getTasks().withType(FindBugs.class, new Action<FindBugs>() {
                @Override
                public void execute(FindBugs findbugsTask) {
                    configureFindbugsTask(project, findbugsTask, circleReportsDir, timer);
                }
            });
        }
    });
}
 
开发者ID:palantir,项目名称:gradle-circle-style,代码行数:31,代码来源:CircleStylePlugin.java

示例15: configureFindbugsTask

import org.gradle.api.Action; //导入依赖的package包/类
private void configureFindbugsTask(
        final Project project,
        final FindBugs findbugsTask,
        final String circleReportsDir,
        final StyleTaskTimer timer) {
    // Ensure XML output is enabled
    findbugsTask.doFirst(new Action<Task>() {
        @Override
        public void execute(Task task) {
            for (SingleFileReport report : findbugsTask.getReports()) {
                report.setEnabled(false);
            }
            FindBugsXmlReport xmlReport = (FindBugsXmlReport) findbugsTask.getReports().findByName("xml");
            xmlReport.setEnabled(true);
            xmlReport.setWithMessages(true);
        }
    });

    // Configure the finalizer task
    CircleStyleFinalizer finalizer = createTask(
            project.getTasks(),
            findbugsTask.getName() + "CircleFinalizer",
            CircleStyleFinalizer.class);
    if (finalizer == null) {
        // Already registered (happens if the user applies us to the root project and subprojects)
        return;
    }
    finalizer.setReportParser(FindBugsReportHandler.PARSER);
    finalizer.setStyleTask(findbugsTask);
    finalizer.setReporting(findbugsTask);
    finalizer.setStyleTaskTimer(timer);
    finalizer.setTargetFile(new File(
            new File(circleReportsDir, "findbugs"),
            project.getName() + "-" + findbugsTask.getName() + ".xml"));

    findbugsTask.finalizedBy(finalizer);
}
 
开发者ID:palantir,项目名称:gradle-circle-style,代码行数:38,代码来源:CircleStylePlugin.java


注:本文中的org.gradle.api.Action类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。