/*
 * Copyright (C) 2011 Google Inc.
 *
 * 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.
 */

task wrapper(type: Wrapper) {
  gradleVersion = '4.10.2'
}

buildscript {
  apply from: "buildscript.gradle"
}

apply plugin: "catkin"
apply plugin: "maven-publish"

allprojects {
  group 'org.ros.rosjava_core'
  version = project.catkin.pkg.version
}

subprojects {
  if (name != 'docs') {
    /*
     * The ros plugin configures a few things:
     *
     *  - local deployment repository : where it dumps the jars and packaged artifacts)
     *  - local maven repositories    : where it finds your locally installed/built artifacts)
     *  - external maven repositories : where it goes looking if it can't find dependencies locally
     *
     * To modify, or add repos to the default external maven repositories list, pull request against this code:
     *
     *   https://github.com/rosjava/rosjava_bootstrap/blob/kinetic/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy#L31
     */
    apply plugin: "ros-java"
    apply plugin: "osgi"
    apply plugin: "idea"
    apply plugin: "eclipse"
  }
}

publishing {
    publications {
        maven(MavenPublication) {
            artifactId = 'rosjava'
            // Comment rs: components.java does not include relast.preprocessor
            // from components.java
            artifact("build/libs/rosjava-${version}.jar") {
                extension 'jar'
            }
        }
    }
    repositories {
        maven {
            url "https://git-st.inf.tu-dresden.de/api/v4/projects/1106/packages/maven"

            credentials(HttpHeaderCredentials) {
                name = 'Job-Token'
                value = System.getenv("CI_JOB_TOKEN")
            }
            authentication {
                header(HttpHeaderAuthentication)
            }
        }

    }
}


defaultTasks 'publish', 'installDist'