diff options
author | Carmi Grushko <carmi@google.com> | 2016-11-16 05:39:54 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2016-11-16 15:59:24 +0000 |
commit | 234b66acc0772ef4cb01a042751d86c1c003e51c (patch) | |
tree | 2f862c3cd82f87da7d4129ac45a982d7137a5fc9 /src/test/java | |
parent | 732907fcdd7a156e084b5e44a768f12ca2a0423a (diff) |
proto_library now produces a descriptor set, when built on the command-line.
RELNOTES: proto_library now produces a descriptor set, when built on the command-line.
--
MOS_MIGRATED_REVID=139288944
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/BUILD | 13 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java | 38 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/BUILD b/src/test/java/com/google/devtools/build/lib/BUILD index e44b08e326..dd2b998d56 100644 --- a/src/test/java/com/google/devtools/build/lib/BUILD +++ b/src/test/java/com/google/devtools/build/lib/BUILD @@ -1151,6 +1151,19 @@ java_test( ], ) +java_test( + name = "BazelProtoLibraryTest", + srcs = ["rules/proto/BazelProtoLibraryTest.java"], + deps = [ + ":actions_testutil", + ":analysis_testutil", + "//src/main/java/com/google/devtools/build/lib:build-base", + "//src/main/java/com/google/devtools/build/lib/actions", + "//third_party:junit4", + "//third_party:truth", + ], +) + java_binary( name = "MockSubprocess", srcs = ["windows/MockSubprocess.java"], diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java new file mode 100644 index 0000000000..ada3e125d1 --- /dev/null +++ b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java @@ -0,0 +1,38 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.rules.proto; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.actions.util.ActionsTestUtil; +import com.google.devtools.build.lib.analysis.ConfiguredTarget; +import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class BazelProtoLibraryTest extends BuildViewTestCase { + @Test + public void testDescriptorSetOutput() throws Exception { + scratch.file("third_party/protobuf/BUILD", "licenses(['notice'])", "exports_files(['protoc'])"); + ConfiguredTarget target = + scratchConfiguredTarget("foo", "foo", "proto_library(name='foo', srcs=['foo.proto'])"); + Artifact file = + ActionsTestUtil.getFirstArtifactEndingWith(getFilesToBuild(target), ".proto.bin"); + assertThat(file.getRootRelativePathString()).isEqualTo("foo/foo-descriptor-set.proto.bin"); + } +} |