// Copyright (c) 2024, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
syntax = "proto3";

package com.android.tools.r8.keepanno.proto;

// All messages are placed under the outer class. This makes it a bit nicer to
// implement the AST <-> Proto conversions without type conflicts.
option java_multiple_files = false;

// Camel-case the outer class name (default is `Keepspec`).
option java_outer_classname = "KeepSpecProtos";

// Java package consistent with R8 convention.
option java_package = "com.android.tools.r8.keepanno.proto";

// Top-level container for the keep specification
message KeepSpec {
  Version version = 1;
  repeated Declaration declarations = 2;
}

message Version {
  uint32 major = 1;
  uint32 minor = 2;
  uint32 patch = 3;
}

message Declaration {
  oneof decl_oneof {
    Edge edge = 2;
    Check check = 3;
  }
}

// Note: the messages and fields avoid the use of `descriptor` in any place as
// that name is used internally in the protobuf encodings. We consistently use
// the short-form `desc` throughout.

message Context {
  oneof context_oneof {
    TypeDesc class_desc = 1;
    MethodDesc method_desc = 2;
    FieldDesc field_desc = 3;
  }
}

message TypeDesc {
  string desc = 1;
}

message MethodDesc {
  string name = 1;
  TypeDesc holder = 2;
  TypeDesc return_type = 3;
  repeated TypeDesc parameter_types = 4;
}

message FieldDesc {
  string name = 1;
  TypeDesc holder = 2;
  TypeDesc field_type = 3;
}

message MetaInfo {
  optional Context context = 1;
  optional string description = 2;
}

enum CheckKind {
  CHECK_UNSPECIFIED = 0;
  CHECK_REMOVED = 1;
  CHECK_OPTIMIZED_OUT = 2;
}

message Check {
  optional MetaInfo meta_info = 1;
  CheckKind kind = 2;
  Bindings bindings = 3;
  BindingReference item = 4;
}

message Edge {
  MetaInfo meta_info = 1;
  Bindings bindings = 2;
  repeated Condition preconditions = 3;
  repeated Target consequences = 4;
}

message Bindings {
  repeated Binding bindings = 1;
}

message Binding {
  string name = 1;
  ItemPattern item = 2;
}

message BindingReference {
  string name = 1;
}

message Condition {
  BindingReference item = 1;
}

message Target {
  BindingReference item = 1;
  optional Constraints constraints = 2;
  repeated Constraint constraint_additions = 3;
}

message Constraints {
  repeated Constraint constraints = 1;
}

enum ConstraintElement {
  CONSTRAINT_UNSPECIFIED = 0;
  CONSTRAINT_LOOKUP = 1;
  CONSTRAINT_NAME = 2;
  CONSTRAINT_VISIBILITY_RELAX = 3;
  CONSTRAINT_VISIBILITY_RESTRICT = 4;
  CONSTRAINT_NEVER_INLINE = 5;
  CONSTRAINT_CLASS_INSTANTIATE = 6;
  CONSTRAINT_CLASS_OPEN_HIERARCHY = 7;
  CONSTRAINT_METHOD_INVOKE = 8;
  CONSTRAINT_METHOD_REPLACE = 9;
  CONSTRAINT_FIELD_GET = 10;
  CONSTRAINT_FIELD_SET = 11;
  CONSTRAINT_FIELD_REPLACE = 12;
  CONSTRAINT_GENERIC_SIGNATURE = 13;
}

message AnnotationPattern {
  optional AnnotationRetention retention = 1;
  optional ClassNamePattern name = 2;
}

enum AnnotationRetention {
  RETENTION_UNSPECIFIED = 0;
  RETENTION_RUNTIME = 1;
  RETENTION_CLASS = 2;
}

message Constraint {
  oneof constraint_oneof {
    ConstraintElement element = 1;
    AnnotationPattern annotation = 2;
  }
}

message ItemPattern {
  oneof item_oneof {
    ClassItemPattern class_item = 1;
    MemberItemPattern member_item = 2;
  }
}

message ClassItemPattern {
  optional ClassPattern class_pattern = 1;
  optional AnnotatedByPattern annotated_by = 2;
}

message ClassPattern {
  optional ClassNamePattern class_name = 1;
  optional InstanceOfPattern instance_of = 2;
}

message InstanceOfPattern {
  optional bool inclusive = 1;
  optional ClassNamePattern class_name = 2;
}

