Skip to content

Why is PascalCase the Default for the Android applicationId's App Name Segment in Dioxus CLI? #4098

Closed
@fontlos

Description

@fontlos
Contributor

Hello Dioxus Team,

The Dioxus CLI appears to default to using a PascalCase version of the app name for the final segment of the Android applicationId.

The application_id for Android templates is derived from self.full_mobile_app_name():

Code: request.rs#L2270-L2280

let hbs_data = AndroidHandlebarsObjects {
    application_id: self.full_mobile_app_name(),
    app_name: self.bundled_app_name(),
    // ...
};

full_mobile_app_name() incorporates self.bundled_app_name(), which explicitly converts the executable_name to PascalCase:

Code: request.rs#L2745-L2748

pub(crate) fn bundled_app_name(&self) -> String {
    use convert_case::{Case, Casing};
    self.executable_name().to_case(Case::Pascal)
}
pub(crate) fn full_mobile_app_name(&self) -> String {
    format!("{}.{}", self.mobile_org(), self.bundled_app_name())
}

This leads to a default applicationId structure like com.example.MyAppName.

This contrasts with Google's Kotlin style guide, which recommends all lowercase for package names.

From the guide

// Okay
package com.example.deepspace
// WRONG!
package com.example.deepSpace
// WRONG!
package com.example.deep_space

Could you please provide insight into the design decision for this PascalCase default? Specifically, why is full_mobile_app_name() used for the application_id in the Android template data instead of directly using bundle_identifier(), which would seem to more directly reflect the intended final identifier (including honoring a user-defined bundle.identifier in full)?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @fontlos

      Issue actions

        Why is PascalCase the Default for the Android applicationId's App Name Segment in Dioxus CLI? · Issue #4098 · DioxusLabs/dioxus