Skip to content

Rename module and recipes #5377

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

Merged
merged 6 commits into from
Jul 10, 2024
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
4 changes: 2 additions & 2 deletions .brazil.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

"dynamodb": { "packageName": "AwsJavaSdk-DynamoDb" },
"waf": { "packageName": "AwsJavaSdk-Waf" },
"migration-tool": { "packageName": "AwsJavaSdk-Tooling-MigrationTool"},
"v2-migration": { "packageName": "AwsJavaSdk-Tooling-V2Migration"},

"third-party-jackson-core": {
"packageName": "AwsJavaSdk-ThirdParty-JacksonCore",
Expand Down Expand Up @@ -106,7 +106,7 @@
"tests-coverage-reporting": { "skipImport": true },
"third-party": { "skipImport": true },
"third-party-slf4j-api": { "skipImport": true },
"migration-tool-tests": {"skipImport": true},
"v2-migration-tests": {"skipImport": true},
"crt-unavailable-tests": { "skipImport": true },
"bundle-shading-tests": { "skipImport": true }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@
<!-- Skip the warning since this source is forked from openrewrite -->
<Match>
<Or>
<Class name="software.amazon.awssdk.migration.recipe.ChangeSdkType"/>
<Class name="software.amazon.awssdk.migration.recipe.ChangeSdkType$ChangeTypeVisitor"/>
<Class name="software.amazon.awssdk.v2migration.ChangeSdkType"/>
<Class name="software.amazon.awssdk.v2migration.ChangeSdkType$ChangeTypeVisitor"/>
</Or>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
Expand Down
2 changes: 1 addition & 1 deletion buildspecs/release-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ phases:
commands:
- python ./scripts/doc_crosslinks/generate_cross_link_data.py --apiDefinitionsBasePath ./services/ --apiDefinitionsRelativeFilePath src/main/resources/codegen-resources/service-2.json --templateFilePath ./scripts/doc_crosslinks/crosslink_redirect.html --outputFilePath ./scripts/crosslink_redirect.html
- mvn install -P quick -T1C
- mvn clean install javadoc:aggregate -B -Ppublic-javadoc -Dcheckstyle.skip -Dspotbugs.skip -DskipTests -Ddoclint=none -pl '!:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:s3-benchmarks,!:module-path-tests,!:test-utils,!:http-client-tests,!:tests-coverage-reporting,!:sdk-native-image-test,!:ruleset-testing-core,!:old-client-version-compatibility-test,!:crt-unavailable-tests,!:bundle-shading-tests,!:migration-tool,!:migration-tool-tests'
- mvn clean install javadoc:aggregate -B -Ppublic-javadoc -Dcheckstyle.skip -Dspotbugs.skip -DskipTests -Ddoclint=none -pl '!:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:s3-benchmarks,!:module-path-tests,!:test-utils,!:http-client-tests,!:tests-coverage-reporting,!:sdk-native-image-test,!:ruleset-testing-core,!:old-client-version-compatibility-test,!:crt-unavailable-tests,!:bundle-shading-tests,!:v2-migration,!:v2-migration-tests'
- RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
-
- aws s3 sync target/site/apidocs/ $DOC_PATH/$RELEASE_VERSION/ --acl="public-read"
Expand Down
2 changes: 1 addition & 1 deletion buildspecs/release-to-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ phases:
awk 'BEGIN { var=ENVIRON["SDK_SIGNING_GPG_KEYNAME"] } { gsub("\\$SDK_SIGNING_GPG_KEYNAME", var, $0); print }' > \
$SETTINGS_XML

mvn clean deploy -B -s $SETTINGS_XML -Ppublishing -DperformRelease -Dspotbugs.skip -DskipTests -Dcheckstyle.skip -Djapicmp.skip -Ddoclint=none -pl !:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:tests-coverage-reporting,!:stability-tests,!:sdk-native-image-test,!:auth-tests,!:s3-benchmarks,!:region-testing,!:old-client-version-compatibility-test,!:crt-unavailable-tests,!:bundle-shading-tests,!:migration-tool-tests -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
mvn clean deploy -B -s $SETTINGS_XML -Ppublishing -DperformRelease -Dspotbugs.skip -DskipTests -Dcheckstyle.skip -Djapicmp.skip -Ddoclint=none -pl !:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:tests-coverage-reporting,!:stability-tests,!:sdk-native-image-test,!:auth-tests,!:s3-benchmarks,!:region-testing,!:old-client-version-compatibility-test,!:crt-unavailable-tests,!:bundle-shading-tests,!:v2-migration-tests -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
else
echo "This version was already released."
fi

This file was deleted.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<module>codegen-lite-maven-plugin</module>
<module>archetypes</module>
<module>third-party</module>
<module>migration-tool</module>
<module>v2-migration</module>
<module>test/http-client-tests</module>
<module>test/protocol-tests</module>
<module>test/protocol-tests-core</module>
Expand All @@ -89,7 +89,7 @@
<module>test/ruleset-testing-core</module>
<module>test/old-client-version-compatibility-test</module>
<module>test/bundle-logging-bridge-binding-test</module>
<module>test/migration-tool-tests</module>
<module>test/v2-migration-tests</module>
<module>test/bundle-shading-tests</module>
<module>test/crt-unavailable-tests</module>
</modules>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS SDK Migration Tool Tests

## Description
This module is used to test `migration-tool`. It contains an application that uses the AWS SDK for Java v1
This module is used to test `v2-migration`. It contains an application that uses the AWS SDK for Java v1
and performs `mvn open:rewrite` to migrate it to the AWS SDK for Java v2 and compares the transformed code
with the expected code for verification. The test code is in [run-test](./src/test/resources/run-test).
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</parent>

<groupId>software.amazon.awssdk</groupId>
<artifactId>migration-tool-tests</artifactId>
<artifactId>v2-migration-tests</artifactId>

<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -61,7 +61,7 @@
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>migration-tool</artifactId>
<artifactId>v2-migration</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ initscript {
rootProject {
plugins.apply(org.openrewrite.gradle.RewritePlugin)
dependencies {
rewrite("software.amazon.awssdk:migration-tool:V2_VERSION")
rewrite("software.amazon.awssdk:v2-migration:V2_VERSION")
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def run_maven_test(version):
copy_directory(AFTER_DIR_MAVEN, TARGET_AFTER_DIR_MAVEN)

subprocess.run(["mvn", "org.openrewrite.maven:rewrite-maven-plugin:run",
"-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:migration-tool:"+ version,
"-Drewrite.activeRecipes=software.amazon.awssdk.UpgradeJavaSdk2"], cwd=TARGET_DIR_MAVEN, check=True)
"-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:v2-migration:"+ version,
"-Drewrite.activeRecipes=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2"], cwd=TARGET_DIR_MAVEN, check=True)
shutil.rmtree(os.path.join(TARGET_DIR_MAVEN, "target"))

pom_file = Path(AFTER_POM)
Expand All @@ -66,7 +66,7 @@ def run_gradle_test(version):
init_file.write_text(init_file.read_text().replace('V2_VERSION', version))

subprocess.run(["./gradlew", "rewriteRun", "--init-script", "init.gradle",
"-Drewrite.activeRecipes=software.amazon.awssdk.UpgradeJavaSdk2"], cwd=TARGET_DIR_GRADLE, check=True)
"-Drewrite.activeRecipes=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2"], cwd=TARGET_DIR_GRADLE, check=True)

# only compares source directory and build.gradle and skip non-code directories such as gradle wrapper
actual_source = os.path.join(TARGET_DIR_GRADLE, "src")
Expand Down
21 changes: 10 additions & 11 deletions migration-tool/README.md → v2-migration/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# AWS SDK for Java v2 Migration Tool
# AWS SDK for Java v2 Migration Tooling

## Description
This is a migration tool to automate migration from AWS SDK for Java v1 to AWS SDK for Java v2.
It uses [OpenRewrite][open-rewrite].
This modules contains [OpenRewrite][open-rewrite] recipes to automate migration from the AWS SDK for Java v1 to the AWS SDK for Java v2.

## Usage

Expand All @@ -17,8 +16,8 @@ find the latest version.

```
mvn org.openrewrite.maven:rewrite-maven-plugin:dryRun \
-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:migration-tool:{sdkversion} \
-Drewrite.activeRecipes=software.amazon.awssdk.UpgradeJavaSdk2
-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:v2-migration:{sdkversion} \
-Drewrite.activeRecipes=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2
```

- Run
Expand All @@ -27,8 +26,8 @@ With this mode, it runs the SDK recipes and applies the changes locally.

```
mvn org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:migration-tool:{sdkversion} \
-Drewrite.activeRecipes=software.amazon.awssdk.UpgradeJavaSdk2
-Drewrite.recipeArtifactCoordinates=software.amazon.awssdk:v2-migration:{sdkversion} \
-Drewrite.activeRecipes=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2
```


Expand All @@ -37,7 +36,7 @@ mvn org.openrewrite.maven:rewrite-maven-plugin:run \
To build this module locally for fast development, run the following command.

```
mvn clean install -pl :bom-internal,:bom,:migration-tool -P quick --am
mvn clean install -pl :bom-internal,:bom,:v2-migration -P quick --am
```

### Testing
Expand All @@ -49,13 +48,13 @@ Unit tests reside in the test folder in this module. They use [RewriteTest][rewr

- End-to-end functional tests

End-to-end functional tests are in [migration-tool-tests module][migration-tool-tests]. It contains
End-to-end functional tests are in [v2-migration-tests module][v2-migration-tests]. It contains
sample applications using the AWS SDK for Java v1 and compares the transformed code with the expected v2
code and ensures it compiles.

[open-rewrite]: https://docs.openrewrite.org/
[open-rewrite-usage]: https://docs.openrewrite.org/running-recipes
[open-rewrite-plugin]: https://docs.openrewrite.org/reference/rewrite-maven-plugin
[maven-central]: https://central.sonatype.com/artifact/software.amazon.awssdk/migration-tool
[maven-central]: https://central.sonatype.com/artifact/software.amazon.awssdk/v2-migration
[rewrite-test]:https://docs.openrewrite.org/authoring-recipes/recipe-testing#rewritetest-interface
[migration-tool-tests]:../test/migration-tool-tests
[v2-migration-tests]:../test/v2-migration-tests
8 changes: 4 additions & 4 deletions migration-tool/pom.xml → v2-migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<version>2.26.16-SNAPSHOT</version>
</parent>

<artifactId>migration-tool</artifactId>
<name>AWS Java SDK :: Migration Tool</name>
<artifactId>v2-migration</artifactId>
<name>AWS Java SDK :: V2 Migration</name>
<description>
Migration tool to help users migrate from AWS SDK for Java v1 to AWS SDK for Java v2
Contains OpenRewrite recipes to help users migrate from the AWS SDK for Java v1 to the AWS SDK for Java v2
</description>

<dependencyManagement>
Expand Down Expand Up @@ -217,7 +217,7 @@
<archive>
<manifestEntries>
<!-- TODO: is this really needed since we don't expect users to use our recipe classes directly ? -->
<Automatic-Module-Name>software.amazon.awssdk.migration</Automatic-Module-Name>
<Automatic-Module-Name>software.amazon.awssdk.v2migration</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.recipe;
package software.amazon.awssdk.v2migration;

import static software.amazon.awssdk.migration.internal.utils.NamingConversionUtils.getV2Equivalent;
import static software.amazon.awssdk.migration.internal.utils.NamingConversionUtils.getV2ModelPackageWildCardEquivalent;
import static software.amazon.awssdk.migration.internal.utils.SdkTypeUtils.isV1ClientClass;
import static software.amazon.awssdk.migration.internal.utils.SdkTypeUtils.isV1ModelClass;
import static software.amazon.awssdk.v2migration.internal.utils.NamingConversionUtils.getV2Equivalent;
import static software.amazon.awssdk.v2migration.internal.utils.NamingConversionUtils.getV2ModelPackageWildCardEquivalent;
import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.isV1ClientClass;
import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.isV1ModelClass;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -43,11 +43,11 @@
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.http.apache.ApacheHttpClient;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.migration.internal.utils.IdentifierUtils;
import software.amazon.awssdk.migration.internal.utils.SdkTypeUtils;
import software.amazon.awssdk.utils.CollectionUtils;
import software.amazon.awssdk.utils.Logger;
import software.amazon.awssdk.utils.Pair;
import software.amazon.awssdk.v2migration.internal.utils.IdentifierUtils;
import software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils;

/**
* This recipe moves the HTTP settings such as maxConnections configured on v1 ClientConfiguration to v2 ApacheHttpClient builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import static software.amazon.awssdk.migration.internal.utils.SdkTypeUtils.isEligibleToConvertToBuilder;
import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.isEligibleToConvertToBuilder;

import java.util.Collections;
import org.openrewrite.ExecutionContext;
Expand All @@ -31,9 +31,8 @@
import org.openrewrite.java.tree.Space;
import org.openrewrite.marker.Markers;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.migration.internal.utils.NamingUtils;
import software.amazon.awssdk.migration.internal.utils.SdkTypeUtils;
import software.amazon.awssdk.migration.recipe.NewClassToBuilderPattern;
import software.amazon.awssdk.v2migration.internal.utils.NamingUtils;
import software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils;

/**
* Internal recipe that converts new class creation to the builder pattern.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.recipe;
package software.amazon.awssdk.v2migration;

import java.util.Arrays;
import java.util.List;
import org.openrewrite.Recipe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.migration.internal.recipe.NewClassToBuilder;
import software.amazon.awssdk.migration.internal.recipe.V1SetterToV2;
import software.amazon.awssdk.annotations.SdkInternalApi;

/**
* Recipe that converts objects creation using {@code new} such as
Expand All @@ -45,7 +43,7 @@
* sqs.sendMessage(sendMessage);
* }
*/
@SdkPublicApi
@SdkInternalApi
public class NewClassToBuilderPattern extends Recipe {
@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.recipe;
package software.amazon.awssdk.v2migration;

import static software.amazon.awssdk.migration.internal.utils.SdkTypeUtils.V2_CORE_CLASSES_WITH_STATIC_FACTORY;
import static software.amazon.awssdk.migration.internal.utils.SdkTypeUtils.isEligibleToConvertToStaticFactory;
import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.V2_CORE_CLASSES_WITH_STATIC_FACTORY;
import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.isEligibleToConvertToStaticFactory;

import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

package software.amazon.awssdk.migration.internal.recipe;
package software.amazon.awssdk.v2migration;

import java.util.Collections;
import java.util.List;
Expand All @@ -33,7 +33,7 @@
import org.openrewrite.java.tree.TypeUtils;
import org.openrewrite.marker.Markers;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.migration.internal.utils.IdentifierUtils;
import software.amazon.awssdk.v2migration.internal.utils.IdentifierUtils;

@SdkInternalApi
public class S3StreamingResponseToV2 extends Recipe {
Expand Down
Loading
Loading