Apache Cordova for F-Droid

I developed an APP in Apache Cordova. Are there any means to upload it to F-Droid?

Indeed converting the JS code of Cordova to the APK is quite straightforward

cordova build android

For example, from my open source APP, you would only need to run to obtain the APK

git clone https://github.com/jfoclpf/in-my-district.git
cd in-my-district
cordova platform add android
cordova build --release android

It would be useful to keep the generated Android code in the repo so that we can build it with gradle without nodejs.

1 Like

I really have no idea how that is achieved, the cordava CLI converts the JS code into a APK, but surely the Java code must be there around, actually I think it is inside the the folder platform/android

It would be useful to keep the generated Android code in the repo so that we can build it with gradle without nodejs.

This would mean that we aren’t building the app from its source code. Sounds against the policy to me.

Exactly,

how do you build the APKs? Why is nodeJS a problem?

We did that before. You can search cordova and you can found many examples. IIRC we required some upstream authors to provide that in a f-droid specific tag. It’s still source code but generated from js.

Just run cordova platform add android. Then we can run gradle assembleRelease in platforms/android/app. NodeJS is not really a problem since we use it for many ReactNative apps. But for cordova apps we can avoid that so that we don’t need to

  1. install node. node in debian is old and we usually need to download it from upstream.
  2. install cordova and run cordova platform add android
  3. find the output apk manully.

Basically the cordova build --release android is the same as gradle assembleRelease. Our build system works better with gradle and it can make the recipe simple.

We did that before. You can search cordova and you can found many examples. IIRC we required some upstream authors to provide that in a f-droid specific tag.

This sounds like a mistake. I vaguely remember a discussion about such a case.

It’s still source code but generated from js.

FSF puts it this way:

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

So, source code is the text that humans modify, anything generated from it—is not.

1 Like

This is a valid point @linsui , the generated JAVA code obtained from cordova build --release android is far from human readable and thus amendable/workable by humans. Furthermore many developers, such as myself, use a hook to previously minify the JS code upon build, which makes the JAVA code even more human unreadable

The APK is generated always in the same directory

I doubt that the discussion was about the nodejs usage. I guess we didn’t have RN apps then.

Good point!

Yep. It’s not difficult but a little verbose.