Native extension Build vs Bundle

Hello ,

I have a project that uses a native extension as a dependency and I noticed that the code used for build is different between Build(Ctrl+B) and Bundle:

  • In case of Build, the local modified extension code is used.
  • In case of Bundle, the local modified code is not used(I guess, instead it’s used the extension repo directly).

Is this true or am I doing something wrong? Also, is this the intended behavior?

I assumed that the local changes will be used always and to me it seems like this would be the correct behavior.

1 Like

How did you modify the extension locally? If you just copy the extension folder into your project without a dependency, both should use it. If you fetch it from a dependency, you should not be able to modify it. Did you copy it into your project, but keep it in the dependencies without fetching?

1 Like

I use it as a dependency(it’s added as a dependency in the project file) and I modify it(indeed the changes are not permanent but they can be done).

I believe Native Extensions and Dependencies are two different things. Native Extensions are in C++ I believe. And Dependencies are just lua modules that you use.

I just looked it up:

In Defold these are related but distinct concepts.

Dependencies are external libraries or assets your project pulls in, declared in game.project under the [project] section as URLs (usually zip archives or git release links). When you fetch libraries (Project → Fetch Libraries), the editor downloads them and makes their contents — Lua modules, scripts, assets, or even native extensions — available to your project. A dependency is just a packaging/distribution mechanism: it’s how code or assets get into your project from outside.

Native Extensions are C/C++ (or Objective-C, Java, etc.) code that extends the engine itself, compiled into a custom engine build via Defold’s cloud build server (or a local build server). They live in a folder containing an ext.manifest file plus src/, include/, lib/ directories. They let you call platform APIs, link third-party native libraries, or expose new functions to Lua that the stock engine doesn’t provide.

The key relationship: a native extension can be distributed as a dependency. So you might add a native extension to your project either by placing its folder directly in your project, or by listing its release URL as a dependency so the editor downloads it.

In short — Dependencies = the delivery mechanism for external content (any kind); Native Extensions = a specific kind of content that extends the engine in native code, often delivered via a dependency. A dependency doesn’t have to be a native extension (it could be pure Lua), and a native extension doesn’t have to be a dependency (it could be local).

I guess the explanation might be that the local changes of the dependencies(they are possible but only temporary) are stored in the editor state and can be used by the Ctrl+B build but can’t be used by the bundling build because that one uses bob.

1 Like

Yes, you can make changes to the files in Dependencies, but it will be only locally and will be discarded when you close it. From documentation:

“Files in libraries cannot be saved. You can make changes, and the editor will be able to build with those changes, which is useful for testing. However, the file itself remains unchanged, and all modifications will be discarded when the file is closed.”

So Project → Build (Ctrl+B) can use the temporary editor-side changes, but those changes are not really saved back to the dependency. For bundling, Defold uses Bob and it works from the actual project files and resolved dependencies, so it should not be expected to use temporary, unsaved editor changes made inside a fetched library dependency.