speedtest-android
speedtest-android copied to clipboard
[WIP] Make a separate, independent java library out of the `core` package
This PR fixes issue #10
The following has been done:
- Create a library from scratch and add librespeed's
corepackage to it - Removed android dependencies to make library more compatible
- Flattened packages to only expose relevant classes and methods to public
The following still needs to be done:
- [ ] Improve User Agent
- [x] ~Add README~ Improve README
- [x] ~Add javadoc~ Improve javadoc
- [x] Publish to github package registry for easier use
@adolfintel I have added the code to publish the library to Maven Central (See https://github.com/librespeed/speedtest-android/pull/12/commits/9d11687d9b2142fe256dfa677a17502f82639bca).
This code will however need some steps from your side in order to make a publication. You will need to make a request to sonatype (the company hosting Maven Central) to allow you to publish the library. Information about this procedure be found on this site: https://proandroiddev.com/publishing-a-maven-artifact-3-3-step-by-step-instructions-to-mavencentral-publishing-bd661081645d Note that the steps 5 and 6 of this page are already done in https://github.com/librespeed/speedtest-android/pull/12/commits/9d11687d9b2142fe256dfa677a17502f82639bca
Let me know if you need any help with that or if you prefer another method of publishing your library.
Hi @adolfintel, Are you still interested in this?
In the meanwhile, I have changed the build to upload the artifacts to GitHub's package registry. This is done automatically for any release (on the onlyCore branch) with GitHub Actions (See for example this workflow: https://github.com/pec0ra/speedtest-android/actions/runs/7387305485/job/20095719687).
Here is an example: https://github.com/pec0ra/speedtest-android/packages/2028007 The package can be used in gradle with
implementation 'com.fdossena:librespeed:1.2.5'
@pec0ra Yes, I'm still interested and it looks good.
I don't have time to work on anything right now, let me know when it's finished and I'll give it a try.
No problem, I will see if I can make some more improvements. At least the ones in the todo list of the PR description.
There is however another point I wanted to bring back again. It is the one of the location of the code. This PR would put the code in a separate coreOnly branch, which I don't find optimal. I think it would be better to have two separate repositories: One for the android app and one for the library.
A separate repository would have the following benefits:
- It is easier to find the code of the library
- Releases can be made independently (this can be done in one repo with releases on separate branches but it would be very confusing).
- The library would be allowed to grow independently of the android app. I think this is important if people want to use it for other applications (cli, desktop, etc).
Let me know what you think.
I agree, it would be more useful as a java client library that's also compatible with android. Let me know when your PR is ready and I'll set up a repo where you can push it.
Hi @adolfintel
I improved the README and had another look at the javadoc and things look ready.
I kept the code very similar to what already exists (and works) in the master branch of this repo. I tried to only refactor the structure to make it independent from the Android code. Improvements to the library/code can always be made in the future.
The User Agent is the only thing that is different from the master branch. I'd like to make it configurable (with a good default) instead of hardcoded but I couldn't find a good way to do it without some code refactoring. I recommend that we keep it as a future improvement.
If you setup a new repo, I will reopen this Pull Request against it.