diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/PegasusPlugin.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/PegasusPlugin.java index 9e9f2be94b..826e64ba23 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/PegasusPlugin.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/PegasusPlugin.java @@ -1407,6 +1407,7 @@ protected void configureRestModelGeneration(Project project, SourceSet sourceSet changedFileReportTask.setIdlFiles(SharedFileUtils.getSuffixedFiles(project, apiIdlDir, IDL_FILE_SUFFIX)); changedFileReportTask.setSnapshotFiles(SharedFileUtils.getSuffixedFiles(project, apiSnapshotDir, SNAPSHOT_FILE_SUFFIX)); + changedFileReportTask.getOutputFile().set(project.getLayout().getBuildDirectory().file("changedFilesReport.txt")); changedFileReportTask.mustRunAfter(publishRestliSnapshotTask, publishRestliIdlTask); changedFileReportTask.doLast(new CacheableAction<>(t -> { diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/ChangedFileReportTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/ChangedFileReportTask.java index a7dd65f606..9683ff51d4 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/ChangedFileReportTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/ChangedFileReportTask.java @@ -5,11 +5,14 @@ import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; + +import com.linkedin.pegasus.gradle.IOUtil; import org.gradle.api.DefaultTask; import org.gradle.api.file.FileCollection; -import org.gradle.api.specs.Specs; +import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.InputFiles; import org.gradle.api.tasks.Internal; +import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.SkipWhenEmpty; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.incremental.IncrementalTaskInputs; @@ -21,12 +24,7 @@ public class ChangedFileReportTask extends DefaultTask private FileCollection _idlFiles = getProject().files(); private FileCollection _snapshotFiles = getProject().files(); - - public ChangedFileReportTask() - { - //with Gradle 6.0, Declaring an incremental task without outputs is not allowed. - getOutputs().upToDateWhen(Specs.satisfyNone()); - } + private RegularFileProperty _outputFile = getProject().getObjects().fileProperty(); @TaskAction public void checkFilesForChanges(IncrementalTaskInputs inputs) @@ -60,27 +58,40 @@ public void checkFilesForChanges(IncrementalTaskInputs inputs) inputs.removed(inputFileDetails -> filesRemoved.add(inputFileDetails.getFile().getAbsolutePath())); + StringBuilder sb = new StringBuilder(); + if (!filesRemoved.isEmpty()) { String files = joinByComma(filesRemoved); _needCheckinFiles.add(files); - getLogger().lifecycle( - "The following files have been removed, be sure to remove them from source control: {}", files); + String removedFilesMsg = String.format("The following files have been removed, " + + "be sure to remove them from source control: %s\n", files); + sb.append(removedFilesMsg); } if (!filesAdded.isEmpty()) { String files = joinByComma(filesAdded); _needCheckinFiles.add(files); - getLogger().lifecycle("The following files have been added, be sure to add them to source control: {}", files); + String addedFilesMsg = String.format("The following files have been added, " + + "be sure to add them to source control: %s\n", files); + sb.append(addedFilesMsg); } if (!filesChanged.isEmpty()) { String files = joinByComma(filesChanged); _needCheckinFiles.add(files); - getLogger().lifecycle( - "The following files have been changed, be sure to commit the changes to source control: {}", files); + String modifiedFilesMsg = String.format("The following files have been changed, " + + "be sure to commit the changes to source control: %s\n", files); + sb.append(modifiedFilesMsg); + } + + String output = sb.toString(); + if (!output.isEmpty()) + { + getLogger().lifecycle(output); + IOUtil.writeText(getOutputFile().get().getAsFile(), output); } } } @@ -119,4 +130,9 @@ public Collection getNeedCheckinFiles() { return _needCheckinFiles; } + + @OutputFile + public RegularFileProperty getOutputFile() { + return _outputFile; + } } diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckIdlTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckIdlTask.java index 185c1dcf59..4f7ca496d2 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckIdlTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckIdlTask.java @@ -166,102 +166,18 @@ public void setSummaryTarget(File summaryTarget) _summaryTarget = summaryTarget; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean getIsModelCompatible() - { - return isModelCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean isIsModelCompatible() - { - return isModelCompatible(); - } - @Internal public boolean isModelCompatible() { return _modelCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean getIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean isIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - @Internal public boolean isRestSpecCompatible() { return _restSpecCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean getIsEquivalent() - { - return _equivalent; - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean isIsEquivalent() - { - return _equivalent; - } - @Internal public boolean isEquivalent() { diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckRestModelTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckRestModelTask.java index fff58ababe..db2ed57b70 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckRestModelTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckRestModelTask.java @@ -201,136 +201,24 @@ public void setSummaryTarget(File summaryTarget) _summaryTarget = summaryTarget; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean getIsModelCompatible() - { - return isModelCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean isIsModelCompatible() - { - return isModelCompatible(); - } - @Internal public boolean isModelCompatible() { return _modelCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean getIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean isIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - @Internal public boolean isRestSpecCompatible() { return _restSpecCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean getIsEquivalent() - { - return isEquivalent(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean isIsEquivalent() - { - return isEquivalent(); - } - @Internal public boolean isEquivalent() { return _equivalent; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecEquivalent()} instead - */ - @Deprecated - public boolean getIsRestSpecEquivalent() - { - return isRestSpecEquivalent(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecEquivalent()} instead - */ - @Deprecated - public boolean isIsRestSpecEquivalent() - { - return isRestSpecEquivalent(); - } - @Internal public boolean isRestSpecEquivalent() { diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckSnapshotTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckSnapshotTask.java index f601ef67b3..52c333f678 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckSnapshotTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/CheckSnapshotTask.java @@ -105,6 +105,7 @@ public void setCurrentSnapshotFiles(FileCollection currentSnapshotFiles) } @InputDirectory + @PathSensitive(PathSensitivity.RELATIVE) public File getPreviousSnapshotDirectory() { return _previousSnapshotDirectory; @@ -148,136 +149,24 @@ public void setSummaryTarget(File summaryTarget) _summaryTarget = summaryTarget; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean getIsModelCompatible() - { - return isModelCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isModelCompatible()} instead - */ - @Deprecated - public boolean isIsModelCompatible() - { - return isModelCompatible(); - } - @Internal public boolean isModelCompatible() { return _modelCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean getIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecCompatible()} instead - */ - @Deprecated - public boolean isIsRestSpecCompatible() - { - return isRestSpecCompatible(); - } - @Internal public boolean isRestSpecCompatible() { return _restSpecCompatible; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean getIsEquivalent() - { - return isEquivalent(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isEquivalent()} instead - */ - @Deprecated - public boolean isIsEquivalent() - { - return isEquivalent(); - } - @Internal public boolean isEquivalent() { return _equivalent; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecEquivalent()} instead - */ - @Deprecated - public boolean getIsRestSpecEquivalent() - { - return isRestSpecEquivalent(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestSpecEquivalent()} instead - */ - @Deprecated - public boolean isIsRestSpecEquivalent() - { - return isRestSpecEquivalent(); - } - @Internal public boolean isRestSpecEquivalent() { diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateDataTemplateTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateDataTemplateTask.java index db4aeab750..7922bc4437 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateDataTemplateTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateDataTemplateTask.java @@ -126,9 +126,22 @@ public void setEnableArgFile(boolean enable) _enableArgFile = enable; } + /** + * This method is kept for backwards compatibility. + *

+ * This non-property method was exposed. Property methods should begin with is or get. + * + * @deprecated use {@link #isGenerateLowercasePath()} instead + */ + @Deprecated + public Boolean generateLowercasePath() + { + return isGenerateLowercasePath(); + } + @Optional @Input - public Boolean generateLowercasePath() + public Boolean isGenerateLowercasePath() { return _generateLowercasePath; } diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestClientTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestClientTask.java index 557c631f91..bf79dd60f5 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestClientTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestClientTask.java @@ -290,9 +290,22 @@ public void setEnableArgFile(boolean enable) _enableArgFile = enable; } + /** + * This method is kept for backwards compatibility. + *

+ * This non-property method was exposed. Property methods should begin with is or get. + * + * @deprecated use {@link #isGenerateLowercasePath()} instead + */ + @Deprecated + public Boolean generateLowercasePath() + { + return isGenerateLowercasePath(); + } + @Optional @Input - public Boolean generateLowercasePath() + public Boolean isGenerateLowercasePath() { return _generateLowercasePath; } @@ -313,34 +326,6 @@ public void setDestinationDir(File destinationDir) _destinationDir = destinationDir; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestli2FormatSuppressed()} instead - */ - @Deprecated - public boolean getIsRestli2FormatSuppressed() - { - return isRestli2FormatSuppressed(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestli2FormatSuppressed()} instead - */ - @Deprecated - public boolean isIsRestli2FormatSuppressed() - { - return isRestli2FormatSuppressed(); - } - @Internal public boolean isRestli2FormatSuppressed() { @@ -388,34 +373,6 @@ public void setGenerateFluentApi(boolean generateFluentApi) _generateFluentApi = generateFluentApi; } - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestli1BuildersDeprecated()} instead - */ - @Deprecated - public boolean get_isRestli1BuildersDeprecated() - { - return isRestli1BuildersDeprecated(); - } - - /** - * This method is kept for backwards compatibility. - *

- * A Groovy property with this name was exposed, which leads to this lengthy - * getter name. In Java, boolean fields are named without the "is" prefix. - * - * @deprecated use {@link #isRestli1BuildersDeprecated()} instead - */ - @Deprecated - public boolean is_isRestli1BuildersDeprecated() - { - return isRestli1BuildersDeprecated(); - } - @Internal public boolean isRestli1BuildersDeprecated() { diff --git a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestModelTask.java b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestModelTask.java index 154f355863..6e1c0f1117 100644 --- a/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestModelTask.java +++ b/gradle-plugins/src/main/java/com/linkedin/pegasus/gradle/tasks/GenerateRestModelTask.java @@ -163,7 +163,6 @@ public void setResolverPath(FileCollection resolverPath) } @OutputDirectory - @PathSensitive(PathSensitivity.NAME_ONLY) public File getIdlDestinationDir() { return _idlDestinationDir;