diff --git a/.github/actions/slack/action.yml b/.github/actions/slack/action.yml index 4a398da1d1dab3..6f89bef11ae061 100644 --- a/.github/actions/slack/action.yml +++ b/.github/actions/slack/action.yml @@ -35,7 +35,7 @@ runs: using: composite steps: - - uses: ruby/action-slack@54175162371f1f7c8eb94d7c8644ee2479fcd375 # v3.2.2 + - uses: ruby/action-slack@d260b61aa817726d5bedd22dd6cc305787fa4cdd # v4.0.0 with: payload: | { diff --git a/.github/workflows/annocheck.yml b/.github/workflows/annocheck.yml index c8b922d1978849..f2454ca9788455 100644 --- a/.github/workflows/annocheck.yml +++ b/.github/workflows/annocheck.yml @@ -73,7 +73,7 @@ jobs: builddir: build makeup: true - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none diff --git a/.github/workflows/auto_review_pr.yml b/.github/workflows/auto_review_pr.yml index 83338337ef65a2..90323e620addc9 100644 --- a/.github/workflows/auto_review_pr.yml +++ b/.github/workflows/auto_review_pr.yml @@ -29,7 +29,7 @@ jobs: with: persist-credentials: false - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.4' bundler: none diff --git a/.github/workflows/baseruby.yml b/.github/workflows/baseruby.yml index bac0a298b70a2c..7f5a090a19a451 100644 --- a/.github/workflows/baseruby.yml +++ b/.github/workflows/baseruby.yml @@ -48,7 +48,7 @@ jobs: - ruby-3.3 steps: - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: ${{ matrix.ruby }} bundler: none diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml index 67113f422a7578..5a7b30fc3d8983 100644 --- a/.github/workflows/bundled_gems.yml +++ b/.github/workflows/bundled_gems.yml @@ -38,7 +38,7 @@ jobs: with: token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: 4.0 diff --git a/.github/workflows/check_dependencies.yml b/.github/workflows/check_dependencies.yml index 7fec25c2a362a4..455c3c6b67df77 100644 --- a/.github/workflows/check_dependencies.yml +++ b/.github/workflows/check_dependencies.yml @@ -42,7 +42,7 @@ jobs: - uses: ./.github/actions/setup/directories - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml index 518e461ab46b14..71bccdb5c9e2ad 100644 --- a/.github/workflows/check_misc.yml +++ b/.github/workflows/check_misc.yml @@ -23,7 +23,7 @@ jobs: token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }} persist-credentials: false - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: head diff --git a/.github/workflows/check_sast.yml b/.github/workflows/check_sast.yml index 136fbc7619d88b..c80d4a57fae6cb 100644 --- a/.github/workflows/check_sast.yml +++ b/.github/workflows/check_sast.yml @@ -78,14 +78,14 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 with: languages: ${{ matrix.language }} build-mode: none config-file: .github/codeql/codeql-config.yml - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 with: category: '/language:${{ matrix.language }}' upload: False @@ -126,7 +126,7 @@ jobs: continue-on-error: true - name: Upload SARIF - uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 with: sarif_file: sarif-results/${{ matrix.language }}.sarif continue-on-error: true diff --git a/.github/workflows/modgc.yml b/.github/workflows/modgc.yml index 319841b51e8e2d..8eea71764b851c 100644 --- a/.github/workflows/modgc.yml +++ b/.github/workflows/modgc.yml @@ -62,7 +62,7 @@ jobs: uses: ./.github/actions/setup/ubuntu if: ${{ contains(matrix.os, 'ubuntu') }} - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none @@ -105,7 +105,7 @@ jobs: ${SETARCH} ../src/configure -C --disable-install-doc --with-modular-gc="${MODULAR_GC_DIR}" \ ${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE} - - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0 + - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1 - name: Set MMTk environment variables run: | echo 'EXCLUDES=../src/test/.excludes-mmtk' >> $GITHUB_ENV diff --git a/.github/workflows/parse_y.yml b/.github/workflows/parse_y.yml index 3ba87c684daa26..4fca3706a590cd 100644 --- a/.github/workflows/parse_y.yml +++ b/.github/workflows/parse_y.yml @@ -59,7 +59,7 @@ jobs: - uses: ./.github/actions/setup/ubuntu - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1b3df3a6eabd3e..6f9332b1def804 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,7 @@ jobs: with: persist-credentials: false - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: 3.3.4 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index a74c4787159c03..4160ee07f8f484 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -73,6 +73,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4 with: sarif_file: results.sarif diff --git a/.github/workflows/spec_guards.yml b/.github/workflows/spec_guards.yml index 3836ae30aa3557..ce4a055fac5370 100644 --- a/.github/workflows/spec_guards.yml +++ b/.github/workflows/spec_guards.yml @@ -49,7 +49,7 @@ jobs: with: persist-credentials: false - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: ${{ matrix.ruby }} bundler: none diff --git a/.github/workflows/sync_default_gems.yml b/.github/workflows/sync_default_gems.yml index f867919348a0e1..d06b52e22e2729 100644 --- a/.github/workflows/sync_default_gems.yml +++ b/.github/workflows/sync_default_gems.yml @@ -39,7 +39,7 @@ jobs: with: token: ${{ github.repository == 'ruby/ruby' && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }} - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.4' bundler: none diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index cff80e47c7ef28..4995680930029b 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -70,7 +70,7 @@ jobs: with: arch: ${{ matrix.arch }} - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 61f7df0c179a7b..0d1fb61cc376dc 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -65,6 +65,11 @@ jobs: sparse-checkout: /.github persist-credentials: false + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 + with: + ruby-version: '3.1' + bundler: none + - uses: ./.github/actions/setup/directories with: srcdir: src @@ -99,16 +104,14 @@ jobs: run: | echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 - with: - ruby-version: '3.1' - bundler: none - - name: Build baseruby + id: baseruby run: | set -ex mkdir ../baseruby pushd ../baseruby + echo "ruby=$PWD/install/bin/ruby" >> $GITHUB_OUTPUT + echo "dump_ast=$PWD/dump_ast" >> $GITHUB_OUTPUT ../src/configure --prefix=$PWD/install make make install @@ -120,20 +123,38 @@ jobs: working-directory: src - name: Run configure - run: | - ../src/configure \ - --host wasm32-unknown-wasi \ - --with-baseruby=$PWD/../baseruby/install/bin/ruby \ - --with-dump-ast=$PWD/../baseruby/dump_ast \ - --with-static-linked-ext \ - --with-ext=cgi/escape,continuation,coverage,date,digest/bubblebabble,digest,digest/md5,digest/rmd160,digest/sha1,digest/sha2,etc,fcntl,json,json/generator,json/parser,objspace,pathname,rbconfig/sizeof,ripper,stringio,strscan,monitor \ - LDFLAGS=" \ - -Xlinker --stack-first \ - -Xlinker -z -Xlinker stack-size=16777216 \ - " \ - optflags="${{ matrix.entry.optflags }}" \ - debugflags="${{ matrix.entry.debugflags }}" \ - wasmoptflags="${{ matrix.entry.wasmoptflags }} ${{ matrix.entry.debugflags }}" + run: >- + ../src/configure + --host wasm32-unknown-wasi + --with-baseruby="${{ steps.baseruby.outputs.ruby }}" + --with-dump-ast="${{ steps.baseruby.outputs.dump_ast }}" + --with-static-linked-ext + --with-ext=${EXTS// /,} + LDFLAGS=" + -Xlinker --stack-first + -Xlinker -z -Xlinker stack-size=16777216 + " + optflags="${{ matrix.entry.optflags }}" + debugflags="${{ matrix.entry.debugflags }}" + wasmoptflags="${{ matrix.entry.wasmoptflags }} ${{ matrix.entry.debugflags }}" + env: + EXTS: + cgi/escape + continuation + coverage + date + digest + digest/* + erb/escape + etc + fcntl + json + json/* + objspace + rbconfig/sizeof + ripper + stringio + strscan # miniruby may not be built when cross-compling - run: make mini ruby diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index caf38bb2bff406..d2c8feac988e7c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -26,17 +26,16 @@ jobs: matrix: include: - os: 2022 - vc: 2022 test_task: check - - os: 2025 - vc: 2022 + - os: 2022 + test_task: test-bundled-gems + - os: 2025-vs2026 test_task: check + - os: 2025-vs2026 + test_task: test-bundled-gems - os: 11-arm test_task: 'btest test-basic test-tool' # check and test-spec are broken yet. target: arm64 - - os: 2025 - vc: 2022 - test_task: test-bundled-gems fail-fast: false runs-on: windows-${{ matrix.os }} @@ -49,7 +48,7 @@ jobs: || (github.event.pull_request.user.login == 'dependabot[bot]' && !startsWith(github.head_ref, 'dependabot/vcpkg')) )}} - name: Windows ${{ matrix.os }}/Visual C++ ${{ matrix.vc }} (${{ matrix.test_task }}) + name: Windows ${{ matrix.os }} (${{ matrix.test_task }}) env: GITPULLOPTIONS: --no-tags origin ${{ github.ref }} @@ -59,7 +58,7 @@ jobs: - run: md build working-directory: - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: # windows-11-arm has only 3.4.1, 3.4.2, 3.4.3, head ruby-version: ${{ !endsWith(matrix.os, 'arm') && '3.1' || '3.4' }} @@ -113,8 +112,6 @@ jobs: # %TEMP% is inconsistent with %TMP% and test-all expects they are consistent. # https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302 run: | - ::- Set up VC ${{ matrix.vc }} - ::- Using sort.exe located in the same directory as comm.exe ::- should probably work just fine. for %%I in (comm.exe) do set "sort=%%~dp$PATH:I\sort.exe" @@ -188,14 +185,14 @@ jobs: - uses: ./.github/actions/slack with: - label: Windows ${{ matrix.os }} / VC ${{ matrix.vc }} / ${{ matrix.test_task || 'check' }} + label: Windows ${{ matrix.os }} / ${{ matrix.test_task || 'check' }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} result: if: ${{ always() }} name: ${{ github.workflow }} result - runs-on: windows-latest + runs-on: windows-2025-vs2026 needs: [make] steps: - run: exit 1 diff --git a/.github/workflows/wsl.yml b/.github/workflows/wsl.yml index 189f978e299d3e..470b68fe663b9c 100644 --- a/.github/workflows/wsl.yml +++ b/.github/workflows/wsl.yml @@ -19,7 +19,7 @@ permissions: jobs: wsl: - runs-on: windows-2025 + runs-on: windows-2025-vs2026 if: >- ${{!(false diff --git a/.github/workflows/yjit-ubuntu.yml b/.github/workflows/yjit-ubuntu.yml index 5b320b3fa9bb94..cbb002f42e9193 100644 --- a/.github/workflows/yjit-ubuntu.yml +++ b/.github/workflows/yjit-ubuntu.yml @@ -133,7 +133,7 @@ jobs: - uses: ./.github/actions/setup/ubuntu - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none diff --git a/.github/workflows/zjit-macos.yml b/.github/workflows/zjit-macos.yml index 1e57379e678fc0..18b6e9b38f8ca2 100644 --- a/.github/workflows/zjit-macos.yml +++ b/.github/workflows/zjit-macos.yml @@ -93,7 +93,7 @@ jobs: rustup install ${{ matrix.rust_version }} --profile minimal rustup default ${{ matrix.rust_version }} - - uses: taiki-e/install-action@cca35edeb1d01366c2843b68fc3ca441446d73d3 # v2.77.1 + - uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 with: tool: nextest@0.9 if: ${{ matrix.test_task == 'zjit-check' }} diff --git a/.github/workflows/zjit-ubuntu.yml b/.github/workflows/zjit-ubuntu.yml index 633628f3e6ec08..5b4420d2452501 100644 --- a/.github/workflows/zjit-ubuntu.yml +++ b/.github/workflows/zjit-ubuntu.yml @@ -114,12 +114,12 @@ jobs: - uses: ./.github/actions/setup/ubuntu - - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: '3.1' bundler: none - - uses: taiki-e/install-action@cca35edeb1d01366c2843b68fc3ca441446d73d3 # v2.77.1 + - uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 with: tool: nextest@0.9 if: ${{ matrix.test_task == 'zjit-check' }} diff --git a/common.mk b/common.mk index 4407bc41fddec5..b1debdebc9730b 100644 --- a/common.mk +++ b/common.mk @@ -69,7 +69,9 @@ LIBRUBY_EXTS = ./.libruby-with-ext.time REVISION_H = ./.revision.time PLATFORM_D = $(TIMESTAMPDIR)/.$(PLATFORM_DIR).time ENC_TRANS_D = $(TIMESTAMPDIR)/.enc-trans.time -RDOC = $(XRUBY) "$(tooldir)/rdoc-srcdir" +X_$(no_baseruby:no=NO_)BASERUBY = $(BASERUBY) +X_$(yes_baseruby:yes=NO_)BASERUBY = $(XRUBY) +RDOC = $(X_BASERUBY) --enable-gems "$(tooldir)/rdoc-srcdir" RDOCOUT = $(EXTOUT)/rdoc HTMLOUT = $(EXTOUT)/html CAPIOUT = doc/capi @@ -344,7 +346,7 @@ $(EXTS_MK): ext/configure-ext.mk $(srcdir)/template/exts.mk.tmpl \ $(srcdir)/template/exts.mk.tmpl --gnumake=$(gnumake) --configure-exts=ext/configure-ext.mk ext/configure-ext.mk: $(PREP) all-incs $(MKFILES) $(RBCONFIG) $(LIBRUBY) \ - $(srcdir)/template/configure-ext.mk.tmpl + $(srcdir)/template/configure-ext.mk.tmpl update-default-gemspecs $(ECHO) generating makefiles $@ $(Q)$(MAKEDIRS) $(@D) $(Q)$(MINIRUBY) $(tooldir)/generic_erb.rb -o $@ -c \ @@ -623,11 +625,11 @@ post-install-dbg:: srcs-doc: prepare-gems RDOC_DEPENDS = main srcs-doc -rdoc: PHONY $(RDOC_DEPENDS) $(RBCONFIG) +rdoc: PHONY $(RDOC_DEPENDS) $(RBCONFIG) update-default-gemspecs @echo Generating RDoc documentation $(Q) $(RDOC) --ri --op "$(RDOCOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) . -html: PHONY $(RDOC_DEPENDS) $(RBCONFIG) +html: PHONY $(RDOC_DEPENDS) $(RBCONFIG) update-default-gemspecs @echo Generating RDoc HTML files $(Q) $(RDOC) --op "$(HTMLOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) . @@ -1485,7 +1487,7 @@ dist: up:: update-remote up$(DOT_WAIT):: - -$(Q)$(MAKE) $(mflags) Q=$(Q) REVISION_FORCE=PHONY ALWAYS_UPDATE_UNICODE= after-update + -$(Q)$(MAKE) $(mflags) Q=$(Q) REVISION_FORCE=PHONY ALWAYS_UPDATE_UNICODE= MINIRUBY=$(BASERUBY) after-update yes:: no:: @@ -1494,6 +1496,7 @@ after-update:: common-srcs after-update:: $(REVISION_H) after-update:: extract-extlibs after-update:: extract-gems +after-update:: update-default-gemspecs update-src:: $(Q) $(RM) $(REVISION_H) revision.h "$(srcdir)/$(REVISION_H)" "$(srcdir)/revision.h" @@ -1576,31 +1579,13 @@ test-bundled-gems-precheck: $(TEST_RUNNABLE)-test-bundled-gems-precheck yes-test-bundled-gems-precheck: $(PRECHECK_BUNDLED_GEMS:yes=main) no-test-bundled-gems-precheck: -update-default-gemspecs: $(TEST_RUNNABLE)-update-default-gemspecs -no-update-default-gemspecs: -yes-update-default-gemspecs: $(PRECHECK_BUNDLED_GEMS:yes=main) $(PROGRAM) +yes-update-default-gemspecs no-update-default-gemspecs: update-default-gemspecs +update-default-gemspecs: $(PREP) @$(MAKEDIRS) $(srcdir)/.bundle/specifications - @$(XRUBY) -W0 -C "$(srcdir)" -rrubygems \ - -e "destdir = ARGV.shift" \ - -e "ARGV.each do |basedir|" \ - -e "Dir.glob(basedir+'/**/*.gemspec') do |g|" \ - -e "dir, base = File.split(g)" \ - -e "spec = Dir.chdir(dir) {Gem::Specification.load(base)} ||" \ - -e "Gem::Specification.load(g)" \ - -e "unless spec" \ - -e "puts %[Ignoring #{g}]" \ - -e "next" \ - -e "end" \ - -e "spec.files.clear" \ - -e "spec.extensions.clear" \ - -e "src = spec.to_ruby" \ - -e "src.sub!(/^$$/) {" \ - -e "%[# default: #{g} #{File.mtime(g).strftime(%[%s.%N])}\n]" \ - -e "}" \ - -e "File.binwrite(File.join(destdir, spec.full_name+'.gemspec'), src)" \ - -e "end" \ - -e "end" \ - -- .bundle/specifications lib ext + $(Q)$(MINIRUBY) -W0 -C "$(srcdir)" -I tool/lib -roptparse -routput -rbundled_gem \ + -e "(out = Output.new).def_options(ARGV.options)" \ + -e "BundledGem.update_default_gemspecs(ARGV.parse!, out, quiet: $(V).zero?)" \ + -- -c -o .bundle/specifications lib ext install-for-test-bundled-gems: $(TEST_RUNNABLE)-install-for-test-bundled-gems no-install-for-test-bundled-gems: no-update-default-gemspecs diff --git a/configure.ac b/configure.ac index caf3475a38d0b9..cfa78394d40b7d 100644 --- a/configure.ac +++ b/configure.ac @@ -3538,7 +3538,7 @@ AS_IF([test x"$cross_compiling" = xyes], [ # darwin target requires miniruby for linking ext bundles PREP="$PREP"' miniruby$(EXEEXT)' ]) - RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`' + RUNRUBY_COMMAND='$(MINIRUBY) -I`$(CHDIR) $(srcdir)/lib; pwd`' RUNRUBY='$(RUNRUBY_COMMAND)' XRUBY='$(MINIRUBY)' TEST_RUNNABLE=no diff --git a/defs/gmake.mk b/defs/gmake.mk index fd1d467a46b14a..0320f9b7d553fb 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -411,6 +411,7 @@ $(srcdir)/.bundle/gems: ifneq ($(DOT_WAIT),) up:: $(DOT_WAIT) after-update +after-update:: MINIRUBY = $(BASERUBY) endif ifneq ($(filter update-bundled_gems refresh-gems,$(MAKECMDGOALS)),) diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb index 22d03112ed1e0f..ca9b40875c2fa5 100644 --- a/tool/lib/bundled_gem.rb +++ b/tool/lib/bundled_gem.rb @@ -130,4 +130,30 @@ def checkout(gemdir, repo, rev, git: $git) command = "#{git} checkout --detach #{rev}" system(command, chdir: gemdir) or raise "failed: #{command}" end + + def load_gemspec(g) + dir, base = File.split(g) + spec = Dir.chdir(dir) {Gem::Specification.load(base)} || Gem::Specification.load(g) or + return false + spec.files.clear + spec.extensions.clear + src = spec.to_ruby + src.sub!(/^$$/) { + %[# default: #{g} #{File.mtime(g).strftime(%[%s.%N])}\n] + } + return spec.full_name+'.gemspec', src + end + + def update_default_gemspecs(basedirs, out, quiet: true) + basedirs.each do |basedir| + Dir.glob(basedir+'/**/*.gemspec') do |g| + name, src = BundledGem.load_gemspec(g) + unless src + puts "Ignoring #{g}" unless quiet + next + end + out.write(src, name: name, newer: File.mtime(g), quiet: quiet) + end + end + end end diff --git a/tool/lib/output.rb b/tool/lib/output.rb index 8cb426ae4af69b..8590e0ffe21c96 100644 --- a/tool/lib/output.rb +++ b/tool/lib/output.rb @@ -31,8 +31,8 @@ def def_options(opt) @vpath.def_options(opt) end - def write(data, overwrite: @overwrite, create_only: @create_only) - unless @path + def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, newer: nil, quiet: false) + unless (name = name ? (@path ? File.join(@path, name) : name) : @path) $stdout.print data return true end @@ -41,20 +41,21 @@ def write(data, overwrite: @overwrite, create_only: @create_only) updated = color.fail("updated") outpath = nil - if (@ifchange or overwrite or create_only) and (@vpath.open(@path, "rb") {|f| + if (@ifchange or overwrite or create_only or newer) and (@vpath.open(name, "rb") {|f| outpath = f.path + next true if newer and f.mtime > newer if @ifchange or create_only original = f.read (@ifchange and original == data) or (create_only and !original.empty?) end } rescue false) - puts "#{outpath} #{unchanged}" + puts "#{outpath} #{unchanged}" unless quiet written = false else unless overwrite and outpath and (File.binwrite(outpath, data) rescue nil) - File.binwrite(outpath = @path, data) + File.binwrite(outpath = name, data) end - puts "#{outpath} #{updated}" + puts "#{outpath} #{updated}" unless quiet written = true end if timestamp = @timestamp diff --git a/tool/rdoc-srcdir b/tool/rdoc-srcdir index 67d024fc0be9b4..bc5e6c4e9e0020 100755 --- a/tool/rdoc-srcdir +++ b/tool/rdoc-srcdir @@ -1,19 +1,8 @@ #!ruby -W0 -srcdir = File.dirname(__dir__) -bundled_gems = File.join(srcdir, "gems/bundled_gems") -versions = {} -File.foreach(bundled_gems) do |line| - next if line.start_with?("#") || line.strip.empty? - name, version, = line.split - versions[name] = version -end - -%w[tsort rdoc].each do |lib| - path = File.join(srcdir, ".bundle/gems/#{lib}-#{versions[lib]}") - $LOAD_PATH.unshift("#{path}/lib") -end +require 'rubygems' require 'rdoc/rdoc' +require 'rbs' # Make only the output directory relative to the invoked directory. invoked = Dir.pwd diff --git a/vcpkg.json b/vcpkg.json index 2652e626e55a83..64d73c40481ccc 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,5 +7,5 @@ "openssl", "zlib" ], - "builtin-baseline": "c3867e714dd3a51c272826eea77267876517ed99" + "builtin-baseline": "56bb2411609227288b70117ead2c47585ba07713" } \ No newline at end of file