本文整理汇总了Java中org.gradle.api.invocation.Gradle类的典型用法代码示例。如果您正苦于以下问题:Java Gradle类的具体用法?Java Gradle怎么用?Java Gradle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gradle类属于org.gradle.api.invocation包,在下文中一共展示了Gradle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onApply
import org.gradle.api.invocation.Gradle; //导入依赖的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
示例2: convert
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
private DefaultGradleBuild convert(Gradle gradle) {
DefaultGradleBuild model = new DefaultGradleBuild();
Map<Project, BasicGradleProject> convertedProjects = new LinkedHashMap<Project, BasicGradleProject>();
Project rootProject = gradle.getRootProject();
BasicGradleProject convertedRootProject = convert(rootProject, convertedProjects);
model.setRootProject(convertedRootProject);
for (Project project : rootProject.getAllprojects()) {
model.addProject(convertedProjects.get(project));
}
for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
Gradle includedGradle = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
DefaultGradleBuild convertedIncludedBuild = convert(includedGradle);
model.addIncludedBuild(convertedIncludedBuild);
}
return model;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:GradleBuildBuilder.java
示例3: onApply
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
@Override
protected void onApply(Project project) {
getLifecycleTask().setDescription("Generates IDEA project files (IML, IPR, IWS)");
getCleanTask().setDescription("Cleans IDEA project files (IML, IPR)");
ideaModel = project.getExtensions().create("idea", IdeaModel.class);
configureIdeaWorkspace(project);
configureIdeaProject(project);
configureIdeaModule(project);
configureForJavaPlugin(project);
configureForScalaPlugin();
postProcess("idea", new Action<Gradle>() {
@Override
public void execute(Gradle gradle) {
performPostEvaluationActions();
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:IdeaPlugin.java
示例4: getRootDirectory
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
@Override
public File getRootDirectory(@Nullable Object scope) {
if (scope == null) {
return globalCacheDir;
}
if (scope instanceof Gradle) {
Gradle gradle = (Gradle) scope;
return getBuildCacheDir(gradle.getRootProject());
}
if (scope instanceof Project) {
Project project = (Project) scope;
return getBuildCacheDir(project.getRootProject());
}
if (scope instanceof Task) {
Task task = (Task) scope;
return getBuildCacheDir(task.getProject().getRootProject());
}
throw new IllegalArgumentException(String.format("Don't know how to determine the cache directory for scope of type %s.", scope.getClass().getSimpleName()));
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:DefaultCacheScopeMapping.java
示例5: apply
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
/**
* @see org.gradle.api.Plugin#apply(java.lang.Object)
*/
@Override
public void apply(Project project) {
this.project = project;
if (VersionNumber.parse(project.getGradle().getGradleVersion()).compareTo(MIN_GRADLE_VERSION) < 0) {
throw new GradleException(format("Base project plugin requires Gradle %s or higher", MIN_GRADLE_VERSION));
}
getLogger().info("Applying plugin {} to {}", this, getProject());
initialize();
getProject().afterEvaluate(p -> configure());
getProject().getGradle().addBuildListener(new BuildAdapter() {
@Override
public void projectsEvaluated(@Nullable Gradle gradle) {
complete();
}
});
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:25,代码来源:AbstractProjectConfigPlugin.java
示例6: DefaultGradle
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public DefaultGradle(Gradle parent, StartParameter startParameter, ServiceRegistryFactory parentRegistry) {
this.parent = parent;
this.startParameter = startParameter;
this.services = parentRegistry.createFor(this);
this.listenerManager = services.get(ListenerManager.class);
taskGraph = services.get(TaskGraphExecuter.class);
distributionLocator = services.get(GradleDistributionLocator.class);
classLoaderScope = services.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope();
pluginContainer = services.get(PluginContainer.class);
fileResolver = services.get(FileResolver.class);
scriptPluginFactory = services.get(ScriptPluginFactory.class);
scriptHandlerFactory = services.get(ScriptHandlerFactory.class);
buildListenerBroadcast = listenerManager.createAnonymousBroadcaster(BuildListener.class);
projectEvaluationListenerBroadcast = listenerManager.createAnonymousBroadcaster(ProjectEvaluationListener.class);
buildListenerBroadcast.add(new BuildAdapter() {
@Override
public void projectsLoaded(Gradle gradle) {
rootProjectActions.execute(rootProject);
rootProjectActions = null;
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultGradle.java
示例7: getBaseDirectory
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public File getBaseDirectory(Object scope, String key, CacheBuilder.VersionStrategy versionStrategy) {
if (key.equalsIgnoreCase("projects") || key.equalsIgnoreCase("tasks") || !key.matches("\\p{Alpha}+[-//.\\w]*")) {
throw new IllegalArgumentException(String.format("Unsupported cache key '%s'.", key));
}
if (scope == null) {
return getCacheDir(globalCacheDir, versionStrategy, key);
}
if (scope instanceof Gradle) {
Gradle gradle = (Gradle) scope;
return getCacheDir(getBuildCacheDir(gradle.getRootProject()), versionStrategy, key);
}
if (scope instanceof Project) {
Project project = (Project) scope;
return getCacheDir(getBuildCacheDir(project.getRootProject()), versionStrategy, String.format("projects/%s/%s", project.getPath().replace(':', '_'), key));
}
if (scope instanceof Task) {
Task task = (Task) scope;
return getCacheDir(getBuildCacheDir(task.getProject().getRootProject()), versionStrategy, String.format("tasks/%s/%s", task.getPath().replace(':', '_'), key));
}
throw new IllegalArgumentException(String.format("Don't know how to determine the cache directory for scope of type %s.", scope.getClass().getSimpleName()));
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:DefaultCacheScopeMapping.java
示例8: DefaultGradle
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public DefaultGradle(Gradle parent, StartParameter startParameter, ServiceRegistryFactory parentRegistry) {
this.parent = parent;
this.startParameter = startParameter;
this.services = parentRegistry.createFor(this);
this.listenerManager = services.get(ListenerManager.class);
taskGraph = services.get(TaskGraphExecuter.class);
distributionLocator = services.get(GradleDistributionLocator.class);
classLoaderScope = services.get(ClassLoaderScope.class);
pluginContainer = services.get(PluginContainer.class);
fileResolver = services.get(FileResolver.class);
scriptPluginFactory = services.get(ScriptPluginFactory.class);
scriptHandlerFactory = services.get(ScriptHandlerFactory.class);
buildListenerBroadcast = listenerManager.createAnonymousBroadcaster(BuildListener.class);
projectEvaluationListenerBroadcast = listenerManager.createAnonymousBroadcaster(ProjectEvaluationListener.class);
buildListenerBroadcast.add(new BuildAdapter() {
@Override
public void projectsLoaded(Gradle gradle) {
rootProjectActions.execute(rootProject);
rootProjectActions = null;
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultGradle.java
示例9: configureScalaCompile
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
private static void configureScalaCompile(final Project project, JavaBasePlugin javaPlugin, final SourceSet sourceSet) {
String taskName = sourceSet.getCompileTaskName("scala");
final ScalaCompile scalaCompile = project.getTasks().create(taskName, ScalaCompile.class);
scalaCompile.dependsOn(sourceSet.getCompileJavaTaskName());
javaPlugin.configureForSourceSet(sourceSet, scalaCompile);
Convention scalaConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
ScalaSourceSet scalaSourceSet = scalaConvention.findPlugin(ScalaSourceSet.class);
scalaCompile.setDescription("Compiles the " + scalaSourceSet.getScala() + ".");
scalaCompile.setSource(scalaSourceSet.getScala());
project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(taskName);
// cannot use convention mapping because the resulting object won't be serializable
// cannot compute at task execution time because we need association with source set
project.getGradle().addBuildListener(new BuildAdapter() {
@Override
public void projectsEvaluated(Gradle gradle) {
IncrementalCompileOptions incrementalOptions = scalaCompile.getScalaCompileOptions().getIncrementalOptions();
if (incrementalOptions.getAnalysisFile() == null) {
String analysisFilePath = project.getBuildDir().getPath() + "/tmp/scala/compilerAnalysis/" + scalaCompile.getName() + ".analysis";
incrementalOptions.setAnalysisFile(new File(analysisFilePath));
}
if (incrementalOptions.getPublishedCode() == null) {
Jar jarTask = (Jar) project.getTasks().findByName(sourceSet.getJarTaskName());
incrementalOptions.setPublishedCode(jarTask == null ? null : jarTask.getArchivePath());
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:30,代码来源:ScalaBasePlugin.java
示例10: invokeExecuteGradleClient
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
/**
* This starts a gradle client for doing regular execution of a command. It expects the port number to set as a system property. Note: this is using gradle to find the port. See getPort().
*
* @param gradle the gradle object.
*/
public static void invokeExecuteGradleClient(Gradle gradle) {
Integer port = getPort(gradle);
if (port == null) {
return;
}
ExecuteGradleCommandClientProtocol protocol = new ExecuteGradleCommandClientProtocol(gradle);
GradleClient client = new GradleClient();
client.start(protocol, port);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:IPCUtilities.java
示例11: getPort
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
/**
* This gets the port out of the start parameters. Why? Because this is meant to be run from the init script and the system properties haven't been set yet. That is due to how gradle is run from
* the bat file/shell script. It has to manually set the java system properties (-D). I don't this is a desired side-effect.
*
* @param gradle the gradle object
* @return an integer or null if we didn't get the port.
*/
private static Integer getPort(Gradle gradle) {
String portText = gradle.getStartParameter().getSystemPropertiesArgs().get(ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY);
if (portText == null) {
LOGGER.error("Failed to set " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property");
return null;
}
try {
return Integer.parseInt(portText);
} catch (NumberFormatException e) {
LOGGER.error("Invalid " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property", e);
return null;
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:IPCUtilities.java
示例12: invokeTaskListGradleClient
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
/**
* This starts a gradle client that sends a task list back to the server. It expects the port number to set as a system property. You probably should be executing the "tasks" command. Note: this
* is using gradle to find the port. See getPort().
*
* @param gradle the gradle launcher object.
*/
public static void invokeTaskListGradleClient(Gradle gradle) {
Integer port = getPort(gradle);
if (port == null) {
return;
}
TaskListClientProtocol protocol = new TaskListClientProtocol(gradle);
GradleClient client = new GradleClient();
client.start(protocol, port);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:IPCUtilities.java
示例13: GradleBuildComparison
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public GradleBuildComparison(
ComparableGradleBuildExecuter sourceBuildExecuter,
ComparableGradleBuildExecuter targetBuildExecuter,
Logger logger,
ProgressLogger progressLogger,
Gradle gradle) {
this.sourceBuildExecuter = sourceBuildExecuter;
this.targetBuildExecuter = targetBuildExecuter;
this.logger = logger;
this.progressLogger = progressLogger;
this.gradle = gradle;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:GradleBuildComparison.java
示例14: configureScalaDependencies
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
private static void configureScalaDependencies(final Project project, final GenerateEclipseClasspath task) {
project.getPlugins().withType(ScalaBasePlugin.class, new Action<ScalaBasePlugin>() {
@Override
public void execute(ScalaBasePlugin scalaBasePlugin) {
task.getClasspath().containers("org.scala-ide.sdt.launching.SCALA_CONTAINER");
// exclude the dependencies already provided by SCALA_CONTAINER; prevents problems with Eclipse Scala plugin
project.getGradle().addBuildListener(new BuildAdapter() {
@Override
public void projectsEvaluated(Gradle gradle) {
final List<String> provided = Lists.newArrayList("scala-library", "scala-swing", "scala-dbc");
Predicate<Dependency> dependencyInProvided = new Predicate<Dependency>() {
@Override
public boolean apply(Dependency dependency) {
return provided.contains(dependency.getName());
}
};
List<Dependency> dependencies = Lists.newArrayList(Iterables.filter(Iterables.concat(Iterables.transform(task.getClasspath().getPlusConfigurations(), new Function<Configuration, Iterable<Dependency>>() {
@Override
public Iterable<Dependency> apply(Configuration config) {
return config.getAllDependencies();
}
})), dependencyInProvided));
if (!dependencies.isEmpty()) {
task.getClasspath().getMinusConfigurations().add(project.getConfigurations().detachedConfiguration(dependencies.toArray(new Dependency[0])));
}
}
});
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:35,代码来源:EclipsePlugin.java
示例15: postProcess
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
/**
* Executes the provided Action after all projects have been evaluated.
* Action will only be added once per provided key. Any subsequent calls for the same key will be ignored.
* This permits the plugin to be applied in multiple subprojects, with the postprocess action executed once only.
*/
protected void postProcess(String key, final Action<? super Gradle> action) {
Project rootProject = project.getRootProject();
ExtraPropertiesExtension rootExtraProperties = rootProject.getExtensions().getByType(ExtraPropertiesExtension.class);
String extraPropertyName = "org.gradle." + key + ".postprocess.applied";
if (!rootExtraProperties.has(extraPropertyName)) {
project.getGradle().addBuildListener(new BuildAdapter() {
@Override
public void projectsEvaluated(Gradle gradle) {
action.execute(gradle);
}
});
rootExtraProperties.set(extraPropertyName, true);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:IdePlugin.java
示例16: configure
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public void configure() {
rootProject.getGradle().addBuildListener(new BuildAdapter() {
public void projectsEvaluated(Gradle gradle) {
VersionNumber ideaTargetVersion = findIdeaTargetVersion();
final boolean useScalaSdk = ideaTargetVersion == null || IDEA_VERSION_WHEN_SCALA_SDK_WAS_INTRODUCED.compareTo(ideaTargetVersion) <= 0;
final Collection<Project> scalaProjects = findProjectsApplyingIdeaAndScalaPlugins();
final Map<String, ProjectLibrary> scalaCompilerLibraries = Maps.newHashMap();
rootProject.getTasks().getByName("ideaProject").doFirst(new Action<Task>() {
@Override
public void execute(Task task) {
if (scalaProjects.size() > 0) {
scalaCompilerLibraries.clear();
scalaCompilerLibraries.putAll(resolveScalaCompilerLibraries(scalaProjects, useScalaSdk));
declareUniqueProjectLibraries(Sets.newLinkedHashSet(scalaCompilerLibraries.values()));
}
}
});
rootProject.configure(scalaProjects, new Action<Project>() {
@Override
public void execute(final Project project) {
project.getExtensions().getByType(IdeaModel.class).getModule().getIml().withXml(new Action<XmlProvider>() {
@Override
public void execute(XmlProvider xmlProvider) {
if (useScalaSdk) {
declareScalaSdk(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
} else {
declareScalaFacet(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
}
}
});
}
});
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:36,代码来源:IdeaScalaConfigurer.java
示例17: onNewBuild
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
@Override
public void onNewBuild(Gradle gradle) {
lock.lock();
try {
for (DeploymentHandle handle : handles.values()) {
handle.onNewBuild(gradle);
}
} finally {
lock.unlock();
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultDeploymentRegistry.java
示例18: DefaultTaskHistoryStore
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public DefaultTaskHistoryStore(Gradle gradle, CacheRepository cacheRepository, InMemoryTaskArtifactCache inMemoryTaskArtifactCache) {
this.inMemoryTaskArtifactCache = inMemoryTaskArtifactCache;
cache = cacheRepository
.cache(gradle, "taskArtifacts")
.withDisplayName("task history cache")
.withLockOptions(mode(FileLockManager.LockMode.None)) // Lock on demand
.open();
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultTaskHistoryStore.java
示例19: DefaultGradle
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public DefaultGradle(GradleInternal parent, StartParameter startParameter, ServiceRegistryFactory parentRegistry) {
this.parent = parent;
this.startParameter = startParameter;
this.services = parentRegistry.createFor(this);
classLoaderScope = services.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope();
buildListenerBroadcast = getListenerManager().createAnonymousBroadcaster(BuildListener.class);
projectEvaluationListenerBroadcast = getListenerManager().createAnonymousBroadcaster(ProjectEvaluationListener.class);
buildListenerBroadcast.add(new BuildAdapter() {
@Override
public void projectsLoaded(Gradle gradle) {
rootProjectActions.execute(rootProject);
rootProjectActions = null;
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:DefaultGradle.java
示例20: buildStarted
import org.gradle.api.invocation.Gradle; //导入依赖的package包/类
public void buildStarted(Gradle gradle) {
StartParameter startParameter = gradle.getStartParameter();
logger.info("Starting Build");
logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir());
logger.debug("Current dir: {}", startParameter.getCurrentDir());
logger.debug("Settings file: {}", startParameter.getSettingsFile());
logger.debug("Build file: {}", startParameter.getBuildFile());
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:BuildLogger.java
注:本文中的org.gradle.api.invocation.Gradle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论