Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1259 Allow a local kiwix-lib aar to be used #1348

Conversation

mhutti1
Copy link
Contributor

@mhutti1 mhutti1 commented Aug 11, 2019

Work on #1259

@mhutti1 mhutti1 requested a review from macgills August 11, 2019 14:34
@mhutti1 mhutti1 force-pushed the feature/mhutti1/#1259-subfix branch from ba4279b to 0e895b1 Compare August 11, 2019 14:37
implementation 'org.kiwix.kiwixlib:kiwixlib:5.2.0'

// Get kiwixlib online if it is not populated locally
if (!file("./libs").exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get rid of the ! and flip the branches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, the top branch will be hit 99% of the time though, so I would personally prefer it to be that way round.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kiwix/kiwix-build#346 (comment) sounds like we are not doing this anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I am using this for is to test kiwix-lib changes directly. The workflow is:

  1. symlink libs directory to the output of kiwix-build
  2. Build aar using kiwix-build
  3. Build and run the app.
  4. Repeat steps 2-4 until you fix whatever bug you are trying to fix.

Turnaround time with this is about a minute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With unit tests turnaround is in seconds if not milliseconds. We should have this discussion here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure unit tests would help and might reduce the need for this but we don't have them now. This is a small change that can be implemented now and allows other bugs such as #735 to be solved now. Simply open the effected file and debug using a combination of breakpoints and print statements between c++ recompiles.

if (!file("./libs").exists()) {
implementation 'org.kiwix.kiwixlib:kiwixlib:5.2.0'
} else {
implementation 'com.getkeepsafe.relinker:relinker:1.3.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be necessary? I think transitive = true should work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try getting relinker inside the aar but was struggling. (and we would only want to do this for debug builds). I think this is probably an acceptable solution instead.

@mhutti1
Copy link
Contributor Author

mhutti1 commented Aug 14, 2019

I am going to merge this into the fix branch and then try get the tests passing on that.

@mhutti1 mhutti1 merged commit b35c1db into feature/macgills/#1259-unsatisfied-link-error Aug 14, 2019
@mhutti1 mhutti1 deleted the feature/mhutti1/#1259-subfix branch August 14, 2019 10:38
@macgills
Copy link
Contributor

Why when you could just do it locally? Also what tests?

@mhutti1
Copy link
Contributor Author

mhutti1 commented Aug 14, 2019

Travis is failing showing 0 tests. The tests don't do this for me locally.

@macgills
Copy link
Contributor

We had that conversation on slack, you haven't added the aar to the project in git

@macgills
Copy link
Contributor

if you were to add this functionality not off a failing branch then tests would pass but the branch you based off of is failing and will continue to fail because we need an update from kiwixlib

@mhutti1
Copy link
Contributor Author

mhutti1 commented Aug 14, 2019

Yes I know, which is why I merged this so that once a new kiwix-lib is released (It has been fixed but not released yet) we can simply use that branch to merge in quickly.

@macgills
Copy link
Contributor

Once it has been released the pre-existing branch would have worked without this update (after incrementing the version number).
I am still not a fan of this functionality and we have made no commitment to do it.

@mhutti1
Copy link
Contributor Author

mhutti1 commented Aug 14, 2019

So I have been working on getting the stackoverflow ZIM files working the last 2 days and this change has been essential to doing that. We don't have a JNI testing system yet so I don't see any reason why we can't add this to develop until such a system exists.

@macgills
Copy link
Contributor

It is fine to have this change local but I don't see the necessity for the change to happen to dev. Ideally we have a better system in place for the next ticket

If we must see it I'd prefer to see

impl real_lib
// uncomment these lines to use local copy, also comment out real lib TODO Delete this
//impl relink
//impl aar

as it doesn't just integrate it into our project as a normal way of working

@mhutti1
Copy link
Contributor Author

mhutti1 commented Aug 14, 2019

We have had the current style system for over a year now and it works well. Uncommenting could also work but I really don't see the reason we can't have a check to see if the user has created a file and then use that file to override our import if they have.

It makes debugging simpler and I really can't see a downside.

@macgills
Copy link
Contributor

it is active code in the build system, I have never seen a conditional dependency before so for me it was quite weird to see and interrupted my reading flow (the original kiwixlib one).
I don't necessarily want this to be simple because I want it to stick out as unusual and a reason to remove it and use a proper way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants