Skip to content

Commit

Permalink
Allow enabling Live-Edit for Query-Sync even when Compose is disabled
Browse files Browse the repository at this point in the history
Allow enabling Live Edit for Query-Sync independent of Compose. Currently Compose/Previews is WIP and requiring compose for Live-Edit would expose development code to users (b/294125425). This is a temporary fix and Compose will correctly be configured in b/262296694.

PiperOrigin-RevId: 553255662
  • Loading branch information
Googler authored and copybara-github committed Aug 2, 2023
1 parent 4c13f26 commit 592e35d
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,23 @@ public VirtualFile findClass(String fqcn) {
}

if (QuerySync.isEnabled()) {
ArtifactTracker artifactTracker = QuerySyncManager.getInstance(project).getArtifactTracker();
// TODO(b/283280194): Setup fqcn -> target and target -> Render jar mappings to avoid
// iterating over all render jars when trying to locate class for fqcn.
// TODO(b/284002836): Collect metrics on time taken to iterate over the jars
for (File renderJar : artifactTracker.getRenderJars()) {
VirtualFile renderResolveJarVF =
VirtualFileSystemProvider.getInstance().getSystem().findFileByIoFile(renderJar);
if (renderResolveJarVF != null) {
return findClassInJar(renderResolveJarVF, fqcn);
if (QuerySync.isComposeEnabled()) {
ArtifactTracker artifactTracker =
QuerySyncManager.getInstance(project).getArtifactTracker();
// TODO(b/283280194): Setup fqcn -> target and target -> Render jar mappings to avoid
// iterating over all render jars when trying to locate class for fqcn.
// TODO(b/284002836): Collect metrics on time taken to iterate over the jars
for (File renderJar : artifactTracker.getRenderJars()) {
VirtualFile renderResolveJarVf =
VirtualFileSystemProvider.getInstance().getSystem().findFileByIoFile(renderJar);
if (renderResolveJarVf != null) {
return findClassInJar(renderResolveJarVf, fqcn);
}
log.warn(String.format("Could not find class `%1$s` with Query Sync", fqcn));
return null;
}
log.warn(String.format("Could not find class `%1$s` with Query Sync", fqcn));
} else {
// Disable this class for Query Sync if Compose is not enabled
return null;
}
}
Expand Down

0 comments on commit 592e35d

Please sign in to comment.