requery / sqlite-android

Android SQLite support library
Apache License 2.0
1.05k stars 138 forks source link

Make repository jitpack.io compatible #145

Closed mikehardy closed 3 years ago

mikehardy commented 3 years ago

The repository was suprisingly close to working on jitpack

Fixes #140

https://jitpack.io/com/github/mikehardy/sqlite-android/3.35.1.1/build.log

Takes about 10 minutes for jitpack to build the artifact starting from the first time someone requests it.

You can already depend on this artifact and try it if you like:

    implementation 'com.github.mikehardy:sqlite-android:3.35.1.1'
npurushe commented 3 years ago

Awesome thanks for this!

mikehardy commented 3 years ago

NP - thanks for keeping this thing going so long, and hopefully this makes that easier, as mentioned elsewhere I have a library in mavenCentral() and while that's cool and all it was time I didn't have in order to get it set up :-).

We have an alpha of AnkiDroid built using my forked-temporary-proof-of-concept dependency already and it all worked using GitHub Actions to do the build and release, so I'd say it's not a science fair project, it appears "good to go" to me, just requires your "release" process now to be tagging the code with a version number any time you want people to be able to use jitpack as their maven repo, and then (as a courtesy) you should probably try to fetch the tag once so that it builds :)

Heck, that's probably all doable in a github action as well - I think they can listen to push events, see if it is a tag, and then curl the .pom for the new tag to kick off the build, could sleep for 15 minutes, curl the build log and make sure it was a success?

If anyone is interested in hacking that together :-), otherwise just push a tag and will work...

M66B commented 3 years ago

@mikehardy thanks for contributing this, especially looking at the upcoming deprecation of Bintray.

mikehardy commented 3 years ago

@M66B exactly why I was doing it :-), this was the last dependency I had stopping me from removing jcenter() maven repo in one of my apps, and I know open source repository maintainership is hard to move up on the priority list plus publishing on mavenCentral is a pain in the butt I was guessing @npurushe wasn't looking forward to ;-). With this it just needs to be merged (with correct version for next release), tagged with current sqlite version and...done

M66B commented 3 years ago

@npurushe since there were a number bugs fixed in the latest sqlite sub versions, so you might want to jump to version 3.35.4:

https://www.sqlite.org/changes.html

Let me thank you, like @mikehardy, for keeping this useful repository up to date! This doesn't mean there is a rush to update to the latest version now, although it would be welcome to me because I can finally remove some unused columns without doing a risky alterations of the database schema. This is not a big deal in any case, more a nice to have.

npurushe commented 3 years ago

I merged a prior PR that bumps the version to 3.35.4 and also removed the old bintray publish. Can you merge those changes into this? then will merge this PR thanks!

mikehardy commented 3 years ago

Yes, and I just realized I need to update the docs as well (the README.md, that is) I will merge those changes and an update to the docs so that it should be perfect for a 3.35.4 tag, test it on my fork, and if jitpack builds it right, it will be possible to just merge it here and tag it and we can all move on with our lives :-)

mikehardy commented 3 years ago

I've made all the changes in one clean commit that should be ready to merge.

jitpack.io is still building the tag on my fork to confirm it's :100: but it looks good so far - you should confirm prior to merge by making sure the log looks right

One "gotcha" with this is that if you forget to git push --tags to actually send the tag up to github.com, then jitpack.io can't see it to build it. So don't be like me and forget to push the tags then wonder why it's not building :clown_face:

Once the tag is up though, any attempt to access https://jitpack.io/com/github/requery/sqlite-android/<version> will trigger the build of <version> at which point you may actually watch it the build output in real time (takes about 10mins) at https://jitpack.io/com/github/requery/sqlite-android/<version>/build.log

Since I obviously have the URLs handy already, let's make that concrete and clickable

1- post merge make a tag of 3.35.1 however you prefer 2- click https://jitpack.io/com/github/requery/sqlite-android/3.35.4 3- click here to watch build https://jitpack.io/com/github/requery/sqlite-android/3.35.4/build.log 4- profit

mikehardy commented 3 years ago

Oh wait, scratch that. I wasn't expecting any of the changes from your previous merges to break things but something did.


* What went wrong:
Execution failed for task ':sqlite-android:publishMavenPublicationToMavenLocal'.
> Failed to publish publication 'maven' to repository 'mavenLocal'
   > Invalid publication 'maven': POM file is invalid. Check any modifications you have made to the POM file.

Investigating.

mikehardy commented 3 years ago

Okay, I had to revert your maven publishing changes @npurushe - apologies, they simply did not work for jitpack because it won't have the local properties file and it fails, plus something about that POM definition did not work. However, you can read the generated POM with that block commented out and it's got what you want in there...

This commit built successfully, and is ready for merge:

https://jitpack.io/com/github/mikehardy/sqlite-android/935649fe9d46f7229429a487e26819bedd022bfe/build.log

It includes documentation updates to use the jitpack reference, and I forward-ported the build file to gradle 7 for you ;-) (I just had to do that for AnkiDroid so you get my learnings free! what a bargain)

mikehardy commented 3 years ago

I won't have any more time really to go back and forth on this so I annotated the full diff with explanations of everything. Hopefully it's good and can merge or I'll just use my fork for now. It's busy times handling the jcenter thing across a few ecosystems...

npurushe commented 3 years ago

Sorry that change caused an issue with this PR i'll investigate what went wrong, thanks!

mikehardy commented 3 years ago

Yeah, it seemed innocuous, I was surprised it did not just go first time!

mikehardy commented 3 years ago

I just merged your changes from master in to here (I had simply commented the same lines you removed so took 2 secs) may still be good to go :-) ?

npurushe commented 3 years ago

sounds good merging your PR to master and will try the jitpack version in a test app, thanks!

mikehardy commented 3 years ago

It looks good! https://jitpack.io/com/github/requery/sqlite-android/master-0b4d5508cc-1/build.log

just needs a tag on that commit hash and it's a good build, easy to integrate - I've test integrated with AnkiDroid from a build that did all the important (and otherwise untouched) bits (download + compile + link) the same so I've got high confidence in that part,

npurushe commented 3 years ago

Great! added a tag for version 3.35.4