/**
 * $Id: build-dist.gradle 6768 2024-05-31 02:24:23Z 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' watching for JavaDoc
 *         authoring mistakes, and fix them.
 *      2: Run "svn log ^/base/trunk/src/org/hsqldb/cmdline/SqlTool.java | head" and
 *         "svn log ^/base/trunk/src/org/hsqldb/cmdline/SqlFile.java | head" 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.
 *         Except check for real code changes between the *.ent revisions and
 *         the HEAD revisions.  If only comment changes then leave *.ent as-is.
 *      3: Update THIS_VERSION, THIS_FULL_VERSION, MAJOR, MINOR, REVISION in
 *         "../src/org/hsqldb/persist/HsqlDatabaseProperties.java"; and
 *         DBMS VERSION in "../src/org/hsqldb/resources/information-schema.sql".
 *      4: Update property 'hsqldb.version' in file 'build.xml'.
 *         For now it is conditional upon the build JDK.
 *      5: (obsolete step) Execute task/target 'refresh-verbatim' to update code in our docs.
 *      6: Execute task/target 'update-readme' to substitute updated variables
 *         into some doc file(s).
 *      7: Double-check file "../readme.txt".
 *         May or may not need to be updated manually.
 *      8: Commit all of the work above.
 *      9: add or update build.properties with the publication date e.g. "doc.pubtime=2021-03-21".
 *     10: Verify that docs build successfully.  E.g. "gradlew -i regen-docs"
 *     11: Make a release tag.
 *
 *   USAGE:
 *       1: Do a Subversion export with the release tag to a NEW directory
 *       2: 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",
 *          "dbimage.path".  (See following section about optional properties).
 *          Set property "doc.pubtime" to the current date/time in
 *          format like 2019-01-27 18:55:44.
 *       3: Set up your desired build environment (JAVA_HOME of JDK11, etc.).
 *       4: For additional Java 8 jars, use regular late-model java (prev. step)
 *          and cross-compile by setting build properties ant.build.javac and
 *          javac.bootcp.override.  Make sure that build.debug=false.
 *              gradlew hsqldb sqltool
 *          from the build directory.
 *          After the jars are built, COMMENT OUT the cross-compile properties.
 *       5: Run
 *              gradlew -i -b build-dist.gradle
 *          from the build directory..
 *          After the distribution zip is built, it resides in /dist/ and will
 *          be retained there if you proceed with the mvn-pub procedure.
 *       6: If you used a properties file shared with other environments,
 *          then comment out distribution-specific build properties, including
 *          "doc.pubtime" (otherwise future document builds will label
 *          incorrectly).
 *
 *   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)
 */

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'
