Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | #ifndef AAPT2_APKSPLITTER_H |
| 18 | #define AAPT2_APKSPLITTER_H |
| 19 | |
| 20 | #include "Diagnostics.h" |
| 21 | #include "LoadedApk.h" |
| 22 | #include "configuration/ConfigurationParser.h" |
| 23 | |
| 24 | namespace aapt { |
| 25 | |
| 26 | /** |
| 27 | * Generates a set of APKs that are a subset of the original base APKs. Each of the new APKs contain |
| 28 | * only the resources and assets for an artifact in the configuration file. |
| 29 | */ |
| 30 | class MultiApkGenerator { |
| 31 | public: |
| 32 | MultiApkGenerator(LoadedApk* apk, IAaptContext* context); |
| 33 | |
| 34 | /** |
| 35 | * Writes a set of APKs to the provided output directory. Each APK is a subset fo the base APK and |
| 36 | * represents an artifact in the post processing configuration. |
| 37 | */ |
| 38 | bool FromBaseApk(const std::string& out_dir, |
| 39 | const configuration::PostProcessingConfiguration& config, |
| 40 | const TableFlattenerOptions& table_flattener_options); |
| 41 | |
| 42 | private: |
| 43 | IDiagnostics* GetDiagnostics() { |
| 44 | return context_->GetDiagnostics(); |
| 45 | } |
| 46 | |
| 47 | LoadedApk* apk_; |
| 48 | IAaptContext* context_; |
| 49 | }; |
| 50 | |
| 51 | } // namespace aapt |
| 52 | |
| 53 | #endif // AAPT2_APKSPLITTER_H |