/*
 * 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.
 */

apply plugin: 'idea'

subprojects {
  plugins.withType(JavaPlugin) {
    plugins.apply('idea')
    plugins.apply('eclipse')

    // Configure the IDEA plugin to (1) add the codegen as source dirs and (2) work around
    // an apparent bug in the plugin which doesn't set the outputDir/testOutputDir as documented
    idea.module {
      // Gradle docs claim the two settings below are the default, but
      // the actual defaults appear to be "out/production/$MODULE_NAME"
      // and "out/test/$MODULE_NAME". Changing it so IDEA and gradle share
      // the class output directory.

      outputDir = file(sourceSets.main.output.classesDirs.getSingleFile())
      testOutputDir = file(sourceSets.test.output.classesDirs.getSingleFile())
    }

  }
}
