Skip to content

Commit 2fe7fe9

Browse files
authored
Add support for Gradle 6 (#272)
1 parent ca099f2 commit 2fe7fe9

19 files changed

+53
-73
lines changed

build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
signing
2020
checkstyle
2121
jacoco
22-
id("com.github.spotbugs") version "1.6.10"
22+
id("com.github.spotbugs") version "4.6.0"
2323
id("io.codearte.nexus-staging") version "0.21.0"
2424
}
2525

@@ -245,9 +245,12 @@ subprojects {
245245
tasks["spotbugsTest"].enabled = false
246246

247247
// Configure the bug filter for spotbugs.
248-
tasks.withType<com.github.spotbugs.SpotBugsTask> {
249-
effort = "max"
250-
excludeFilterConfig = project.resources.text.fromFile("${project.rootDir}/config/spotbugs/filter.xml")
248+
spotbugs {
249+
setEffort("max")
250+
val excludeFile = File("${project.rootDir}/config/spotbugs/filter.xml")
251+
if (excludeFile.exists()) {
252+
excludeFilter.set(excludeFile)
253+
}
251254
}
252255
}
253256
}

config/checkstyle/checkstyle.xml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
-->
1616

1717
<!DOCTYPE module PUBLIC
18-
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
19-
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
18+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
19+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
2020

2121
<module name="Checker">
22-
<module name="SuppressWarningsFilter" />
22+
<module name="SuppressWarningsFilter"/>
2323

2424
<module name="SuppressionFilter">
2525
<property name="file" value="${config_loc}/suppressions.xml"/>
@@ -32,11 +32,19 @@
3232
<!-- Files must contain a copyright header. -->
3333
<module name="RegexpHeader">
3434
<property name="header"
35-
value="/*\n * Copyright 20(19|20|21) Amazon.com, Inc. or its affiliates. All Rights Reserved.\n"/>
35+
value="/\*\n \* Copyright 20(19|20|21) Amazon\.com, Inc\. or its affiliates\. All Rights Reserved\.\n"/>
3636
<property name="fileExtensions" value="java"/>
3737
</module>
3838

39-
<module name="NewlineAtEndOfFile"/>
39+
<module name="NewlineAtEndOfFile">
40+
<property name="lineSeparator" value="lf_cr_crlf"/>
41+
</module>
42+
43+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
44+
<module name="LineLength">
45+
<property name="max" value="${checkstyle.linelength}" default="120"/>
46+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
47+
</module>
4048

4149
<!-- Checks for whitespace -->
4250
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
@@ -51,13 +59,6 @@
5159
<module name="SuppressWarningsHolder"/>
5260
<module name="SuppressionCommentFilter"/>
5361

54-
<!-- Checks for Size Violations. -->
55-
<!-- See http://checkstyle.sf.net/config_sizes.html -->
56-
<module name="LineLength">
57-
<property name="max" value="${checkstyle.linelength}" default="120"/>
58-
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
59-
</module>
60-
6162
<!-- Checks for imports -->
6263
<!-- See http://checkstyle.sf.net/config_import.html -->
6364
<module name="NoLineWrap"/>
@@ -79,12 +80,8 @@
7980
<module name="JavadocMethod">
8081
<property name="scope" value="public"/>
8182
<property name="allowMissingParamTags" value="true"/>
82-
<property name="allowMissingThrowsTags" value="true"/>
8383
<property name="allowMissingReturnTag" value="true"/>
84-
<property name="minLineCount" value="2"/>
8584
<property name="allowedAnnotations" value="Override, Test"/>
86-
<property name="allowThrowsTagsForSubclasses" value="true"/>
87-
<property name="allowMissingJavadoc" value="true"/>
8885
</module>
8986
<module name="JavadocStyle"/>
9087
<module name="NonEmptyAtclauseDescription"/>
@@ -155,7 +152,9 @@
155152
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
156153
</module>
157154
<module name="LeftCurly"/>
158-
<module name="NeedBraces"/>
155+
<module name="NeedBraces">
156+
<property name="allowEmptyLoopBody" value="true"/>
157+
</module>
159158
<module name="RightCurly">
160159
<property name="id" value="RightCurlySame"/>
161160
<property name="tokens"
@@ -165,12 +164,11 @@
165164
<property name="id" value="RightCurlyAlone"/>
166165
<property name="option" value="alone"/>
167166
<property name="tokens"
168-
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
167+
value="CLASS_DEF, METHOD_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
169168
</module>
170169

171170
<!-- Checks for common coding problems -->
172171
<!-- See http://checkstyle.sf.net/config_coding.html -->
173-
<module name="EmptyStatement"/>
174172
<module name="EqualsHashCode"/>
175173
<module name="IllegalInstantiation"/>
176174
<module name="InnerAssignment"/>
@@ -206,4 +204,4 @@
206204
<property name="allowNonPrintableEscapes" value="true"/>
207205
</module>
208206
</module>
209-
</module>
207+
</module>

gradle/wrapper/gradle-wrapper.jar

3.5 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154156
else
155157
eval `echo args$i`="\"$arg\""
156158
fi
157-
i=$((i+1))
159+
i=`expr $i + 1`
158160
done
159161
case $i in
160-
(0) set -- ;;
161-
(1) set -- "$args0" ;;
162-
(2) set -- "$args0" "$args1" ;;
163-
(3) set -- "$args0" "$args1" "$args2" ;;
164-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170172
esac
171173
fi
172174

@@ -175,14 +177,9 @@ save () {
175177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176178
echo " "
177179
}
178-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
179181

