Skip to content

Commit

Permalink
Clone and create dummy gemspec in sequential build
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 21, 2023
1 parent 241c4cf commit 289080e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions common.mk
Expand Up @@ -1411,6 +1411,20 @@ extract-gems$(gnumake:yes=-sequential): PHONY
-e 'end' \
gems/bundled_gems

extract-gems$(gnumake:yes=-sequential): clone-bundled-gems-src

clone-bundled-gems-src: PHONY
$(Q) $(BASERUBY) -C "$(srcdir)" \
-Itool/lib -rbundled_gem -answ \
-e 'BEGIN {git = $$git}' \
-e 'gem, _, repo, rev = *$$F' \
-e 'next if !rev or /^#/=~gem' \
-e 'gemdir = "gems/src/#{gem}"' \
-e 'BundledGem.checkout(gemdir, repo, rev, git: git)' \
-e 'BundledGem.dummy_gemspec("#{gemdir}/#{gem}.gemspec")' \
-- -git="$(GIT)" \
gems/bundled_gems

outdate-bundled-gems: PHONY
$(Q) $(BASERUBY) $(tooldir)/$@.rb --make="$(MAKE)" --mflags="$(MFLAGS)" "$(srcdir)"

Expand Down
11 changes: 11 additions & 0 deletions tool/lib/bundled_gem.rb
Expand Up @@ -83,4 +83,15 @@ def dummy_gemspec(gemspec)
File.write(gemfile, spec.to_ruby)
end
end

def checkout(gemdir, repo, rev, git: $git)
return unless rev
unless File.exist?("#{gemdir}/.git")
puts "Cloning #{repo}"
system("#{git} clone #{repo} #{gemdir}") or raise
end
puts "Update #{File.basename(gemdir)} to #{rev}"
system("#{git} fetch origin #{rev}", chdir: gemdir)
system("#{git} checkout --detach #{rev}", chdir: gemdir)
end
end

0 comments on commit 289080e

Please sign in to comment.