فهرست منبع

HUE-2451 [core] Split parser generation in the makefile

Johan Ahlen 8 سال پیش
والد
کامیت
1a0a121

+ 24 - 4
Makefile

@@ -232,13 +232,33 @@ ace:
 
 
 ###################################
-# JISON Parser Generator
+# JISON Parser Generators
 ###################################
 
 # <<<< DEV ONLY
-.PHONY: jison
-jison:
-	@cd tools/jison && ./hue-jison.sh
+.PHONY: global-search-parser
+global-search-parser:
+	@cd tools/jison && ./hue-global-search.sh
+
+.PHONY: solr-formula-parser
+solr-formula-parser:
+	@cd tools/jison && ./hue-solr-formula.sh
+
+.PHONY: sql-all-parsers
+sql-all-parsers:
+	@cd tools/jison && ./hue-sql-autocomplete.sh && ./hue-sql-statement.sh && ./hue-sql-syntax.sh
+
+.PHONY: sql-autocomplete-parser
+sql-autocomplete-parser:
+	@cd tools/jison && ./hue-sql-autocomplete.sh
+
+.PHONY: sql-statement-parser
+sql-statement-parser:
+	@cd tools/jison && ./hue-sql-statement.sh
+
+.PHONY: sql-syntax-parser
+sql-syntax-parser:
+	@cd tools/jison && ./hue-sql-syntax.sh
 # END DEV ONLY >>>>
 
 ###################################

+ 31 - 0
tools/jison/hue-global-search.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+echo "Make sure you install jison first (npm install jison -g)"
+echo ""
+echo "Generating parser..."
+
+pushd ../../desktop/core/src/desktop/static/desktop/js/autocomplete/jison
+
+echo "Creating Global Search parser..."
+jison globalSearchParser.jison
+grunt uglify:globalSearchParser
+cat license.txt globalSearchParser.js > ../globalSearchParser.js
+rm globalSearchParser.js
+
+popd
+echo "Done!"

+ 31 - 0
tools/jison/hue-solr-formula.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+echo "Make sure you install jison first (npm install jison -g)"
+echo ""
+echo "Generating parser..."
+
+pushd ../../desktop/core/src/desktop/static/desktop/js/autocomplete/jison
+
+echo "Creating SOLR Expression parser..."
+jison solrExpressionParser.jison
+grunt uglify:solrExpressionParser
+cat license.txt solrExpressionParser.js > ../solrExpressionParser.js
+rm solrExpressionParser.js
+
+popd
+echo "Done!"

+ 36 - 0
tools/jison/hue-sql-autocomplete.sh

@@ -0,0 +1,36 @@
+#!/bin/bash
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+echo "Make sure you install jison first (npm install jison -g)"
+echo ""
+echo "Generating parser..."
+
+pushd ../../desktop/core/src/desktop/static/desktop/js/autocomplete/jison
+
+# For quick version of just SELECT statements without value expressions
+# cat autocomplete_header.jison sql_main.jison autocomplete_footer.jison > sqlAutocompleteParser.jison
+cat autocomplete_header.jison sql_main.jison sql_valueExpression.jison sql_error.jison sql_alter.jison sql_analyze.jison sql_create.jison sql_drop.jison sql_grant.jison sql_insert.jison sql_load.jison sql_set.jison sql_show.jison sql_update.jison sql_use.jison autocomplete_footer.jison > sqlAutocompleteParser.jison
+
+echo "Creating SQL autocomplete parser..."
+jison sqlAutocompleteParser.jison sql.jisonlex
+grunt uglify:sqlAutocompleteParser
+cat license.txt sqlAutocompleteParser.js > ../sqlAutocompleteParser.js
+rm sqlAutocompleteParser.jison
+rm sqlAutocompleteParser.js
+
+popd
+echo "Done!"

+ 31 - 0
tools/jison/hue-sql-statement.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+echo "Make sure you install jison first (npm install jison -g)"
+echo ""
+echo "Generating parser..."
+
+pushd ../../desktop/core/src/desktop/static/desktop/js/autocomplete/jison
+
+echo "Creating SQL statements parser..."
+jison sqlStatementsParser.jison
+grunt uglify:sqlStatementsParser
+cat license.txt sqlStatementsParser.js > ../sqlStatementsParser.js
+rm sqlStatementsParser.js
+
+popd
+echo "Done!"

+ 0 - 33
tools/jison/hue-jison.sh → tools/jison/hue-sql-syntax.sh

@@ -21,18 +21,6 @@ echo "Generating parser..."
 
 pushd ../../desktop/core/src/desktop/static/desktop/js/autocomplete/jison
 
-# === Autocomplete parser ===
-# For quick version of just SELECT statements without value expressions
-# cat autocomplete_header.jison sql_main.jison autocomplete_footer.jison > sqlAutocompleteParser.jison
-cat autocomplete_header.jison sql_main.jison sql_valueExpression.jison sql_error.jison sql_alter.jison sql_analyze.jison sql_create.jison sql_drop.jison sql_grant.jison sql_insert.jison sql_load.jison sql_set.jison sql_show.jison sql_update.jison sql_use.jison autocomplete_footer.jison > sqlAutocompleteParser.jison
-
-echo "Creating SQL autocomplete parser..."
-jison sqlAutocompleteParser.jison sql.jisonlex
-grunt uglify:sqlAutocompleteParser
-cat license.txt sqlAutocompleteParser.js > ../sqlAutocompleteParser.js
-rm sqlAutocompleteParser.jison
-rm sqlAutocompleteParser.js
-
 # === Syntax parser ===
 cat syntax_header.jison sql_main.jison sql_valueExpression.jison  sql_alter.jison sql_analyze.jison sql_create.jison sql_drop.jison sql_grant.jison sql_insert.jison sql_load.jison sql_set.jison sql_show.jison sql_update.jison sql_use.jison syntax_footer.jison > sqlSyntaxParser.jison
 
@@ -46,26 +34,5 @@ cat license.txt sqlSyntaxParser.js > ../sqlSyntaxParser.js
 rm sqlSyntaxParser.jison
 rm sqlSyntaxParser.js
 
-# === Statement parser ===
-echo "Creating SQL statements parser..."
-jison sqlStatementsParser.jison
-grunt uglify:sqlStatementsParser
-cat license.txt sqlStatementsParser.js > ../sqlStatementsParser.js
-rm sqlStatementsParser.js
-
-# === Global Search parser ===
-echo "Creating Global Search parser..."
-jison globalSearchParser.jison
-grunt uglify:globalSearchParser
-cat license.txt globalSearchParser.js > ../globalSearchParser.js
-rm globalSearchParser.js
-
-# === SOLR Expression parser ===
-echo "Creating SOLR Expression parser..."
-jison solrExpressionParser.jison
-grunt uglify:solrExpressionParser
-cat license.txt solrExpressionParser.js > ../solrExpressionParser.js
-rm solrExpressionParser.js
-
 popd
 echo "Done!"