plugins {
  id 'net.researchgate.release'
  id 'maven-publish'
  id 'eclipse'
}

dependencies {
  compileOnly dependencyStrings.JSR305

  testImplementation dependencyStrings.GUAVA
  testImplementation dependencyStrings.JUNIT
  testImplementation dependencyStrings.MOCKITO_CORE
  testImplementation dependencyStrings.SLF4J_API
  testImplementation dependencyStrings.SYSTEM_RULES
}

jar {
  manifest {
    attributes 'Implementation-Version': archiveVersion
    attributes 'Automatic-Module-Name': 'com.google.cloud.tools.jib.api.buildplan'

    // OSGi metadata
    attributes 'Bundle-SymbolicName': 'com.google.cloud.tools.jib.api.buildplan'
    attributes 'Bundle-Name': 'Jib Container Build Plan API'
    attributes 'Bundle-Vendor': 'Google LLC'
    attributes 'Bundle-DocURL': 'https://github.com/GoogleContainerTools/jib'
    attributes 'Bundle-License': 'https://www.apache.org/licenses/LICENSE-2.0'
    attributes 'Export-Package': 'com.google.cloud.tools.jib.api.buildplan'
  }
}

/* RELEASE */
configureMavenRelease()

publishing {
  publications {
    mavenJava(MavenPublication) {
      pom {
        name = 'Jib Container Build Plan API'
        description = 'Jib Container Build Plan API'
      }
      from components.java
    }
  }
}

// Release plugin (git release commits and version updates)
release {
  tagTemplate = 'v$version-build-plan'
  git {
    requireBranch = /^build-plan-release-v\d+.*$/  //regex
  }
}
/* RELEASE */

/* ECLIPSE */
eclipse.classpath.plusConfigurations += [configurations.integrationTestImplementation]
/* ECLIPSE */
