1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.build.config;
18 
19 import java.util.Arrays;
20 import java.util.List;
21 
22 public interface KatiCommand {
23     public static class KatiException extends Exception {
24         private String mStderr;
25 
KatiException(List<String> cmd, String stderr)26         public KatiException(List<String> cmd, String stderr) {
27             super("Error running kati: " + Arrays.toString(cmd.toArray()));
28             mStderr = stderr;
29         }
30 
getStderr()31         public String getStderr() {
32             return mStderr;
33         }
34     }
35 
36     /**
37      * Run kati directly. Returns stdout data.
38      *
39      * @throws KatiException if there is an error. KatiException will contain
40      * the stderr from the kati invocation.
41      */
run(String[] args)42     public String run(String[] args) throws KatiException;
43 }
44