// Copyright 2018 Google LLC
//
// 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.

plugins {
    id 'firebase-library'
    id 'com.google.protobuf'
}

firebaseLibrary {
    publishJavadoc = false
    releaseNotes { 
        enabled.set(false)
    }
}

protobuf {
    protoc {
        artifact = libs.protoc.get().toString()
    }
    generateProtoTasks {
        all().each { task ->

            task.addIncludeDir(files('fix-javalite/proto'))

            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

android {
    namespace "firebase.com.protolitewrapper"
    compileSdkVersion project.compileSdkVersion
    defaultConfig {
        targetSdkVersion project.targetSdkVersion
        minSdkVersion project.minSdkVersion
        versionCode 1
        versionName '1.0'
        consumerProguardFiles 'proguard-rules.pro'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets.main.resources.srcDirs = ['build/extracted-protos/main/', 'src/main/proto']
}


dependencies {
    protobuf(libs.proto.google.common.protos){
        exclude group: "com.google.protobuf", module: "protobuf-java"
    }

    implementation libs.protobuf.java.lite
}
