-1

I am in the process of configuring a headless Ubuntu server to automate the task of building APKs using Phonegap CLI. I have figured out how to automate most tasks - including creating the keystore for the release build, building the actual APK etc. What I am still missing is this

I want to run a script that gets the relevant HTML, CSS and JS files and then

  • Creates the folder in which the relevant project folders - plugins, www etc - will reside.
  • Populate the www folder with the supplied HTML and then its child js/css folders accordingly
  • The "Problem" bit - populate the plugins folder using the list of plugins that I supply to the script.

Now this could be done by running phonegap plugin add source-plugin-name. But it is wasteful since chances are that my script would spent a great deal of time, and bandwidth, fetching plugins it has already used before in another context.

Easy, I thought - I will just grab the plugins once and for all and then copy them across to the current projet's plugins folder. However, things are clearly not quite that easy. When done "normally" - i.e. via phonegap plugin add that folder ends up with two additional files android.json and fetch.json.

The function served by the android.json file is explained outstandingly well in this SO thread.

Now to my questions

  • If I do as I have indicated - copy the plugins across to myproject/plugins from a local copy what is to stop me from also building android.json myself at the same time following the guidelines in that thread
  • What purpose does the fetch.json file serve and do I need it

Finally, are there any gotchas (other than having dated local copies) that I need to be aware of if I go down the copy local plugin copies route as I am planning to do.

Community
  • 1
  • 1
DroidOS
  • 8,530
  • 16
  • 99
  • 171
  • Downvoter could you care to do more than just click that button? Is my question badly phrased, poorly researched, unsuitable for this forum...? – DroidOS Oct 14 '15 at 17:00

1 Answers1

1

I would recommend you not put anything from plugins (or platforms) in source control and just have your scripts regenerate the plugins and platforms folders on each build.

You would incur some bandwidth hit doing this, but you could for example copy the plugins you want to git repos on your local network and install them from there rather than the internet on each build. This would then give you the added audit trail / versioning and change management associated with git for your plugins.

In this model you wouldn't need to worry about files such as fetch.json

Simon Prickett
  • 3,838
  • 1
  • 13
  • 26
  • I am accepting your answer since you put me on the right track. Manually building the `android.json` file - as I had planned to do - is not a good idea if for no other reason at least because at some point in the future a version upgrade will render that build incompatible. However, `phonegap plugin add /local/path/to/plugin` is enough to have the `android.json` file created & updated correctly by Phonegap/Cordova. `fetch.json` is created & updated too but has little importance. – DroidOS Oct 15 '15 at 06:58