Skip to content

Commit

Permalink
Revert "Add exception on implicit empty config (smithy-lang#123)"
Browse files Browse the repository at this point in the history
This reverts commit 59f1454.
  • Loading branch information
hpmellema committed Mar 7, 2024
1 parent a3957b4 commit 13ffa9f
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 86 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 1 addition & 5 deletions examples/jar-plugin/custom-trait/consumer/build.gradle.kts
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())
}
}
3 changes: 0 additions & 3 deletions examples/jar-plugin/multi-project/consumer/smithy-build.json

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

0 comments on commit 13ffa9f

Please sign in to comment.