/*
 * Copyright 2021 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 'java'
}

repositories {
    mavenCentral()
    maven {
        url = uri('https://repository.apache.org/content/repositories/snapshots/')
    }

    maven {
        url = uri('https://packages.confluent.io/maven/')
    }

    maven {
        url = uri('https://repo.maven.apache.org/maven2/')
    }
}

def beamVersion = '2.54.0'
def slf4jVersion = '2.0.12'
dependencies {
    implementation 'com.github.spotbugs:spotbugs-annotations:4.8.3'
    implementation "org.apache.beam:beam-sdks-java-core:${beamVersion}"
    implementation "org.apache.beam:beam-sdks-java-io-google-cloud-platform:${beamVersion}"
    implementation "org.apache.beam:beam-examples-java:${beamVersion}"
    implementation "org.slf4j:slf4j-api:${slf4jVersion}"
    implementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"
    runtimeOnly "org.apache.beam:beam-runners-direct-java:${beamVersion}"
    runtimeOnly "org.apache.beam:beam-runners-google-cloud-dataflow-java:${beamVersion}"
}

group = 'com.example'
version = '1.0.0-SNAPSHOT'
description = 'pubsub-streaming'

task execute (type:JavaExec) {
    mainClass = 'com.examples.pubsub.streaming.PubSubToGcs'
    description('Run the Beam pipeline with gradle execute -Dexec.args=...')
    classpath = sourceSets.main.runtimeClasspath
    systemProperties System.getProperties()
    args System.getProperty("exec.args", "").split()
}
