Mercurial > hg > thermostat
changeset 2278:21d476af1f0e
Move Byteman misc files into vm-byteman plugin folder.
Reviewed-by: neugens
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-April/018418.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Fri, 29 Apr 2016 08:51:24 +0200 |
parents | a15a2233e4c7 |
children | a82d1142f074 |
files | assembly/src/main/resources/assemblies/plugin-libs-assembly.xml distribution/assembly/plugin-libs-assembly.xml distribution/pom.xml vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/UpdateRulePollingAction.java vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanBackend.java vm-byteman/byteman-helper-distro/pom.xml |
diffstat | 6 files changed, 217 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/assembly/src/main/resources/assemblies/plugin-libs-assembly.xml Fri Apr 29 08:51:24 2016 +0200 @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2012-2016 Red Hat, Inc. + + This file is part of Thermostat. + + Thermostat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + Thermostat is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Thermostat; see the file COPYING. If not see + <http://www.gnu.org/licenses/>. + + Linking this code with other modules is making a combined work + based on this code. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + As a special exception, the copyright holders of this code give + you permission to link this code with independent modules to + produce an executable, regardless of the license terms of these + independent modules, and to copy and distribute the resulting + executable under terms of your choice, provided that you also + meet, for each linked independent module, the terms and conditions + of the license of that module. An independent module is a module + which is not derived from or based on this code. If you modify + this code, you may extend this exception to your version of the + library, but you are not obligated to do so. If you do not wish + to do so, delete this exception statement from your version. + +--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>plugin-libs-assembly</id> + <formats> + <format>zip</format> + </formats> + <baseDirectory>${thermostat.plugin}/plugin-libs</baseDirectory> + <includeBaseDirectory>true</includeBaseDirectory> + + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <useTransitiveDependencies>false</useTransitiveDependencies> + <!-- Skip deps as defined in poms in the assembled zip --> + <excludes> + <exclude>*</exclude> + </excludes> + </dependencySet> + </dependencySets> + + <fileSets> + <fileSet> + <!-- include everything in dir ${thermostat.plugin.libs.dir} --> + <directory>${thermostat.plugin.libs.dir}</directory> + <outputDirectory>/</outputDirectory> + </fileSet> + </fileSets> +</assembly> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distribution/assembly/plugin-libs-assembly.xml Fri Apr 29 08:51:24 2016 +0200 @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2012-2016 Red Hat, Inc. + + This file is part of Thermostat. + + Thermostat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + Thermostat is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Thermostat; see the file COPYING. If not see + <http://www.gnu.org/licenses/>. + + Linking this code with other modules is making a combined work + based on this code. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + As a special exception, the copyright holders of this code give + you permission to link this code with independent modules to + produce an executable, regardless of the license terms of these + independent modules, and to copy and distribute the resulting + executable under terms of your choice, provided that you also + meet, for each linked independent module, the terms and conditions + of the license of that module. An independent module is a module + which is not derived from or based on this code. If you modify + this code, you may extend this exception to your version of the + library, but you are not obligated to do so. If you do not wish + to do so, delete this exception statement from your version. + +--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>plugin-libs-assembly</id> + <formats> + <format>dir</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <unpack>true</unpack> + <includes> + <include>com.redhat.thermostat:thermostat-vm-byteman-helper-distro</include> + </includes> + </dependencySet> + </dependencySets> + +</assembly> +
--- a/distribution/pom.xml Tue Apr 26 10:27:02 2016 -0400 +++ b/distribution/pom.xml Fri Apr 29 08:51:24 2016 +0200 @@ -94,46 +94,6 @@ <excludeTransitive>true</excludeTransitive> </configuration> </execution> - <!-- Extract the byteman helper distro (including transitive deps) into directory - image/libs/byteman/thermostat-helper by using maven-dependency-plugin. --> - <execution> - <id>copy-byteman-helper-to-libs</id> - <phase>package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>com.redhat.thermostat</groupId> - <artifactId>thermostat-vm-byteman-helper-distro</artifactId> - <type>zip</type> - </artifactItem> - </artifactItems> - <outputDirectory>${project.build.directory}/image/libs/byteman/thermostat-helper</outputDirectory> - </configuration> - </execution> - <!-- Extract the byteman jar to directory - image/libs/byteman/byteman-install/lib by using maven-dependency-plugin. - The byteman plugin uses $THERMOSTAT_HOME/byteman/byteman-install as - $BYTEMAN_HOME. - --> - <execution> - <id>copy-byteman-jar-to-byteman-install</id> - <phase>prepare-package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.jboss.byteman</groupId> - <artifactId>byteman</artifactId> - </artifactItem> - </artifactItems> - <outputDirectory>${project.build.directory}/image/libs/byteman/byteman-install/lib</outputDirectory> - </configuration> - </execution> </executions> </plugin> <plugin> @@ -170,6 +130,20 @@ <goal>single</goal> </goals> </execution> + <execution> + <id>assemble-all-plugin-libs</id> + <configuration> + <descriptors> + <descriptor>assembly/plugin-libs-assembly.xml</descriptor> + </descriptors> + <finalName>image/plugins</finalName> + <attach>false</attach> + </configuration> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> </executions> </plugin> <plugin> @@ -311,19 +285,6 @@ </goals> </execution> <execution> - <id>symlink-byteman.jar</id> - <phase>package</phase> - <configuration> - <target> - <symlink link="${project.build.directory}/image/libs/byteman/byteman-install/lib/byteman.jar" - resource="${project.build.directory}/image/libs/byteman/byteman-install/lib/byteman-${byteman.version}.jar"/> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> <id>directory-structure</id> <phase>prepare-package</phase> <configuration> @@ -701,16 +662,6 @@ <type>zip</type> </dependency> - <!-- Third party libs --> - - <!-- - Dependency merely for byteman.jar copying to the right place - --> - <dependency> - <groupId>org.jboss.byteman</groupId> - <artifactId>byteman</artifactId> - <version>${byteman.version}</version> - </dependency> </dependencies> </project>
--- a/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/UpdateRulePollingAction.java Tue Apr 26 10:27:02 2016 -0400 +++ b/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/UpdateRulePollingAction.java Fri Apr 29 08:51:24 2016 +0200 @@ -58,7 +58,9 @@ class UpdateRulePollingAction implements VmPollingAction { - private static final String BYTEMAN_HELPER_DIR = "byteman" + File.separator + "thermostat-helper"; + private static final String BYTEMAN_PLUGIN_DIR = System.getProperty("thermostat.plugin", "vm-byteman"); + private static final String BYTEMAN_PLUGIN_LIBS_DIR = BYTEMAN_PLUGIN_DIR + File.separator + "plugin-libs"; + private static final String BYTEMAN_HELPER_DIR = BYTEMAN_PLUGIN_LIBS_DIR + File.separator + "thermostat-helper"; private static final String BYTEMAN_SCRIPT_NAME = "bytemanRule.btm"; private static final Logger logger = LoggingUtils.getLogger(UpdateRulePollingAction.class); static final List<ScriptText> bmScripts; @@ -74,7 +76,7 @@ UpdateRulePollingAction(BytemanAgentInfo agentInfo, CommonPaths paths) { this.agentInfo = agentInfo; this.rulesSubmitted = new HashMap<>(); - File bytemanHelperDir = new File(paths.getSystemLibRoot(), BYTEMAN_HELPER_DIR); + File bytemanHelperDir = new File(paths.getSystemPluginRoot(), BYTEMAN_HELPER_DIR); initListOfHelperJars(bytemanHelperDir); }
--- a/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanBackend.java Tue Apr 26 10:27:02 2016 -0400 +++ b/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/VmBytemanBackend.java Fri Apr 29 08:51:24 2016 +0200 @@ -69,7 +69,8 @@ private static final String NAME = "VM Byteman backend (attacher)"; private static final String DESCRIPTION = "Attaches the byteman java agent to JVMs"; private static final String VENDOR = "Red Hat Inc."; - private static final String BYTEMAN_INSTALL_HOME = "byteman" + File.separator + "byteman-install"; + private static final String BYTEMAN_PLUGIN_DIR = System.getProperty("thermostat.plugin", "vm-byteman"); + private static final String BYTEMAN_INSTALL_HOME = BYTEMAN_PLUGIN_DIR + File.separator + "plugin-libs" + File.separator + "byteman-install"; private static final String BYTEMAN_HOME_PROPERTY = "org.jboss.byteman.home"; private static final Logger logger = LoggingUtils.getLogger(VmBytemanBackend.class); static final int BACKEND_ORDER_VALUE = ORDER_CODE_GROUP + 3; @@ -128,7 +129,7 @@ @Override public boolean activate() { if (!started) { - String bytemanHome = paths.getSystemLibRoot() + File.separator + BYTEMAN_INSTALL_HOME; + String bytemanHome = paths.getSystemPluginRoot().getAbsolutePath() + File.separator + BYTEMAN_INSTALL_HOME; // This will depend on BYTEMAN-303 being fixed and incorporated in a release logger.fine("Setting system property " + BYTEMAN_HOME_PROPERTY + "=" + bytemanHome); System.setProperty(BYTEMAN_HOME_PROPERTY, bytemanHome);
--- a/vm-byteman/byteman-helper-distro/pom.xml Tue Apr 26 10:27:02 2016 -0400 +++ b/vm-byteman/byteman-helper-distro/pom.xml Fri Apr 29 08:51:24 2016 +0200 @@ -47,12 +47,24 @@ <packaging>pom</packaging> <name>Thermostat Byteman Helper Distribution</name> <description>A build artifact for collecting the byteman helper + required libs</description> + <properties> + <thermostat.plugin.libs.dir>${project.build.directory}/byteman-distro</thermostat.plugin.libs.dir> + <thermostat.plugin>vm-byteman</thermostat.plugin> + </properties> <dependencies> <dependency> <groupId>com.redhat.thermostat</groupId> <artifactId>thermostat-vm-byteman-helper</artifactId> <version>${project.version}</version> </dependency> + <!-- + Dependency merely for byteman.jar copying to the right place + --> + <dependency> + <groupId>org.jboss.byteman</groupId> + <artifactId>byteman</artifactId> + <version>${byteman.version}</version> + </dependency> </dependencies> <build> <plugins> @@ -60,6 +72,8 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> + <!-- copy byteman-helper jar + transitive deps to + ${thermostat.plugin.libs.dir}/thermostat-helper --> <execution> <id>copy-byteman-helper-to-build-dir</id> <phase>process-sources</phase> @@ -67,20 +81,51 @@ <goal>copy-dependencies</goal> </goals> <configuration> - <outputDirectory>${project.build.directory}/foo</outputDirectory> + <outputDirectory>${thermostat.plugin.libs.dir}/thermostat-helper</outputDirectory> + </configuration> + </execution> + <!-- Copy the byteman jar to directory + ${thermostat.plugin.libs.dir}/byteman-install/lib + The byteman plugin uses + $THERMOSTAT_HOME/plugins/vm-byteman/plugin-libs/byteman-install as + $BYTEMAN_HOME. + --> + <execution> + <id>copy-byteman-jar-to-byteman-install</id> + <phase>process-sources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.jboss.byteman</groupId> + <artifactId>byteman</artifactId> + </artifactItem> + </artifactItems> + <outputDirectory>${thermostat.plugin.libs.dir}/byteman-install/lib</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> + <dependencies> + <dependency> + <groupId>com.redhat.thermostat</groupId> + <artifactId>thermostat-assembly</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + <configuration> + <descriptorRefs> + <descriptorRef>plugin-libs-assembly</descriptorRef> + </descriptorRefs> + <appendAssemblyId>false</appendAssemblyId> + </configuration> <executions> <execution> - <configuration> - <descriptor>src/assembly/deps.xml</descriptor> - <appendAssemblyId>false</appendAssemblyId> - </configuration> - <id>create-zip-archive</id> + <id>assemble-byteman-helper-libs</id> <phase>package</phase> <goals> <goal>single</goal> @@ -88,6 +133,25 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>rename-byteman.jar</id> + <phase>process-sources</phase> + <configuration> + <target> + <move file="${thermostat.plugin.libs.dir}/byteman-install/lib/byteman-${byteman.version}.jar" + tofile="${thermostat.plugin.libs.dir}/byteman-install/lib/byteman.jar" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> </project>