message ClassNamePattern {
  optional PackagePattern package = 1;
  optional UnqualifiedNamePattern unqualified_name = 2;
}

message PackagePattern {
  // No components matches any package.
  repeated PackageComponentPattern components = 1;
}

message PackageComponentPattern {
  // An absent single component matches any number of components.
  optional StringPattern single_component = 1;
}

message StringPattern {
  // The string pattern is split in two so that we can distinguish the exact
  // empty string, from the inexact patterns.
  oneof pattern_oneof {
    // Unset oneof denotes any type.
    string exact = 1;
    StringPatternInexact inexact = 2;
  }
}

message StringPatternInexact {
  optional string prefix = 2;
  optional string suffix = 3;
}

message UnqualifiedNamePattern {
  optional StringPattern name = 1;
}

message AnnotatedByPattern {
  optional ClassNamePattern name = 1;
}

message MemberItemPattern {
  BindingReference class_reference = 1;
  optional MemberPattern member_pattern = 2;
}

message MemberPattern {
  oneof member_oneof {
    MemberPatternGeneral general_member = 1;
    MemberPatternField field_member = 2;
    MemberPatternMethod method_member = 3;
  }
}

enum AccessVisibility {
  ACCESS_UNSPECIFIED = 0;
  ACCESS_PUBLIC = 1;
  ACCESS_PROTECTED = 2;
  ACCESS_PACKAGE_PRIVATE = 3;
  ACCESS_PRIVATE = 4;
}

message AccessVisibilitySet {
  repeated AccessVisibility access_visibility = 1;
}

// Placeholder for an optional boolean modifier.
// The optional value is encoded by it not being present at the reference point.
message ModifierPattern {
  bool value = 1;
}

message MemberAccessGeneral {
  optional AccessVisibilitySet access_visibility = 1;
  optional ModifierPattern static_pattern = 2;
  optional ModifierPattern final_pattern = 3;
  optional ModifierPattern synthetic_pattern = 4;
}

message MemberAccessField {
  optional MemberAccessGeneral general_access = 1;
  optional ModifierPattern volatile_pattern = 2;
  optional ModifierPattern transient_pattern = 3;
}

message MemberAccessMethod {
  optional MemberAccessGeneral general_access = 1;
  optional ModifierPattern synchronized_pattern = 2;
  optional ModifierPattern bridge_pattern = 3;
  optional ModifierPattern native_pattern = 4;
  optional ModifierPattern abstract_pattern = 5;
  optional ModifierPattern strict_fp_pattern = 6;
}

message MemberPatternGeneral {
  optional MemberAccessGeneral access = 1;
  optional AnnotatedByPattern annotated_by = 2;
}

message MemberPatternField {
  optional MemberAccessField access = 1;
  optional AnnotatedByPattern annotated_by = 2;
  optional StringPattern name = 3;
  optional TypePattern field_type = 4;
}

message MemberPatternMethod {
  optional MemberAccessMethod access = 1;
  optional AnnotatedByPattern annotated_by = 2;
  optional StringPattern name = 3;
  optional MethodReturnTypePattern return_type = 4;
  optional MethodParameterTypesPattern parameter_types = 5;
}

message MethodReturnTypePattern {
  oneof return_type_oneof {
    // Unset type denotes any type.
    TypeVoid void_type = 1;
    TypePattern some_type = 2;
  }
}

message MethodParameterTypesPattern {
  repeated TypePattern types = 1;
}

message TypeVoid {
  // Placeholder to denote a 'void' method return type.
}

message TypePattern {
  oneof type_oneof {
    // Unset type denotes any type.
    TypePatternPrimitive primitive = 1;
    TypePatternArray array = 2;
    ClassPattern class_pattern = 3;
  }
}

enum TypePatternPrimitive {
  PRIMITIVE_UNSPECIFIED = 0; // Denotes any primitive.
  PRIMITIVE_BOOLEAN = 1;
  PRIMITIVE_BYTE = 2;
  PRIMITIVE_CHAR = 3;
  PRIMITIVE_SHORT = 4;
  PRIMITIVE_INT = 5;
  PRIMITIVE_LONG = 6;
  PRIMITIVE_FLOAT = 7;
  PRIMITIVE_DOUBLE = 8;
}

message TypePatternArray {
  // An unset or zero-valued dimensions will be interpreted as 1.
  optional uint32 dimensions = 1;
  optional TypePattern base_type = 2;
}
