本文整理汇总了Java中org.gradle.api.internal.GradleInternal类的典型用法代码示例。如果您正苦于以下问题:Java GradleInternal类的具体用法?Java GradleInternal怎么用?Java GradleInternal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GradleInternal类属于org.gradle.api.internal包,在下文中一共展示了GradleInternal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
@Override
public void run(BuildAction action, BuildController buildController) {
if (!(action instanceof TestExecutionRequestAction)) {
return;
}
GradleInternal gradle = buildController.getGradle();
try {
TestExecutionRequestAction testExecutionRequestAction = (TestExecutionRequestAction) action;
TestExecutionResultEvaluator testExecutionResultEvaluator = new TestExecutionResultEvaluator(testExecutionRequestAction);
buildController.addNestedListener(testExecutionResultEvaluator);
doRun(testExecutionRequestAction, buildController);
testExecutionResultEvaluator.evaluate();
} catch (RuntimeException rex) {
Throwable throwable = findRootCause(rex);
if (throwable instanceof TestExecutionException) {
throw new InternalTestExecutionException("Error while running test(s)", throwable);
} else {
throw rex;
}
}
PayloadSerializer payloadSerializer = gradle.getServices().get(PayloadSerializer.class);
buildController.setResult(new BuildActionResult(payloadSerializer.serialize(null), null));
}
示例2: getTargetProject
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
private ProjectInternal getTargetProject(Object target) {
ProjectInternal project;
if (target == null) {
project = gradle.getDefaultProject();
} else if (target instanceof GradleProjectIdentity) {
GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
GradleInternal build = findBuild(projectIdentity);
project = findProject(build, projectIdentity);
} else if (target instanceof GradleBuildIdentity) {
GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
project = findBuild(buildIdentity).getDefaultProject();
} else {
throw new IllegalArgumentException("Don't know how to build models for " + target);
}
return project;
}
示例3: configureBuildForInternalJvmTestRequest
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
private List<Test> configureBuildForInternalJvmTestRequest(GradleInternal gradle, TestExecutionRequestAction testExecutionRequest) {
final Collection<InternalJvmTestRequest> internalJvmTestRequests = testExecutionRequest.getInternalJvmTestRequests();
if(internalJvmTestRequests.isEmpty()){
return Collections.emptyList();
}
List<Test> tasksToExecute = new ArrayList<Test>();
final Set<Project> allprojects = gradle.getRootProject().getAllprojects();
for (Project project : allprojects) {
final Collection<Test> testTasks = project.getTasks().withType(Test.class);
for (Test testTask : testTasks) {
for (InternalJvmTestRequest jvmTestRequest : internalJvmTestRequests) {
final TestFilter filter = testTask.getFilter();
filter.includeTest(jvmTestRequest.getClassName(), jvmTestRequest.getMethodName());
}
}
tasksToExecute.addAll(testTasks);
}
return tasksToExecute;
}
示例4: registerListenersForClientSubscriptions
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
private void registerListenersForClientSubscriptions(BuildClientSubscriptions clientSubscriptions, GradleInternal gradle, BuildController buildController) {
BuildEventConsumer eventConsumer = gradle.getServices().get(BuildEventConsumer.class);
if (clientSubscriptions.isSendTestProgressEvents()) {
buildController.addNestedListener(new ClientForwardingTestListener(eventConsumer, clientSubscriptions));
}
if (!clientSubscriptions.isSendBuildProgressEvents() && !clientSubscriptions.isSendTaskProgressEvents()) {
return;
}
InternalBuildListener buildListener = NO_OP;
if (clientSubscriptions.isSendBuildProgressEvents()) {
buildListener = new ClientForwardingBuildListener(eventConsumer);
}
buildListener = new ClientForwardingTaskListener(eventConsumer, clientSubscriptions, buildListener);
buildController.addNestedListener(buildListener);
}
示例5: run
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
@Override
public void run(BuildAction action, final BuildController buildController) {
if (!(action instanceof ClientProvidedBuildAction)) {
return;
}
final GradleInternal gradle = buildController.getGradle();
ClientProvidedBuildAction clientProvidedBuildAction = (ClientProvidedBuildAction) action;
PayloadSerializer payloadSerializer = getPayloadSerializer(gradle);
final InternalBuildAction<?> clientAction = (InternalBuildAction<?>) payloadSerializer.deserialize(clientProvidedBuildAction.getAction());
gradle.addBuildListener(new BuildAdapter() {
@Override
public void buildFinished(BuildResult result) {
if (result.getFailure() == null) {
buildController.setResult(buildResult(clientAction, gradle));
}
}
});
buildController.configure();
}
示例6: run
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
@Override
public void run(BuildAction action, final BuildController buildController) {
if (!(action instanceof BuildModelAction)) {
return;
}
final BuildModelAction buildModelAction = (BuildModelAction) action;
final GradleInternal gradle = buildController.getGradle();
gradle.addBuildListener(new BuildResultAdapter(gradle, buildController, buildModelAction));
if (buildModelAction.isRunTasks()) {
buildController.run();
} else {
buildController.configure();
}
}
示例7: createProject
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public Project createProject(String name, File inputProjectDir, File gradleUserHomeDir) {
File projectDir = prepareProjectDir(inputProjectDir);
final File homeDir = new File(projectDir, "gradleHome");
StartParameter startParameter = new StartParameter();
File userHomeDir = gradleUserHomeDir == null ? new File(projectDir, "userHome") : FileUtils.canonicalize(gradleUserHomeDir);
startParameter.setGradleUserHomeDir(userHomeDir);
NativeServices.initialize(userHomeDir);
ServiceRegistry topLevelRegistry = new TestBuildScopeServices(getUserHomeServices(userHomeDir), startParameter, homeDir);
GradleInternal gradle = CLASS_GENERATOR.newInstance(DefaultGradle.class, null, startParameter, topLevelRegistry.get(ServiceRegistryFactory.class));
DefaultProjectDescriptor projectDescriptor = new DefaultProjectDescriptor(null, name, projectDir, new DefaultProjectDescriptorRegistry(),
topLevelRegistry.get(FileResolver.class));
ClassLoaderScope baseScope = gradle.getClassLoaderScope();
ClassLoaderScope rootProjectScope = baseScope.createChild("root-project");
ProjectInternal project = topLevelRegistry.get(IProjectFactory.class).createProject(projectDescriptor, null, gradle, rootProjectScope, baseScope);
gradle.setRootProject(project);
gradle.setDefaultProject(project);
return project;
}
示例8: createProject
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public DefaultProject createProject(ProjectDescriptor projectDescriptor, ProjectInternal parent, GradleInternal gradle, ClassLoaderScope selfClassLoaderScope, ClassLoaderScope baseClassLoaderScope) {
File buildFile = projectDescriptor.getBuildFile();
ScriptSource source = UriScriptSource.file("build file", buildFile);
DefaultProject project = instantiator.newInstance(DefaultProject.class,
projectDescriptor.getName(),
parent,
projectDescriptor.getProjectDir(),
source,
gradle,
gradle.getServiceRegistryFactory(),
selfClassLoaderScope,
baseClassLoaderScope
);
if (parent != null) {
parent.addChildProject(project);
}
projectRegistry.addProject(project);
return project;
}
示例9: findAndLoadSettings
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
@Override
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
StartParameter startParameter = gradle.getStartParameter();
SettingsInternal settings = findSettingsAndLoadIfAppropriate(gradle, startParameter);
ProjectSpec spec = ProjectSpecs.forStartParameter(startParameter, settings);
if (spec.containsProject(settings.getProjectRegistry())) {
setDefaultProject(spec, settings);
return settings;
}
// Try again with empty settings
StartParameter noSearchParameter = startParameter.newInstance();
noSearchParameter.useEmptySettings();
settings = findSettingsAndLoadIfAppropriate(gradle, noSearchParameter);
// Set explicit build file, if required
if (noSearchParameter.getBuildFile() != null) {
ProjectDescriptor rootProject = settings.getRootProject();
rootProject.setBuildFileName(noSearchParameter.getBuildFile().getName());
}
setDefaultProject(spec, settings);
return settings;
}
示例10: DefaultGradleLauncher
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public DefaultGradleLauncher(GradleInternal gradle, InitScriptHandler initScriptHandler, SettingsLoader settingsLoader,
BuildConfigurer buildConfigurer, ExceptionAnalyser exceptionAnalyser,
LoggingManagerInternal loggingManager, BuildListener buildListener,
ModelConfigurationListener modelConfigurationListener,
BuildCompletionListener buildCompletionListener, BuildOperationExecutor operationExecutor,
BuildConfigurationActionExecuter buildConfigurationActionExecuter, BuildExecuter buildExecuter,
BuildScopeServices buildServices, ListenerManager globalListenerManager, List<?> servicesToStop) {
this.gradle = gradle;
this.initScriptHandler = initScriptHandler;
this.settingsLoader = settingsLoader;
this.buildConfigurer = buildConfigurer;
this.exceptionAnalyser = exceptionAnalyser;
this.buildListener = buildListener;
this.loggingManager = loggingManager;
this.modelConfigurationListener = modelConfigurationListener;
this.buildOperationExecutor = operationExecutor;
this.buildConfigurationActionExecuter = buildConfigurationActionExecuter;
this.buildExecuter = buildExecuter;
this.buildCompletionListener = buildCompletionListener;
this.buildServices = buildServices;
this.globalListenerManager = globalListenerManager;
this.servicesToStop = servicesToStop;
loggingManager.start();
}
示例11: executeScripts
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public void executeScripts(final GradleInternal gradle) {
final List<File> initScripts = gradle.getStartParameter().getAllInitScripts();
if (initScripts.isEmpty()) {
return;
}
BuildOperationDetails operationDetails = BuildOperationDetails.displayName("Run init scripts").progressDisplayName("init scripts").build();
buildOperationExecutor.run(operationDetails, new Action<BuildOperationContext>() {
@Override
public void execute(BuildOperationContext buildOperationContext) {
for (File script : initScripts) {
processor.process(new UriScriptSource("initialization script", script), gradle);
}
}
});
}
示例12: findAndLoadSettings
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
@Override
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
SettingsInternal settings = delegate.findAndLoadSettings(gradle);
Collection<IncludedBuild> includedBuilds = getIncludedBuilds(gradle.getStartParameter(), settings);
if (!includedBuilds.isEmpty()) {
gradle.setIncludedBuilds(includedBuilds);
if (gradle.getStartParameter().isContinuous()) {
LOGGER.warn("[composite-build] Warning: continuous build doesn't detect changes in included builds.");
}
CompositeContextBuilder compositeContextBuilder = buildServices.get(CompositeContextBuilder.class);
compositeContextBuilder.addToCompositeContext(includedBuilds);
}
return settings;
}
示例13: wrap
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
private ScriptTarget wrap(Object target, boolean isInitialPass) {
if (target instanceof ProjectInternal && topLevelScript) {
// Only use this for top level project scripts
return new ProjectScriptTarget((ProjectInternal) target);
}
if (target instanceof GradleInternal && topLevelScript) {
// Only use this for top level init scripts
return new InitScriptTarget((GradleInternal) target);
}
if (target instanceof SettingsInternal && topLevelScript) {
// Only use this for top level settings scripts
if (isInitialPass) {
return new InitialPassSettingScriptTarget((SettingsInternal) target);
} else {
return new SettingScriptTarget((SettingsInternal) target);
}
} else {
return new DefaultScriptTarget(target);
}
}
示例14: createProject
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public Project createProject(String name, File inputProjectDir) {
File projectDir = prepareProjectDir(inputProjectDir);
final File homeDir = new File(projectDir, "gradleHome");
StartParameter startParameter = new StartParameter();
startParameter.setGradleUserHomeDir(new File(projectDir, "userHome"));
ServiceRegistry topLevelRegistry = new TestBuildScopeServices(GLOBAL_SERVICES, startParameter, homeDir);
GradleInternal gradle = new DefaultGradle(null, startParameter, topLevelRegistry.get(ServiceRegistryFactory.class));
DefaultProjectDescriptor projectDescriptor = new DefaultProjectDescriptor(null, name, projectDir, new DefaultProjectDescriptorRegistry(),
topLevelRegistry.get(FileResolver.class));
ClassLoaderScope baseScope = gradle.getClassLoaderScope();
ClassLoaderScope rootProjectScope = baseScope.createChild();
ProjectInternal project = topLevelRegistry.get(IProjectFactory.class).createProject(projectDescriptor, null, gradle, rootProjectScope, baseScope);
gradle.setRootProject(project);
gradle.setDefaultProject(project);
return project;
}
示例15: BaseSettings
import org.gradle.api.internal.GradleInternal; //导入依赖的package包/类
public BaseSettings(ServiceRegistryFactory serviceRegistryFactory, GradleInternal gradle,
ClassLoaderScope classLoaderScope, ClassLoaderScope rootClassLoaderScope, File settingsDir,
ScriptSource settingsScript, StartParameter startParameter) {
this.gradle = gradle;
this.rootClassLoaderScope = rootClassLoaderScope;
this.settingsDir = settingsDir;
this.settingsScript = settingsScript;
this.startParameter = startParameter;
this.classLoaderScope = classLoaderScope;
ServiceRegistry services = serviceRegistryFactory.createFor(this);
this.plugins = services.get(PluginContainer.class);
this.fileResolver = services.get(FileResolver.class);
this.scriptPluginFactory = services.get(ScriptPluginFactory.class);
this.scriptHandlerFactory = services.get(ScriptHandlerFactory.class);
this.projectDescriptorRegistry = services.get(ProjectDescriptorRegistry.class);
rootProjectDescriptor = createProjectDescriptor(null, settingsDir.getName(), settingsDir);
}