Skip to content

Commit

Permalink
WIP: Don't overwrite jdeps
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 16, 2024
1 parent 8413859 commit 9f7aaf5
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ public PlatformInfo getExecutionPlatform() {
* Returns artifacts that should be subject to path mapping (see {@link Spawn#getPathMapper()},
* but aren't inputs of the action.
*/
public NestedSet<Artifact> getAdditionalArtifactsForPathMapping() {
public NestedSet<? extends ActionInput> getAdditionalArtifactsForPathMapping() {
return NestedSetBuilder.emptySet(Order.STABLE_ORDER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public NestedSet<? extends ActionInput> getInputFiles() {
}

@Override
public Collection<Artifact> getOutputFiles() {
public Collection<? extends ActionInput> getOutputFiles() {
return action.getOutputs();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,26 +864,26 @@ public Builder addPath(@CompileTimeConstant String arg, @Nullable PathFragment v
}

/**
* Adds an artifact by calling {@link Artifact#getExecPath}.
* Adds an artifact by calling {@link ActionInput#getExecPath}.
*
* <p>Prefer this over manually calling {@link Artifact#getExecPath}, as it avoids storing a
* <p>Prefer this over manually calling {@link ActionInput#getExecPath}, as it avoids storing a
* copy of the artifact path string.
*/
@CanIgnoreReturnValue
public Builder addExecPath(@Nullable Artifact value) {
public Builder addExecPath(@Nullable ActionInput value) {
return addObjectInternal(value);
}

/**
* Adds an artifact by calling {@link Artifact#getExecPath}.
* Adds an artifact by calling {@link ActionInput#getExecPath}.
*
* <p>Prefer this over manually calling {@link Artifact#getExecPath}, as it avoids storing a
* <p>Prefer this over manually calling {@link ActionInput#getExecPath}, as it avoids storing a
* copy of the artifact path string.
*
* <p>If the value is null, neither the arg nor the value is added.
*/
@CanIgnoreReturnValue
public Builder addExecPath(@CompileTimeConstant String arg, @Nullable Artifact value) {
public Builder addExecPath(@CompileTimeConstant String arg, @Nullable ActionInput value) {
return addObjectInternal(arg, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

package com.google.devtools.build.lib.analysis.actions;


import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.AbstractAction;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactExpander;
import com.google.devtools.build.lib.actions.CommandLineExpansionException;
import com.google.devtools.build.lib.actions.CommandLineLimits;
Expand Down Expand Up @@ -118,7 +117,7 @@ public final class PathMappers {
public static void addToFingerprint(
String mnemonic,
Map<String, String> executionInfo,
NestedSet<Artifact> additionalArtifactsForPathMapping,
NestedSet<? extends ActionInput> additionalArtifactsForPathMapping,
ActionKeyContext actionKeyContext,
OutputPathsMode outputPathsMode,
Fingerprint fingerprint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public NestedSet<? extends ActionInput> getInputFiles() {
}

@Override
public Collection<Artifact> getOutputFiles() {
public Collection<? extends ActionInput> getOutputFiles() {
return reportOutputs ? super.getOutputFiles() : ImmutableSet.of();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ java_library(
],
deps = [
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:action_input_helper",
"//src/main/java/com/google/devtools/build/lib/actions:artifact_expander",
"//src/main/java/com/google/devtools/build/lib/actions:artifacts",
"//src/main/java/com/google/devtools/build/lib/actions:commandline_item",
Expand Down
Loading

0 comments on commit 9f7aaf5

Please sign in to comment.