Skip to content

Commit

Permalink
Update exclude pattern, apply formatting to smithy-build
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker committed Dec 16, 2024
1 parent 1eb7e18 commit 48469b3
Show file tree
Hide file tree
Showing 109 changed files with 1,633 additions and 2,211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spotless {
removeUnusedImports()
importOrder("\\#", "")
// Ignore generated code for formatter check
targetExclude("**/build/**/*.*")
targetExclude("*/build/**/*.*")
}

// Formatting for build.gradle.kts files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.io.BufferedReader;
Expand Down Expand Up @@ -62,8 +51,8 @@ public Path addFile(Path path) {
try {
Files.createDirectories(parent);
} catch (IOException e) {
throw new SmithyBuildException(String.format(
"Error create directory `%s`: %s", parent, e.getMessage()));
throw new SmithyBuildException(
String.format("Error create directory `%s`: %s", parent, e.getMessage()));
}
}

Expand All @@ -76,7 +65,7 @@ public Path writeFile(Path path, Reader fileContentsReader) {
path = addFile(path);

try (BufferedReader bufferedReader = new BufferedReader(fileContentsReader);
BufferedWriter writer = Files.newBufferedWriter(path)) {
BufferedWriter writer = Files.newBufferedWriter(path)) {
int len;
char[] buffer = new char[4096];
while ((len = bufferedReader.read(buffer)) != -1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.util.Map;
Expand Down Expand Up @@ -93,7 +82,9 @@ protected Node getDefault(Node value) {

@Override
public Node arrayNode(ArrayNode node) {
return node.getElements().stream().map(element -> element.accept(this)).collect(ArrayNode.collect());
return node.getElements().stream()
.map(element -> element.accept(this))
.collect(ArrayNode.collect());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.io.ByteArrayOutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.nio.file.Path;
Expand Down Expand Up @@ -210,7 +199,8 @@ public Set<Path> getSources() {
* @return Returns true if this shape is considered a source shape.
*/
public boolean isSourceShape(ToShapeId shape) {
return originalModel == null || isSource(originalModel.getShape(shape.toShapeId()).orElse(null));
return originalModel == null
|| isSource(originalModel.getShape(shape.toShapeId()).orElse(null));
}

/**
Expand All @@ -223,7 +213,8 @@ public boolean isSourceShape(ToShapeId shape) {
* @return Returns true if this metadata is considered a source entry.
*/
public boolean isSourceMetadata(String metadataKey) {
return originalModel == null || isSource(originalModel.getMetadataProperty(metadataKey).orElse(null));
return originalModel == null
|| isSource(originalModel.getMetadataProperty(metadataKey).orElse(null));
}

private boolean isSource(FromSourceLocation sourceLocation) {
Expand Down Expand Up @@ -254,7 +245,7 @@ private int findOffsetFromStart(String location) {

@Override
public Builder toBuilder() {
Builder builder = builder()
Builder builder = builder()
.model(model)
.events(events)
.settings(settings)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.util.HashMap;
Expand Down Expand Up @@ -75,8 +64,7 @@ static Function<String, Optional<ProjectionTransformer>> createServiceFactory()
* @return Returns the created factory.
*/
static Function<String, Optional<ProjectionTransformer>> createServiceFactory(
Iterable<ProjectionTransformer> transformers
) {
Iterable<ProjectionTransformer> transformers) {
Map<String, ProjectionTransformer> map = new HashMap<>();
for (ProjectionTransformer transformer : transformers) {
map.put(transformer.getName(), transformer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

import java.nio.file.FileSystems;
Expand Down Expand Up @@ -138,7 +127,9 @@ public SmithyBuildResult build() {
message.append(System.lineSeparator()).append(System.lineSeparator());

for (Map.Entry<String, Throwable> e : errors.entrySet()) {
message.append("(").append(e.getKey()).append("): ")
message.append("(")
.append(e.getKey())
.append("): ")
.append(e.getValue())
.append(System.lineSeparator());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.build;

/**
Expand Down
Loading

0 comments on commit 48469b3

Please sign in to comment.