/**
 * $Id: build-dist.gradle 5457 2015-04-09 01:11:00Z unsaved $
 *
 * Invoke this build file with Gradle's -b switch for zip and jar
 * distribution building.
 *
 * Unfortunately, it is impractical to encpasulate all of the needed processing
 * here, so there is some tight coupling between this file and "build.gradle".
 * (This file loads/applies "build.gradle").
 *
 *   "build-dist.gradle" and "build-dist.xml" are separate from the main
 *   "build.*" files specifically because they are not intended for normal
 *   end-user or developer usage.
 *   They are only for generating full distributable packages of the app.
 *   This build file is NOT necessary to build a distributable jar file:
 *   that is the purpose of several tasks/targets in the main build files.
 *
 *   PREP:  Before building a public distribution, you must:
 *      1: Run task/targets 'javadoc' and 'javadocdev', watching for JavaDoc
 *         authoring mistakes, and fix them.
 *      2: Update HyperSQL minor or version number if required in file
 *         "../doc-src/guide/entities/versions.ent".
 *      3: Run "svn info ../src/org/hsqldb/cmdline/Sql????.java" to determine
 *         the "Last Changed Rev"s of SqlTool.java and SqlFile.java.
 *         Update the revision values in file
 *         "../doc-src/util-guide/entities/versions.ent" accordingly.
 *      4. Update THIS_VERSION, THIS_FULL_VERSION, MAJOR, MINOR, REVISION, and
 *         perhaps THIS_CACHE_VERSION in
 *         "../src/org/hsqldb/persist/HsqlDatabaseProperties.java"; and
 *         DBMS VERSION in "../src/org/hsqldb/resources/information-schema.sql".
 *      5: Update property 'hsqldb.version' in file 'build.xml'.
 *      6: Execute task/target 'refresh-verbatim' to update code in our docs.
 *      7: Execute task/target 'update-readme' to substitute updated variables
 *         into some doc file(s).
 *      8: Double-check file "../readme.txt".
 *         May or may not need to be updated manually.
 *      9: Commit all of the work above.
 *     10: Verify that docs build successfully.  E.g. "gradlew -i regen-docs"
 *     11. Make a release tag.
 *
 *   USAGE:
 *       1: Set up your desired build environment (JAVA_HOME set, etc.).
 *       2: Do a Subversion export with the release tag to a NEW directory
 *       3: If you don't have a .properties file set up for this purpose
 *          already, then make one outside of this work area with a distinctive
 *          name (for auditing and so you can archive it and/or re-use it for
 *          future distribution builds), then copy it to "build.properties"
 *          in this directory.  (If on a good operating system, just sym-link).
 *          This file must set Ant properties "build.label", "build.vendor",
 *          "dbimage.path".  (See following section about optional properties).
 *       4: Run
 *              gradlew -i -b build-dist.gradle  # Gradle users
 *          from the build directory.
 *
 *   OPTIONAL ANT PROPERTIES
 *       I suggest setting properties nsstylebase.url, dbxirng.url,
 *         dbcentx.url in file "local-docbook.properties" or
 *         "build.properties" in the external (or shared) build properties
           explained above), according to the
 *         reasons documented at the top of "build-docbook.xml", and according
 *         to the instructions there (except use the specified properties file).
 *       Add settings for build.debug and build.optimize to change the default
 *         compilation settings.
 *
 *   You may add or edit some files without them being added to the
 *   distribution that you build:  build/build.properties,
 *   build/local*.properties, tmp/*, classes/*, dist/*.
 *   If you don't know if something will have an effect on the distribution
 *   you are building, then *don't do it*.
 *   If you were to add a "todo.txt" file to the main or build directory;
 *   or run "gradle hsqldbtest", for example, artifacts would be added to
 *   the distro.
 *
 * @author Blaine Simpson  (blaine dot simpson at admc dot com)
 */

buildscript { dependencies {
    classpath fileTree(dir: '.', include: 'gradle-javaPropFile-plugin-*.jar')
    classpath fileTree(dir: '.', include: 'gradle-ivyxml-plugin-*.jar')
} }

import org.apache.tools.ant.types.Path

project.ext.addlAntBuildFiles = [file('build-dist.xml')]

project.ext.addlAntBuildClosures = [{
        it.import.find{it.@file = 'build-gradled.xml'}
        it.@name = it.@name.text() + '_gradled'
        it.attributes().remove('basedir')
    }
]

apply from: 'build.gradle'

defaultTasks 'dist'
