Skip to content

C2: export KOTLIN_BANNER and merged_file_path - #13

Merged
milyin merged 1 commit into
docs/validation-umbrellafrom
step/c2-export-stranded
Aug 6, 2026
Merged

C2: export KOTLIN_BANNER and merged_file_path#13
milyin merged 1 commit into
docs/validation-umbrellafrom
step/c2-export-stranded

Conversation

@milyin

@milyin milyin commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Step C2 of #6. Stacked on #12. Small one.

Both items were marked pub but sit in private modules and were never
re-exported — reachable from inside the crate and from nowhere else. An audit of
every pub fn / pub const / pub struct / pub enum across all seven modules
confirms these are the only two.

They are worth having rather than demoting:

  • KOTLIN_BANNER is what KtFile::banner falls back to. A consumer that
    wants to prepend its own header, or check whether a file on disk is one of
    ours, has nothing to compare against without it.
  • merged_file_path is how write_files decides its layout
    (io.zenoh.jni.bytesio/zenoh/jni/bytes.kt). Predicting those paths
    without writing anything — to report them, or post-process them — is a
    reasonable thing to want.

Doc comments expanded for both, since they are now API rather than internals.

The new test is deliberately written against the public paths
(kotlin_codegen::KOTLIN_BANNER, kotlin_codegen::merged_file_path) rather
than the module-internal ones, so it stops compiling if either is un-exported
again.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Exposes two previously-internal but pub items (KOTLIN_BANNER and merged_file_path) at the crate root so downstream consumers can reference the default banner and predict output paths without writing files.

Changes:

  • Re-export file::merged_file_path and render::KOTLIN_BANNER from src/lib.rs.
  • Expand public-facing doc comments for KOTLIN_BANNER and merged_file_path.
  • Update tests to use the public crate-root paths and add a compile-guard test ensuring both remain exported.

Reviewed changes

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

File Description
src/lib.rs Re-exports merged_file_path and KOTLIN_BANNER from the crate root.
src/file.rs Expands docs for merged_file_path now that it’s part of the public API.
src/render.rs Expands docs for KOTLIN_BANNER now that it’s part of the public API.
src/tests.rs Updates path helper calls to the public export and adds a test to prevent accidental un-exporting.

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

Comment thread src/render.rs
Comment on lines +16 to +18
/// [`KtFile::banner`] overrides it per file, and `""` suppresses it entirely;
/// this constant is what an override falls back to, and what a consumer
/// prepending its own header should match against.
Both were marked `pub` but sit in private modules and were never
re-exported, so they were reachable from inside the crate and from
nowhere else. An audit of every `pub` item confirms these are the only
two.

They are worth having: KOTLIN_BANNER is what `KtFile::banner` falls back
to, so a consumer prepending its own header has nothing to match against
without it; merged_file_path is how write_files lays out its output, and
predicting those paths without writing anything is a reasonable thing to
want.

The new test is written against the public paths, so it stops compiling
if either is un-exported again.
@milyin
milyin force-pushed the step/c2-export-stranded branch from 069bd24 to 3c1dfab Compare August 6, 2026 11:40
@milyin
milyin force-pushed the step/c1-ident-utilities branch from a84bed6 to 00a7282 Compare August 6, 2026 11:40
@milyin
milyin changed the base branch from step/c1-ident-utilities to docs/validation-umbrella August 6, 2026 11:41
@milyin
milyin merged commit 4d6a174 into docs/validation-umbrella Aug 6, 2026
0 of 4 checks passed
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.

2 participants