Skip to content

Commit

Permalink
Switch oss-check to use SwiftPM again
Browse files Browse the repository at this point in the history
There might be some performance penalties when building with Bazel.
  • Loading branch information
jpsim committed Sep 27, 2022
1 parent b89dc15 commit 2c48ba5
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions tools/oss-check
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def generate_reports(branch)
print "Linting #{iterations} iterations of #{repo} with #{branch}: 1"
durations = []
start = Time.now
command = "../builds/swiftlint-#{branch} lint --no-cache #{'--enable-all-rules' unless @only_rules_changed} --reporter xcode"
command = "../builds/.build/release/swiftlint lint --no-cache #{'--enable-all-rules' unless @only_rules_changed} --reporter xcode"
File.open("../#{branch}_reports/#{repo}.txt", 'w') do |file|
puts "\n#{command}" if @options[:verbose]
Open3.popen2(command) do |_, stdout, wait_thr|
Expand Down Expand Up @@ -208,7 +208,11 @@ def build(branch)
perform("git worktree add --detach #{dir} #{target}")
end

build_command = "cd #{dir}; bazel build -c opt @SwiftLint//:swiftlint && mv bazel-bin/swiftlint swiftlint-#{branch}"
Dir.chdir(dir) do
FileUtils.rm_rf %w[Packages .build]
end

build_command = "cd #{dir}; swift build -c release"

perform(build_command)
return if $?.success?
Expand Down Expand Up @@ -311,26 +315,12 @@ validate_state_to_run
fetch_origin
set_globals
print_rules_changed
setup_repos
make_directory_structure

# Build & generate reports for branch & main
%w[branch main].each do |branch|
build(branch)
end

full_version_branch = `#{@working_dir}/builds/swiftlint-branch version --verbose`
full_version_main = `#{@working_dir}/builds/swiftlint-main version --verbose`

if full_version_branch == full_version_main
message "Skipping OSSCheck because SwiftLint hasn't changed compared to 'main'"
# Clean up
clean_up unless @options[:skip_clean]
exit
end

setup_repos

%w[branch main].each do |branch|
generate_reports(branch)
end

Expand Down

0 comments on commit 2c48ba5

Please sign in to comment.