Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Fix UP-TO-DATE annotations #320

Merged
merged 6 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;

Expand Down Expand Up @@ -85,7 +86,7 @@ public void setStagingDirectory(Object stagingDirectory) {
/** This method is purely for incremental build calculations. */
@Optional
@InputFiles
private FileCollection convertExtraFilesDirectoriesToInputFiles() {
private FileCollection getExtraFilesDirectoriesAsInputFiles() {
if (extraFilesDirectories == null) {
return null;
}
Expand All @@ -96,10 +97,7 @@ private FileCollection convertExtraFilesDirectoriesToInputFiles() {
return files;
}

/**
* extraFilesDirectory accessor, with {@code @InputFiles} for incremental builds configured on
* {@link StageAppYamlExtension#convertExtraFilesDirectoriesToInputFiles()}.
*/
@Internal("covered by getExtraFilesDirectoriesAsInputFiles")
public List<File> getExtraFilesDirectories() {
return extraFilesDirectories;
}
Expand All @@ -108,7 +106,7 @@ public void setExtraFilesDirectories(Object extraFilesDirectories) {
this.extraFilesDirectories = new ArrayList<>(project.files(extraFilesDirectories).getFiles());
}

AppYamlProjectStageConfiguration toStageArchiveConfiguration() {
AppYamlProjectStageConfiguration toAppYamlProjectStageConfiguration() {
return AppYamlProjectStageConfiguration.builder(
appEngineDirectory.toPath(), artifact.toPath(), stagingDirectory.toPath())
.dockerDirectory(NullSafe.convert(dockerDirectory, File::toPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public void stageAction() throws AppEngineException {
getProject().mkdir(appYamlExtension.getStagingDirectory().getAbsolutePath());

AppYamlProjectStaging staging = new AppYamlProjectStaging();
staging.stageArchive(appYamlExtension.toStageArchiveConfiguration());
staging.stageArchive(appYamlExtension.toAppYamlProjectStageConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.gradle.api.Project;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;

Expand Down Expand Up @@ -67,7 +68,7 @@ public void setStagingDirectory(Object stagingDirectory) {
this.stagingDirectory = project.file(stagingDirectory);
}

@Input
@InputFile
@Optional
public File getDockerfile() {
return dockerfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
package com.google.cloud.tools.gradle.appengine.appyaml;

import com.google.cloud.tools.appengine.configuration.AppYamlProjectStageConfiguration;
import com.google.cloud.tools.appengine.operations.AppYamlProjectStaging;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -54,7 +56,7 @@ public void setUpFiles() throws IOException {
}

@Test
public void testToStageArchiveConfiguration_allValuesSet() {
public void testToAppYamlProjectStageConfiguration_allValuesSet() {
StageAppYamlExtension extension = new StageAppYamlExtension(testContextProject);

extension.setStagingDirectory(stagingDirectory);
Expand All @@ -63,7 +65,7 @@ public void testToStageArchiveConfiguration_allValuesSet() {
extension.setDockerDirectory(dockerDirectory);
extension.setExtraFilesDirectories(extraFilesDirectories);

AppYamlProjectStageConfiguration generatedConfig = extension.toStageArchiveConfiguration();
AppYamlProjectStageConfiguration generatedConfig = extension.toAppYamlProjectStageConfiguration();
Assert.assertEquals(appEngineDirectory.toPath(), generatedConfig.getAppEngineDirectory());
Assert.assertEquals(stagingDirectory.toPath(), generatedConfig.getStagingDirectory());
Assert.assertEquals(artifact.toPath(), generatedConfig.getArtifact());
Expand All @@ -74,7 +76,7 @@ public void testToStageArchiveConfiguration_allValuesSet() {
}

@Test
public void testToStageArchiveConfiguration_nullExtraFiles() {
public void testToAppYamlProjectStageConfiguration_nullExtraFiles() {
StageAppYamlExtension extension = new StageAppYamlExtension(testContextProject);

extension.setStagingDirectory(stagingDirectory);
Expand All @@ -83,7 +85,7 @@ public void testToStageArchiveConfiguration_nullExtraFiles() {
extension.setDockerDirectory(dockerDirectory);
// extraFilesDirectories is not set (default = null)

AppYamlProjectStageConfiguration generatedConfig = extension.toStageArchiveConfiguration();
AppYamlProjectStageConfiguration generatedConfig = extension.toAppYamlProjectStageConfiguration();
Assert.assertEquals(appEngineDirectory.toPath(), generatedConfig.getAppEngineDirectory());
Assert.assertEquals(stagingDirectory.toPath(), generatedConfig.getStagingDirectory());
Assert.assertEquals(artifact.toPath(), generatedConfig.getArtifact());
Expand All @@ -92,7 +94,7 @@ public void testToStageArchiveConfiguration_nullExtraFiles() {
}

@Test
public void testToStageArchiveConfiguration_emptyExtraFiles() {
public void testToAppYamlProjectStageConfiguration_emptyExtraFiles() {
StageAppYamlExtension extension = new StageAppYamlExtension(testContextProject);

extension.setStagingDirectory(stagingDirectory);
Expand All @@ -101,11 +103,12 @@ public void testToStageArchiveConfiguration_emptyExtraFiles() {
extension.setDockerDirectory(dockerDirectory);
extension.setExtraFilesDirectories(Collections.emptyList());

AppYamlProjectStageConfiguration generatedConfig = extension.toStageArchiveConfiguration();
AppYamlProjectStageConfiguration generatedConfig = extension.toAppYamlProjectStageConfiguration();
Assert.assertEquals(appEngineDirectory.toPath(), generatedConfig.getAppEngineDirectory());
Assert.assertEquals(stagingDirectory.toPath(), generatedConfig.getStagingDirectory());
Assert.assertEquals(artifact.toPath(), generatedConfig.getArtifact());
Assert.assertEquals(dockerDirectory.toPath(), generatedConfig.getDockerDirectory());
Assert.assertEquals(0, generatedConfig.getExtraFilesDirectory().size());
}

loosebazooka marked this conversation as resolved.
Show resolved Hide resolved
}