question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass app id, name and version to build command.

See original GitHub issue

Feature Request

Motivation Behind Feature

For a monorepo with single dependencies, a single config.xml I have to change the xml before build. It would be better if there is an option to pass these parameters to the build or run command. To set the app id, name and version. Without changing the config.xml. All other settings (incl. plugins) are shared for all apps.

Feature Description

cordova build android --release --app-id="com.foo.bar" --app-name="Foo Bar" --app-version="1.2.3"
cordova run android --app-id="com.test.me" --app-name="Test App" --app-version="0.0.0"
Parameter Description
app-id The app id like in config.xml widget.$.id.
app-version The app version like in config.xml widget.$.version.
app-name The app name like in config.xml widget.name.

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.foo.bar" version="1.2.3"
  xmlns="http://www.w3.org/ns/widgets"
  xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name>Foo Bar</name>
  <!-- etc -->
</widget>

Alternatives or Workarounds

I have to update the config.xml with a xml parser. It’s a custom implementation. I also don’t want this git changes.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dpoguecommented, Aug 27, 2020

This is unlikely to be implemented at the Cordova level, because things like changing the app ID in between commands will break the native projects.

If you’re wanting to generate multiple native projects with different settings from a single repo, I have written a tool (seymour) that will create and build projects with settings coming in from environment variables, which might be similar to what you’re looking for.

0reactions
dpoguecommented, Sep 17, 2020

All the config.xml parsing happens with cordova-common’s ConfigParser: https://github.com/apache/cordova-common/blob/master/src/ConfigParser/ConfigParser.js

Note that this sometimes gets extended/patched in the various platforms to add platform-specific methods to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building from the Command Line with Xcode FAQ
What version of Xcode do the command-line tools currently use? ... Log in with your Apple ID, then search and download the Command...
Read more >
Using ldflags to Set Version Information for Go Applications
To use this command, first build the binary for app : go build. Now that app is built, point the nm tool at...
Read more >
How can you get the build/version number of your Android ...
Set the version name to a TextView TextView tvVersionName = (TextView) findViewById(R.id.tv_versionName); tvVersionName.setText(myVersionName);.
Read more >
Run (build) number - Azure Pipelines | Microsoft Learn
Pipeline name: CIBuild. Branch: master. Build ID/Run ID: 752. Date: May 5, 2019. Time ...
Read more >
Automatic build versioning - Codemagic Docs
There are several approaches you can use for build versioning on Codemagic. One of the easiest ways to increment the application version on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found