/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

import org.apache.gobblin.gradle.BuildProperties
import org.apache.gobblin.gradle.BuildProperty

def BuildProperties BUILD_PROPERTIES = new BuildProperties(project)
    .register(new BuildProperty("sonatypeArtifactRepository", "https://oss.sonatype.org/service/local/staging/deploy/maven2/", "Maven repository to publish artifacts"))
    .register(new BuildProperty("sonatypeArtifactSnapshotRepository", "https://oss.sonatype.org/content/repositories/snapshots/", "Maven repository to publish artifacts"))
    .register(new BuildProperty("nexusArtifactRepository", "https://repository.apache.org/service/local/staging/deploy/maven2", "Maven repository to publish artifacts"))
    .register(new BuildProperty("nexusArtifactSnapshotRepository", "https://repository.apache.org/content/repositories/snapshots", "Maven repository to publish artifacts"))
    .register(new BuildProperty("avroVersion", "1.9.2", "Avro dependencies version"))
    .register(new BuildProperty("awsVersion", "1.12.261", "AWS dependencies version"))
    .register(new BuildProperty("bytemanVersion", "4.0.5", "Byteman dependencies version"))
    .register(new BuildProperty("confluentVersion", "2.0.1", "confluent dependencies version"))
    .register(new BuildProperty("doNotSignArtifacts", false, "Do not sight Maven artifacts"))
    .register(new BuildProperty("gobblinFlavor", "standard", "Build flavor (see http://gobblin.readthedocs.io/en/latest/developer-guide/GobblinModules/)"))
    .register(new BuildProperty("hadoopVersion", "2.10.0", "Hadoop dependencies version"))
    .register(new BuildProperty("hiveVersion", "1.0.1-avro", "Hive dependencies version"))
    .register(new BuildProperty("icebergVersion", "1.2.0", "Iceberg dependencies version"))
    .register(new BuildProperty("jdkVersion", JavaVersion.VERSION_1_8.toString(),
    "Java languange compatibility; supported versions: " + JavaVersion.VERSION_1_8))
    .register(new BuildProperty("kafka08Version", "0.8.2.2", "Kafka 0.8 dependencies version"))
    .register(new BuildProperty("kafka09Version", "0.9.0.1", "Kafka 0.9 dependencies version"))
    .register(new BuildProperty("kafka1Version", "1.1.1", "Kafka 1.1 dependencies version"))
    .register(new BuildProperty("pegasusVersion", "29.6.4", "Pegasus dependencies version"))
    .register(new BuildProperty("publishToMaven", false, "Enable publishing of artifacts to a central Maven repository"))
    .register(new BuildProperty("publishToNexus", false, "Enable publishing of artifacts to Nexus"))
    .register(new BuildProperty("salesforceVersion", "42.0.0", "Salesforce dependencies version"))
    .register(new BuildProperty("openTelemetryVersion", "1.30.0", "OpenTelemetry dependencies version"))
    .register(new BuildProperty("micrometerVersion", "1.11.1", "Micrometer dependencies version"))
task buildProperties(description: 'Lists main properties that can be used to customize the build') {
  doLast {
    BUILD_PROPERTIES.printHelp();
  }
}

// Gobblin build customization
BUILD_PROPERTIES.ensureDefined('gobblinFlavor')

// Compiler compatibility
BUILD_PROPERTIES.ensureDefined('jdkVersion')

BUILD_PROPERTIES.ensureDefined('sonatypeArtifactRepository')
BUILD_PROPERTIES.ensureDefined('sonatypeArtifactSnapshotRepository')
BUILD_PROPERTIES.ensureDefined('nexusArtifactRepository')
BUILD_PROPERTIES.ensureDefined('nexusArtifactSnapshotRepository')
BUILD_PROPERTIES.ensureDefined('doNotSignArtifacts')

// Library dependencies versions
BUILD_PROPERTIES.ensureDefined('avroVersion')
BUILD_PROPERTIES.ensureDefined('awsVersion')
BUILD_PROPERTIES.ensureDefined('bytemanVersion')
BUILD_PROPERTIES.ensureDefined('confluentVersion')
BUILD_PROPERTIES.ensureDefined('hadoopVersion')
BUILD_PROPERTIES.ensureDefined('hiveVersion')
BUILD_PROPERTIES.ensureDefined('icebergVersion')
BUILD_PROPERTIES.ensureDefined('kafka08Version')
BUILD_PROPERTIES.ensureDefined('kafka09Version')
BUILD_PROPERTIES.ensureDefined('kafka1Version')
BUILD_PROPERTIES.ensureDefined('pegasusVersion')
BUILD_PROPERTIES.ensureDefined('salesforceVersion')
BUILD_PROPERTIES.ensureDefined('openTelemetryVersion')
BUILD_PROPERTIES.ensureDefined('micrometerVersion')

ext.buildProperties = BUILD_PROPERTIES
