Adjust the singlejar binary to accept an optional comma-separated "label" with
each entry in the --outputs flag.
RELNOTES: n/a
PiperOrigin-RevId: 173547248
diff --git a/src/tools/singlejar/options.h b/src/tools/singlejar/options.h
index c228fc6..1fea135 100644
--- a/src/tools/singlejar/options.h
+++ b/src/tools/singlejar/options.h
@@ -17,6 +17,7 @@
#include <string>
#include <vector>
+#include "src/tools/singlejar/token_stream.h"
/* Command line options. */
class Options {
@@ -32,14 +33,16 @@
warn_duplicate_resources(false),
check_desugar_deps(false) {}
+ virtual ~Options() {}
+
// Parses command line arguments into the fields of this instance.
- void ParseCommandLine(int argc, const char * const argv[]);
+ void ParseCommandLine(int argc, const char *const argv[]);
std::string output_jar;
std::string main_class;
std::string java_launcher;
std::vector<std::string> manifest_lines;
- std::vector<std::string> input_jars;
+ std::vector<std::pair<std::string, std::string> > input_jars;
std::vector<std::string> resources;
std::vector<std::string> classpath_resources;
std::vector<std::string> build_info_files;
@@ -55,6 +58,22 @@
bool verbose;
bool warn_duplicate_resources;
bool check_desugar_deps;
+
+ protected:
+ /*
+ * Given the token stream, consume one notional flag from the input stream and
+ * return true if the flag was recognized and fully consumed. This notional
+ * flag may result in many tokens being consumed, as flags like --inputs ends
+ * up consuming many future tokens: --inputs a b c d e --some_other_flag
+ */
+ virtual bool ParseToken(ArgTokenStream *tokens);
+
+ /*
+ * After all of the command line options are consumed, validate that the
+ * options make sense. This function will exit(1) if invalid combinations of
+ * flags are passed (e.g.: is missing --output_jar)
+ */
+ virtual void PostValidateOptions();
};
#endif // THIRD_PARTY_BAZEL_SRC_TOOLS_SINGLEJAR_OPTIONS_H_