Skip to content
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

Require build tools in tasks that require them instead of in top level Rakefile #3109

Merged
merged 3 commits into from
Sep 24, 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
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ $:.unshift("#{$GEMS_DIR}/aws-partitions/lib")
$:.unshift("#{$GEMS_DIR}/aws-eventstream/lib")
$:.unshift("#{$GEMS_DIR}/aws-sigv4/lib")

require 'build_tools'
require 'aws-sdk-code-generator'
require 'aws-sdk-core'
task 'require-build-tools' do
require 'build_tools'
end

Dir.glob("#{$REPO_ROOT}/tasks/**/*.rake").each do |task_file|
load(task_file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'aws-sdk-core'

require_relative 'aws-sdk-code-generator/api'
require_relative 'aws-sdk-code-generator/apply_docs'
require_relative 'aws-sdk-code-generator/codegenerated_plugin'
Expand Down
10 changes: 5 additions & 5 deletions tasks/build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'set'

desc 'Generates the code for every service'
task 'build' do
task 'build' => 'require-build-tools' do
BuildTools::Services.each do |service|
Rake::Task["build:aws-sdk-#{service.identifier}"].invoke
end
Expand All @@ -12,7 +12,7 @@ end
desc 'Generates the code for one service, e.g. `rake build build:aws-sdk-dynamodb`'
task 'build:aws-sdk-*'

rule /^build:aws-sdk-\w+$/ do |task|
rule /^build:aws-sdk-\w+$/ => 'require-build-tools' do |task|
identifier = task.name.split('-').last
service = BuildTools::Services[identifier]
files = AwsSdkCodeGenerator::GemBuilder.new(
Expand All @@ -27,7 +27,7 @@ end
# Aws::STS is generated directly into the `aws-sdk-core` gem.
# 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
task 'build:aws-sdk-sts' => 'require-build-tools' do
sts = BuildTools::Services.service('sts')
generator = AwsSdkCodeGenerator::CodeBuilder.new(
aws_sdk_core_lib_path: $CORE_LIB,
Expand All @@ -47,7 +47,7 @@ end
# Aws::SSO is generated directly into the `aws-sdk-core` gem.
# It is need to provide SSO Credentials.
# Only building source, but not gemspecs, version file, etc.
task 'build:aws-sdk-sso' do
task 'build:aws-sdk-sso' => 'require-build-tools' do
sso = BuildTools::Services.service('sso')
generator = AwsSdkCodeGenerator::CodeBuilder.new(
aws_sdk_core_lib_path: $CORE_LIB,
Expand All @@ -65,7 +65,7 @@ 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
task 'build:aws-sdk-ssooidc' => 'require-build-tools' do
ssooidc = BuildTools::Services.service('ssooidc')
generator = AwsSdkCodeGenerator::CodeBuilder.new(
aws_sdk_core_lib_path: $CORE_LIB,
Expand Down
2 changes: 1 addition & 1 deletion tasks/update-aws-sdk-dependencies.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# updates list of service gems dependend on by the aws-sdk gem
task 'update-aws-sdk-dependencies' do
task 'update-aws-sdk-dependencies' => 'require-build-tools' do

# update the aws-sdk-resources.gemspec
BuildTools.replace_lines(
Expand Down
1 change: 1 addition & 0 deletions tasks/update-defaults-mode.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# updates the defaults mode configuration
task 'update-defaults-mode', [:defaults_file] do |t, args|
Rake::Task['require-build-tools'].invoke

defaults_file = args[:defaults_file]
if defaults_file.nil? || defaults_file.empty?
Expand Down
2 changes: 1 addition & 1 deletion tasks/update-partition-service-list.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# updates the services in the aws-partitions gem
task 'update-partition-service-list' do
task 'update-partition-service-list' => 'require-build-tools' do
lines = []
lines << " {\n"
BuildTools::Services.sort_by(&:name).each do |svc|
Expand Down
2 changes: 1 addition & 1 deletion tasks/update-readme.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# updates the table of supported services in the repo README
task 'update-readme' do
task 'update-readme' => 'require-build-tools' do

# insert one row for each supported service
table = []
Expand Down