diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2019-12-05 00:57:12 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2019-12-05 00:57:12 +0000 |
commit | bd505d8097b10d5ae9c7e201bb576ef7f1347632 (patch) | |
tree | 73407d5b120d83a6d9445e0a7cd715d752a7967f | |
parent | c34c45be4ee0612974848004942f143a7882683d (diff) | |
parent | 795ec97fef1399ad3a10b56d13845c8e088cf8ed (diff) | |
download | aidl-bd505d8097b10d5ae9c7e201bb576ef7f1347632.tar.gz |
Don't emit output file name in dep file for parcelable delcaration am: 795ec97fef
Change-Id: I19a3a66fff9e33202a1555c680d8467a9bfde55d
-rw-r--r-- | aidl.cpp | 9 | ||||
-rw-r--r-- | aidl_unittest.cpp | 28 |
2 files changed, 33 insertions, 4 deletions
@@ -232,7 +232,14 @@ bool write_dep_file(const Options& options, const AidlDefinedType& defined_type, } // Encode that the output file depends on aidl input files. - writer->Write("%s : \\\n", output_file.c_str()); + if (defined_type.AsUnstructuredParcelable() != nullptr && + options.TargetLanguage() == Options::Language::JAVA) { + // Legacy behavior. For parcelable declarations in Java, don't emit output file as + // the dependency target. b/141372861 + writer->Write(" : \\\n"); + } else { + writer->Write("%s : \\\n", output_file.c_str()); + } writer->Write(" %s", Join(source_aidl, " \\\n ").c_str()); writer->Write("\n"); diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp index 3c5c6413..721bc89c 100644 --- a/aidl_unittest.cpp +++ b/aidl_unittest.cpp @@ -55,7 +55,14 @@ R"(place/for/output/p/IFoo.java : \ p/IFoo.aidl )"; -const char kExpectedParcelableDepFileContents[] = +const char kExpectedParcelableDeclarationDepFileContents[] = + R"( : \ + p/Foo.aidl + +p/Foo.aidl : +)"; + +const char kExpectedStructuredParcelableDepFileContents[] = R"(place/for/output/p/Foo.java : \ p/Foo.aidl @@ -571,7 +578,7 @@ TEST_F(AidlTest, WritesCorrectDependencyFileNinja) { EXPECT_EQ(actual_dep_file_contents, kExpectedNinjaDepFileContents); } -TEST_F(AidlTest, WritesTrivialDependencyFileForParcelable) { +TEST_F(AidlTest, WritesTrivialDependencyFileForParcelableDeclaration) { // The SDK uses aidl to decide whether a .aidl file is a parcelable. It does // this by calling aidl with every .aidl file it finds, then parsing the // generated dependency files. Those that reference .java output files are @@ -587,7 +594,22 @@ TEST_F(AidlTest, WritesTrivialDependencyFileForParcelable) { EXPECT_EQ(0, ::android::aidl::compile_aidl(options, io_delegate_)); string actual_dep_file_contents; EXPECT_TRUE(io_delegate_.GetWrittenContents(options.DependencyFile(), &actual_dep_file_contents)); - EXPECT_EQ(actual_dep_file_contents, kExpectedParcelableDepFileContents); + EXPECT_EQ(actual_dep_file_contents, kExpectedParcelableDeclarationDepFileContents); +} + +TEST_F(AidlTest, WritesDependencyFileForStructuredParcelable) { + vector<string> args = { + "aidl", + "--structured", + "-o place/for/output", + "-d dep/file/path", + "p/Foo.aidl"}; + Options options = Options::From(args); + io_delegate_.SetFileContents(options.InputFiles().front(), "package p; parcelable Foo {int a;}"); + EXPECT_EQ(0, ::android::aidl::compile_aidl(options, io_delegate_)); + string actual_dep_file_contents; + EXPECT_TRUE(io_delegate_.GetWrittenContents(options.DependencyFile(), &actual_dep_file_contents)); + EXPECT_EQ(actual_dep_file_contents, kExpectedStructuredParcelableDepFileContents); } /* not working until type_namespace.h is fixed |