Titanium SDK JavaScript API to Native Module Build Cache Interoperability
0 reputation · 17 Feb 2021, 00:58 UTC
0 reputation · 17 Feb 2021, 00:58 UTC
The goal is to determine how JavaScript-visible API changes propagate across the Titanium SDK build-cache boundary to native module artifacts, and whether cached native artifacts automatically reflect such changes without explicit invalidation. The build-cache design persists native module artifacts across rebuilds, establishing an interoperability boundary where JavaScript-visible API modifications may not automatically propagate to native code.
This behavior creates a mismatch between JavaScript resource references resolved during initial build and subsequent native method signature changes, potentially causing runtime method-not-found errors until a full project clean is performed. Cache-clear mechanisms vary across Titanium SDK versions 6.x through 9.x, and no built-in developer hook exists to query or force invalidation across JavaScript and native platform boundaries.
What mechanisms exist for granular cache invalidation when native module method signatures change without a full project clean? How does build-cache staleness behavior differ between iOS and Android native artifact persistence? What are the practical implications for cross-platform development workflows?
37275 reputation · 17 Feb 2021, 08:12 UTC
Titanium SDK establishes a build-cache boundary between JavaScript API surfaces and native module artifacts. When a JavaScript-visible API changes such as a method signature added removed or renamed the cached native framework or library may not reflect that change on the next rebuild unless the cache is explicitly invalidated.
Because the cache key is typically derived from module configuration and platform target rather than the runtime JavaScript API surface a targeted rebuild without a full clean will reuse the existing native artifact. If the JavaScript side references a method that the cached native artifact does not provide the runtime bridge throws a method-not-found error. This mismatch is often only resolved by a project clean which forces regeneration of native artifacts from the updated JavaScript source.
iOS and Android staleness behaviors differ significantly. Assuming uniform invalidation across both platforms may lead to missed runtime errors on one platform while the other appears functional. Developers working on mixed iOS Android projects should treat cache invalidation as platform-specific and may need to perform separate cleans per platform when native module signatures change.
Missing diagnostic detail: the specific Titanium SDK version and target platform (iOS Android or both) would determine whether ti build -p platform -c without a clean is sufficient or whether a full ti clean followed by ti build is required. Confirming these details would refine the recommendation from attempt targeted rebuild to perform full clean.
Use comments to ask for clarification. Post a solution as an answer.
7,830 reputation · 17 Feb 2021, 04:37 UTC
Changing a native module's manifest version or source files usually forces that module to recompile while leaving unrelated cached artifacts in place, which can avoid a full project clean. This is not a documented cross-boundary hook, so treat it as a workaround rather than guaranteed behavior. To verify, list build/iphone and build/android before and after the version bump and confirm only the affected module binary is rewritten. Cache paths differ across Titanium SDK 6.x through 9.x, so check your installed release before relying on this in CI.