本文整理汇总了Java中org.gradle.internal.Actions类的典型用法代码示例。如果您正苦于以下问题:Java Actions类的具体用法?Java Actions怎么用?Java Actions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Actions类属于org.gradle.internal包,在下文中一共展示了Actions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBinaries
import org.gradle.internal.Actions; //导入依赖的package包/类
@Mutate
public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder,
NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
Instantiator instantiator = serviceRegistry.get(Instantiator.class);
List<Action<? super JarBinarySpec>> actions = Lists.newArrayList();
actions.add(new JarBinarySpecInitializer(buildDir));
actions.add(new MarkBinariesBuildable());
Action<JarBinarySpec> initAction = Actions.composite(actions);
JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction);
Action<JvmLibrarySpec> createBinariesAction =
new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms);
for (JvmLibrarySpec jvmLibrary : libraries) {
createBinariesAction.execute(jvmLibrary);
binaries.addAll(jvmLibrary.getBinaries());
}
}
示例2: createNativeBinaries
import org.gradle.internal.Actions; //导入依赖的package包/类
@Mutate
public void createNativeBinaries(BinaryContainer binaries, NamedDomainObjectSet<NativeComponentSpec> nativeComponents,
LanguageRegistry languages, NativeToolChainRegistryInternal toolChains,
PlatformContainer platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
ServiceRegistry serviceRegistry, @Path("buildDir") File buildDir) {
Instantiator instantiator = serviceRegistry.get(Instantiator.class);
NativeDependencyResolver resolver = serviceRegistry.get(NativeDependencyResolver.class);
Action<NativeBinarySpec> configureBinaryAction = new NativeBinarySpecInitializer(buildDir);
Action<NativeBinarySpec> setToolsAction = new ToolSettingNativeBinaryInitializer(languages);
Action<NativeBinarySpec> setDefaultTargetsAction = new ToolSettingNativeBinaryInitializer(languages);
@SuppressWarnings("unchecked") Action<NativeBinarySpec> initAction = Actions.composite(configureBinaryAction, setToolsAction, new MarkBinariesBuildable());
NativeBinariesFactory factory = new DefaultNativeBinariesFactory(instantiator, initAction, resolver);
BinaryNamingSchemeBuilder namingSchemeBuilder = new DefaultBinaryNamingSchemeBuilder();
Action<NativeComponentSpec> createBinariesAction =
new NativeComponentSpecInitializer(factory, namingSchemeBuilder, toolChains, platforms, buildTypes, flavors);
for (NativeComponentSpec component : nativeComponents) {
createBinariesAction.execute(component);
binaries.addAll(component.getBinaries());
}
}
示例3: createAction
import org.gradle.internal.Actions; //导入依赖的package包/类
private Action<? super ExecutionListener> createAction(Iterable<CommandLineAction> factories, CommandLineParser parser, ParsedCommandLine commandLine) {
for (CommandLineAction factory : factories) {
Runnable action = factory.createAction(parser, commandLine);
if (action != null) {
return Actions.toAction(action);
}
}
throw new UnsupportedOperationException("No action factory for specified command-line arguments.");
}
示例4: getDependencySubstitutionRule
import org.gradle.internal.Actions; //导入依赖的package包/类
public Action<DependencySubstitution> getDependencySubstitutionRule() {
Collection<Action<DependencySubstitution>> allRules = flattenElements(
new ModuleForcingResolveRule(forcedModules),
dependencySubstitutions.getRuleAction(),
globalDependencySubstitutionRules.getRuleAction());
return Actions.composite(allRules);
}
示例5: methodMissing
import org.gradle.internal.Actions; //导入依赖的package包/类
public Object methodMissing(String name, Object arg) {
Object[] args = (Object[]) arg;
Configuration configuration = configurationContainer.findByName(name);
if (configuration == null) {
throw new MissingMethodException(name, this.getClass(), args);
}
List<Object> normalizedArgs = GUtil.flatten(Arrays.asList(args), false);
if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
return pushArtifact(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
}
for (Object notation : args) {
pushArtifact(configuration, notation, Actions.doNothing());
}
return null;
}
示例6: getRuleAction
import org.gradle.internal.Actions; //导入依赖的package包/类
@Override
public Action<DependencySubstitution> getRuleAction() {
return Actions.composite(CollectionUtils.collect(ruleProviders, new Transformer<Action<? super DependencySubstitution>, DependencySubstitutionRules>() {
@Override
public Action<? super DependencySubstitution> transform(DependencySubstitutionRules rule) {
return rule.getRuleAction();
}
}));
}
示例7: getRuleAction
import org.gradle.internal.Actions; //导入依赖的package包/类
@Override
public Action<DependencySubstitution> getRuleAction() {
List<Action<DependencySubstitution>> allActions = Lists.newArrayList();
if (!provided.isEmpty()) {
allActions.add(new CompositeBuildDependencySubstitutions(provided));
}
allActions.addAll(substitutionRules);
return Actions.composite(allActions);
}
示例8: configureUsing
import org.gradle.internal.Actions; //导入依赖的package包/类
/**
* Creates an action that uses the given closure to configure objects of type T.
*/
public static <T> Action<T> configureUsing(@Nullable final Closure configureClosure) {
if (configureClosure == null) {
return Actions.doNothing();
}
return new Action<T>() {
@Override
public void execute(T t) {
configure(configureClosure, t);
}
};
}
示例9: beforeChange
import org.gradle.internal.Actions; //导入依赖的package包/类
/**
* Only allows adding beforeChange actions before any collections are composited.
* It can be improved in future but for now it is sufficient.
*/
public CompositeDomainObjectSet<T> beforeChange(Runnable action) {
if(!getStore().getCollections().isEmpty()) {
throw new IllegalStateException("beforeChange action can only be added before any collections are composited.");
}
whenObjectAdded(Actions.toAction(action));
return this;
}
示例10: createProjectEvaluator
import org.gradle.internal.Actions; //导入依赖的package包/类
protected ProjectEvaluator createProjectEvaluator() {
ConfigureActionsProjectEvaluator withActionsEvaluator = new ConfigureActionsProjectEvaluator(
new PluginsProjectConfigureActions(get(ClassLoaderRegistry.class).getPluginsClassLoader()),
new BuildScriptProcessor(get(ScriptPluginFactory.class)),
new DelayedConfigurationActions()
);
Action<? super ProjectInternal> projectFinalizer = Actions.composite(new TaskModelRealizingConfigurationAction(),
new ModelRegistryValidatingConfigurationAction());
return new LifecycleProjectEvaluator(withActionsEvaluator, projectFinalizer);
}
示例11: getArgAction
import org.gradle.internal.Actions; //导入依赖的package包/类
public Action<List<String>> getArgAction() {
Action<? super List<String>> platformArgsAction = new Action<List<String>>() {
public void execute(List<String> strings) {
strings.addAll(0, platformArgs);
}
};
return Actions.composite(baseTool.getArgAction(), platformArgsAction);
}
示例12: apply
import org.gradle.internal.Actions; //导入依赖的package包/类
public void apply(final ProjectInternal project) {
project.getPlugins().apply(BasePlugin.class);
project.getPlugins().apply(LanguageBasePlugin.class);
modelRules.register("toolChains", ToolChainRegistryInternal.class, factory(DefaultToolChainRegistry.class));
modelRules.register("platforms", PlatformContainer.class, factory(DefaultPlatformContainer.class));
modelRules.register("buildTypes", BuildTypeContainer.class, factory(DefaultBuildTypeContainer.class));
modelRules.register("flavors", FlavorContainer.class, factory(DefaultFlavorContainer.class));
project.getModelRegistry().create("repositories", Arrays.asList("flavors", "platforms", "buildTypes"), new RepositoriesFactory(instantiator, fileResolver));
modelRules.rule(new CreateDefaultPlatform());
modelRules.rule(new CreateDefaultBuildTypes());
modelRules.rule(new CreateDefaultFlavors());
modelRules.rule(new AddDefaultToolChainsIfRequired());
modelRules.rule(new CreateNativeBinaries(instantiator, project, resolver));
modelRules.rule(new CloseBinariesForTasks());
project.getExtensions().create(
"executables",
DefaultExecutableContainer.class,
instantiator,
project
);
project.getExtensions().create(
"libraries",
DefaultLibraryContainer.class,
instantiator,
project
);
// TODO:DAZ Lazy configuration actions: need a better way to accomplish these.
configurationActions.add(Actions.composite(
new ConfigureGeneratedSourceSets(),
new ApplySourceSetConventions()
));
}
示例13: createAction
import org.gradle.internal.Actions; //导入依赖的package包/类
public Action<? super ExecutionListener> createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
if (commandLine.hasOption(HELP)) {
return Actions.toAction(new ShowUsageAction(parser));
}
if (commandLine.hasOption(VERSION)) {
return Actions.toAction(new ShowVersionAction());
}
return null;
}
示例14: createAction
import org.gradle.internal.Actions; //导入依赖的package包/类
public Action<? super ExecutionListener> createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
BuildLayoutParameters layout = new BuildLayoutParameters();
layoutConverter.convert(commandLine, layout);
Map<String, String> properties = new HashMap<String, String>();
layoutToPropertiesConverter.convert(layout, properties);
propertiesConverter.convert(commandLine, properties);
StartParameter startParameter = new StartParameter();
propertiesToStartParameterConverter.convert(properties, startParameter);
commandLineConverter.convert(commandLine, startParameter);
DaemonParameters daemonParameters = new DaemonParameters(layout);
propertiesToDaemonParametersConverter.convert(properties, daemonParameters);
daemonConverter.convert(commandLine, daemonParameters);
if (commandLine.hasOption(STOP)) {
return stopAllDaemons(daemonParameters, loggingServices);
}
if (commandLine.hasOption(FOREGROUND)) {
ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
daemonParameters.getUid(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout());
return Actions.toAction(new ForegroundDaemonMain(conf));
}
if (daemonParameters.isEnabled()) {
return runBuildWithDaemon(startParameter, daemonParameters, loggingServices);
}
if (canUseCurrentProcess(daemonParameters)) {
return runBuildInProcess(startParameter, daemonParameters, loggingServices);
}
return runBuildInSingleUseDaemon(startParameter, daemonParameters, loggingServices);
}
示例15: ConnectionVersion4BackedModelProducer
import org.gradle.internal.Actions; //导入依赖的package包/类
public ConnectionVersion4BackedModelProducer(ProtocolToModelAdapter adapter, VersionDetails versionDetails, ModelMapping modelMapping, ConnectionVersion4 delegate) {
super(adapter, versionDetails, modelMapping);
this.delegate = delegate;
mapper = Actions.composite(
new PropertyHandlerFactory().forVersion(versionDetails),
new TaskPropertyHandlerFactory().forVersion(versionDetails));
}