-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass app id, name and version to build command. #528
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. |
Thanks. I'll check out Seymour. If I understand it correctly, I just have to set some temp env variables for that metadata and call the regular build command. Sounds interesting. I'll test it. |
@dpogue The build works but it seems that the env vars does not work. e.g. my apk has the wrong version. And I set release-build, but it's still debug. etc. Do you have some examples? |
@infacto I wrote seymour specifically for us to manage builds on a Jenkins CI environment, where we wanted to have different names/IDs for stages like QA, Beta, and Production. We set the environment variables as part of our Jenkins build script. However, if you're trying to make a build locally on the command-line, this should work: SEY_APP_NAME=MyApp SEY_APP_VERSION=1.1.2 SEY_BUILD_TYPE=release npx seymour If you want to set them once, and then run multiple builds, you should be able to define them in bash ahead of time: export SEY_APP_NAME=MyApp
export SEY_APP_VERSION=1.1.2
export SEY_BUILD_TYPE=release
npx seymour Note: Seymour's unit tests pass on Windows, but I've never actually run it there myself, so I'm not sure exactly how to configure the environment variables there. My examples should work on both Linux and macOS in bash-like shells. |
It does not work for me (Windows, Linux not tested.) Anyway, I use my config.xml xml parser overwrite solution now. |
This isn't a solution but in my projects I use a python script to read a template xml file, which writes/replaces the One problem with this method is the ios platform uses a lot of the app names in the xcode project file structure, so the ios platform doesn't like it when the project name changes. I'm not certain exactly what this entails, but I would be surprised if it only includes file renaming. I'm sure there are files that contains path references that would have to be modified as well. |
I use NodeJS with a xml to json parser and a json file per app with the required informations (id, name, version). Replaces the Anyway ... In my opinion, passing parameters to the build command would be the best solution. Or a separate temporary file used by the Cordova build that overwrites the config.xml parameters if present. 🤔 Maybe an optional property in the Btw. to your iOS naming issue: The |
Ok seymour works now for me. Because I call it directly in a NodeJS script, instead of using env vars and call via CLI. build.js const seymour = require('seymour');
seymour([], {
SEY_APP_NAME: 'MyApp',
SEY_APP_ID: 'com.my.app',
SEY_APP_VERSION: '1.2.3',
SEY_BUILD_TYPE: 'release'
}); Call: Again the current workaround is to change the |
@dpogue I'm sorry to bother you. But I think you are more experienced in Cordova than I am. Just a short question: Which Cordova component is picking up the |
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. |
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
config.xml
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.
The text was updated successfully, but these errors were encountered: