Search in sources :

Example 1 with GradleFileBuildOutcome

use of org.gradle.tooling.model.internal.outcomes.GradleFileBuildOutcome in project gradle by gradle.

the class ProjectOutcomesModelBuilder method addArtifacts.

private void addArtifacts(Project project, List<GradleFileBuildOutcome> outcomes) {
    Configuration configuration = project.getConfigurations().findByName(Dependency.ARCHIVES_CONFIGURATION);
    if (configuration != null) {
        for (PublishArtifact artifact : configuration.getArtifacts()) {
            GradleFileBuildOutcome outcome = artifactTransformer.transform(artifact, project);
            outcomes.add(outcome);
        }
    }
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) GradleFileBuildOutcome(org.gradle.tooling.model.internal.outcomes.GradleFileBuildOutcome) PublishArtifact(org.gradle.api.artifacts.PublishArtifact)

Example 2 with GradleFileBuildOutcome

use of org.gradle.tooling.model.internal.outcomes.GradleFileBuildOutcome in project gradle by gradle.

the class GradleBuildOutcomeSetTransformer method addFileBuildOutcome.

private void addFileBuildOutcome(GradleFileBuildOutcome outcome, ProjectOutcomes rootProject, Set<BuildOutcome> translatedOutcomes) {
    if (zipArchiveTypes.contains(outcome.getTypeIdentifier())) {
        File originalFile = outcome.getFile();
        String relativePath = GFileUtils.relativePath(rootProject.getProjectDirectory(), originalFile);
        LocallyAvailableResource resource = null;
        if (originalFile.exists()) {
            String filestoreDestination = fileStorePrefix + "/" + outcome.getTaskPath() + "/" + originalFile.getName();
            resource = fileStore.move(filestoreDestination, originalFile);
        }
        BuildOutcome buildOutcome = new GeneratedArchiveBuildOutcome(outcome.getTaskPath(), outcome.getDescription(), resource, relativePath);
        translatedOutcomes.add(buildOutcome);
    } else {
        String outcomeName = outcome.getTaskPath();
        if (isEmpty(outcomeName)) {
            outcomeName = GFileUtils.relativePath(rootProject.getProjectDirectory(), outcome.getFile());
        }
        translatedOutcomes.add(new UnknownBuildOutcome(outcomeName, outcome.getDescription()));
    }
}
Also used : LocallyAvailableResource(org.gradle.internal.resource.local.LocallyAvailableResource) GeneratedArchiveBuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcome) UnknownBuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcome) File(java.io.File) GeneratedArchiveBuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcome) GradleBuildOutcome(org.gradle.tooling.model.internal.outcomes.GradleBuildOutcome) UnknownBuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcome) BuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.BuildOutcome) GradleFileBuildOutcome(org.gradle.tooling.model.internal.outcomes.GradleFileBuildOutcome)

Aggregations

GradleFileBuildOutcome (org.gradle.tooling.model.internal.outcomes.GradleFileBuildOutcome)2 File (java.io.File)1 Configuration (org.gradle.api.artifacts.Configuration)1 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)1 BuildOutcome (org.gradle.api.plugins.buildcomparison.outcome.internal.BuildOutcome)1 GeneratedArchiveBuildOutcome (org.gradle.api.plugins.buildcomparison.outcome.internal.archive.GeneratedArchiveBuildOutcome)1 UnknownBuildOutcome (org.gradle.api.plugins.buildcomparison.outcome.internal.unknown.UnknownBuildOutcome)1 LocallyAvailableResource (org.gradle.internal.resource.local.LocallyAvailableResource)1 GradleBuildOutcome (org.gradle.tooling.model.internal.outcomes.GradleBuildOutcome)1