Example #1
0
def copy_htaccess():
    "Copy the .htaccess file from the dev site to the live site."
    LIVE_HTACCESS = os.path.join(LIVE_SITE_DIR, ".htaccess")
    execute("rsync --times %s %s" %
            (os.path.join(DEV_SITE_DIR, ".htaccess"), LIVE_HTACCESS))
    ensure_group_access(LIVE_HTACCESS)
Example #2
0
def ensure_group_access_to_releases():
    """Gives group access to all files and directories in the \"releases\"
    subdirectories on the live web site for the AFU and the
    Checker Framework."""
    ensure_group_access(AFU_LIVE_RELEASES_DIR)
    ensure_group_access(CHECKER_LIVE_RELEASES_DIR)
Example #3
0
def main(argv):
    """The release_build script is responsible for building the release
    artifacts for the AFU and the Checker Framework projects
    and placing them in the development web site. It can also be used to review
    the documentation and changelogs for the three projects."""
    # MANUAL Indicates a manual step
    # AUTO Indicates the step is fully automated.

    delete_if_exists(RELEASE_BUILD_COMPLETED_FLAG_FILE)

    set_umask()

    global debug
    global ant_debug
    debug = read_command_line_option(argv, "--debug")
    if debug:
        ant_debug = "-debug"
    global notest
    notest = read_command_line_option(argv, "--notest")

    afu_date = get_afu_date()

    # For each project, build what is necessary but don't push

    print(
        "Building a new release of Annotation Tools and the Checker Framework!"
    )

    print("\nPATH:\n" + os.environ["PATH"] + "\n")

    print_step("Build Step 1: Clone the build and intermediate repositories."
               )  # MANUAL

    # Recall that there are 3 relevant sets of repositories for the release:
    # * build repository - repository where the project is built for release
    # * intermediate repository - repository to which release related changes are pushed after the project is built
    # * release repository - GitHub repositories, the central repository.

    # Every time we run release_build, changes are committed to the intermediate repository from build but NOT to
    # the release repositories. If we are running the build script multiple times without actually committing the
    # release then these changes need to be cleaned before we run the release_build script again.
    # The "Clone/update repositories" step updates the repositories with respect to the live repositories on
    # GitHub, but it is the "Verify repositories" step that ensures that they are clean,
    # i.e. indistinguishable from a freshly cloned repository.

    # check we are cloning LIVE -> INTERM, INTERM -> RELEASE
    print_step("\n1a: Clone/update repositories.")  # MANUAL
    clone_or_update_repos()

    # This step ensures the previous step worked. It checks to see if we have any modified files, untracked files,
    # or outgoing changesets. If so, it fails.

    print_step("1b: Verify repositories.")  # MANUAL
    check_repos(INTERM_REPOS, True, True)
    check_repos(BUILD_REPOS, True, False)

    # The release script requires a number of common tools (Ant, Maven, make, etc...). This step checks
    # to make sure all tools are available on the command line in order to avoid wasting time in the
    # event a tool is missing late in execution.

    print_step("Build Step 2: Check tools.")  # AUTO
    check_tools(TOOLS)

    # Usually we increment the release by 0.0.1 per release unless there is a major change.
    # The release script will read the current version of the Checker Framework/Annotation File Utilities
    # from the release website and then suggest the next release version 0.0.1 higher than the current
    # version. You can also manually specify a version higher than the current version. Lower or equivalent
    # versions are not possible and will be rejected when you try to push the release.

    print_step("Build Step 3: Determine release versions.")  # MANUAL

    old_cf_version = current_distribution_by_website(LIVE_SITE_URL)
    cf_version = CF_VERSION
    print("Version: " + cf_version + "\n")

    if old_cf_version == cf_version:
        print((
            "It is *strongly discouraged* to not update the release version numbers for the Checker Framework "
            +
            "even if no changes were made to these in a month. This would break so much "
            +
            "in the release scripts that they would become unusable. Update the version number in checker-framework/build.gradle\n"
        ))
        prompt_to_continue()

    print_step(
        "Build Step 4: Create directories for the current release on the dev site."
    )  # AUTO

    (
        afu_interm_dir,
        checker_framework_interm_dir,
    ) = create_dirs_for_dev_website_release_versions(cf_version)

    # The projects are built in the following order:
    # Annotation File Utilities and Checker Framework. Furthermore, their
    # manuals and websites are also built and placed in their relevant locations
    # at https://checkerframework.org/dev/ .  This is the most time-consuming
    # piece of the release. There are no prompts from this step forward; you
    # might want to get a cup of coffee and do something else until it is done.

    print_step("Build Step 5: Build projects and websites.")  # AUTO

    print_step("5a: Build Annotation File Utilities.")
    build_annotation_tools_release(cf_version, afu_interm_dir)

    print_step("5b: Build Checker Framework.")
    build_checker_framework_release(
        cf_version,
        old_cf_version,
        afu_date,
        checker_framework_interm_dir,
    )

    print_step("Build Step 6: Overwrite .htaccess and CFLogo.png .")  # AUTO

    # Not "cp -p" because that does not work across filesystems whereas rsync does
    CFLOGO = os.path.join(CHECKER_FRAMEWORK, "docs", "logo", "Logo",
                          "CFLogo.png")
    execute("rsync --times %s %s" % (CFLOGO, checker_framework_interm_dir))

    # Each project has a set of files that are updated for release. Usually these updates include new
    # release date and version information. All changed files are committed and pushed to the intermediate
    # repositories. Keep this in mind if you have any changed files from steps 1d, 4, or 5. Edits to the
    # scripts in the cf-release/scripts directory will never be checked in.

    print_step("Build Step 7: Commit projects to intermediate repos.")  # AUTO
    commit_to_interm_projects(cf_version)

    # Adds read/write/execute group permissions to all of the new dev website directories
    # under https://checkerframework.org/dev/ These directories need group read/execute
    # permissions in order for them to be served.

    print_step("\n\nBuild Step 8: Add group permissions to repos.")
    for build in BUILD_REPOS:
        ensure_group_access(build)

    for interm in INTERM_REPOS:
        ensure_group_access(interm)

    # At the moment, this will lead to output error messages because some metadata in some of the
    # dirs I think is owned by Mike or Werner.  We should identify these and have them fix it.
    # But as long as the processes return a zero exit status, we should be ok.
    print_step("\n\nBuild Step 9: Add group permissions to websites.")  # AUTO
    ensure_group_access(DEV_SITE_DIR)

    create_empty_file(RELEASE_BUILD_COMPLETED_FLAG_FILE)