From 61442cf3be4a1cc1ea211203daf6d48b5787bf85 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 9 Feb 2018 19:45:01 +0200 Subject: [PATCH] Bug 530000 - Add Meson Build support Editors for meson.build, meson_options.txt and *.ninja files. Just highlighting for now based on textmate grammars. Added tm4e to target to enable resolving tm4e bundles. Change-Id: I22859b2d39a96dcd777ee96d2a5e7465e4884839 Signed-off-by: Alexander Kurtakov --- .../org.eclipse.cdt.meson-feature/feature.xml | 7 + .../.classpath | 7 + .../org.eclipse.cdt.meson.ui.editor/.project | 28 +++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 12 ++ .../OSGI-INF/l10n/bundle.properties | 5 + .../build.properties | 7 + .../plugin.xml | 45 +++++ .../syntaxes/meson.json | 167 ++++++++++++++++++ .../syntaxes/ninja.tmLanguage | 106 +++++++++++ pom.xml | 1 + releng/org.eclipse.cdt.target/cdt.target | 6 +- 12 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 build/org.eclipse.cdt.meson.ui.editor/.classpath create mode 100644 build/org.eclipse.cdt.meson.ui.editor/.project create mode 100644 build/org.eclipse.cdt.meson.ui.editor/.settings/org.eclipse.jdt.core.prefs create mode 100644 build/org.eclipse.cdt.meson.ui.editor/META-INF/MANIFEST.MF create mode 100644 build/org.eclipse.cdt.meson.ui.editor/OSGI-INF/l10n/bundle.properties create mode 100644 build/org.eclipse.cdt.meson.ui.editor/build.properties create mode 100644 build/org.eclipse.cdt.meson.ui.editor/plugin.xml create mode 100644 build/org.eclipse.cdt.meson.ui.editor/syntaxes/meson.json create mode 100644 build/org.eclipse.cdt.meson.ui.editor/syntaxes/ninja.tmLanguage diff --git a/build/org.eclipse.cdt.meson-feature/feature.xml b/build/org.eclipse.cdt.meson-feature/feature.xml index 79ee4b375fd..352177769da 100644 --- a/build/org.eclipse.cdt.meson-feature/feature.xml +++ b/build/org.eclipse.cdt.meson-feature/feature.xml @@ -33,4 +33,11 @@ version="0.0.0" unpack="false"/> + + diff --git a/build/org.eclipse.cdt.meson.ui.editor/.classpath b/build/org.eclipse.cdt.meson.ui.editor/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/build/org.eclipse.cdt.meson.ui.editor/.project b/build/org.eclipse.cdt.meson.ui.editor/.project new file mode 100644 index 00000000000..da493162cda --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/.project @@ -0,0 +1,28 @@ + + + org.eclipse.cdt.meson.ui.editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/build/org.eclipse.cdt.meson.ui.editor/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.meson.ui.editor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/build/org.eclipse.cdt.meson.ui.editor/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.meson.ui.editor/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..127daeaf6b3 --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.cdt.meson.ui.editor;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: %vendorName +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.ui.genericeditor;bundle-version="1.0.0", + org.eclipse.tm4e.ui;bundle-version="0.1.0", + org.eclipse.ui.editors;bundle-version="3.11.0", + org.eclipse.core.contenttype;bundle-version="3.6.0" +Automatic-Module-Name: org.eclipse.cdt.meson.ui.editor diff --git a/build/org.eclipse.cdt.meson.ui.editor/OSGI-INF/l10n/bundle.properties b/build/org.eclipse.cdt.meson.ui.editor/OSGI-INF/l10n/bundle.properties new file mode 100644 index 00000000000..9e6903bb74f --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,5 @@ +#Properties file for org.eclipse.cdt.meson.ui.editor +Bundle-Name = Meson editor +vendorName=Eclipse CDT +content-type.meson = Meson +content-type.ninja = Ninja \ No newline at end of file diff --git a/build/org.eclipse.cdt.meson.ui.editor/build.properties b/build/org.eclipse.cdt.meson.ui.editor/build.properties new file mode 100644 index 00000000000..3f23145208f --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + syntaxes/,\ + plugin.xml,\ + OSGI-INF/ diff --git a/build/org.eclipse.cdt.meson.ui.editor/plugin.xml b/build/org.eclipse.cdt.meson.ui.editor/plugin.xml new file mode 100644 index 00000000000..0a5e9f46cbd --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/plugin.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/org.eclipse.cdt.meson.ui.editor/syntaxes/meson.json b/build/org.eclipse.cdt.meson.ui.editor/syntaxes/meson.json new file mode 100644 index 00000000000..af090ed8ddf --- /dev/null +++ b/build/org.eclipse.cdt.meson.ui.editor/syntaxes/meson.json @@ -0,0 +1,167 @@ +{ + "name": "Meson", + "scopeName": "source.meson", + "author": "Patrick Griffis", + "fileTypes": [ + "meson.build", + "meson_options.txt" + ], + "uuid": "b3713e1e-4289-4e0c-88af-79e8876e5adb", + "patterns": [ + { + "match": "\\#.*$", + "name": "comment.line.meson" + }, + { + "include": "#string_quoted_single" + }, + { + "match": "\\b(if|else|elif|endif|foreach|endforeach)\\b", + "name": "keyword.control.flow.meson" + }, + { + "match": "\\b(and|not|or)\\b", + "name": "keyword.operator.logical.meson" + }, + { + "match": "\\b(true|false)\\b", + "name": "constant.language.meson" + }, + { + "match": "\\b([1-9]+[0-9]*\\.[0-9]*)", + "name": "constant.numeric.float.meson" + }, + { + "match": "\\b([1-9]+[0-9]*|0)", + "name": "constant.numeric.integer.decimal.meson" + }, + { + "match": "\\b(meson|host_machine|build_machine|target_machine)\\b", + "name": "support.variable.meson" + }, + { + "match": "\\b([\\w_]+)\\s*(?=:)", + "name": "variable.parameter.function.keyword.meson" + }, + { + "match": "<\\=|>\\=|\\=\\=|<|>|\\!\\=", + "name": "keyword.operator.comparison.meson" + }, + { + "match": "\\+\\=", + "name": "keyword.operator.assignment.augmented.meson" + }, + { + "match": "\\=", + "name": "keyword.operator.assignment.meson" + }, + { + "match": "\\+|\\-|\\*|%|\\/", + "name": "keyword.operator.arithmetic.meson" + }, + { + "match": "(?x)\\b(add_global_arguments|add_project_arguments|add_global_link_arguments|add_project_link_arguments|add_test_setup|add_languages|assert|benchmark|build_target|configuration_data|configure_file|custom_target|declare_dependency|dependency|environment|error|executable|generator|gettext|get_option|get_variable|files|find_library|find_program|include_directories|import|install_data|install_headers|install_man|install_subdir|is_variable|jar|join_paths|library|message|option|project|run_target|run_command|set_variable|subdir|subproject|shared_library|shared_module|static_library|test|vcs_tag\n)\\b\\s*(?=\\()", + "name": "support.function.builtin.meson" + } + ], + "repository": { + "constant_placeholder": { + "match": "(?i:(%(\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?([0-9]*|\\*)(\\.([0-9]*|\\*))?([hL][a-z]|[a-z%]))|(\\{([!\\[\\].:\\w ]+)?\\}))", + "name": "constant.other.placeholder.meson" + }, + "escaped_character": { + "captures": { + "1": { + "name": "constant.character.escape.newline.meson" + }, + "2": { + "name": "constant.character.escape.backlash.meson" + }, + "3": { + "name": "constant.character.escape.single-quote.meson" + }, + "4": { + "name": "constant.character.escape.linefeed.meson" + }, + "5": { + "name": "constant.character.escape.return.meson" + }, + "6": { + "name": "constant.character.escape.tab.meson" + } + }, + "match": "((\\\\\\n)|(\\\\\\\\)|(\\\\')|(\\\\n)|(\\\\r)|(\\\\t))" + }, + "string_quoted_single": { + "patterns": [ + { + "captures": { + "1": { + "name": "puncutation.definition.string.begin.meson" + }, + "2": { + "name": "puncutation.definition.string.end.meson" + }, + "3": { + "name": "meta.empty-string.single.meson" + } + }, + "match": "(? + + + + fileTypes + + ninja + + keyEquivalent + ^~N + name + Ninja + patterns + + + match + ^\t+(?![#\t]).*\n? + name + invalid.illegal.tab-not-allowed-here.ninja + + + match + $[$: ] + name + constant.character.escape.ninja + + + match + \b(build|rule|default)\b + name + storage.type.$1.ninja + + + match + \b(include|subninja)\b + name + keyword.control.$1.ninja + + + captures + + 1 + + name + punctuation.definition.variable.ninja + + + match + (\$)[a-zA-Z_][a-zA-Z0-9_]* + name + variable.other.normal.ninja + + + captures + + 1 + + name + punctuation.definition.variable.ninja + + + match + (\$)\{.*?\} + name + variable.other.bracket.ninja + + + begin + ^([ \t]+)?(?=#) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.ninja + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.ninja + + + end + \n + name + comment.line.number-sign.ninja + + + + + scopeName + source.ninja + uuid + 012183BB-F02F-496D-9910-3B2504674FEC + + diff --git a/pom.xml b/pom.xml index e7c44e215e0..9d53c35e99e 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,7 @@ build/org.eclipse.cdt.meson.core build/org.eclipse.cdt.meson.ui + build/org.eclipse.cdt.meson.ui.editor build/org.eclipse.cdt.meson-feature build/org.eclipse.cdt.core.autotools.core diff --git a/releng/org.eclipse.cdt.target/cdt.target b/releng/org.eclipse.cdt.target/cdt.target index dc9740b4a19..ae82d0eab43 100644 --- a/releng/org.eclipse.cdt.target/cdt.target +++ b/releng/org.eclipse.cdt.target/cdt.target @@ -1,5 +1,5 @@ - + @@ -73,6 +73,10 @@ + + + +