Skip to content

Commit

Permalink
Move validate task to base plugin (#133)
Browse files Browse the repository at this point in the history
Moves the SmithyValidate task into the base-plugin package.
  • Loading branch information
hpmellema committed Mar 19, 2024
1 parent 8a4d35b commit 86186ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,14 @@ public SmithyValidateTask(ObjectFactory objectFactory) {
}

/**
* Jar file to use as a source for the Smithy CLI validate command.
* Files to use as a sources for the Smithy CLI {@code validate} command.
*
* <p>This is a required input for the {@link SmithyValidateTask}. In general
* this should be the output of a {@link org.gradle.jvm.tasks.Jar task}. For example:
* <p>This is a required input of the SmithyValidate task.
*
* <pre>
* Task jarTask = project.getTasks()
* .getByName(JavaPlugin.JAR_TASK_NAME);
* ...
* validateTask.getJarToValidate().set(
* jarTask.getOutputs().getFiles());
* </pre>
* @return file collection to use as sources for the validate task.
*/
@InputFiles
public abstract Property<FileCollection> getJarToValidate();
public abstract Property<FileCollection> getSources();

/**
* Disable model discovery.
Expand Down Expand Up @@ -107,7 +100,7 @@ public void execute() {

// Set models to an empty collection so source models are not included in validation path.
executeCliProcess("validate", extraArgs,
getJarToValidate().get(),
getSources().get(),
getDisableModelDiscovery().get()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ private void addJavaTasksForSourceSet(SourceSet sourceSet, SmithyBuildTask build

// Only enable validation if the jar Task is also enabled
validateTask.setEnabled(jarTask.getEnabled());

validateTask.getJarToValidate().set(jarTask.getOutputs().getFiles());
validateTask.getSources().set(jarTask.getOutputs().getFiles());
validateTask.getAllowUnknownTraits().set(extension.getAllowUnknownTraits());

// Add to verification group, so this tasks shows up in the output of `gradle tasks`
Expand Down

0 comments on commit 86186ad

Please sign in to comment.