@@ -162,32 +162,36 @@ tasks.generateSmithyProjections {
162162 }
163163}
164164
165- val stageSdks = tasks.register(" stageSdks" ) {
166- group = " codegen"
167- description = " relocate generated SDK(s) from build directory to services/ dir"
168- dependsOn(tasks.generateSmithyProjections)
169- doLast {
170- val discoveredServices = servicesProvider.get()
171- logger.lifecycle(" discoveredServices = ${discoveredServices.joinToString { it.sdkId }} " )
172- discoveredServices.forEach {
173- val projectionOutputDir = smithyBuild.smithyKotlinProjectionPath(it.projectionName).get()
174- logger.info(" copying $projectionOutputDir to ${it.destinationDir} " )
175- copy {
176- from(" $projectionOutputDir /src" )
177- into(" ${it.destinationDir} /generated-src" )
178- }
179- copy {
180- from(" $projectionOutputDir /build.gradle.kts" )
181- into(it.destinationDir)
182- }
183- copy {
184- from(" $projectionOutputDir /OVERVIEW.md" )
185- into(it.destinationDir)
165+ val stageSdkTasks = servicesProvider.map { discoveredServices ->
166+ logger.lifecycle(" discoveredServices = ${discoveredServices.joinToString { it.sdkId }} " )
167+ discoveredServices.map { service ->
168+ tasks.register<Copy >(" stageSdk-${service.projectionName} " ) {
169+ val projectionOutputDir = smithyBuild.smithyKotlinProjectionPath(service.projectionName).get()
170+
171+ description = " Copy generated files for ${service.sdkId} to services directory"
172+ group = " codegen"
173+ dependsOn(tasks.generateSmithyProjections)
174+
175+ doFirst { logger.info(" Copying $projectionOutputDir to ${service.destinationDir} " ) }
176+
177+ // Set base service directory
178+ into(service.destinationDir)
179+
180+ from(" $projectionOutputDir /build.gradle.kts" )
181+ from(" $projectionOutputDir /OVERVIEW.md" )
182+ from(" $projectionOutputDir /src" ) {
183+ into(" generated-src" )
186184 }
187185 }
188186 }
189187}
190188
189+ val stageSdks = tasks.register(" stageSdks" ) {
190+ group = " codegen"
191+ description = " Relocate generated SDK(s) from build directory to services/ dir"
192+ dependsOn(stageSdkTasks)
193+ }
194+
191195tasks.register(" bootstrap" ) {
192196 group = " codegen"
193197 description = " Generate AWS SDK's and register them with the build"
0 commit comments