<commit_before># Make life easier :P
set(MKDIR ${CMAKE_COMMAND} -E make_directory)
set(RM ${CMAKE_COMMAND} -E remove)
set(CP ${CMAKE_COMMAND} -E copy)


set(XPI_OUT ${CMAKE_CURRENT_BINARY_DIR}/esteid-${FBSTRING_PLUGIN_VERSION}.xpi)
set(INSTALLRDF ${CMAKE_CURRENT_BINARY_DIR}/install.rdf)

configure_file(install.rdf.in ${INSTALLRDF})

# Build the XPI
add_custom_target( xpi ALL
        DEPENDS ${PROJNAME}
        DEPENDS ${INSTALLRDF}
        DEPENDS chrome.manifest
        DEPENDS chrome
        COMMAND ${RM} ${XPI_OUT}
        COMMAND zip -pr ${XPI_OUT} chrome chrome.manifest 
                    -j ${INSTALLRDF} -x */.svn/*
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        VERBATIM
)<commit_msg>plugins/browser: Reworked xpi zipping logic<commit_after>set(MKDIR ${CMAKE_COMMAND} -E make_directory)
set(RM    ${CMAKE_COMMAND} -E remove)
set(CP    ${CMAKE_COMMAND} -E copy)
set(CPDIR ${CMAKE_COMMAND} -E copy_directory)

set(XPI_STAGE ${CMAKE_CURRENT_BINARY_DIR}/xpi)
set(XPI_OUT ${PROJECT_BINARY_DIR}/esteid-${FBSTRING_PLUGIN_VERSION}.xpi)

configure_file(install.rdf.in ${XPI_STAGE}/install.rdf)

# Stage all files which are going to end up in the .xpi
add_custom_target(xpi-stage
    COMMAND ${CPDIR} ${CMAKE_CURRENT_SOURCE_DIR}/chrome ${XPI_STAGE}
    COMMAND ${CP}    ${CMAKE_CURRENT_SOURCE_DIR}/chrome.manifest ${XPI_STAGE}
    VERBATIM
)

# Compress the XPI
add_custom_target(zip-xpi ALL
    DEPENDS ${PROJNAME}
    DEPENDS ${XPI_STAGE}/install.rdf
    COMMENT "Compressing xpi file"

    WORKING_DIRECTORY ${XPI_STAGE}
    COMMAND ${RM}  ${XPI_OUT}
    COMMAND zip -r ${XPI_OUT} . -x *.svn/*
    VERBATIM
)
add_dependencies(zip-xpi xpi-stage)
{'fraction_non_alphanumeric': 0.11983223487118035, 'fraction_numerical': 0.0, 'mean_word_length': 4.154320987654321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4854610', 'n_tokens_mistral': 676, 'n_tokens_neox': 639, 'n_words': 128}