Skip to content

Commit

Permalink
Only full_library build can be incremental -- attempt 2
Browse files Browse the repository at this point in the history
Summary:
Underlying issue is fixed by D65280978
re-attemp landing

Original attempt: D65074404

Reviewed By: jiawei-lyu

Differential Revision: D65283258

fbshipit-source-id: 3f78ca49361770fe0424ff3f8790e6d0029afd94
  • Loading branch information
navidqar authored and facebook-github-bot committed Oct 31, 2024
1 parent 552be02 commit ca3ccae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion prelude/kotlin/kotlin_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ def build_kotlin_library(
"deps": deps + [kotlin_toolchain.kotlin_stdlib],
"extra_kotlinc_arguments": ctx.attrs.extra_kotlinc_arguments,
"friend_paths": ctx.attrs.friend_paths,
"incremental": ctx.attrs.incremental,
"is_building_android_binary": ctx.attrs._is_building_android_binary,
"jar_postprocessor": ctx.attrs.jar_postprocessor[RunInfo] if hasattr(ctx.attrs, "jar_postprocessor") and ctx.attrs.jar_postprocessor else None,
"java_toolchain": ctx.attrs._java_toolchain[JavaToolchainInfo],
Expand All @@ -418,6 +417,7 @@ def build_kotlin_library(
plugin_params = create_plugin_params(ctx, ctx.attrs.plugins),
extra_arguments = extra_arguments,
actions_identifier = "",
incremental = ctx.attrs.incremental,
**common_kotlincd_kwargs
)

Expand Down Expand Up @@ -450,6 +450,7 @@ def build_kotlin_library(
# To make sure that even for pure Kotlin targets empty output dir is always present
optional_dirs = [nullsafe_info.output.as_output()],
is_creating_subtarget = True,
incremental = False,
**common_kotlincd_kwargs
)

Expand Down
10 changes: 6 additions & 4 deletions prelude/kotlin/kotlincd_jar_creator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ def create_jar_artifact_kotlincd(
target_type: TargetType,
source_only_abi_compiling_deps: list[JavaClasspathEntry] = [],
is_creating_subtarget: bool = False,
incremental_state_dir: Artifact | None = None):
incremental_state_dir: Artifact | None = None,
should_action_run_incrementally: bool = False):
_unused = source_only_abi_compiling_deps

proto = declare_prefixed_output(actions, actions_identifier, "jar_command.proto.json")
Expand Down Expand Up @@ -337,11 +338,11 @@ def create_jar_artifact_kotlincd(

dep_files["classpath_jars"] = classpath_jars_tag

common_params = {
incremental_run_params = {
"metadata_env_var": "ACTION_METADATA",
"metadata_path": "action_metadata.json",
"no_outputs_cleanup": True,
} if (incremental_state_dir != None) and ("nullsafe" != actions_identifier) else {}
} if should_action_run_incrementally else {}
actions.run(
args,
env = {
Expand All @@ -357,7 +358,7 @@ def create_jar_artifact_kotlincd(
low_pass_filter = False,
weight = 2,
error_handler = kotlin_toolchain.kotlin_error_handler,
**common_params
**incremental_run_params
)
return proto

Expand All @@ -374,6 +375,7 @@ def create_jar_artifact_kotlincd(
target_type = TargetType("library"),
is_creating_subtarget = is_creating_subtarget,
incremental_state_dir = incremental_state_dir,
should_action_run_incrementally = should_kotlinc_run_incrementally,
)

final_jar_output = prepare_final_jar(
Expand Down

0 comments on commit ca3ccae

Please sign in to comment.