diff options
author | Chris Warrington <cmw@google.com> | 2017-04-27 15:27:01 +0100 |
---|---|---|
committer | Chris Warrington <cmw@google.com> | 2017-04-28 10:06:38 +0100 |
commit | 820d72adc0eccbfe4ac4238cdc89b7680ea03d9e (patch) | |
tree | d7f39f1675f4b0f20f764dfa8b70dfb1a26e14e5 /tools/aapt2/cmd/Compile.cpp | |
parent | 3dfd8275749a734380282437579156b6b35ccc51 (diff) |
AAPT2: Error reporting through JNI.
Rather than relying on stderr being wired correctly.
Test: Tests for JNI integration in studio-master-dev.
Change-Id: I1c7e7130bc4e56d61de259a9596bee3a6b3520fb
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r-- | tools/aapt2/cmd/Compile.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp index b93c6ecea274..5413b336ea90 100644 --- a/tools/aapt2/cmd/Compile.cpp +++ b/tools/aapt2/cmd/Compile.cpp @@ -598,6 +598,9 @@ static bool CompileFile(IAaptContext* context, const CompileOptions& options, class CompileContext : public IAaptContext { public: + CompileContext(IDiagnostics* diagnostics) : diagnostics_(diagnostics) { + } + PackageType GetPackageType() override { // Every compilation unit starts as an app and then gets linked as potentially something else. return PackageType::kApp; @@ -612,7 +615,7 @@ class CompileContext : public IAaptContext { } IDiagnostics* GetDiagnostics() override { - return &diagnostics_; + return diagnostics_; } NameMangler* GetNameMangler() override { @@ -639,7 +642,7 @@ class CompileContext : public IAaptContext { } private: - StdErrDiagnostics diagnostics_; + IDiagnostics* diagnostics_; bool verbose_ = false; }; @@ -647,8 +650,8 @@ class CompileContext : public IAaptContext { * Entry point for compilation phase. Parses arguments and dispatches to the * correct steps. */ -int Compile(const std::vector<StringPiece>& args) { - CompileContext context; +int Compile(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) { + CompileContext context(diagnostics); CompileOptions options; bool verbose = false; |