This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 113a92970627e3e0277f8abe595460c5bbe8cd54 Author: Gabor Gyimesi <[email protected]> AuthorDate: Wed Apr 20 18:31:27 2022 +0200 MINIFICPP-1805 Remove unused bootstrap extension Closes #1308 Signed-off-by: Marton Szasz <[email protected]> --- C2.md | 16 ------ CMakeLists.txt | 5 -- extensions/bootstrap/CMakeLists.txt | 41 -------------- extensions/bootstrap/bootstrap.cpp | 57 -------------------- extensions/bootstrap/docs/generatec2docs.h | 86 ------------------------------ 5 files changed, 205 deletions(-) diff --git a/C2.md b/C2.md index 37be50abd..8486cc5e3 100644 --- a/C2.md +++ b/C2.md @@ -368,19 +368,3 @@ update process will be halted. # specifying a trigger nifi.c2.agent.trigger.classes=FileUpdateTrigger nifi.c2.file.watch=<full path of file to monitor> - - - -## Documentation - -Type descriptions ( class descriptions entered in PROCESSORS.md ) can be automatically placed within C2 by building cmake with -the following flag: - - cmake -DBOOTSTRAP=ON .. - - You can then run ./extensions/bootstrap/bstrp --inputc2docs <PROCESSORS.md> --outputc2docs ../libminifi/include/agent/agent_docs.h - - When cmake is instantiated with this, a build will re-generate the type descriptions from PROCESSORS.md. Once this is finished - you may re-build the project with the following command from the build directory, running the build as you normally would: - - cmake -DBOOTSTRAP= .. diff --git a/CMakeLists.txt b/CMakeLists.txt index ff9630eb6..acf2e0ecd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,11 +403,6 @@ endif() SET(TEST_DIR ${CMAKE_SOURCE_DIR}/libminifi/test) include(Extensions) -if(BOOTSTRAP) - # display an error message for those using the bootstrap - message(FATAL_ERROR "Bootstrapping is no longer needed within the agent") -endif() - add_subdirectory(libminifi) createExtension(STANDARD-PROCESSORS "STANDARD PROCESSORS" "Provides standard processors" "extensions/standard-processors" "extensions/standard-processors/tests/") diff --git a/extensions/bootstrap/CMakeLists.txt b/extensions/bootstrap/CMakeLists.txt deleted file mode 100644 index c6a79805e..000000000 --- a/extensions/bootstrap/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -cmake_minimum_required(VERSION 2.6) - -include_directories(../../libminifi/include) - -set(BOOTSTRAP_SOURCES bootstrap.cpp) -add_executable(bstrp ${BOOTSTRAP_SOURCES}) - -target_link_libraries(bstrp cxxopts) - -set_target_properties(bstrp - PROPERTIES OUTPUT_NAME bstrp) - - -add_custom_target(bootstrap-docs - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bstrp --inputc2docs "${CMAKE_SOURCE_DIR}/PROCESSORS.md" --outputc2docs "${CMAKE_SOURCE_DIR}/libminifi/include/agent/agent_docs.h" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Generates documentation ${CMAKE_CURRENT_SOURCE_DIR}" - SOURCES ${BOOTSTRAP_SOURCES} -) - -execute_process(COMMAND bootstrap-docs) - diff --git a/extensions/bootstrap/bootstrap.cpp b/extensions/bootstrap/bootstrap.cpp deleted file mode 100644 index 813c8f767..000000000 --- a/extensions/bootstrap/bootstrap.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include <stdio.h> -#include <signal.h> -#include <vector> -#include <queue> -#include <map> -#include <unistd.h> - -#include "cxxopts.hpp" -#include "docs/generatec2docs.h" - -int main(int argc, char **argv) { - cxxopts::Options options("Bootstrap", "Build bootstrap"); - options.positional_help("[optional args]").show_positional_help(); - - options.add_options() //NOLINT - ("h,help", "Shows Help") //NOLINT - ("inputc2docs", "Input C2 documentation readme", cxxopts::value<std::string>()) //NOLINT - ("outputc2docs", "Specifies output directory for generated C2 documentation", cxxopts::value<std::string>()); - - try { - auto result = options.parse(argc, argv); - - if (result.count("help")) { - std::cout << options.help({ "", "Group" }) << std::endl; - exit(0); - } - - if (result.count("inputc2docs") && result.count("outputc2docs")) { - generateC2Docs(result["inputc2docs"].as<std::string>(), result["outputc2docs"].as<std::string>()); - std::cout << "Generated docs at " << result["outputc2docs"].as<std::string>() << std::endl; - } - }catch (const std::exception &exc) { - // catch anything thrown within try block that derives from std::exception - std::cerr << exc.what() << std::endl; - } catch (...) { - std::cout << options.help({ "", "Group" }) << std::endl; - exit(0); - } - return 0; -} diff --git a/extensions/bootstrap/docs/generatec2docs.h b/extensions/bootstrap/docs/generatec2docs.h deleted file mode 100644 index 637900c34..000000000 --- a/extensions/bootstrap/docs/generatec2docs.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <string> -#include <fstream> -#include <streambuf> -#include <iostream> -#include <regex> -#include <iomanip> -#include "utils/StringUtils.h" - -int generateC2Docs(const std::string &inputfile, const std::string &output) { - std::ifstream inf(inputfile); - std::string input((std::istreambuf_iterator<char>(inf)), std::istreambuf_iterator<char>()); - std::smatch m; - std::smatch n; - std::regex e("## ([A-Za-z]+)\\s+### Description\\s"); - - std::ofstream outputFile(output); - outputFile << "/*" \ - "*" \ - "* Licensed to the Apache Software Foundation (ASF) under one or more\n" \ - "* contributor license agreements. See the NOTICE file distributed with\n" \ - "* this work for additional information regarding copyright ownership.\n" \ - "* The ASF licenses this file to You under the Apache License, Version 2.0\n" \ - "* (the \"License\"); you may not use this file except in compliance with\n" \ - "* the License. You may obtain a copy of the License at\n" \ - "*\n" \ - "* http://www.apache.org/licenses/LICENSE-2.0\n" \ - "*\n" \ - "* Unless required by applicable law or agreed to in writing, software\n" \ - "* distributed under the License is distributed on an \"AS IS\" BASIS,\n" \ - "* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" \ - "* See the License for the specific language governing permissions and\n" \ - "* limitations under the License.\n" \ - "*/\n" \ - "#ifndef AGENT_DOCS_H" << '\n'; - outputFile << "#define AGENT_DOCS_H" << '\n'; - outputFile << "#include <string>\n#include <stdlib.h>\n#include <utils/StringUtils.h>\n"; - outputFile << "namespace org {\n " - "namespace apache { \n" - "namespace nifi { \n" - "namespace minifi { \n" - "class AgentDocs{ \n" - " public: \n" - " static std::string getDescription(const std::string &feature){ \n" - " static std::map<std::string,std::string> extensions; \n" - " if (extensions.empty()){ \n"; - - while (std::regex_search(input, m, e)) { - auto processor = m[1].str(); - - input = m.suffix().str(); - - auto nextBlock = input.find("###"); - - auto description = input.substr(0, nextBlock); - - auto desc = org::apache::nifi::minifi::utils::StringUtils::trim(description); - outputFile << " extensions.insert(std::make_pair(\"" << processor << "\",utils::StringUtils::from_hex(\"" << org::apache::nifi::minifi::utils::StringUtils::to_hex(desc) << "\")));\n"; - } - - outputFile << "}\n return extensions[feature]; \n" - " \n} \n}; \n} \n} \n} \n} \n" - "#endif"; - - outputFile.close(); - - return 0; -} -
