Skip to content

Merge Migration Tool Updates #5493

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

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8924bfc
Create new module for migration tool with basic recipe (#4823)
zoewangg Feb 1, 2024
4b4c2aa
Add recipe to change SDK generated types. (#5053)
zoewangg Apr 8, 2024
ae2b8db
Account for v1 Services Module Naming Differences (#5109)
davidh44 Apr 17, 2024
55f165a
Fix checkstyle errors and suppress spotbug errors for ChangeSdkType (…
zoewangg Apr 17, 2024
23c2ad6
Add Region class mapping (#5118)
zoewangg Apr 18, 2024
a2e0bc5
Add NewV1ClassToBuilder recipe (#5115)
dagnir Apr 18, 2024
7ea05d9
Preserve prefix when moving from new to builder (#5130)
dagnir Apr 22, 2024
a4e8c88
Improve test script to log diff (#5131)
zoewangg Apr 22, 2024
5e99856
Improve diff output when tests fail (#5152)
dagnir Apr 25, 2024
dd1a687
Support code transformation for credentials related classes. (#5147)
zoewangg Apr 25, 2024
3126f62
Flush output after writing diff (#5154)
dagnir Apr 25, 2024
9831bdf
Add ConstructorToFluent recipe (#5145)
dagnir Apr 26, 2024
7a638af
Migration Tool Client Config Part 1: map builder variations to the st…
zoewangg Apr 30, 2024
71aeedd
Add AddCommentToMethod recipe (#5167)
zoewangg May 1, 2024
3f0cbe1
Add NumberToDuration recipe to convert numeric type to Duration (#5170)
zoewangg May 1, 2024
e860bba
Add S3StreamingResponseToV2 Recipe (#5173)
dagnir May 2, 2024
0734f68
Add S3StreamingResponseToV2 to migration recipe (#5180)
dagnir May 6, 2024
1b5f27e
Add mappping for non-HTTP config settings and add comments for settin…
zoewangg May 7, 2024
7bdb373
Add package mapping for the new module and exclude it from javadoc ex…
zoewangg May 7, 2024
55da9ba
Change package name for migration tool and update dependencies (#5200)
zoewangg May 8, 2024
55004c5
Fix NumberToDuraion recipe to handle variable (#5208)
zoewangg May 9, 2024
9408e75
HTTP settings mapping part 1: remove HTTP settings from client config…
zoewangg May 10, 2024
8f14af3
Prefix comment to method call (#5212)
dagnir May 10, 2024
e8e3fca
Add V1GetterToV2 Recipe (#5260)
davidh44 Jun 4, 2024
856a9d1
fix NPE in SdkTypeUtils (#5301)
sullis Jun 18, 2024
62bfe66
Fix POJO class naming mapping (#5315)
zoewangg Jun 19, 2024
59ba025
Change auth type getters to fluent getters (#5318)
zoewangg Jun 21, 2024
e3558b6
Support HTTP settings mapping (#5308)
zoewangg Jun 21, 2024
bbf1287
Fix missing space issue for ClientOverrideConfiguration (#5323)
zoewangg Jun 24, 2024
77efad7
Add mapping for core exception types and getters (#5326)
zoewangg Jun 25, 2024
6aa7d91
Wrap region string with Region.of (#5331)
zoewangg Jun 25, 2024
84986d1
Handle wildcard imports in ChangeSdkType recipe (#5336)
zoewangg Jun 26, 2024
8aa665c
Fix V1GetterToV2 to not change get method (#5338)
zoewangg Jun 27, 2024
4590205
Fix NPE in ChangeSdkType (#5342)
zoewangg Jun 28, 2024
8329c9b
Account for v1 package service name differences (#5353)
davidh44 Jul 2, 2024
0547c4e
Replace aws-java-sdk-core dependency (#5347)
zoewangg Jul 2, 2024
c528be2
Skip transformation for S3 Transfer Manager and DynamoDB mapper (#5364)
zoewangg Jul 4, 2024
db6f51a
Merge remote-tracking branch 'origin' into feature/master/migration-tool
zoewangg Jul 4, 2024
68334e8
Fix tests
zoewangg Jul 4, 2024
c0d444b
Remove hard-coded version in migration-tool-tests test script (#5366)
zoewangg Jul 4, 2024
1f2b0f3
Minor refactoring and updating readme (#5370)
zoewangg Jul 8, 2024
1ee64ee
Add gradle support and add tests for gradle project (#5368)
zoewangg Jul 8, 2024
8e5c6e9
Transform defaultClient to create (#5374)
davidh44 Jul 9, 2024
bfa1524
Add parentheses to method patterns (#5384)
davidh44 Jul 9, 2024
872bdad
Rename module and recipes (#5377)
zoewangg Jul 10, 2024
7ac2931
Add package mapping for rewrite-java-dependencies (#5388)
zoewangg Jul 10, 2024
6f33595
Fix import for real (#5389)
zoewangg Jul 10, 2024
3a90e8d
Add enum getters and casing transforms (#5393)
davidh44 Jul 17, 2024
b1ff244
Refactor HttpSettingsToHttpClient to handler client builder without b…
zoewangg Jul 18, 2024
ae31d77
Transforming S3 PUT override (#5411)
zoewangg Jul 18, 2024
5503299
Fix package/file naming and test (#5426)
davidh44 Jul 25, 2024
672d973
S3 PutObject String overload (#5429)
davidh44 Jul 29, 2024
1eaf187
S3 CreateBucket DeleteBucket single arg overloads (#5438)
davidh44 Jul 29, 2024
5e3d23b
Merge from master (#5491)
davidh44 Aug 8, 2024
9d956bf
Merge branch 'master' into feature/master/migration-tool-updates
davidh44 Aug 9, 2024
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 @@ -315,4 +315,10 @@
<Class name="software.amazon.awssdk.v2migration.EnumCasingToV2$Visitor"/>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>

<!-- False positive -->
<Match>
<Class name="software.amazon.awssdk.v2migration.EnumCasingToV2$Visitor"/>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

plugins {
id 'java-library'
}

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
implementation 'software.amazon.awssdk:dynamodb:V2_VERSION'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
*/

package gradletest.foo.bar;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
import software.amazon.awssdk.services.dynamodb.model.CreateTableResponse;

public class Library {
public void someMethod() {
DynamoDbClient dynamoDB = DynamoDbClient.builder().build();
CreateTableResponse createTableResult = dynamoDB.createTable(CreateTableRequest.builder().tableName("test")
.build());
System.out.println(createTableResult);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

plugins {
id 'java-library'
}

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
implementation 'com.amazonaws:aws-java-sdk-dynamodb:1.12.756'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
249 changes: 249 additions & 0 deletions test/v2-migration-tests/src/test/resources/gradle/before/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
#

##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done

# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

warn () {
echo "$*"
} >&2

die () {
echo
echo "$*"
echo
exit 1
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

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


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
Loading
Loading