Coder Social home page Coder Social logo

Gradle native builds about profilo HOT 1 CLOSED

dbworku avatar dbworku commented on June 29, 2024
Gradle native builds

from profilo.

Comments (1)

BurntBrunch avatar BurntBrunch commented on June 29, 2024

Hi @dbworku,

Thanks for your interest!
Before I go into the steps we would need to get there, let's talk a bit about the proximal issue - duplicate classes.

Would it help if we published an aar that did not bundle any of these other libraries, as well as instructions on the full list of libraries to add to the build? This would be fairly doable (I think) and would not require full maven/gradle builds.

As for gradle, there are a number of considerations:

  1. The Java code would be pretty easy to deal with but the native code is where things get tricky. Our source of truth would always be buck build files, so having a tool that introspects the buck build graph and replicates it in cmake would be by far the easiest long-term approach (but with the highest upfront cost). There are, however, features of buck that are hard to replicate in cmake so we might need to refactor the code base significantly and impose new invariants before doing so.
    a. For example, our usage of header_namespace means that the cmake build will have to create a folder structure to symlink the headers into and expose that to dependent libraries. It's not impossible, just tedious to script.
    b. Our usage of header_namespace is questionable in its own right and I wouldn't be opposed to refactors that cleaned it up, so that e.g. cpp/ can be added as a header path across all compiler invocations.
    c. An alternative naive approach would supply recording versions of the toolchain or inspect the buck logs to produce the exact same sequence of invocations via cmake. This would work fairly well but would be somewhat fragile. We could automate it, however, so that every commit landing in github has a correct CMakeLists generated.
  2. Barring the automatic cmake conversion, another approach would be to have gradle shell out to buck and pull the built libraries that way. This unfortunately means we wouldn't pick up global flags without extra work and would impose a buck setup cost to people anyway. It's limited in utility but would unblock adding the library to existing projects, assuming that you are okay with the buck setup hurdle.
  3. Gradle/cmake will produce suboptimal results, size-wise. For example, this one line completely changes the way buck compiles the native code. It first produces object files, inspects which symbols libraries need from their dependencies and then hides all other symbols when linking the dependencies. This allows us to not worry about manually curating the dynamic symbol table and always produces optimal symbol tables. Replicating this functionality would be very difficult and as a result the gradle build is likely to be significantly bigger than the buck build.

Let me know if you're interested in either the no-deps aar build or the cmake conversion approaches, I'm happy to discuss them in more detail!

from profilo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.