creator_tools/tools/aapt2/
mod.rs

1#![allow(dead_code)]
2
3/// Android Asset Packaging Tool 2.0 (AAPT2).
4/// https://developer.android.com/studio/command-line/aapt2
5/// https://android.googlesource.com/platform/frameworks/base/+/master/tools/aapt2
6///
7/// The main idea behind AAPT2, apart from new features, is that it divides
8/// the 'package' step into two: 'compile' and 'link'. It improves performance,
9/// since if only one file changes, you only need to recompile that one file and
10/// link all the intermediate files with the 'link' command.
11mod compile;
12mod convert;
13mod dump;
14mod link;
15mod optimize;
16
17pub use compile::*;
18pub use convert::*;
19pub use dump::*;
20pub use link::*;
21pub use optimize::*;
22
23use std::path::{Path, PathBuf};
24
25pub struct Aapt2;
26
27impl Aapt2 {
28    /// Compiles resources to be linked into an apk.
29    pub fn compile(self, o: &Path, manifest: &Path) -> Aapt2Compile {
30        Aapt2Compile::new(o, manifest)
31    }
32
33    /// Links resources into an apk.
34    pub fn link(self, inputs: &[PathBuf], o: &Path, manifest: &Path) -> Aapt2Link {
35        Aapt2Link::new(inputs, o, manifest)
36    }
37
38    /// Used for printing information about the APK you generated using the link command.
39    pub fn dump(self, subcommand: SubCommand, filename_apk: &Path) -> Aapt2Dump {
40        Aapt2Dump::new(subcommand, filename_apk)
41    }
42
43    /// Prints the differences in resources of two apks.
44    /// https://gerrit.pixelexperience.org/plugins/gitiles/frameworks_base/+/refs/tags/android-10.0.0_r2/tools/aapt2/cmd/Diff.cpp
45    pub fn diff(self) {
46        todo!();
47    }
48
49    /// Preforms resource optimizations on an apk.
50    pub fn optimize(self) -> Aapt2Optimize {
51        Aapt2Optimize
52    }
53
54    /// Converts an apk between binary and proto formats.
55    pub fn convert(self) -> Aapt2Convert {
56        Aapt2Convert
57    }
58
59    /// Prints the version of aapt.
60    pub fn version(self) -> String {
61        todo!();
62    }
63
64    /// Runs aapt in daemon mode. Each subsequent line is a single parameter to the
65    /// command. The end of an invocation is signaled by providing an empty line.
66    pub fn daemon(self) {
67        // probably stream ...
68        todo!();
69    }
70}