Skip to content

Commit

Permalink
chore(*): add xcodebuild_log_path option
Browse files Browse the repository at this point in the history
  • Loading branch information
trinhngocthuyen committed Mar 9, 2021
1 parent 334bc55 commit cb0e7d7
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ build/
.bundle/

.stats/
.logs/
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## master (to be 0.1.14)
### Enhancements
NA
- Add `xcodebuild_log_path` option.

### Bug fixes
NA
Expand Down
6 changes: 5 additions & 1 deletion docs/configure_cocoapods_binary_cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@ config_cocoapods_binary_cache(

### `silent_build`
- Default: `false`.
- Suppress build output
- Suppress build output.

### `xcodebuild_log_path`
- Default: `nil`.
- The `xcodebuild` log when prebuilding frameworks.
1 change: 1 addition & 0 deletions integration_tests/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ config_cocoapods_binary_cache(
dev_pods_enabled: true,
save_cache_validation_to: ".stats/cocoapods_binary_cache.json",
strict_diagnosis: true, # Fail if any abnormal integration is spotted
xcodebuild_log_path: ".logs/xcodebuild",
xcframework: ENV["USE_XCFRAMEWORK"] == "true"
)

Expand Down
1 change: 1 addition & 0 deletions lib/cocoapods-binary-cache/pod-binary/prebuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def prebuild_frameworks!
bitcode_enabled: PodPrebuild.config.bitcode_enabled?,
device_build_enabled: PodPrebuild.config.device_build_enabled?,
disable_dsym: PodPrebuild.config.disable_dsym?,
log_path: PodPrebuild.config.xcodebuild_log_path,
args: PodPrebuild.config.build_args
)
PodPrebuild.remove_build_dir(sandbox_path)
Expand Down
5 changes: 5 additions & 0 deletions lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def build_for_sdk(sdk)
configuration: configuration,
sdk: sdk,
deployment_target: targets.map { |t| t.platform.deployment_target }.max.to_s,
log_path: log_path(sdk),
args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
)
end
Expand Down Expand Up @@ -252,5 +253,9 @@ def simulator
def disable_dsym?
@options[:disable_dsym]
end

def log_path(sdk)
@options[:log_path].nil? ? nil : "#{@options[:log_path]}_#{sdk}"
end
end
end
8 changes: 7 additions & 1 deletion lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ def self.xcodebuild(options)
end
cmd += options[:args] if options[:args]
cmd << "build"
cmd << "2>&1"

if options[:log_path].nil?
cmd << "2>&1"
else
FileUtils.mkdir_p(File.dirname(options[:log_path]))
cmd << "> #{options[:log_path].shellescape}"
end
cmd = cmd.join(" ")

Pod::UI.puts_indented "$ #{cmd}" unless PodPrebuild.config.silent_build?
Expand Down
5 changes: 5 additions & 0 deletions lib/command/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def dont_remove_source_code?
@dsl_config[:dont_remove_source_code]
end

def xcodebuild_log_path
@dsl_config[:xcodebuild_log_path]
end

def build_args
@dsl_config[:build_args]
end
Expand Down Expand Up @@ -178,6 +182,7 @@ def applicable_dsl_config
:xcframework,
:disable_dsym,
:dont_remove_source_code,
:xcodebuild_log_path,
:build_args,
:save_cache_validation_to,
:validate_prebuilt_settings,
Expand Down

0 comments on commit cb0e7d7

Please sign in to comment.