aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-11-09 14:31:50 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-11-10 10:22:28 +0000
commit4171208f957b78638313219d1858c9a4f1263b1a (patch)
tree7a4706b5ce47393dd5f4bec441aa331ee178874b /src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java
parenta9dd72a7eda6dadf9448e68d4462aaebab429b89 (diff)
Description redacted.
-- MOS_MIGRATED_REVID=107379349
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java b/src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java
index bcb6f483f2..a65e9a6088 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PrecompilePythonMode.java
@@ -14,13 +14,25 @@
package com.google.devtools.build.lib.rules.python;
-/**
- * Enumerates the different modes of Python precompilation.
- *
- * <p>NONE denotes that no precompilation should take place, and PROTO causes
- * only the generated _pb/_pb2.py files to be precompiled. ALL compiles all
- * Python files.
- */
+/** Enumerates the different modes of Python precompilation. */
public enum PrecompilePythonMode {
- NONE, PROTO, ALL;
+ /** No Python precompilation should take place. */
+ NONE,
+
+ /** Only the _pb/_pb2.py files generated from protocol buffers should be precompiled. */
+ PROTO,
+
+ /** Compiles all Python files, but removes the .py sources from the runfiles. */
+ ONLY,
+
+ /** Compiles all Python files, and leaves the .py sources in the runfiles. */
+ ALL;
+
+ public boolean shouldPrecompileProtos() {
+ return this != NONE;
+ };
+
+ public boolean shouldPrecompilePythonSources() {
+ return this == ONLY || this == ALL;
+ };
}