Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move validate task to base plugin #133

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -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
Loading