How euptron/dependency-haven works
Project type and purpose
• This is a dual-module project:
– “haven” is an open-source Java/Android dependency-management library (resolves/caches Maven POMs and artifacts).
– “app” is an Android demo app that integrates and exercises that library.
• The library resolves direct and transitive dependencies, parses POM files, caches results, and exposes a simple API. The demo app provides a UI to trigger dependency resolution, display results and logs.
File structure
• Top-level modules:
– app/ – Android application (Gradle module)
– haven/ – library module with core packages
• app/:
– src/main/java/io/thorenkoder/android/… – Activities, Fragments, Adapters, Utility classes
– api/ & api/library/ – wrappers around the dependency-haven library (LocalLibraryManager, LocalLibrary)
– logging/ – UI logging via LogViewModel, adapters
– util/ – shared helpers, preferences, SDK utilities
• haven/:
– api/ & callback/async/ – public API interfaces, callbacks, AsyncTaskExecutor
– model/ & parser/ – Pom, Dependency, Exclusion models; PomParser
– repository/ – interfaces and implementations for LocalRepository (file system) and RemoteRepository (HTTP/Maven)
– resolver/ – DependencyResolver orchestrates resolution, handles skipping transitive lookups
– versioning/ – ComparableVersion for version comparisons
Key insights from README
• The library’s responsibilities:
– Reading repository definitions (JSON or default Maven Central/jitpack)
– Downloading POMs, resolving parent and transitive dependencies
– Caching POMs and artifacts locally
– Exposing a callback-based async API
– Android Demo App
• UI Layer (Activities / Fragments)
• Logging Layer (LogViewModel, LogAdapter)
• Library Adapter (LocalLibraryManager, LocalLibrary)
– Dependency-Haven Library Core
• API Facade (DependencyResolver, AsyncTaskExecutor, Callbacks)
• Parser (PomParser, model classes)
• Repository Layer
· RemoteRepository (HTTP client to Maven Central/JitPack)
· LocalRepository (file storage via LocalStorageFactory)
• Versioning Module (ComparableVersion)
– UI → Library Adapter: “startResolve(dependencies)”
– Adapter → API Facade: “resolveAsync(…)”
– API Facade → Repository Layer:
• RemoteRepository.downloadPom() → returns raw POM bytes
• LocalRepository.loadCachedPom() / saveCachedPom()
– API Facade → Parser: “PomParser.parse(rawPom)” → returns Dependency model graph
– API Facade → Versioning: compare versions for conflict resolution
– API Facade → Callback: “onSuccess(resolvedTree)” or “onError(exception)”
– Callback → UI / Logging Layer: update results, print logs
c. Architectural patterns & design principles:
– Separation of concerns: UI vs. networking vs. parsing vs. caching
– Callback-based async execution (AsyncTaskExecutor)
– Repository pattern for remote vs. local storage
– Model–View–ViewModel in the demo app (Fragments + LogViewModel)
– Modular packaging inside the “haven” library
d. Key technologies & frameworks:
– Java 8, Android SDK, Gradle
– HTTP client (e.g., URLConnection or OkHttp behind RemoteRepository)
– XML parsing in PomParser
– File I/O for caching (LocalRepository)
– AsyncTask or ThreadPool in AsyncTaskExecutor
Detail without overcomplicating
• Interactions at the API boundary, the parser, the repository, and the UI.