Skip to content

Commit

Permalink
Merge branch 'master' into enovozhilov/fix-xcode-bazel-8
Browse files Browse the repository at this point in the history
  • Loading branch information
ujohnny authored Jan 10, 2025
2 parents c1c0034 + 2417d58 commit a93ef61
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4

- name: Parse issue form
uses: stefanbuck/github-issue-parser@2d2ff50d4aae06ab58d26bf59468d98086605f11 # v3.2.1
uses: stefanbuck/github-issue-parser@2ea9b35a8c584529ed00891a8f7e41dc46d0441e # v3.2.1
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v2025.01.07
===========
* Allow to boost .ijwb over BSP and .idea folder. #7201

v2024.12.17
===========
Fixes:
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_python",
version = "0.40.0",
version = "1.0.0",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
Expand Down Expand Up @@ -51,7 +51,7 @@ use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

bazel_dep(
name = "rules_bazel_integration_test",
version = "0.27.0",
version = "0.31.0",
dev_dependency = True,
)

Expand Down
2 changes: 1 addition & 1 deletion aspect/build_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load(
_ide_kotlin_not_validated = "IDE_KOTLIN",
)

ALWAYS_BUILD_RULES = "java_proto_library,java_lite_proto_library,java_mutable_proto_library,kt_proto_library_helper,_java_grpc_library,_java_lite_grpc_library,kt_grpc_library_helper,java_stubby_library,kt_stubby_library_helper,aar_import,java_import"
ALWAYS_BUILD_RULES = "java_proto_library,java_lite_proto_library,java_mutable_proto_library,kt_proto_library_helper,_java_grpc_library,_java_lite_grpc_library,kt_grpc_library_helper,java_stubby_library,kt_stubby_library_helper,aar_import,java_import, j2kt_native_import"

