Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/src/META-INF/blaze-base.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright 2016 The Bazel Authors. All rights reserved.
~ Copyright 2025 The Bazel Authors. All rights reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -625,6 +625,7 @@

<extensions defaultExtensionNs="com.google.idea.blaze">
<SyncListener implementation="com.google.idea.blaze.base.sync.SyncCache$ClearSyncCache"/>
<SyncListener implementation="com.google.idea.blaze.base.sync.SourceToTargetMapInitializer"/>
<SyncListener implementation="com.google.idea.blaze.base.run.BlazeRunConfigurationSyncListener"/>
<SyncListener implementation="com.google.idea.blaze.base.sync.status.BlazeSyncStatusListener" order="first"/>
<SyncListener implementation="com.google.idea.blaze.base.dependencies.ExternalFileProjectManagementHelper$UpdateNotificationsAfterSync"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2025 The Bazel Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.idea.blaze.base.sync;

import com.google.common.collect.ImmutableSet;
import com.google.idea.blaze.base.model.BlazeProjectData;
import com.google.idea.blaze.base.projectview.ProjectViewSet;
import com.google.idea.blaze.base.scope.BlazeContext;
import com.google.idea.blaze.base.settings.BlazeImportSettings;
import com.google.idea.blaze.base.targetmaps.SourceToTargetMap;
import com.intellij.openapi.project.Project;
import java.io.File;

public class SourceToTargetMapInitializer implements SyncListener {

@Override
public void onSyncComplete(Project project, BlazeContext context,
BlazeImportSettings importSettings, ProjectViewSet projectViewSet,
ImmutableSet<Integer> buildIds, BlazeProjectData blazeProjectData, SyncMode syncMode,
SyncResult syncResult) {
// eagerly instantiate source to target map
SourceToTargetMap.getInstance(project).getRulesForSourceFile(new File(""));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 The Bazel Authors. All rights reserved.
* Copyright 2025 The Bazel Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +29,7 @@
import com.google.idea.blaze.base.sync.data.BlazeProjectDataManager;
import com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder;
import com.intellij.openapi.project.Project;
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread;
import java.io.File;
import java.util.Objects;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -77,6 +78,7 @@ private synchronized ImmutableMultimap<File, TargetKey> getSourceToTargetMap() {
}

@SuppressWarnings("unused")
@RequiresBackgroundThread
private static ImmutableMultimap<File, TargetKey> computeSourceToTargetMap(
Project project, BlazeProjectData blazeProjectData) {
ArtifactLocationDecoder decoder = blazeProjectData.getArtifactLocationDecoder();
Expand Down