Mercurial > hg > thermostat-ng > agent
changeset 2628:70926dc1ecc4
Fixes for Gradle compatibility
This is an attempt to be more consistent with the use of the "@property@" Maven resource filter.
I found that resource files that used ${property.with.dot} as a substitution syntax didn't work the same way that they do in Maven (the period character has a special meaning in Gradle), so I replaced it with the syntax @property@ instead. Then I found that although I could see the resource had been transformed properly in target/classes (this is done by the <resources> element in the pom file), it was appearing untransformed in the jar files (this is done by the maven-bundle-plugin).
The syntax is laid out in http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#include-resource
Using the curly braces tells BND to perform filtering while copying, the string "{maven-resources}" is actually the default behaviour(copy from src/main/resources to jar and filter), and the string "{path1=path2}" is copy with filtering to a specific location.
Admittedly this isn't strictly necessary if the old syntax for the property files is unchanged. I wanted to make everything consistent, so adding this extra line seemed the best way. It's imperfect, in that the pom file must explicitly name any files that need maven-style '@' filtering.
So my added line just tells BND to copy the pre-filtered property file from target/classes/..... into the jar file instead of performing its own filtering.
(I've removed the curly braces so BND doesn't perform a second filtering)
Reviewed-by: sgehwolf
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-March/022591.html
author | Simon Tooke <stooke@redhat.com> |
---|---|
date | Fri, 31 Mar 2017 15:36:28 -0400 |
parents | 92c35ea119fd |
children | 7fd0eba13ac7 |
files | common/core/pom.xml common/core/src/main/resources/com/redhat/thermostat/app-info.properties distribution/config/commands/agent.properties distribution/pom.xml distribution/scripts/thermostat-ipc-client-common main/pom.xml main/src/main/resources/com/redhat/thermostat/main/internal/bootstrapbundles.properties |
diffstat | 7 files changed, 62 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/common/core/pom.xml Fri Mar 31 15:33:23 2017 -0400 +++ b/common/core/pom.xml Fri Mar 31 15:36:28 2017 -0400 @@ -75,6 +75,13 @@ <extensions>true</extensions> <configuration> <instructions> + <!-- + Explicitly tell the bundle-plugin to pull and filter resources from maven-resources (src/main/resources) + and then get app-info.properties from target/classes, where it was filtered by + the maven resourced mechanism. + Doing it this way avoids using the BND filtering, which doesn't support '@' tokens. + --> + <Include-Resource>{maven-resources}, com/redhat/thermostat/app-info.properties=target/classes/com/redhat/thermostat/app-info.properties</Include-Resource> <Bundle-SymbolicName>com.redhat.thermostat.common.core</Bundle-SymbolicName> <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor> <Bundle-Activator>com.redhat.thermostat.common.internal.Activator</Bundle-Activator>
--- a/common/core/src/main/resources/com/redhat/thermostat/app-info.properties Fri Mar 31 15:33:23 2017 -0400 +++ b/common/core/src/main/resources/com/redhat/thermostat/app-info.properties Fri Mar 31 15:36:28 2017 -0400 @@ -1,9 +1,9 @@ APP_NAME = Thermostat -APP_RELEASE_DATE = ${thermostat.releasedate} -APP_EMAIL = ${thermostat.email} -APP_WEBSITE = ${thermostat.url} +APP_RELEASE_DATE = @thermostat.releasedate@ +APP_EMAIL = @thermostat.email@ +APP_WEBSITE = @thermostat.url@ APP_COPYRIGHT = Copyright 2012-2017 Red Hat, Inc. -APP_VERSION = ${project.version} -APP_USER_GUIDE = ${thermostat.user.guide} -BUG_WEBSITE = ${thermostat.bug.url} +APP_VERSION = @project.version@ +APP_USER_GUIDE = @thermostat.user.guide@ +BUG_WEBSITE = @thermostat.bug.url@
--- a/distribution/config/commands/agent.properties Fri Mar 31 15:33:23 2017 -0400 +++ b/distribution/config/commands/agent.properties Fri Mar 31 15:36:28 2017 -0400 @@ -1,10 +1,10 @@ -bundles = com.redhat.thermostat.web.client=${project.version}, \ - com.redhat.thermostat.agent.cli=${project.version}, \ - com.redhat.thermostat.backend.system=${project.version}, \ - com.redhat.thermostat.agent.ipc.tcpsocket.server=${project.version}, \ - com.redhat.thermostat.storage.mongodb=${project.version}, \ - com.redhat.thermostat.process=${project.version} \ - @agent.extra.bundles@ +bundles = com.redhat.thermostat.web.client=@project.version@, \ + com.redhat.thermostat.agent.cli=@project.version@, \ + com.redhat.thermostat.backend.system=@project.version@, \ + com.redhat.thermostat.agent.ipc.tcpsocket.server=@project.version@, \ + com.redhat.thermostat.storage.mongodb=@project.version@, \ + com.redhat.thermostat.process=@project.version@ \ + @agent_extra_bundles@ summary = run the thermostat agent
--- a/distribution/pom.xml Fri Mar 31 15:33:23 2017 -0400 +++ b/distribution/pom.xml Fri Mar 31 15:36:28 2017 -0400 @@ -123,10 +123,10 @@ </activation> <properties> <assemblyfile.suffix>macosx</assemblyfile.suffix> - <agent.extra.bundles>,com.redhat.thermostat.agent.ipc.unixsocket.server=${project.version}, \ - ${jffi-native.bundle.symbolic.name}=${jffi.version}</agent.extra.bundles> - <service.extra.bundles>,com.redhat.thermostat.agent.ipc.unixsocket.server=${project.version}, \ - ${jffi-native.bundle.symbolic.name}=${jffi.version}</service.extra.bundles> + <agent_extra_bundles>,com.redhat.thermostat.agent.ipc.unixsocket.server=${project.version}, \ + ${jffi-native.bundle.symbolic.name}=${jffi.version}</agent_extra_bundles> + <service_extra_bundles>,com.redhat.thermostat.agent.ipc.unixsocket.server=${project.version}, \ + ${jffi-native.bundle.symbolic.name}=${jffi.version}</service_extra_bundles> </properties> <dependencies> <dependency> @@ -173,8 +173,8 @@ </activation> <properties> <assemblyfile.suffix>-windows</assemblyfile.suffix> - <agent.extra.bundles>,com.redhat.thermostat.agent.ipc.winpipes.server=${project.version}</agent.extra.bundles> - <service.extra.bundles>,com.redhat.thermostat.agent.ipc.winpipes.server=${project.version}</service.extra.bundles> + <agent_extra_bundles>,com.redhat.thermostat.agent.ipc.winpipes.server=${project.version}</agent_extra_bundles> + <service_extra_bundles>,com.redhat.thermostat.agent.ipc.winpipes.server=${project.version}</service_extra_bundles> </properties> <dependencies> <dependency>
--- a/distribution/scripts/thermostat-ipc-client-common Fri Mar 31 15:33:23 2017 -0400 +++ b/distribution/scripts/thermostat-ipc-client-common Fri Mar 31 15:36:28 2017 -0400 @@ -4,27 +4,27 @@ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/thermostat-common # Build classpath shared by all IPC clients -IPC_CLASSPATH="${THERMOSTAT_LIBS}/thermostat-agent-ipc-client-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-common-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-unixsocket-client-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-unixsocket-common-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-tcpsocket-client-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-tcpsocket-common-${project.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-unixsocket-${jnr-unixsocket.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-enxio-${jnr-enxio.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-constants-${jnr-constants.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-posix-${jnr-posix.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-ffi-${jnr-ffi.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-x86asm-${jnr-x86asm.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jffi-${jffi.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jffi-${jffi.version}-native.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-${asm.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-commons-${asm.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-util-${asm.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-analysis-${asm.version}.jar" -IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-tree-${asm.version}.jar" +IPC_CLASSPATH="${THERMOSTAT_LIBS}/thermostat-agent-ipc-client-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-common-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-unixsocket-client-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-unixsocket-common-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-tcpsocket-client-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-tcpsocket-common-@project.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-unixsocket-@jnr-unixsocket.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-enxio-@jnr-enxio.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-constants-@jnr-constants.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-posix-@jnr-posix.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-ffi-@jnr-ffi.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jnr-x86asm-@jnr-x86asm.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jffi-@jffi.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/jffi-@jffi.version@-native.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-@asm.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-commons-@asm.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-util-@asm.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-analysis-@asm.version@.jar" +IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/asm-tree-@asm.version@.jar" if [ $CYGWIN_MODE -eq 1 ]; then - IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-winpipes-client-${project.version}.jar" - IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-winpipes-common-${project.version}.jar" + IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-winpipes-client-@project.version@.jar" + IPC_CLASSPATH="${IPC_CLASSPATH}:${THERMOSTAT_LIBS}/thermostat-agent-ipc-winpipes-common-@project.version@.jar" fi
--- a/main/pom.xml Fri Mar 31 15:33:23 2017 -0400 +++ b/main/pom.xml Fri Mar 31 15:36:28 2017 -0400 @@ -121,6 +121,13 @@ <extensions>true</extensions> <configuration> <instructions> + <!-- + Explicitly tell the bundle-plugin to pull and filter resources from maven-resources (src/main/resources) + and then get bootstrapbundles.properties from target/classes, where it was filtered by + the maven resourced mechanism. + Doing it this way avoids using the BND filtering, which doesn't support '@' tokens. + --> + <Include-Resource>{maven-resources}, com/redhat/thermostat/main/internal/bootstrapbundles.properties=target/classes/com/redhat/thermostat/main/internal/bootstrapbundles.properties</Include-Resource> <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor> <Bundle-SymbolicName>com.redhat.thermostat.main</Bundle-SymbolicName> <Export-Package>
--- a/main/src/main/resources/com/redhat/thermostat/main/internal/bootstrapbundles.properties Fri Mar 31 15:33:23 2017 -0400 +++ b/main/src/main/resources/com/redhat/thermostat/main/internal/bootstrapbundles.properties Fri Mar 31 15:36:28 2017 -0400 @@ -1,8 +1,8 @@ -bundles=thermostat-shared-config-${project.version}.jar, \ - thermostat-storage-core-${project.version}.jar, \ - thermostat-common-core-${project.version}.jar, \ - thermostat-plugin-validator-${project.version}.jar, \ - thermostat-launcher-${project.version}.jar, \ - jline-${jline.version}.jar, \ - commons-cli-${commons-cli.version}.jar, \ - org.apache.felix.scr-${felix.scr.version}.jar, \ +bundles=thermostat-shared-config-@project.version@.jar, \ + thermostat-storage-core-@project.version@.jar, \ + thermostat-common-core-@project.version@.jar, \ + thermostat-plugin-validator-@project.version@.jar, \ + thermostat-launcher-@project.version@.jar, \ + jline-@jline.version@.jar, \ + commons-cli-@commons-cli.version@.jar, \ + org.apache.felix.scr-@felix.scr.version@.jar, \