cordova icon indicating copy to clipboard operation
cordova copied to clipboard

Rework use of ~ in build.json

Open janpio opened this issue 6 years ago • 4 comments

Based on: https://github.com/apache/cordova-cli/pull/359 https://github.com/apache/cordova-android/pull/563 https://github.com/apache/cordova-docs/pull/909

Conclusion was to not merge any of those PRs, but rework how the support for ~ is implemented. Instead of manually reading env variables, using untildify should be much more stable.

During the discussion also the suggestion came up to support this in all build.json files, not just for cordova-android. (Will have to check if any of those use paths at all, so that it is worth the effort to move this from cordova-android to a more general location.)

janpio avatar Nov 18 '18 23:11 janpio

@janpio please add https://github.com/apache/cordova-docs/pull/909 to the list you made above.


EDITED & moved to another issue:

~~There are other Cordova packages where we should consider using untildify or another more portable solution instead of doing our own thing with ~, process.env.HOME, and sometimes process.env.USERPROFILE. Here is what I found so far:~~

brody4hire avatar Nov 18 '18 23:11 brody4hire

In terms of build.config I do not see Cordova doing anything with ~, process.env.HOME, or process.env.USERPROFILE. I think the explanation is that for iOS and Windows the same OS is always used to do the build.

~~But I hope we consider using untildify or another more portable solution for cordova-lib and cordova-ios as I suggested in my previous comment, which is now edited. I just added ", etc." to the title to reflect this suggestion.~~

P.S. I think we should consider using untildify for paths specified in build.config for iOS, macOS ("osx"), and Windows, for the sake of improved consistency:

  • for iOS & macOS ("osx"): path specified in codeSignResourceRules entry
  • for Windows: path specified in packageCertificateKeyFile entry

brody4hire avatar Nov 19 '18 00:11 brody4hire

Thanks for the investigation @brodybits, so it definitely makes sense to use this for all platforms and see if this can be moved out of cordova-android.

For the other uses of HOME and similar, please open a new issue - I disagree that using untildify there would be justified, but don't want to discuss this here. Thanks.

janpio avatar Nov 19 '18 00:11 janpio

I just raised #49 to propose the other changes, which should not block any of the changes discussed here, and changed the title of this issue back to the original.

brody4hire avatar Nov 19 '18 00:11 brody4hire