diff --git a/.gitignore b/.gitignore index 548c400e557d..b5bcd17299e9 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,7 @@ codegen/*/bin benchmark/size/raw etc/ -temp/ \ No newline at end of file +temp/ + +# Gradle composite build properties +codegen/local.properties diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ac52bd4270d..2f0a06bd10e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,6 +126,22 @@ lerna run build --scope [package name] --include-dependencies You don't need to run this command if the dependency packages are not changed. +## Gradle Composite Build + +The `aws-sdk-js-v3` repository uses Gradle as a build tool and has Gradle based dependencies such as `smithy` and `smithy-typescript`. +To improve development experience when making changes to the dependencies locally, we can +use the [Gradle composite build feature](https://docs.gradle.org/current/userguide/composite_builds.html), +which allows picking up any local changes from dependencies automatically and rebuilding them when `aws-sdk-js-v3` is rebuilt. + +This also makes IDE integration more pleasant, as Intellij IDEA will open the included projects as modules when the Gradle build is imported. + +In order to utilise this feature, create a file `local.properties` in the `codegen` directory with the following content: + +``` +smithy=/Volumes/workplace/smithy +smithy-typescript=/Volumes/workplace/smithy-typescript +``` + ## Build caching Build caching is optionally available via Turborepo. See `turbo.json`. diff --git a/codegen/settings.gradle.kts b/codegen/settings.gradle.kts index 176d20e8eeb7..1bc44fa3ec79 100644 --- a/codegen/settings.gradle.kts +++ b/codegen/settings.gradle.kts @@ -13,8 +13,25 @@ * permissions and limitations under the License. */ +import java.io.FileInputStream +import java.nio.charset.StandardCharsets.UTF_8 + rootProject.name = "codegen" include(":smithy-aws-typescript-codegen") include(":sdk-codegen") include(":protocol-test-codegen") include(":generic-client-test-codegen") + +file( + java.nio.file.Paths.get(rootProject.projectDir.absolutePath, "local.properties")) + .takeIf { it.isFile }?.let { f -> + java.util.Properties().apply { load(java.io.InputStreamReader(FileInputStream(f), UTF_8)) } + }?.run { + listOf("smithy-typescript", "smithy") + .map { it to getProperty(it) } + .filterNot { it.second.isNullOrEmpty() } + .onEach { println("Found property `${it.first}`: ${it.second}") } + .map { file(it.second) } + .filter { it.isDirectory } + .forEach { includeBuild(it.absolutePath) } + }