You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/01/12 12:06:14 UTC

[GitHub] [solr] dweiss commented on a change in pull request #519: Script to scaffold a new contrib module

dweiss commented on a change in pull request #519:
URL: https://github.com/apache/solr/pull/519#discussion_r783013875



##########
File path: dev-tools/scripts/addContrib.py
##########
@@ -0,0 +1,170 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# 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.
+
+import os
+import sys
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+
+import argparse
+import re
+from textwrap import dedent
+
+def update_build(file_path, search_re, replace_line):
+  print('adding contrib into %s' % file_path)
+  matcher = re.compile(search_re)
+
+  def edit(buffer, match, line):
+    if replace_line in line:
+      return None
+    match = matcher.search(line)
+    if match is not None:
+      buffer.append(replace_line)
+    buffer.append(line)
+    return match is not None
+
+  changed = update_file(file_path, matcher, edit)
+  print('done' if changed else 'uptodate')
+
+
+def read_config():
+  parser = argparse.ArgumentParser(description='Scaffold new contrib module')
+  parser.add_argument("name")
+  parser.add_argument("full_name")
+  parser.add_argument("description")
+  newconf = parser.parse_args()
+  return newconf
+
+
+def get_readme_skel(conrib_name):
+  return dedent('''Apache Solr %s
+=====================================
+
+Introduction
+------------
+TBD
+
+Getting Started
+---------------
+TBD
+''' % conrib_name)
+
+def get_license_header():
+  return '''/*
+ * 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.
+ */
+
+'''
+
+def get_build_gradle(description):
+  return dedent('''apply plugin: 'java-library'
+
+description = '%s'
+
+configurations.all {

Review comment:
       You shouldn't need this or do this. This is wrong. It's not a configuration that should exclude dependencies - it's either a dependency that should exclude it or a configuration this dependency is attached to should make it optional (compileOnly, runtimeOnly).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org