-
-
Notifications
You must be signed in to change notification settings - Fork 197
Change versionCode/versionName when running with --release #1118
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
Comments
Just as an fyi, I’ve also suggested that the Android version code be configured in an app’s |
Sound idea! And let my proposed prompt update the package.json (which is then used to generate the plist/xml) |
I keep running into this as well, very much need a version to be merged with the build |
We are planning to allow Also we think to provide two additional options Does this sound sufficient? |
I would like to see the value populated in |
Sounds like a good start! Yes the numbers should be bumped and persisted in And yes, the same for |
I like the Therefore we may want to consider moving app id out of the
I’ll just note that I personally don’t have a need for this workflow. I just want to change the version numbers in my |
I dont suppose in the package.json we could do like
Or if not seperated, they both use the same version number?
I personally would not like\find the need to manually set the version on a build with a parameter... sure it saves me time opening xcode to change it, but fundamentally it's the same thing. |
@tjvantoll: I wanted these for automation because I dislike @sitefinitysteve: We can. We do so for CFBundleIdentifier already. But I am not sure what's the best approach here. For JS devs setting these in package.json would be somewhat more convenient but then we will end with two different places where you can set them. Also it may frustrate native native developers moving to {N}. P. S. The build numbers for iOS and Android diverge extremely fast. |
@PanayotCankov Ah gotcha, that makes a lot of sense. No one likes @sitefinitysteve I would argue that it’s not the same because you don’t have to go into Xcode at all. You just need to open up a pre-provided file and increment a value. I personally think we do ourselves a disservice if we try to abstract away iOS and Android too much. Developers are going to do Google searches and find existing iOS/Android guides and advice, and we stand to benefit from that. We can easily allow version to be configured in your |
I have been convinced!... So why bother with the one in package.json at all then i suppose. |
We are planning on providing a |
Revisiting this... Since NativeScript is really created for the JS dev (versus the "native developers"), I think it feels more intuitive to control these basic app configuration values in the Steve's proposal for version numbers in If we want to reduce confusion, we could change the default value in If someone REMOVES this variable from the native config files, then they can set the values directly and Thoughts? |
I've implemented this for my own project https://github.com/jacargentina/nativescript-dev-version |
@jacargentina thanks for the solution. In general it looks there is a need to pass extra params to build command. |
@dtopuzov It's not clear to me how #2528 directly relates to the issue discussed in this thread. Based on my reading of #2528, there is a need for a solution to pass additional/arbitrary parameters with CLI commands to support development workflows that need to alter start-up configurations in different environments (like 'test', 'demo', 'staging', etc). This thread was more about 1) the ability auto-change version/build numbers when you run a CLI command, and 2) defining app version numbers in the package.json file instead of the separate iOS/Android config files. Do you see the solutions being discussed in #2528 as addressing the challenges raised in this thread? |
Hi @toddanglin Changing build version, changing environment, changing some config, all those look to be cases when you need something custom and may be custom flags are the solution for this problem. Reopen, since changing build version is common case and may be you are right that we should provide such mechanism out of the box (not via custom flags). |
I would like to see the standard package.json Specifically, being able to use the standard |
I still like @sitefinitysteve's proposal for adding flexibility to separately version iOS and Android builds (as you may evolve them slightly differently, even within the same shared code/app). To recap his proposal, in
If you need do need to separately version iOS and Android (say you publish a major update for an app for iOS before Android updates are ready), you should be able to provide version numbers for each platform:
In both cases, the values in |
Any updates here? |
I have noticed that this functionality is incorporated into sidekick. You can update a single version and it updates both ios/android. However, I would like this functionality to be available by a script to incorporate into various CI/CD cycles. |
Any updates here? |
When this feature will be released? |
I have a little after-prepare hook that updates the Basically, my I put this in const fs = require('fs')
const shell = require('shelljs')
module.exports = function($logger, $projectData) {
const platformsDir = $projectData.platformsDir
const projectName = $projectData.projectName
const version = $projectData.packageJsonData.version
const [ major, minor, patch ] = version.split('.').map((v) => parseInt(v))
const build = ((major * 100000000) + (minor * 100000) + patch).toString()
const infoPlist = `${platformsDir}/ios/${projectName}/${projectName}-Info.plist`
const androidManifest = `${platformsDir}/android/app/src/main/AndroidManifest.xml`
$logger.info(`Updating version to ${version} (build=${build})`)
for (const file of [ infoPlist, androidManifest ]) {
if (fs.existsSync(file)) {
$logger.debug(`Replacing "__VERSION__" with "${version}" in ${file}`)
$logger.debug(`Replacing "__BUILD__" with "${build}" in ${file}`)
shell.sed('-i', /__VERSION__/, version, file)
shell.sed('-i', /__BUILD__/, build, file)
}
}
} If someone finds it useful, feel free to steal/modify. PS. |
Hi,
I've been building-beta releasing-building-beta releasing an Android app for a couple of days now. Pretty much every time I build it I forget to update the versionCode and versionName in the AndroidManifest.xml. I get reminded of this then Google's Developer Console rejects my APK because of the versionCode not being larger than the previous version.
An easy way to make a little bit easier for the developers would be to add a prompt for versionCode/versionName in the CLI if the build is run with the
--release
flag. And let the predefined value be read from the current AndroidManifest.xml. This way the developer will be reminded to update the versionCode/versionName and if s/he doesn't want to it's just an enter stroke away.If versionCode/versionName is changed then write it back to the AndroidManifest.xml
As
tns build
could be a part of a larger build script where user input is not possible, a new flag, such as--auto
or--quiet
, should probably be added as well - skipping the prompt.The text was updated successfully, but these errors were encountered: