Skip to content

Change the default behavior of all commands to debug#1153

Open
lynzrand wants to merge 5 commits intomainfrom
rynco/everything-debug
Open

Change the default behavior of all commands to debug#1153
lynzrand wants to merge 5 commits intomainfrom
rynco/everything-debug

Conversation

@lynzrand
Copy link
Contributor

Closes #1151

Summary

As said, this PR will unify the default behavior of all subcommands of moon to debug, except for moon bench and moon bundle which will remain in release mode.

This PR also changes the behavior of debug information to emit by default, irrelevant of the debug/release flag set, and only disabled upon --strip.

Metadata

  • Tests added/updated for bug fixes or new features
  • Compatible with Windows/Linux/macOS

@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 29, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/moon/tests/test_cases/moon_test/mod.rs  95% smaller
  crates/moon/tests/test_cases/packages/mod.rs  92% smaller
  crates/moon/tests/test_cases/dummy_core/mod.rs  90% smaller
  crates/moon/tests/test_cases/backend_config/mod.rs  89% smaller
  crates/moon/tests/test_cases/mod.rs  83% smaller
  crates/moon/tests/test_cases/moon_commands/mod.rs  82% smaller
  crates/moon/tests/test_cases/virtual_pkg_dep/mod.rs  77% smaller
  crates/moon/tests/test_cases/extra_flags/mod.rs  76% smaller
  crates/moon/tests/test_cases/target_backend/mod.rs  74% smaller
  crates/moon/tests/test_cases/targets/mod.rs  72% smaller
  crates/moon/tests/test_cases/warns/mod.rs  70% smaller
  crates/moonrun/tests/test.rs  32% smaller
  crates/moon/tests/test_cases/backend/mod.rs  28% smaller
  crates/moon/src/cli/info.rs  23% smaller
  crates/moon/src/cli/test.rs  6% smaller
  crates/moon/src/cli/check.rs  3% smaller
  crates/moon/src/cli.rs  0% smaller
  crates/moon/src/cli/bench.rs  0% smaller
  crates/moon/src/cli/build.rs  0% smaller
  crates/moon/src/cli/bundle.rs  0% smaller
  crates/moon/src/cli/doc.rs  0% smaller
  crates/moon/src/cli/run.rs  0% smaller
  crates/moon/tests/test_cases/cond_comp.in/moon.test Unsupported file format
  crates/moon/tests/test_cases/design/mod.rs  0% smaller
  crates/moon/tests/test_cases/moon_build_package.in/moon.test Unsupported file format
  crates/moon/tests/test_cases/moon_bundle/mod.rs  0% smaller
  crates/moon/tests/test_cases/output_format/mod.rs  0% smaller
  crates/moon/tests/test_cases/prebuild_config_script/mod.rs  0% smaller
  crates/moon/tests/test_cases/specify_source_dir_001.in/moon.test Unsupported file format
  crates/moon/tests/test_cases/test_dot_source.in/moon.test Unsupported file format
  docs/manual-zh/src/commands.md Unsupported file format
  docs/manual/src/commands.md Unsupported file format

@lynzrand lynzrand force-pushed the rynco/everything-debug branch from b1214f3 to a697b9f Compare October 29, 2025 10:04
@lynzrand lynzrand requested a review from Copilot October 29, 2025 10:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request changes the default build mode from "release" to "debug" across various commands in the MoonBit build system. The change affects the output directory structure, compiler flags, and test expectations throughout the codebase.

Key changes:

  • Default build mode changed from release to debug for most commands except bundle
  • Build artifacts now output to target/<backend>/debug/ instead of target/<backend>/release/ by default
  • Debug information (-g) and source maps are now enabled by default
  • Optimization level defaults to -O0 (no optimization) for debug builds
  • Updated documentation to reflect new flag descriptions

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/manual/src/commands.md Updated command-line flag descriptions for debug/release/strip options
docs/manual-zh/src/commands.md Chinese version of documentation updates
crates/moon/src/cli/*.rs Updated default build behavior for run, test, doc, info, bundle commands
crates/moon/tests/test_cases/**/mod.rs Updated test expectations to use debug paths instead of release paths
crates/moonrun/tests/test.rs Updated test expectations for debug build paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +29
moonc build-package ./lib/hello.mbt -o ./target/wasm-gc/debug/build/lib/lib.core -pkg hello/lib -pkg-sources hello/lib:./lib -target wasm-gc -g -O0 -source-map -g -no-builtin -workspace-path .
moonc build-package ./main/main.mbt -o ./target/wasm-gc/debug/build/main/main.core -pkg hello/main -is-main -i ./target/wasm-gc/debug/build/lib/lib.mi:lib -pkg-sources hello/main:./main -target wasm-gc -g -O0 -source-map -g -no-builtin -workspace-path .
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -g flag appears twice in the compiler command line (once from the default debug flags and once from the extra flags). While not causing errors, this duplication is redundant and could be confusing. Consider deduplicating flags in the command builder to avoid repetition.

Copilot uses AI. Check for mistakes.
@lynzrand lynzrand force-pushed the rynco/everything-debug branch from a697b9f to c1981ab Compare October 31, 2025 03:18
@lynzrand lynzrand force-pushed the rynco/everything-debug branch from c1981ab to 4d1a0f9 Compare November 4, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default all subcommands to use Debug mode

1 participant