180182
# Collect all arguments for the java command, following the shell quoting and substitution rules
181183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182184

183-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185-
cd "$(dirname "$0")"
186-
fi
187-
188185
exec "$JAVACMD" "$@"

gradlew.bat

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
3740

3841
set JAVA_EXE=java.exe
3942
%JAVA_EXE% -version >NUL 2>&1
40-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4144

4245
echo.
4346
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
5154
set JAVA_HOME=%JAVA_HOME:"=%
5255
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5356

54-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5558

5659
echo.
5760
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
6164

6265
goto fail
6366

64-
:init
65-
@rem Get command-line arguments, handling Windows variants
66-
67-
if not "%OS%" == "Windows_NT" goto win9xME_args
68-
69-
:win9xME_args
70-
@rem Slurp the command line arguments.
71-
set CMD_LINE_ARGS=
72-
set _SKIP=2
73-
74-
:win9xME_args_slurp
75-
if "x%~1" == "x" goto execute
76-
77-
set CMD_LINE_ARGS=%*
78-
7967
:execute
8068
@rem Setup the command line
8169

8270
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8371

72+
8473
@rem Execute Gradle
85-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8675

8776
:end
8877
@rem End local scope for the variables with windows NT shell

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.util.ArrayList;
1919
import java.util.List;
20-
2120
import software.amazon.smithy.model.Model;
2221
import software.amazon.smithy.model.knowledge.EventStreamIndex;
2322
import software.amazon.smithy.model.shapes.OperationShape;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenVisitor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.Set;
2828
import java.util.TreeSet;
2929
import java.util.logging.Logger;
30-
3130
import software.amazon.smithy.build.FileManifest;
3231
import software.amazon.smithy.build.PluginContext;
3332
import software.amazon.smithy.codegen.core.CodegenException;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/IndexGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.util.Set;
1919
import java.util.TreeSet;
20-
2120
import software.amazon.smithy.build.FileManifest;
2221
import software.amazon.smithy.codegen.core.Symbol;
2322
import software.amazon.smithy.codegen.core.SymbolProvider;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/PaginationGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package software.amazon.smithy.typescript.codegen;
1818

1919
import java.util.Optional;
20-
2120
import software.amazon.smithy.codegen.core.CodegenException;
2221
import software.amazon.smithy.codegen.core.Symbol;
2322
import software.amazon.smithy.codegen.core.SymbolProvider;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/RuntimeConfigGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.Map;
2020
import java.util.TreeMap;
2121
import java.util.function.Consumer;
22-
2322
import software.amazon.smithy.build.SmithyBuildException;
2423
import software.amazon.smithy.codegen.core.SymbolProvider;
2524
import software.amazon.smithy.model.Model;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Optional;
2525
import java.util.Set;
2626
import java.util.logging.Logger;
27-
2827
import software.amazon.smithy.build.FileManifest;
2928
import software.amazon.smithy.codegen.core.CodegenException;
3029
import software.amazon.smithy.codegen.core.ReservedWordSymbolProvider;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptDependency.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.ArrayList;
1919
import java.util.Collections;
2020
import java.util.List;
21-
2221
import software.amazon.smithy.codegen.core.Symbol;
2322
import software.amazon.smithy.codegen.core.SymbolDependency;
2423
import software.amazon.smithy.codegen.core.SymbolDependencyContainer;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptJmesPathVisitor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package software.amazon.smithy.typescript.codegen;
1717

1818
import java.util.ArrayList;
19-
2019
import software.amazon.smithy.codegen.core.CodegenException;
2120
import software.amazon.smithy.jmespath.ExpressionVisitor;
2221
import software.amazon.smithy.jmespath.JmespathExpression;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddEventStreamDependency.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Map;
2121
import java.util.Set;
2222
import java.util.function.Consumer;
23-
2423
import software.amazon.smithy.codegen.core.SymbolProvider;
2524
import software.amazon.smithy.model.Model;
2625
import software.amazon.smithy.model.knowledge.EventStreamIndex;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ private String getTimestampInputParam(
653653
* @param context The generation context.
654654
* @param operation The operation being generated.
655655
*/
656-
protected void writeDefaultHeaders(GenerationContext context, OperationShape operation) {}
656+
protected void writeDefaultHeaders(GenerationContext context, OperationShape operation) {
657+
}
657658

658659
/**
659660
* Writes the code needed to serialize the input document of a request.

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.function.BiFunction;
2323
import java.util.function.Consumer;
2424
import java.util.logging.Logger;
25-
2625
import software.amazon.smithy.codegen.core.CodegenException;
2726
import software.amazon.smithy.codegen.core.Symbol;
2827
import software.amazon.smithy.codegen.core.SymbolProvider;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ private boolean writeRequestBody(GenerationContext context, OperationShape opera
246246
* @param context The generation context.
247247
* @param operation The operation being generated.
248248
*/
249-
protected void writeDefaultHeaders(GenerationContext context, OperationShape operation) {}
249+
protected void writeDefaultHeaders(GenerationContext context, OperationShape operation) {
250+
}
250251

251252
/**
252253
* Writes the code needed to serialize the input document of a request.

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/ProtocolGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ default ApplicationProtocol resolveApplicationProtocol(
121121
*
122122
* @param context Serde context.
123123
*/
124-
default void generateSharedComponents(GenerationContext context) {}
124+
default void generateSharedComponents(GenerationContext context) {
125+
}
125126

126127
/**
127128
* Generates the code used to serialize the shapes of a service

0 commit comments

Comments
 (0)