Skip to content

Recover projects after update: expose app dir, import legacy Gradle projects (compat mode)#1046

Closed
tyron12233 wants to merge 0 commit into
mainfrom
fix-legacy-project-recovery-1042
Closed

Recover projects after update: expose app dir, import legacy Gradle projects (compat mode)#1046
tyron12233 wants to merge 0 commit into
mainfrom
fix-legacy-project-recovery-1042

Conversation

@tyron12233

Copy link
Copy Markdown
Owner

Fixes #1003, #1024, #1041, #1042 — projects "disappearing" from the picker after a Play update.

Root cause

The app keeps the same com.tyron.code applicationId across updates, so the external files dir survives — the data was never lost, just not surfaced. Two generations of project data exist on disk:

  • v0.2.9 (legacy): getExternalFilesDir("Projects")<external-files>/Projects/<name>Gradle projects.
  • New app: <external-files>/codeassist/projects/<workspace> — native-model projects.

What this does

1. Expose the whole external files dir. The DocumentsProvider and the "Open in file manager" action now expose getExternalFilesDir(null) (parent of both Projects/ and codeassist/), with a full file view, so legacy sources are browsable. The storage card, reveal action, and provider all resolve the same storageRoot.

2. Recover into the picker. ProjectManager.importLegacyProjects() (runs once, non-destructive) sweeps the legacy data dirs:

  • current-format projects (e.g. an earlier internal-storage build) are copied verbatim;
  • legacy Gradle projects are imported in compatibility mode via a new tolerant GradleImport reader of the settings/build scripts — extracting modules, plugin/module type, the android {} SDK/namespace, and dependencies {} coordinates+scopes — which authors a native workspace from them.

3. Set expectations. The Gradle import is best-effort: dependency versions aren't resolved and build-script logic is ignored, so a compatibility-mode project may show unresolved symbols and may not build until deps are re-added. This is surfaced as a per-project amber "Compatibility" chip and a dismissible first-run banner.

Backups now also sweep the legacy Projects/ dir.

Limitations

Full Gradle sync (resolving the dependency graph, build-script evaluation) is roadmap step 9 and not attempted here. Compatibility-mode projects are for recovering/editing code, not guaranteed to build as-is.

Tests

  • GradleImportTest — parser (modules/types/SDK/deps/scopes) + end-to-end import that lists, flags compatibility, opens with the right modules, and has sources copied.
  • ProjectManagerTest.importsLegacyProjectsFromAPreviousStorageLocation — current-format recovery.
  • Verified :ide-core:test, :ide-ui/:ide-desktop compile, and :ide-android:compileDebugKotlin (clean aside from an unrelated untracked scratch file).

@my-garbage

my-garbage commented Jun 19, 2026

Copy link
Copy Markdown

@tyron12233 Where is this roadmap you wrote about?
Maybe it should be mentioned in the readme.md

@tyron12233 tyron12233 closed this Jun 19, 2026
@tyron12233 tyron12233 force-pushed the fix-legacy-project-recovery-1042 branch from edbbc2b to 85295b2 Compare June 19, 2026 09:35
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.

projects

2 participants