// Copyright 2014 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.objc; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.vfs.PathFragment; /** * Represents an .xcdatamodel[d] directory - knowing all {@code Artifact}s contained therein - and * the .zip file that it is compiled to which should be merged with the final application bundle. *
* An .xcdatamodel (here and below note that lack or presence of a d) directory contains the schema * for a managed object, or a managed object model. It typically has two files: {@code layout} and * {@code contents}, although this detail isn't addressed in Bazel code. Directories of this * sort are compiled into a single .mom file. If the .xcdatamodel directory is inside a * .xcdatamodeld directory, then the .mom file is placed inside a .momd directory. The .momd * directory or .mom file is placed in the bundle root of the final bundle. *
* An .xcdatamodeld directory contains several .xcdatamodel directories, each corresponding to a * different version. In addition the .xcdatamodeld directory contains a {@code .xccurrentversion} * file which identifies the current version. (this file is also not handled explicitly by Bazel * code). *
* When processing artifacts referenced by a {@code datamodels} attribute, we must determine if it
* is in a .xcdatamodeld directory or only a .xcdatamodel directory. We also must group the
* artifacts by their container, the container being an .xcdatamodeld directory if possible, and a
* .xcdatamodel directory otherwise. Every container is compiled with a single invocation of the
* Managed Object Model Compiler (momc) and corresponds to exactly one instance of this class. We
* invoke momc indirectly through the momczip tool (part of Bazel) which runs momc and zips the
* output. The files in this zip are placed in the bundle root of the final application, not unlike
* the zips generated by {@code actoolzip} or {@code ibtoolzip}.
*/
class Xcdatamodel extends Value