You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/11/25 10:33:38 UTC

[shardingsphere] branch master updated: agent build package (#8338)

This is an automated email from the ASF dual-hosted git repository.

zhangyonglun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 40112c2  agent build package (#8338)
40112c2 is described below

commit 40112c254051012bf8cd281ed51b31e075c626d5
Author: xiaoyu <54...@qq.com>
AuthorDate: Wed Nov 25 18:33:09 2020 +0800

    agent build package (#8338)
---
 shardingsphere-agent/config/agent.yaml             | 23 ++++++
 .../shardingsphere-agent-bootstrap/pom.xml         | 33 +++++++++
 .../shardingsphere-agent-plugins/pom.xml           | 81 +++++++++++++++++++++-
 .../shardingsphere-agent-plugin-metrics/pom.xml    |  2 +-
 .../agent/plugin/metrics/MetricsRegistry.java      | 24 +++++++
 5 files changed, 161 insertions(+), 2 deletions(-)

diff --git a/shardingsphere-agent/config/agent.yaml b/shardingsphere-agent/config/agent.yaml
new file mode 100644
index 0000000..d4ce979
--- /dev/null
+++ b/shardingsphere-agent/config/agent.yaml
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+applicationName: shardingsphere-agent
+
+metrics:
+  host: localhost
+  port: 8090
+
diff --git a/shardingsphere-agent/shardingsphere-agent-bootstrap/pom.xml b/shardingsphere-agent/shardingsphere-agent-bootstrap/pom.xml
index f263a85..db2ee9d 100644
--- a/shardingsphere-agent/shardingsphere-agent-bootstrap/pom.xml
+++ b/shardingsphere-agent/shardingsphere-agent-bootstrap/pom.xml
@@ -105,6 +105,39 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>clean</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <delete dir="${project.basedir}/../../agent" />
+                            </tasks>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <mkdir dir="${project.basedir}/../../agent" />
+                                <copy file="${project.build.directory}/shardingsphere-agent.jar" tofile="${project.basedir}/../../agent/shardingsphere-agent.jar" overwrite="true" />
+                                <mkdir dir="${project.basedir}/../../agent/config" />
+                                <mkdir dir="${project.basedir}/../../agent/logs" />
+                                <copydir src="${project.basedir}/../config" dest="${project.basedir}/../../agent/config" forceoverwrite="true" />
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/pom.xml b/shardingsphere-agent/shardingsphere-agent-plugins/pom.xml
index 7c5a413..e542726 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/pom.xml
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/pom.xml
@@ -31,6 +31,85 @@
         <module>shardingsphere-agent-plugin-metrics</module>
     </modules>
 
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <shade.package>org.apache.shardingsphere.dependencies</shade.package>
+        <sdk.plugin.related.dir/>
+        <shade.net.bytebuddy.source>net.bytebuddy</shade.net.bytebuddy.source>
+        <shade.net.bytebuddy.target>${shade.package}.${shade.net.bytebuddy.source}</shade.net.bytebuddy.target>
+        <agent.package.dest.dir>${project.build.directory}${sdk.plugin.related.dir}/../../../../agent
+        </agent.package.dest.dir>
+        <plugin.dest.dir>${agent.package.dest.dir}/plugins</plugin.dest.dir>
+        <ant-contrib.version>1.0b3</ant-contrib.version>
+        <ant-nodeps.version>1.8.1</ant-nodeps.version>
+    </properties>
 
-
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <shadedArtifactAttached>false</shadedArtifactAttached>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                            <createSourcesJar>true</createSourcesJar>
+                            <shadeSourcesContent>true</shadeSourcesContent>
+                            <relocations>
+                                <relocation>
+                                    <pattern>${shade.net.bytebuddy.source}</pattern>
+                                    <shadedPattern>${shade.net.bytebuddy.target}</shadedPattern>
+                                </relocation>
+                            </relocations>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.runtime.classpath" />
+                                <if>
+                                    <equals arg1="${project.packaging}" arg2="jar" />
+                                    <then>
+                                        <mkdir dir="${plugin.dest.dir}" />
+                                        <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" tofile="${plugin.dest.dir}/${project.artifactId}-${project.version}.jar" overwrite="true" />
+                                    </then>
+                                </if>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>ant-contrib</groupId>
+                        <artifactId>ant-contrib</artifactId>
+                        <version>${ant-contrib.version}</version>
+                        <exclusions>
+                            <exclusion>
+                                <groupId>ant</groupId>
+                                <artifactId>ant</artifactId>
+                            </exclusion>
+                        </exclusions>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.ant</groupId>
+                        <artifactId>ant-nodeps</artifactId>
+                        <version>${ant-nodeps.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/pom.xml b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/pom.xml
index 0ecf447..2ff4fbf 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/pom.xml
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/pom.xml
@@ -25,7 +25,7 @@
         <version>5.0.0-RC1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
+    <packaging>jar</packaging>
     <artifactId>shardingsphere-agent-plugin-metrics</artifactId>
 
 
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/MetricsRegistry.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/MetricsRegistry.java
new file mode 100644
index 0000000..c9e4059
--- /dev/null
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/MetricsRegistry.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.agent.plugin.metrics;
+
+/**
+ * Metrics registry.
+ */
+public class MetricsRegistry {
+}