aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-03-02 20:30:04 +0000
committerGravatar Ulf Adams <ulfjack@google.com>2015-03-05 14:16:52 +0000
commit2cbac1f35f263480b8f42743c02d2b29e0e87f0a (patch)
treebe536622bc62b33643b417ba7e44a4329e4d224e /src/main
parentc673a82bea3457cf51de51df73759ac947feadcb (diff)
Add J2ObjC support for proto option: "objc_class_prefix", which provides prefix names for generated protos.
-- MOS_MIGRATED_REVID=87539098
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcHeaderMappingFileProvider.java38
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcMappingFileProvider.java55
2 files changed, 55 insertions, 38 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcHeaderMappingFileProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcHeaderMappingFileProvider.java
deleted file mode 100644
index 93ff980333..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcHeaderMappingFileProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 Google Inc. 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.objc;
-
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
-
-/**
- * This provider is exported by java_library rules to supply ObjC header to Java type mapping files
- * for J2ObjC translation. J2ObjC needs the mapping files to be able to output translated files with
- * correct header import paths in the same directories of the Java source files.
- */
-@Immutable
-public final class J2ObjcHeaderMappingFileProvider implements TransitiveInfoProvider {
- private final NestedSet<Artifact> mappingFiles;
-
- public J2ObjcHeaderMappingFileProvider(NestedSet<Artifact> mappingFiles) {
- this.mappingFiles = mappingFiles;
- }
-
- public NestedSet<Artifact> getMappingFiles() {
- return mappingFiles;
- }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcMappingFileProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcMappingFileProvider.java
new file mode 100644
index 0000000000..7ee799e3df
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcMappingFileProvider.java
@@ -0,0 +1,55 @@
+// Copyright 2014 Google Inc. 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.objc;
+
+import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
+import com.google.devtools.build.lib.collect.nestedset.NestedSet;
+import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
+
+/**
+ * This provider is exported by java_library rules and proto_library rules with attribute
+ * "j2objc_api_version=1" to support distributed J2ObjC translation and proto compilation.
+ */
+@Immutable
+public final class J2ObjcMappingFileProvider implements TransitiveInfoProvider {
+
+ private final NestedSet<Artifact> headerMappingFiles;
+ private final NestedSet<Artifact> classMappingFiles;
+
+ public J2ObjcMappingFileProvider(NestedSet<Artifact> headerMappingFiles,
+ NestedSet<Artifact> classMappingFiles) {
+ this.headerMappingFiles = headerMappingFiles;
+ this.classMappingFiles = classMappingFiles;
+ }
+
+ /**
+ * Returns the ObjC header to Java type mapping files for J2ObjC translation. J2ObjC needs these
+ * mapping files to be able to output translated files with correct header import paths in the
+ * same directories of the Java source files.
+ */
+ public NestedSet<Artifact> getHeaderMappingFiles() {
+ return headerMappingFiles;
+ }
+
+ /**
+ * Returns the Java class name to ObjC class name mapping files. J2ObjC transpiler and J2ObjC
+ * proto plugin needs this mapping files to support "objc_class_prefix" proto option, which sets
+ * the ObjC class prefix on generated protos.
+ */
+ public NestedSet<Artifact> getClassMappingFiles() {
+ return classMappingFiles;
+ }
+}