librespeed / speedtest-android

Android app template for Librespeed servers
GNU Lesser General Public License v3.0
380 stars 126 forks source link

[WIP] Make a separate, independent java library out of the `core` package #12

Open pec0ra opened 4 years ago

pec0ra commented 4 years ago

This PR fixes issue #10

The following has been done:

The following still needs to be done:

pec0ra commented 4 years ago

@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.

pec0ra commented 11 months ago

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'
adolfintel commented 11 months ago

@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.

pec0ra commented 10 months ago

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:

Let me know what you think.

adolfintel commented 10 months ago

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.

pec0ra commented 10 months ago

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.