use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class JavaGradlePluginPlugin method registerPlugins.
private void registerPlugins(Project project, GradlePluginDevelopmentExtension extension) {
ProjectInternal projectInternal = (ProjectInternal) project;
ProjectPublicationRegistry registry = projectInternal.getServices().get(ProjectPublicationRegistry.class);
extension.getPlugins().all(pluginDeclaration -> registry.registerPublication(projectInternal, new LocalPluginPublication(pluginDeclaration)));
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class EarPlugin method setupEarTask.
private void setupEarTask(final Project project, EarPluginConvention convention, PluginContainer plugins) {
TaskProvider<Ear> ear = project.getTasks().register(EAR_TASK_NAME, Ear.class, new Action<Ear>() {
@Override
public void execute(Ear ear) {
ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
ear.setGroup(BasePlugin.BUILD_GROUP);
ear.getGenerateDeploymentDescriptor().convention(convention.getGenerateDeploymentDescriptor());
plugins.withType(JavaPlugin.class, javaPlugin -> {
final JavaPluginExtension javaPluginExtension = project.getExtensions().findByType(JavaPluginExtension.class);
SourceSet sourceSet = mainSourceSetOf(javaPluginExtension);
sourceSet.getResources().srcDir(ear.getAppDirectory());
});
}
});
DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
if (deploymentDescriptor != null) {
if (deploymentDescriptor.getDisplayName() == null) {
deploymentDescriptor.setDisplayName(project.getName());
}
if (deploymentDescriptor.getDescription() == null) {
deploymentDescriptor.setDescription(project.getDescription());
}
}
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new LazyPublishArtifact(ear, ((ProjectInternal) project).getFileResolver()));
project.getTasks().withType(Ear.class).configureEach(new Action<Ear>() {
@Override
public void execute(Ear task) {
}
});
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class EclipseModelBuilder method gatherExternalProjects.
private List<EclipseWorkspaceProject> gatherExternalProjects(ProjectInternal rootProject, List<EclipseWorkspaceProject> projects) {
// The eclipse workspace contains projects from root and included builds. Check projects from all builds
// so that models built for included builds do not consider projects from parent builds as external.
Set<File> gradleProjectLocations = collectAllProjects(new ArrayList<>(), getRootBuild(rootProject.getGradle()), new HashSet<>()).stream().map(p -> p.getProjectDir().getAbsoluteFile()).collect(Collectors.toSet());
List<EclipseWorkspaceProject> externalProjects = new ArrayList<>();
for (EclipseWorkspaceProject project : projects) {
if (project == null || project.getLocation() == null || project.getName() == null || project.getLocation() == null) {
continue;
}
if (!gradleProjectLocations.contains(project.getLocation().getAbsoluteFile())) {
externalProjects.add(project);
}
}
return externalProjects;
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class JvmEcosystemPlugin method apply.
@Override
public void apply(Project project) {
ProjectInternal p = (ProjectInternal) project;
project.getExtensions().add(SourceSetContainer.class, "sourceSets", sourceSets);
configureVariantDerivationStrategy(p);
configureSchema(p);
jvmPluginServices.inject(p, sourceSets);
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultConfiguration method toRootComponentMetaData.
public ComponentResolveMetadata toRootComponentMetaData() {
Module module = getModule();
ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
ModuleVersionIdentifier moduleVersionIdentifier = moduleIdentifierFactory.moduleWithVersion(module.getGroup(), module.getName(), module.getVersion());
ProjectInternal project = projectFinder.findProject(module.getProjectPath());
AttributesSchemaInternal schema = project == null ? null : (AttributesSchemaInternal) project.getDependencies().getAttributesSchema();
DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), schema);
configurationComponentMetaDataBuilder.addConfigurations(metaData, configurationsProvider.getAll());
return metaData;
}
Aggregations