aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
diff options
context:
space:
mode:
authorGravatar elenairina <elenairina@google.com>2018-06-29 08:10:12 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-29 08:11:27 -0700
commit1458c61f6b458747906dec95b3592bf9b3eb6c91 (patch)
tree1ba931864af3242475c26e06fe4a2b5ee47d895a /src/main/java/com/google/devtools/build/lib/packages
parentc816b89a2224c3c318f1228755ef41c53975f45c (diff)
[java_common.compile] Always generate a source jar.
[Rolling forward https://github.com/bazelbuild/bazel/commit/c4e128e2c6d8cacaeba034d6a3195796d50f1745] java_common.compile doesn't generate the output source jar when a source jar is the only input for the compilation. This is wrong because the source jar can include APT generated sources. It is also inconsistent with java_library and leads to inconsistent Skylark rules where a declared output will not always have a generating action. This new behavior is guarded by a new flag --incompatible_generate_javacommon_source_jar. RELNOTES: None. PiperOrigin-RevId: 202648346
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsCodec.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsOptions.java14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsCodec.java b/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsCodec.java
index 0a7d7f7ccd..7f147cb422 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsCodec.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsCodec.java
@@ -54,6 +54,7 @@ public final class SkylarkSemanticsCodec implements ObjectCodec<SkylarkSemantics
codedOut.writeBoolNoTag(semantics.incompatibleDisallowLegacyJavaInfo());
codedOut.writeBoolNoTag(semantics.incompatibleDisallowOldStyleArgsAdd());
codedOut.writeBoolNoTag(semantics.incompatibleDisallowSlashOperator());
+ codedOut.writeBoolNoTag(semantics.incompatibleGenerateJavaCommonSourceJar());
codedOut.writeBoolNoTag(semantics.incompatibleNewActionsApi());
codedOut.writeBoolNoTag(semantics.incompatibleNoSupportToolsInActionInputs());
codedOut.writeBoolNoTag(semantics.incompatiblePackageNameIsAFunction());
@@ -80,6 +81,7 @@ public final class SkylarkSemanticsCodec implements ObjectCodec<SkylarkSemantics
builder.incompatibleDisallowLegacyJavaInfo(codedIn.readBool());
builder.incompatibleDisallowOldStyleArgsAdd(codedIn.readBool());
builder.incompatibleDisallowSlashOperator(codedIn.readBool());
+ builder.incompatibleGenerateJavaCommonSourceJar(codedIn.readBool());
builder.incompatibleNewActionsApi(codedIn.readBool());
builder.incompatibleNoSupportToolsInActionInputs(codedIn.readBool());
builder.incompatiblePackageNameIsAFunction(codedIn.readBool());
diff --git a/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsOptions.java
index 14c68c4d90..8781bb5b59 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/SkylarkSemanticsOptions.java
@@ -179,6 +179,19 @@ public class SkylarkSemanticsOptions extends OptionsBase implements Serializable
public boolean incompatibleDisallowLegacyJavaInfo;
@Option(
+ name = "incompatible_generate_javacommon_source_jar",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
+ effectTags = {OptionEffectTag.UNKNOWN},
+ metadataTags = {
+ OptionMetadataTag.INCOMPATIBLE_CHANGE,
+ OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
+ },
+ help = "If set to true, java_common.compile will always generate an output source jar."
+ )
+ public boolean incompatibleGenerateJavaCommonSourceJar;
+
+ @Option(
name = "incompatible_disallow_slash_operator",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
@@ -321,6 +334,7 @@ public class SkylarkSemanticsOptions extends OptionsBase implements Serializable
.incompatibleDisallowLegacyJavaInfo(incompatibleDisallowLegacyJavaInfo)
.incompatibleDisallowOldStyleArgsAdd(incompatibleDisallowOldStyleArgsAdd)
.incompatibleDisallowSlashOperator(incompatibleDisallowSlashOperator)
+ .incompatibleGenerateJavaCommonSourceJar(incompatibleGenerateJavaCommonSourceJar)
.incompatibleNewActionsApi(incompatibleNewActionsApi)
.incompatibleNoSupportToolsInActionInputs(incompatibleNoSupportToolsInActionInputs)
.incompatiblePackageNameIsAFunction(incompatiblePackageNameIsAFunction)