PROTO_RULE_KINDS = [
"java_proto_library",
Expand Down
5 changes: 4 additions & 1 deletion base/src/META-INF/blaze-base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@
<registryKey defaultValue="true"
description="By default Bazel plugin takes control and opens project if .ijwb folder is present. This property can be used to disable this behavior to allow to open .idea or other project models if they are exists."
key="bazel.project.auto.open.if.present"/>
<registryKey defaultValue="false"
description="Google plugin is not exclusive anymore, and we need to give a chance to BSP to chime in. Otherwise neither will import the project if .idea folder is present. This property can be used to give a priority to .ijwb or alike over .idea *and* BSP."
key="bazel.project.prefer.google.plugin"/>
<registryKey defaultValue="false"
description="The Bazel Plugin sometimes uses the --query_file option to pass the query via a file. By default, the file is deleted immediately after the query execution is finished. Set this flag to true to avoid file deletion"
key="bazel.sync.keep.query.files"/>
Expand All @@ -422,7 +425,7 @@
description="Causes the plugin to read external workspace data, enabling features such as code completion for external targets. This may incur the cost of an additional 'bazel mod' call, which could cause issues with older versions or setups."
key="bazel.read.external.workspace.data"/>
<registryKey defaultValue="true"
description="Enable basic syntax highliting in Query Sync's 'Analysis Disabled' mode"
description="Enable basic syntax highlighting in Query Sync's 'Analysis Disabled' mode"
key="bazel.qsync.enable.basic.highlighting.in.non.analysis.mode"/>
<editorNotificationProvider implementation="com.google.idea.blaze.base.wizard2.BazelNotificationProvider"/>
</extensions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import com.intellij.ide.SaveAndSyncHandler;
import com.intellij.ide.impl.OpenProjectTask;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ex.ProjectManagerEx;
Expand Down Expand Up @@ -78,7 +80,8 @@ public Icon getIcon() {

@Override
public boolean isStrongProjectInfoHolder() {
return false;
return !PluginManagerCore.isPluginInstalled(PluginId.getId("org.jetbrains.bazel")) ||
Registry.is("bazel.project.prefer.google.plugin");
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions kotlin/src/com/google/idea/blaze/kotlin/KotlinBlazeRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public enum RuleTypes {
KT_JVM_LIBRARY_HELPER("kt_jvm_library_helper", LanguageClass.KOTLIN, RuleType.LIBRARY),
// bazel only kotlin rules:
KT_JVM_LIBRARY("kt_jvm_library", LanguageClass.KOTLIN, RuleType.LIBRARY),
KT_NATIVE_LIBRARY("kt_native_library", LanguageClass.KOTLIN, RuleType.LIBRARY),
KT_JVM_BINARY("kt_jvm_binary", LanguageClass.KOTLIN, RuleType.BINARY),
KT_JVM_TEST("kt_jvm_test", LanguageClass.KOTLIN, RuleType.TEST),
KT_JVM_IMPORT("kt_jvm_import", LanguageClass.KOTLIN, RuleType.UNKNOWN),
J2KT_NATIVE_IMPORT("j2kt_native_import", LanguageClass.KOTLIN, RuleType.UNKNOWN),
KOTLIN_STDLIB("kotlin_stdlib", LanguageClass.KOTLIN, RuleType.UNKNOWN);

private final String name;
Expand Down Expand Up @@ -70,6 +72,7 @@ public Function<TargetIdeInfo, Kind> getTargetKindHeuristics() {
return proto ->
proto.getKindString().startsWith("kt_jvm_")
|| proto.getKindString().startsWith("kt_android_")
|| proto.getKindString().startsWith("kt_native_")
? Kind.Provider.create(proto.getKindString(), LanguageClass.KOTLIN, RuleType.UNKNOWN)
: null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void testGetQueryExpression_experimental_includes_and_excludes() {
assertThat(qs.getQueryExpression())
.hasValue(
"let base = //some/included/path/...:* + //another/included/path/...:* - //some/included/path/excluded/...:* - //another/included/path/excluded/...:*\n" +
" in let known = kind(\"source file|android_library|android_binary|android_local_test|android_instrumentation_test|kt_android_library_helper|java_library|java_binary|kt_jvm_library|kt_jvm_binary|kt_jvm_library_helper|java_test|java_proto_library|java_lite_proto_library|java_mutable_proto_library|_java_grpc_library|_kotlin_library|_java_lite_grpc_library|_iml_module_|cc_library|cc_binary|cc_shared_library|cc_test|proto_library|py_library|py_binary|py_test\", $base) \n" +
" in let known = kind(\"source file|android_library|android_binary|android_local_test|android_instrumentation_test|kt_android_library_helper|java_library|java_binary|kt_jvm_library|kt_jvm_binary|kt_jvm_library_helper|kt_native_library|java_test|java_proto_library|java_lite_proto_library|java_mutable_proto_library|_java_grpc_library|_kotlin_library|_java_lite_grpc_library|_iml_module_|cc_library|cc_binary|cc_shared_library|cc_test|proto_library|py_library|py_binary|py_test\", $base) \n" +
" in let unknown = $base except $known \n" +
" in $known union ($base intersect allpaths($known, $unknown)) \n");
}
Expand Down
1 change: 1 addition & 0 deletions shared/java/com/google/idea/blaze/common/RuleKinds.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private RuleKinds() {}
"kt_jvm_library",
"kt_jvm_binary",
"kt_jvm_library_helper",
"kt_native_library",
"java_test",
"java_proto_library",
"java_lite_proto_library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ private FileTime readAccessTime(Path entry) throws IOException {
@Override
public void clean(long maxTargetSizeBytes, Duration minKeepDuration) throws BuildException {
// Ensure that no artifacts are added or read from the cache while we're cleaning:
long stamp = lock.writeLock();
long stamp = lock.tryWriteLock();
if (stamp == 0) {
logger.warning("Failed to clean the build cache at " + cacheDir + " Failed to obtain the write lock");
return; // Just exit. WE will clean the cache next time.
}
try {
needClean = false;
clean(maxTargetSizeBytes, Instant.now().minus(minKeepDuration));
Expand Down Expand Up @@ -467,7 +471,11 @@ void clean(long maxTargetSize, Instant minAgeToDelete) throws IOException {

public void purge() throws BuildException {
// Ensure that no artifacts are added or read from the cache while we're cleaning:
long stamp = lock.writeLock();
long stamp = lock.tryWriteLock();
if (stamp == 0) {
// TODO: b/373957467 - Report this error to the user properly.
throw new BuildException("Failed to purge the build artifact cache. Cannot obtain the write lock.");
}
try {
MoreFiles.deleteDirectoryContents(cacheDir);
} catch (IOException e) {
Expand Down

0 comments on commit a93ef61

Please sign in to comment.