<commit_before>## ---------------------------------------------------------------------
##
## Copyright (C) 2015 by the deal.II Authors
##
## This file is part of the deal.II library.
##
## The deal.II library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE at
## the top level of the deal.II distribution.
##
## ---------------------------------------------------------------------



#
# A target for the preparation of all the stuff happening in here...
#

ADD_CUSTOM_TARGET(code-gallery)


#
# Check whether someone has either specified a global variable that
# points to a code gallery directory, or whether it has been put into
# a top-level code-gallery/ directory alongside the tutorial/
# directory
#
SET_IF_EMPTY(DEAL_II_CODE_GALLERY_DIRECTORY ${CMAKE_SOURCE_DIR}/code-gallery)
IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md)

  MESSAGE(STATUS "Setting up code gallery documentation from ${DEAL_II_CODE_GALLERY_DIRECTORY}.")

  # Collect the names of all code gallery projects. To
  # do so, find all 'author' files, then strip the last two
  # levels of these paths.
  #
  # For unclear reasons, the glob returns these files as
  # "/a/b/c/name//doc//author", so make sure we eat the
  # double slashes in the second step
  FILE(GLOB _code_gallery_names
       "${DEAL_II_CODE_GALLERY_DIRECTORY}/*/doc/author")
  STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}")

  # Now set up targets for each of the code gallery programs

  FOREACH(_step ${_code_gallery_names})
    GET_FILENAME_COMPONENT(_step "${_step}" NAME)
    MESSAGE(STATUS "  Setting up ${_step}")

    # get all source files so we can properly describe the dependencies
    FILE(GLOB_RECURSE _src_files *)

    ADD_CUSTOM_COMMAND(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      COMMAND ${PERL_EXECUTABLE}
      ARGS
        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
        ${_step} ${CMAKE_SOURCE_DIR}
        > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}
      DEPENDS
        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
        ${_src_files}
      )

    ADD_CUSTOM_TARGET(code-gallery_${_step}
      DEPENDS
        ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      )
    ADD_DEPENDENCIES(code-gallery code-gallery_${_step})


  ENDFOREACH()

ELSE()
  MESSAGE(STATUS "Generating the code-gallery documentation is only possible if the code gallery exists in ${DEAL_II_CODE_GALLERY_DIRECTORY}.")
ENDIF()
<commit_msg>Properly track dependencies, and install copies of the code gallery.<commit_after>## ---------------------------------------------------------------------
##
## Copyright (C) 2015 by the deal.II Authors
##
## This file is part of the deal.II library.
##
## The deal.II library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE at
## the top level of the deal.II distribution.
##
## ---------------------------------------------------------------------



#
# A target for the preparation of all the stuff happening in here...
#

ADD_CUSTOM_TARGET(code-gallery)


#
# Check whether someone has either specified a global variable that
# points to a code gallery directory, or whether it has been put into
# a top-level code-gallery/ directory alongside the tutorial/
# directory
#
SET_IF_EMPTY(DEAL_II_CODE_GALLERY_DIRECTORY ${CMAKE_SOURCE_DIR}/code-gallery)
IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md)

  MESSAGE(STATUS "Setting up code gallery documentation from ${DEAL_II_CODE_GALLERY_DIRECTORY}.")

  # Collect the names of all code gallery projects. To
  # do so, find all 'author' files, then strip the last two
  # levels of these paths.
  #
  # For unclear reasons, the glob returns these files as
  # "/a/b/c/name//doc//author", so make sure we eat the
  # double slashes in the second step
  FILE(GLOB _code_gallery_names
       "${DEAL_II_CODE_GALLERY_DIRECTORY}/*/doc/author")
  STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}")

  # Now set up targets for each of the code gallery programs

  FOREACH(_step ${_code_gallery_names})
    GET_FILENAME_COMPONENT(_step "${_step}" NAME)
    MESSAGE(STATUS "  Setting up ${_step}")

    # Get all source files so we can let the perl script work on
    # them and so we properly describe the dependencies. exclude
    # meta-files necessary to describe each code gallery project
    FILE(GLOB_RECURSE _src_files
         ${DEAL_II_CODE_GALLERY_DIRECTORY}/${_step}/*)
    STRING(REPLACE "${DEAL_II_CODE_GALLERY_DIRECTORY}/${_step}/" "" _relative_src_files
           "${_src_files}")
    LIST(REMOVE_ITEM _relative_src_files doc/author)
    LIST(REMOVE_ITEM _relative_src_files doc/tooltip)
    LIST(REMOVE_ITEM _relative_src_files doc/dependencies)
    LIST(REMOVE_ITEM _relative_src_files doc/builds-on)

    ADD_CUSTOM_COMMAND(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      COMMAND ${PERL_EXECUTABLE}
      ARGS
        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
        ${CMAKE_SOURCE_DIR} 
        ${_step} 
        ${DEAL_II_CODE_GALLERY_DIRECTORY}/${_step}
        ${_relative_src_files} 
        > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}
      DEPENDS
        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
        ${_src_files}
      )

    # Copy files of interest (non-metadata) to the build directory
    # so we can link to them, and schedule them for installation
    FILE(COPY ${DEAL_II_CODE_GALLERY_DIRECTORY}/${_step}
         DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
         PATTERN REGEX "doc/tooltip|doc/dependencies|doc/builds-on" EXCLUDE)
    INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_step}
            DESTINATION ${DEAL_II_DOCHTML_RELDIR}/doxygen/code-gallery
            COMPONENT documentation
           )

    # Create a target for this program and add it to the top-level
    # target of this directory
    ADD_CUSTOM_TARGET(code-gallery_${_step}
      DEPENDS
        ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
      )
    ADD_DEPENDENCIES(code-gallery code-gallery_${_step})


  ENDFOREACH()

ELSE()
  MESSAGE(STATUS "Generating the code-gallery documentation is only possible if the code gallery exists in ${DEAL_II_CODE_GALLERY_DIRECTORY}.")
ENDIF()

{'fraction_non_alphanumeric': 0.12874470261581178, 'fraction_numerical': 0.0017536168347216134, 'mean_word_length': 3.1503941782898726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6526192', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2055, 'n_words': 625}