/*
 * Copyright 2015-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.python;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.rules.AbstractDescriptionArg;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.CellPathResolver;
import com.facebook.buck.rules.Description;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.infer.annotation.SuppressFieldNotInitialized;
import com.google.common.collect.ImmutableSortedSet;

public class PrebuiltPythonLibraryDescription
    implements Description<PrebuiltPythonLibraryDescription.Arg> {

  @Override
  public Class<Arg> getConstructorArgType() {
    return Arg.class;
  }

  @Override
  public PrebuiltPythonLibrary createBuildRule(
      TargetGraph targetGraph,
      BuildRuleParams params,
      BuildRuleResolver resolver,
      CellPathResolver cellRoots,
      Arg args) {
    return new PrebuiltPythonLibrary(params, args.binarySrc);
  }

  @SuppressFieldNotInitialized
  public static class Arg extends AbstractDescriptionArg {
    public SourcePath binarySrc;
    public ImmutableSortedSet<BuildTarget> deps = ImmutableSortedSet.of();
  }
}

@@ -664,25 +664,29 @@
 uck.
-model
+rules
 .Build
-Target
+RuleParams
 ;%0Aim
@@ -714,38 +714,33 @@
 k.rules.
-AbstractDescriptionArg
+BuildRuleResolver
 ;%0Aimport
@@ -760,39 +760,40 @@
 .buck.rules.
-BuildRuleParams
+CellPathResolver
 ;%0Aimport com
@@ -813,33 +813,36 @@
 k.rules.
-BuildRuleResolver
+CommonDescriptionArg
 ;%0Aimport
@@ -866,32 +866,27 @@
 k.rules.
-CellPathResolver
+Description
 ;%0Aimport
@@ -906,35 +906,39 @@
 .buck.rules.
-Description
+HasDeclaredDeps
 ;%0Aimport com
@@ -1038,105 +1038,82 @@
 ook.
-infer.annotation.SuppressFieldNotInitialized;%0Aimport com.google.common.collect.ImmutableSortedSet
+buck.util.immutables.BuckStyleImmutable;%0Aimport org.immutables.value.Value
 ;%0A%0Ap
@@ -1216,17 +1216,16 @@
 cription
-.
 Arg%3E %7B%0A%0A
@@ -1251,16 +1251,48 @@
 c Class%3C
+PrebuiltPythonLibraryDescription
 Arg%3E get
@@ -1325,16 +1325,48 @@
  return 
+PrebuiltPythonLibraryDescription
 Arg.clas
@@ -1568,16 +1568,48 @@
 ,%0A      
+PrebuiltPythonLibraryDescription
 Arg args
@@ -1662,25 +1662,28 @@
 s, args.
-b
+getB
 inarySrc
 );%0A  %7D%0A%0A
@@ -1674,16 +1674,18 @@
 inarySrc
+()
 );%0A  %7D%0A%0A
@@ -1691,61 +1691,107 @@
 %0A  @
-SuppressFieldNotInitialized%0A  public static class Arg
+BuckStyleImmutable%0A  @Value.Immutable%0A  interface AbstractPrebuiltPythonLibraryDescriptionArg%0A     
  ext
@@ -1795,24 +1795,22 @@
 extends 
-Abstract
+Common
 Descript
@@ -1819,21 +1819,31 @@
 nArg
- %7B%0A    public
+, HasDeclaredDeps %7B%0A   
  Sou
@@ -1854,17 +1854,20 @@
 ath 
-b
+getB
 inarySrc
 ;%0A  
@@ -1866,81 +1866,8 @@
 ySrc
-;%0A    public ImmutableSortedSet%3CBuildTarget%3E deps = ImmutableSortedSet.of
 ();%0A

Convert prebuilt_python_library Arg to be an Immutable