Pass app id, name and version to build command.
See original GitHub issueFeature 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:
- Created 3 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.