Merge "Revert "Add workaround for a file with an mtime in the future"" into main

This commit is contained in:
Cole Faust 2023-07-22 04:01:59 +00:00 committed by Gerrit Code Review
commit 1c535124d5
2 changed files with 1 additions and 25 deletions

View file

@ -1389,9 +1389,6 @@ func createCommand(cmd *RuleBuilderCommand, buildStatement *bazel.BuildStatement
cmd.ImplicitOutput(PathForBazelOut(ctx, outputPath)) cmd.ImplicitOutput(PathForBazelOut(ctx, outputPath))
} }
} }
for _, inputPath := range buildStatement.OrderOnlyInputs {
cmd.OrderOnly(PathForBazelOut(ctx, inputPath))
}
for _, inputPath := range buildStatement.InputPaths { for _, inputPath := range buildStatement.InputPaths {
cmd.Implicit(PathForBazelOut(ctx, inputPath)) cmd.Implicit(PathForBazelOut(ctx, inputPath))
} }

View file

@ -115,7 +115,6 @@ type BuildStatement struct {
// input path string, but not both. // input path string, but not both.
InputDepsetHashes []string InputDepsetHashes []string
InputPaths []string InputPaths []string
OrderOnlyInputs []string
FileContents string FileContents string
// If ShouldRunInSbox is true, Soong will use sbox to created an isolated environment // If ShouldRunInSbox is true, Soong will use sbox to created an isolated environment
// and run the mixed build action there // and run the mixed build action there
@ -138,8 +137,6 @@ type aqueryArtifactHandler struct {
depsetHashToArtifactPathsCache sync.Map depsetHashToArtifactPathsCache sync.Map
// Maps artifact ids to fully expanded paths. // Maps artifact ids to fully expanded paths.
artifactIdToPath map[artifactId]string artifactIdToPath map[artifactId]string
extraBuildStatements []*BuildStatement
} }
// The tokens should be substituted with the value specified here, instead of the // The tokens should be substituted with the value specified here, instead of the
@ -169,30 +166,14 @@ func newAqueryHandler(aqueryResult *analysis_v2_proto.ActionGraphContainer) (*aq
return pathFragmentId(pf.Id) return pathFragmentId(pf.Id)
}) })
var extraBuildStatements []*BuildStatement
artifactIdToPath := make(map[artifactId]string, len(aqueryResult.Artifacts)) artifactIdToPath := make(map[artifactId]string, len(aqueryResult.Artifacts))
for _, artifact := range aqueryResult.Artifacts { for _, artifact := range aqueryResult.Artifacts {
artifactPath, err := expandPathFragment(pathFragmentId(artifact.PathFragmentId), pathFragments) artifactPath, err := expandPathFragment(pathFragmentId(artifact.PathFragmentId), pathFragments)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if strings.HasSuffix(artifactPath, "DumpPlatformClassPath.java") {
// TODO(b/291828210): This is a workaround for the fact that DumpPlatformClassPath.java
// has a timestamp in 2033. We'll copy it to a new file using a order-only dep, so that
// the file is not recopied every build. Technically the order-only dep would produce
// incremental build issues if this was a regular file produced as part of the build,
// but this file is actually created by bazel during analysis, so it's not an issue.
outputPath := "hack_for_b291828210/DumpPlatformClassPath.java"
extraBuildStatements = append(extraBuildStatements, &BuildStatement{
Command: fmt.Sprintf("cp %s %s", artifactPath, outputPath),
OutputPaths: []string{outputPath},
OrderOnlyInputs: []string{artifactPath},
})
artifactIdToPath[artifactId(artifact.Id)] = outputPath
} else {
artifactIdToPath[artifactId(artifact.Id)] = artifactPath artifactIdToPath[artifactId(artifact.Id)] = artifactPath
} }
}
// Map middleman artifact ContentHash to input artifact depset ID. // Map middleman artifact ContentHash to input artifact depset ID.
// Middleman artifacts are treated as "substitute" artifacts for mixed builds. For example, // Middleman artifacts are treated as "substitute" artifacts for mixed builds. For example,
@ -218,7 +199,6 @@ func newAqueryHandler(aqueryResult *analysis_v2_proto.ActionGraphContainer) (*aq
depsetHashToArtifactPathsCache: sync.Map{}, depsetHashToArtifactPathsCache: sync.Map{},
emptyDepsetIds: make(map[depsetId]struct{}, 0), emptyDepsetIds: make(map[depsetId]struct{}, 0),
artifactIdToPath: artifactIdToPath, artifactIdToPath: artifactIdToPath,
extraBuildStatements: extraBuildStatements,
} }
// Validate and adjust aqueryResult.DepSetOfFiles values. // Validate and adjust aqueryResult.DepSetOfFiles values.
@ -392,7 +372,6 @@ func AqueryBuildStatements(aqueryJsonProto []byte, eventHandler *metrics.EventHa
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
buildStatements = append(buildStatements, aqueryHandler.extraBuildStatements...)
depsetsByHash := map[string]AqueryDepset{} depsetsByHash := map[string]AqueryDepset{}
depsets := make([]AqueryDepset, 0, len(aqueryHandler.depsetIdToAqueryDepset)) depsets := make([]AqueryDepset, 0, len(aqueryHandler.depsetIdToAqueryDepset))