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

Temporarily Revert "Add exception on implicit empty config (#123)" #126

Merged
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

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@ repositories {

dependencies {
implementation(project(":custom-string-trait"))
}

smithy {
smithyBuildConfigs.set(project.files())
}
}

This file was deleted.

3 changes: 0 additions & 3 deletions examples/jar-plugin/multiple-sources/smithy-build.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private void configureDefaults(Project project) {
getFormat().convention(true);
getAllowUnknownTraits().convention(false);
getOutputDirectory().convention(getDefaultOutputDirectory(project));

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
import org.gradle.api.GradleException;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.FileCollection;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.SetProperty;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
Expand Down Expand Up @@ -59,14 +57,14 @@ public SmithyBuildTask(ObjectFactory objectFactory) {
public abstract SetProperty<String> getProjectionSourceTags();


/**
* Smithy build configs to use for building models.
/** Smithy build configs to use for building models.
*
* @return list of smithy-build config json files
*/
@InputFiles
public abstract Property<FileCollection> getSmithyBuildConfigs();


/**
* Sets whether to fail a {@link SmithyBuildTask} if an unknown trait is encountered.
*
Expand Down Expand Up @@ -106,27 +104,10 @@ List<String> getModelAbsolutePaths() {
.collect(Collectors.toList());
}

/**
* Read-only property.
*
* @return Returns true if at least one of the specified build configs exists.
*/
@Internal
Provider<Boolean> getSmithyBuildConfigsMissing() {
return getSmithyBuildConfigs().map(
files -> !files.isEmpty() && files.filter(File::exists).isEmpty()
);
}

@TaskAction
public void execute() {
writeHeading("Running smithy build");

if (getSmithyBuildConfigsMissing().get()) {
throw new GradleException("No smithy-build configs found. "
+ "If this was intentional, set the `smithyBuildConfigs` property to an empty list.");
}

BuildParameterBuilder builder = new BuildParameterBuilder();

// Model discovery classpath
Expand Down
Loading