diff --git a/gems/aws-sdk-core/lib/aws-sdk-core.rb b/gems/aws-sdk-core/lib/aws-sdk-core.rb index 4beb4c769b5..f9685d2373b 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core.rb @@ -109,7 +109,15 @@ # defaults require_relative 'aws-defaults' -# plugins - loaded through service clients as needed. +# plugins +# loaded through building STS or SSO .. + +# aws-sdk-sts is included to support Aws::AssumeRoleCredentials +require_relative 'aws-sdk-sts' + +# aws-sdk-sso is included to support Aws::SSOCredentials +require_relative 'aws-sdk-sso' +require_relative 'aws-sdk-ssooidc' module Aws @@ -197,14 +205,3 @@ def eager_autoload!(*args) end end - -# Autoload bundled service gems used in credential providers -# need to ensure that the files are the local files from aws-sdk-core -# and not the installed, legacy/dummy service gems. - -# aws-sdk-sts is included to support Aws::AssumeRoleCredentials -Aws.autoload :STS, File.join(__dir__, 'aws-sdk-sts.rb') - -# aws-sdk-sso is included to support Aws::SSOCredentials -Aws.autoload :SSO, File.join(__dir__, 'aws-sdk-sso.rb') -Aws.autoload :SSOOIDC, File.join(__dir__, 'aws-sdk-ssooidc.rb') diff --git a/gems/aws-sdk-resources/CHANGELOG.md b/gems/aws-sdk-resources/CHANGELOG.md index eb62aa1e10f..18c0d12d68f 100644 --- a/gems/aws-sdk-resources/CHANGELOG.md +++ b/gems/aws-sdk-resources/CHANGELOG.md @@ -17,7 +17,6 @@ Unreleased Changes * Issue - Remove autoloads for service gems bundled in `aws-sdk-core` (STS, SSO, SSOOIDC). -3.201.0 (2024-08-12) ------------------ * Feature - Removed a dependency on the deprecated `aws-sdk-codestar` gem. diff --git a/gems/aws-sdk-resources/bin/aws-v3.rb b/gems/aws-sdk-resources/bin/aws-v3.rb index 44886eef2c4..9b77e69ea72 100755 --- a/gems/aws-sdk-resources/bin/aws-v3.rb +++ b/gems/aws-sdk-resources/bin/aws-v3.rb @@ -106,13 +106,11 @@ def env_bool key, default # The Aws namespace used to check autoload requires aws-sdk-resources. require 'aws-sdk-resources' -# Finally load all of the gems. -# Don't update the load path for gems bundled in core. -core_gems = [:STS, :SSO, :SSOOIDC] +# Finally load all of the gems. Core is loaded a second time because of STS. if File.directory?(File.expand_path('../../../../build_tools', __FILE__)) gems = [] Aws.constants.each do |const_name| - if Aws.autoload?(const_name) && !core_gems.include?(const_name) + if Aws.autoload?(const_name) gems << "aws-sdk-#{const_name.downcase}" end end diff --git a/tasks/build.rake b/tasks/build.rake index 138d4f2c8e1..8767374fc34 100644 --- a/tasks/build.rake +++ b/tasks/build.rake @@ -28,7 +28,6 @@ end # It is need to provide session credentials and assume role support. # Only building source, but not gemspecs, version file, etc. task 'build:aws-sdk-sts' do - Aws::STS if Aws.autoload?(:STS) # force autoload from core sts = BuildTools::Services.service('sts') generator = AwsSdkCodeGenerator::CodeBuilder.new( aws_sdk_core_lib_path: $CORE_LIB, @@ -49,7 +48,6 @@ end # It is need to provide SSO Credentials. # Only building source, but not gemspecs, version file, etc. task 'build:aws-sdk-sso' do - Aws::SSO if Aws.autoload?(:SSO) # force autoload from core sso = BuildTools::Services.service('sso') generator = AwsSdkCodeGenerator::CodeBuilder.new( aws_sdk_core_lib_path: $CORE_LIB, @@ -68,7 +66,6 @@ end # Aws::SSOOIDC is generated directly into the `aws-sdk-core` gem. # Only building source, but not gemspecs, version file, etc. task 'build:aws-sdk-ssooidc' do - Aws::SSOOIDC if Aws.autoload?(:SSOOIDC) # force autoload from core ssooidc = BuildTools::Services.service('ssooidc') generator = AwsSdkCodeGenerator::CodeBuilder.new( aws_sdk_core_lib_path: $CORE_LIB, diff --git a/tasks/update-aws-sdk-dependencies.rake b/tasks/update-aws-sdk-dependencies.rake index bbd8774304d..c3c11e494f5 100644 --- a/tasks/update-aws-sdk-dependencies.rake +++ b/tasks/update-aws-sdk-dependencies.rake @@ -19,13 +19,11 @@ task 'update-aws-sdk-dependencies' do ) # update the module autoloads - # Remove service gems bundled in core (eg, sts) that have gem_name of aws-sdk-core. - autoload_services = BuildTools::Services.select { |svc| svc.gem_name != 'aws-sdk-core' } BuildTools.replace_lines( filename: "#{$GEMS_DIR}/aws-sdk-resources/lib/aws-sdk-resources.rb", start: /# service gems/, stop: /# end service gems/, - new_lines: autoload_services.map { |service| + new_lines: BuildTools::Services.map { |service| " autoload :#{service.name}, '#{service.gem_name}'\n" } )