/*
 * Copyright 2017-present Facebook, Inc.
 *
 * 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.facebook.buck.android.exopackage;

import java.util.EnumSet;

public enum ExopackageMode {
  SECONDARY_DEX(1),
  NATIVE_LIBRARY(2),
  RESOURCES(4),
  ;

  private final int code;

  ExopackageMode(int code) {
    this.code = code;
  }

  public static boolean enabledForSecondaryDexes(EnumSet<ExopackageMode> modes) {
    return modes.contains(SECONDARY_DEX);
  }

  public static boolean enabledForNativeLibraries(EnumSet<ExopackageMode> modes) {
    return modes.contains(NATIVE_LIBRARY);
  }

  public static boolean enabledForResources(EnumSet<ExopackageMode> modes) {
    return modes.contains(RESOURCES);
  }

  public static int toBitmask(EnumSet<ExopackageMode> modes) {
    int bitmask = 0;
    for (ExopackageMode mode : modes) {
      bitmask |= mode.code;
    }
    return bitmask;
  }
}

@@ -760,16 +760,30 @@
 CES(4),%0A
+  MODULES(8),%0A
   ;%0A%0A  p
@@ -1234,32 +1234,148 @@
 ESOURCES);%0A  %7D%0A%0A
+  public static boolean enabledForModules(EnumSet%3CExopackageMode%3E modes) %7B%0A    return modes.contains(MODULES);%0A  %7D%0A%0A
   public static 

Add a modules mode for exopackage