description 'Java Swing Tips'

allprojects {
  apply {
    plugin 'java'
    plugin 'application'
  }
  apply from: "$rootDir/checkstyle.gradle"
  apply from: "$rootDir/pmd.gradle"

  repositories {
    mavenCentral()
  }

  def defaultEncoding = 'UTF-8'
  [compileJava, compileTestJava]*.options*.encoding = defaultEncoding
}

subprojects {
  sourceSets {
    main {
      java { srcDir 'src/java' }
      resources { srcDir 'src/java' }
    }
  }

  ext.config = new ConfigSlurper().parse(new File("${project.projectDir}/config.gradle").toURL())

  mainClassName = config.main.class

  // In this section you declare where to find the dependencies of your project
  repositories {
    flatDir { dirs "${project.projectDir}/lib" }
  }

  // In this section you declare the dependencies for your production and test code
  dependencies {
    implementation fileTree(dir: "${project.projectDir}/lib", include: '*.jar')
  }

  version = config.version
  jar {
    manifest {
      attributes 'Implementation-Version': config.version,
                 'Implementation-Vendor': config.vendor,
                 'Main-Class': config.main.class,
                 'Class-Path': config.runtime.classpath
    }
  }
}
