// 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.


def configurePlatform() {
  def bom = "com.google.firebase:firebase-bom:33.16.0"
  if (project.hasProperty("firebase-bom")) {
    bom = project.getProperty("firebase-bom")
  }

  def platform = project.dependencies.enforcedPlatform(bom)
  project.dependencies.add("implementation", platform)
}

def configureRepositories() {
  def m2repo = "../build/m2repository/"
  if (project.hasProperty("m2repo")) {
    m2repo = project.getProperty("m2repo")
  }

  project.repositories {
    // This is necessary for Bill of Materials injection. This repository is created by running the
    // `assembleAllForSmokeTests` task on the main firebase-android-sdk project.
    maven {
      url m2repo
    }

    google()
    mavenCentral()
  }
}

configureRepositories()
configurePlatform()
