Search in sources :

Example 76 with Project

use of org.gradle.api.Project in project atlas by alibaba.

the class AppVariantContext method getAwSourceOutputDir.

public List<ConfigurableFileTree> getAwSourceOutputDir(AwbBundle awbBundle) {
    Project project = scope.getGlobalScope().getProject();
    // Build the list of source folders.
    ImmutableList.Builder<ConfigurableFileTree> sourceSets = ImmutableList.builder();
    // then all the generated src folders.
    if (getAwbRClassSourceOutputDir(awbBundle) != null) {
        sourceSets.add(project.fileTree(getAwbRClassSourceOutputDir(awbBundle)));
    }
    sourceSets.add(project.fileTree(getAwbMergeResourcesOutputDir(awbBundle)));
    if (scope.getGlobalScope().getExtension().getDataBinding().isEnabled()) {
        sourceSets.add(project.fileTree(getAwbClassOutputForDataBinding(awbBundle)));
    }
    return sourceSets.build();
}
Also used : Project(org.gradle.api.Project) ImmutableList(com.google.common.collect.ImmutableList) ConfigurableFileTree(org.gradle.api.file.ConfigurableFileTree)

Example 77 with Project

use of org.gradle.api.Project in project spring-boot by spring-projects.

the class ArtifactoryRepositoryTests method whenProjectVersionIsSnapshotThenRepositoryIsSnapshot.

@Test
void whenProjectVersionIsSnapshotThenRepositoryIsSnapshot() {
    Project project = ProjectBuilder.builder().build();
    project.setVersion("1.2.3-SNAPSHOT");
    assertThat(ArtifactoryRepository.forProject(project).getName()).isEqualTo("snapshot");
}
Also used : Project(org.gradle.api.Project) Test(org.junit.jupiter.api.Test)

Example 78 with Project

use of org.gradle.api.Project in project spring-boot by spring-projects.

the class ArtifactoryRepositoryTests method whenProjectVersionIsMilestoneThenRepositoryIsMilestone.

@Test
void whenProjectVersionIsMilestoneThenRepositoryIsMilestone() {
    Project project = ProjectBuilder.builder().build();
    project.setVersion("1.2.3-M1");
    assertThat(ArtifactoryRepository.forProject(project).getName()).isEqualTo("milestone");
}
Also used : Project(org.gradle.api.Project) Test(org.junit.jupiter.api.Test)

Example 79 with Project

use of org.gradle.api.Project in project spring-boot by spring-projects.

the class ConfigurationPropertiesPlugin method addMetadataArtifact.

private void addMetadataArtifact(Project project) {
    SourceSet mainSourceSet = project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
    project.getConfigurations().maybeCreate(CONFIGURATION_PROPERTIES_METADATA_CONFIGURATION_NAME);
    project.afterEvaluate((evaluatedProject) -> evaluatedProject.getArtifacts().add(CONFIGURATION_PROPERTIES_METADATA_CONFIGURATION_NAME, mainSourceSet.getJava().getDestinationDirectory().dir("META-INF/spring-configuration-metadata.json"), (artifact) -> artifact.builtBy(evaluatedProject.getTasks().getByName(mainSourceSet.getClassesTaskName()))));
}
Also used : JavaCompile(org.gradle.api.tasks.compile.JavaCompile) Configuration(org.gradle.api.artifacts.Configuration) Task(org.gradle.api.Task) Project(org.gradle.api.Project) JavaPluginExtension(org.gradle.api.plugins.JavaPluginExtension) PathSensitivity(org.gradle.api.tasks.PathSensitivity) JavaPlugin(org.gradle.api.plugins.JavaPlugin) Collections(java.util.Collections) Collectors(java.util.stream.Collectors) Plugin(org.gradle.api.Plugin) SourceSet(org.gradle.api.tasks.SourceSet) StringUtils(org.springframework.util.StringUtils) SourceSet(org.gradle.api.tasks.SourceSet)

Example 80 with Project

use of org.gradle.api.Project in project spring-boot by spring-projects.

the class MavenRepositoryPlugin method apply.

@Override
public void apply(Project project) {
    project.getPlugins().apply(MavenPublishPlugin.class);
    PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
    File repositoryLocation = new File(project.getBuildDir(), "maven-repository");
    publishing.getRepositories().maven((mavenRepository) -> {
        mavenRepository.setName("project");
        mavenRepository.setUrl(repositoryLocation.toURI());
    });
    project.getTasks().matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME)).all((task) -> setUpProjectRepository(project, task, repositoryLocation));
    project.getTasks().matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository")).all((task) -> setUpProjectRepository(project, task, repositoryLocation));
}
Also used : Action(org.gradle.api.Action) JavaPlatformPlugin(org.gradle.api.plugins.JavaPlatformPlugin) Project(org.gradle.api.Project) MavenPublishPlugin(org.gradle.api.publish.maven.plugins.MavenPublishPlugin) ProjectDependency(org.gradle.api.artifacts.ProjectDependency) HashMap(java.util.HashMap) JavaPlugin(org.gradle.api.plugins.JavaPlugin) DependencySet(org.gradle.api.artifacts.DependencySet) File(java.io.File) Configuration(org.gradle.api.artifacts.Configuration) JavaLibraryPlugin(org.gradle.api.plugins.JavaLibraryPlugin) Task(org.gradle.api.Task) PublishingExtension(org.gradle.api.publish.PublishingExtension) Map(java.util.Map) Plugin(org.gradle.api.Plugin) File(java.io.File) PublishingExtension(org.gradle.api.publish.PublishingExtension)

Aggregations

Project (org.gradle.api.Project)269 File (java.io.File)98 Task (org.gradle.api.Task)71 Plugin (org.gradle.api.Plugin)69 Configuration (org.gradle.api.artifacts.Configuration)53 List (java.util.List)40 ArrayList (java.util.ArrayList)39 SourceSet (org.gradle.api.tasks.SourceSet)38 TaskProvider (org.gradle.api.tasks.TaskProvider)38 IOException (java.io.IOException)35 Map (java.util.Map)35 Action (org.gradle.api.Action)34 Set (java.util.Set)32 JavaPlugin (org.gradle.api.plugins.JavaPlugin)31 FileCollection (org.gradle.api.file.FileCollection)30 Provider (org.gradle.api.provider.Provider)27 HashMap (java.util.HashMap)26 Collectors (java.util.stream.Collectors)26 ObjectFactory (org.gradle.api.model.ObjectFactory)25 Collections (java.util.Collections)24