From d0ec82f54de2be6dffa68aec1f0c3961cd078ea4 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 2 Sep 2024 15:11:37 +0200 Subject: [PATCH] ExtensionSystem: Allow .md files for License and LongDescription Change-Id: Ic5f6ebf72ee97f30c0bca01a046f04aeff319c1f Reviewed-by: Eike Ziller --- cmake/QtCreatorAPI.cmake | 27 +++++++++++++++++++++++- src/plugins/android/Android.json.in | 16 ++------------ src/plugins/android/CMakeLists.txt | 2 ++ src/plugins/android/LICENSE.md | 13 ++++++++++++ src/plugins/android/plugindescription.md | 6 ++++++ 5 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 src/plugins/android/LICENSE.md create mode 100644 src/plugins/android/plugindescription.md diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 1ba02655d4a..7027386ae97 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -328,10 +328,22 @@ function(add_qtc_library name) endif() endfunction(add_qtc_library) + +function(markdown_to_json resultVarName filepath) + file(STRINGS ${filepath} markdown) + list(TRANSFORM markdown REPLACE "\\\\" "\\\\\\\\") # Replace \ with \\ + list(TRANSFORM markdown REPLACE "\\\"" "\\\\\"") # Replace " with \" + list(TRANSFORM markdown PREPEND " \"" ) + list(TRANSFORM markdown APPEND "\"") + list(JOIN markdown ",\n" result) + set(result "[\n${result}\n ]") + set("${resultVarName}" ${result} PARENT_SCOPE) +endfunction() + function(add_qtc_plugin target_name) cmake_parse_arguments(_arg "SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION;EXPORT;SKIP_PCH" - "VERSION;COMPAT_VERSION;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT;PLUGIN_CLASS" + "VERSION;COMPAT_VERSION;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT;PLUGIN_CLASS;LONG_DESCRIPTION_MD;LICENSE_MD" "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;SYSTEM_INCLUDES;PUBLIC_INCLUDES;PUBLIC_SYSTEM_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PLUGIN_TEST_DEPENDS;PLUGIN_MANUAL_DEPENDS;PROPERTIES;PRIVATE_COMPILE_OPTIONS;PUBLIC_COMPILE_OPTIONS" ${ARGN} ) @@ -446,6 +458,19 @@ function(add_qtc_plugin target_name) set(IDE_PLUGIN_DEPENDENCIES ${_arg_DEPENDENCY_STRING}) + set(LONG_DESCRIPTION "[]") + if (_arg_LONG_DESCRIPTION_MD) + markdown_to_json(LONG_DESCRIPTION ${_arg_LONG_DESCRIPTION_MD}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_arg_LONG_DESCRIPTION_MD}) + endif() + + set(LICENSE "[]") + if (_arg_LICENSE_MD) + markdown_to_json(LICENSE ${_arg_LICENSE_MD}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_arg_LICENSE_MD}) + endif() + + ### Configure plugin.json file: if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${name}.json.in") list(APPEND _arg_SOURCES ${name}.json.in) diff --git a/src/plugins/android/Android.json.in b/src/plugins/android/Android.json.in index 3dc4a079030..049363c75aa 100644 --- a/src/plugins/android/Android.json.in +++ b/src/plugins/android/Android.json.in @@ -6,22 +6,10 @@ "VendorId" : "kdenecessitas", "Vendor" : "KDE Necessitas", "Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd", - "License" : [ "Commercial Usage", - "", - "Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.", - "", - "GNU General Public License Usage", - "", - "Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html." - ], + "License" : ${LICENSE}, "Category" : "Device Support", "Description" : "Develop applications for Android devices.", - "LongDescription" : [ - "Connect devices with USB to run, debug, and analyze applications built for them.", - "You also need:", - "- Qt for Android", - "- Android development tools" - ], + "LongDescription" : ${LONG_DESCRIPTION}, "Url" : "https://www.qt.io", "DocumentationUrl" : "https://doc.qt.io/qtcreator/creator-developing-android.html", ${IDE_PLUGIN_DEPENDENCIES}, diff --git a/src/plugins/android/CMakeLists.txt b/src/plugins/android/CMakeLists.txt index 6b29a8a85dd..94a52d5148e 100644 --- a/src/plugins/android/CMakeLists.txt +++ b/src/plugins/android/CMakeLists.txt @@ -1,6 +1,8 @@ add_qtc_plugin(Android DEPENDS QmlDebug Qt::Xml LanguageServerProtocol PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport LanguageClient + LONG_DESCRIPTION_MD plugindescription.md + LICENSE_MD LICENSE.md SOURCES android.qrc androidtr.h diff --git a/src/plugins/android/LICENSE.md b/src/plugins/android/LICENSE.md new file mode 100644 index 00000000000..bc5278e2c74 --- /dev/null +++ b/src/plugins/android/LICENSE.md @@ -0,0 +1,13 @@ +Commercial Usage + +Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt +Commercial License Agreement provided with the Software or, alternatively, in accordance with the +terms contained in a written agreement between you and The Qt Company. + +GNU General Public License Usage + +Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 +as published by the Free Software Foundation with exceptions as appearing in the file +LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following +information to ensure the GNU General Public License requirements will be met: +https://www.gnu.org/licenses/gpl-3.0.html diff --git a/src/plugins/android/plugindescription.md b/src/plugins/android/plugindescription.md new file mode 100644 index 00000000000..97ebab8bb2c --- /dev/null +++ b/src/plugins/android/plugindescription.md @@ -0,0 +1,6 @@ +Connect devices with USB to run, debug, and analyze applications built for them. + +You also need: + +* Qt for Android +* Android development tools