Skip to content
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
652 changes: 362 additions & 290 deletions dev/modules/moose_support.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions jcpan
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,19 @@ fi
# Override: JPERL_TEST_TIMEOUT=0 (disable) or JPERL_TEST_TIMEOUT=600 (10 min)
export JPERL_TEST_TIMEOUT="${JPERL_TEST_TIMEOUT:-300}"

# Expose the jperl launcher AND the jcpan launcher itself so distroprefs
# (e.g. Moose.yml) can run upstream tests against the bundled shims with
# `prove --exec jperl`, and bootstrap missing helper modules with
# `jcpan SomeModule`. We also prepend SCRIPT_DIR to PATH so shell-spawned
# subprocesses (CPAN's distroprefs commandlines, prove --exec, ...) find
# `jperl` and `jcpan` cross-platform without needing $JPERL_BIN tokens
# that don't expand in Windows cmd.exe.
export JPERL_BIN="$SCRIPT_DIR/jperl"
export JCPAN_BIN="${BASH_SOURCE[0]}"
case "$JCPAN_BIN" in
/*) ;; # already absolute
*) JCPAN_BIN="$SCRIPT_DIR/jcpan" ;;
esac
export PATH="$SCRIPT_DIR:$PATH"

exec "$SCRIPT_DIR/jperl" "$CPAN_SCRIPT" "${ARGS[@]}"
7 changes: 7 additions & 0 deletions jcpan.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ goto parse_args
:run
rem Set default per-test timeout (300s) to kill hanging tests
if not defined JPERL_TEST_TIMEOUT set "JPERL_TEST_TIMEOUT=300"
rem Expose jperl and jcpan launchers, and prepend SCRIPT_DIR to PATH so
rem shell-spawned subprocesses (distroprefs commandlines, prove --exec,
rem etc.) can find jperl/jcpan without tokens that don't expand in
rem POSIX sh. See src/main/perl/lib/CPAN/Config.pm (Moose.yml).
set "JPERL_BIN=%SCRIPT_DIR%jperl.bat"
set "JCPAN_BIN=%SCRIPT_DIR%jcpan.bat"
set "PATH=%SCRIPT_DIR%;%PATH%"
"%SCRIPT_DIR%jperl.bat" "%SCRIPT_DIR%src\main\perl\bin\cpan" %JCPAN_ARGS%
4 changes: 2 additions & 2 deletions src/main/java/org/perlonjava/core/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class Configuration {
* Automatically populated by Gradle/Maven during build.
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String gitCommitId = "472d4e2da";
public static final String gitCommitId = "df9a9f3f9";

/**
* Git commit date of the build (ISO format: YYYY-MM-DD).
Expand All @@ -48,7 +48,7 @@ public final class Configuration {
* Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at"
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String buildTimestamp = "Apr 26 2026 17:43:24";
public static final String buildTimestamp = "Apr 26 2026 20:39:38";

// Prevent instantiation
private Configuration() {
Expand Down
53 changes: 53 additions & 0 deletions src/main/perl/lib/CPAN/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,59 @@ pl:
- "--pp"
env:
PARAMS_VALIDATE_IMPLEMENTATION: PP
YAML
'Moose.yml' => <<'YAML',
---
comment: |
PerlOnJava distroprefs for Moose.

Modern Moose ships 13 .xs files plus mop.c. PerlOnJava cannot compile
XS, so a normal install/test cycle fails at Makefile.PL with
"This distribution requires a working compiler".

PerlOnJava bundles a pure-Perl Moose-as-Moo shim at
src/main/perl/lib/Moose.pm (loaded from the jar via PERL5LIB), so we
don't need to build or install the upstream distribution at all. We
just need to run its tests against the shim. This distropref:

- Skips Makefile.PL (would die on the compiler check).
- Skips make (nothing to build).
- Runs the upstream t/ tree with jperl directly via prove --exec,
so the bundled shim from the jar wins over the unpacked
lib/Moose.pm.
- Skips install (the shim is already on @INC via the jar).

Required: jcpan / jcpan.bat exports JPERL_BIN pointing at the right
jperl launcher. See bin/jcpan.

Expected result on `jcpan -t Moose`: most upstream tests fail to load
because they require Class::MOP, Moose::Meta::Class, etc. that the
shim doesn't provide. The shim-supported subset (basic attributes,
roles, BUILD/BUILDARGS, immutable round-trips, method modifiers,
cookbook recipes) does pass. See dev/modules/moose_support.md for
the baseline numbers and the plan for improving them.
match:
distribution: "^ETHER/Moose-"
disabled: 0
# Cross-platform commandlines: each phase invokes `jperl` (which is on
# PATH thanks to jcpan/jcpan.bat prepending SCRIPT_DIR) with -M to load
# a small Perl helper. We avoid POSIX-only shell constructs (||, ;,
# `touch`, /dev/null, $VAR) because CPAN.pm's commandline runs through
# Perl's system(), which on Windows hands off to cmd.exe.
#
# We also avoid CPAN's `depends:` block: it would force CPAN to resolve
# Moose's full upstream prereq tree (Package::Stash::XS,
# MooseX::NonMoose, ...), most of which is XS and unsatisfiable on
# PerlOnJava. The pl-phase helper installs only the one thing the
# Moose-as-Moo shim genuinely needs: Moo itself.
pl:
commandline: 'jperl -MPerlOnJava::Distroprefs::Moose -e "PerlOnJava::Distroprefs::Moose::bootstrap_pl_phase()"'
make:
commandline: 'jperl -MPerlOnJava::Distroprefs::Moose -e "PerlOnJava::Distroprefs::Moose::noop()"'
test:
commandline: 'prove --exec jperl -r t/'
install:
commandline: 'jperl -MPerlOnJava::Distroprefs::Moose -e "PerlOnJava::Distroprefs::Moose::noop()"'
YAML
);

Expand Down
Loading
Loading