-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proto toolchains as dependencies and collect runtime jar in the a…
…spect Introduces ImplicitDepsProvider, which stores a mapping of rule types to implicit dependencies that need to be added to targets of the rule type (for the kotlin proto rule, this is determined dynamically according to the "variant" attribute), and augments the query proto during summarization. These labels can be found in the query output itself via "rule-input" fields of each target. Adds attributes to the build_deps aspect so these dependencies can be reached for protos. This required adjusting the logic to allow traversal to go through targets without JavaInfo (the proto toolchain targets do not have a JavaInfo provider, but their "runtime" attribute is the java_library the IDE needs for resolving base classes. Adds proto libraries as JAVA_RULE_TYPES in BlazeQueryParser so their deps are adequately reflected in the IDE. For current query sync projects, this does not change what deps are built (as the runtime jars are picked up in the transitive deps for in-project proto libraries, which are "always build"), but it ensures that the runtime jars are marked as dependencies and built even if the ide doesn't need to build in-project protos. PiperOrigin-RevId: 555229414
- Loading branch information
1 parent
5843e0b
commit 598a5f7
Showing
17 changed files
with
256 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
querysync/java/com/google/idea/blaze/qsync/query/ImplicitDepsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2023 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.qsync.query; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.devtools.build.lib.query2.proto.proto2api.Build.Rule; | ||
|
||
/** | ||
* Interface for providing information about deps implicit for certain rules (e.g. runtime jars for | ||
* proto java libraries). | ||
*/ | ||
public interface ImplicitDepsProvider { | ||
ImmutableList<String> forRule(Rule rule); | ||
|
||
String name(); | ||
|
||
/** | ||
* Version of the provider. If the provider implementation changes, the version should be changed | ||
* to prevent possible errors during partial syncs. | ||
*/ | ||
int version(); | ||
|
||
default String getVersionWithName() { | ||
return String.format("%s:%d", name(), version()); | ||
} | ||
|
||
ImplicitDepsProvider EMPTY = | ||
new ImplicitDepsProvider() { | ||
|
||
private static final int VERSION = 0; | ||
|
||
@Override | ||
public ImmutableList<String> forRule(Rule rule) { | ||
return ImmutableList.of(); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "Default"; | ||
} | ||
|
||
@Override | ||
public int version() { | ||
return VERSION; | ||
} | ||
}; | ||
} |
Oops, something went wrong.