From db091577fff5bcddac703bc8ac4f932fd53e0621 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Thu, 13 Apr 2017 12:48:56 -0700 Subject: AAPT2: Allow the ';' separator on Windows for split args Bug: 36870463 Test: manual (wine) Change-Id: I8a38545a3cac9354b41858e1840b197b60925c03 --- tools/aapt2/cmd/Link.cpp | 9 +++++---- tools/aapt2/cmd/Optimize.cpp | 3 ++- tools/aapt2/cmd/Util.cpp | 11 +++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp index 6e0809e62450..48eae4d72814 100644 --- a/tools/aapt2/cmd/Link.cpp +++ b/tools/aapt2/cmd/Link.cpp @@ -1785,9 +1785,9 @@ int Link(const std::vector& args) { .OptionalSwitch("-z", "Require localization of strings marked 'suggested'.", &require_localization) .OptionalFlagList("-c", - "Comma separated list of configurations to include. The default\n" - "is all configurations.", - &configs) + "Comma separated list of configurations to include. The default\n" + "is all configurations.", + &configs) .OptionalFlag("--preferred-density", "Selects the closest matching density and strips out all others.", &preferred_density) @@ -1855,7 +1855,8 @@ int Link(const std::vector& args) { &options.extensions_to_not_compress) .OptionalFlagList("--split", "Split resources matching a set of configs out to a Split APK.\n" - "Syntax: path/to/output.apk:[,[...]].", + "Syntax: path/to/output.apk:[,[...]].\n" + "On Windows, use a semicolon ';' separator instead.", &split_args) .OptionalSwitch("-v", "Enables verbose logging.", &verbose); diff --git a/tools/aapt2/cmd/Optimize.cpp b/tools/aapt2/cmd/Optimize.cpp index 8f8e0c8e4f6d..e99ee8aa93c2 100644 --- a/tools/aapt2/cmd/Optimize.cpp +++ b/tools/aapt2/cmd/Optimize.cpp @@ -302,7 +302,8 @@ int Optimize(const std::vector& args) { &configs) .OptionalFlagList("--split", "Split resources matching a set of configs out to a " - "Split APK.\nSyntax: path/to/output.apk:[,[...]].", + "Split APK.\nSyntax: path/to/output.apk;[,[...]].\n" + "On Windows, use a semicolon ';' separator instead.", &split_args) .OptionalSwitch("--enable-sparse-encoding", "Enables encoding sparse entries using a binary search tree.\n" diff --git a/tools/aapt2/cmd/Util.cpp b/tools/aapt2/cmd/Util.cpp index fd94bbc0a1c3..14d426061e56 100644 --- a/tools/aapt2/cmd/Util.cpp +++ b/tools/aapt2/cmd/Util.cpp @@ -57,10 +57,17 @@ bool ParseSplitParameter(const StringPiece& arg, IDiagnostics* diag, std::string CHECK(out_path != nullptr); CHECK(out_split != nullptr); - std::vector parts = util::Split(arg, ':'); +#ifdef _WIN32 + const char sSeparator = ';'; +#else + const char sSeparator = ':'; +#endif + + std::vector parts = util::Split(arg, sSeparator); if (parts.size() != 2) { diag->Error(DiagMessage() << "invalid split parameter '" << arg << "'"); - diag->Note(DiagMessage() << "should be --split path/to/output.apk:[,...]"); + diag->Note(DiagMessage() << "should be --split path/to/output.apk" << sSeparator + << "[,...]."); return false; } -- cgit v1.2.3-59-g8ed1b