Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tools/maven-bundle-plugin/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Changes from 6.0.0 to 6.1.0
---------------------------
* Improvement
* FELIX-6741 Upgrade dependencies for maven-bundle-plugin (bnd 7.3.0 among other updates). See https://github.com/bndtools/bnd/wiki/Changes-in-7.3.0

Changes from 5.1.9 to 6.0.0
---------------------------
* Improvement
Expand Down
31 changes: 18 additions & 13 deletions tools/maven-bundle-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,33 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<artifactId>osgi.core</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.metatype</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>7.0.0</version>
<version>7.3.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.bundlerepository</artifactId>
<version>1.6.6</version>
<version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.utils</artifactId>
<version>1.6.0</version>
<version>1.11.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -218,17 +223,17 @@
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.0</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>3.5.2</version>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>3.0</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand All @@ -248,17 +253,17 @@
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>1.0</version>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.0</version>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<version>3.15.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -276,7 +281,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version='1.0' encoding='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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.felix.bundleits</groupId>
<artifactId>proxy-interface-import</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<artifactId>proxy-interface-import-bundle</artifactId>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>org.apache.felix.bundleits</groupId>
<artifactId>proxy-interface-import-provider</artifactId>
<version>1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${mbp.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.apache.felix.proxy.client</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.felix.proxy.client;

import java.lang.reflect.Proxy;

import org.apache.felix.proxy.api.Greeting;

/**
* Creates a dynamic proxy for {@link Greeting}. This class only references the Greeting interface
* (via the {@code Greeting.class} literal); it never references org.apache.felix.proxy.model
* directly. That package therefore appears in Import-Package only because bnd (7.2.0+) inspects
* the method signatures of interfaces passed to Proxy.newProxyInstance.
*/
public class Client {
public Greeting create() {
return (Greeting) Proxy.newProxyInstance(
Client.class.getClassLoader(),
new Class[] { Greeting.class },
(proxy, method, args) -> null);
}
}
48 changes: 48 additions & 0 deletions tools/maven-bundle-plugin/src/it/proxy-interface-import/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version='1.0' encoding='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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.felix.bundleits</groupId>
<artifactId>proxy-interface-import</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>

<!--
Verifies bnd 7.2.0 Proxy.newProxyInstance detection: packages referenced only through the
method signatures of an interface passed to Proxy.newProxyInstance must be added to
Import-Package, even though the bundle's own bytecode never references them directly.

The interface (and the type used in its method signature) live in a separate 'provider'
module, so the 'bundle' module's bytecode references only the interface class literal.
Without the proxy detection, the method-signature package would not be imported.
-->

<properties>
<mbp.version>@project.version@</mbp.version>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>provider</module>
<module>bundle</module>
</modules>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version='1.0' encoding='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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.felix.bundleits</groupId>
<artifactId>proxy-interface-import</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<artifactId>proxy-interface-import-provider</artifactId>
<!-- A plain jar (not an OSGi bundle): the interface below is external to the bundle under test. -->
<packaging>jar</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.felix.proxy.api;

import org.apache.felix.proxy.model.Message;

/**
* Proxied interface. Its single method references {@link Message}, which lives in a different
* package. The bundle under test only references this interface via a class literal, so the
* Message package can reach Import-Package solely through bnd's Proxy.newProxyInstance detection.
*/
public interface Greeting {
Message greet();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.felix.proxy.model;

/**
* Referenced only from {@link org.apache.felix.proxy.api.Greeting}'s method signature.
*/
public class Message {
public String text() {
return "hello";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 java.util.jar.Manifest

// Parse with java.util.jar.Manifest so that 72-column line folding is handled for us.
Manifest manifest = new File(basedir, "bundle/target/classes/META-INF/MANIFEST.MF").withInputStream { new Manifest(it) }
String importPackage = manifest.mainAttributes.getValue("Import-Package")
assert importPackage != null : "Bundle has no Import-Package header"

// Sanity check: the interface's own package is imported (referenced via the Greeting.class literal).
assert importPackage.contains("org.apache.felix.proxy.api") :
"Expected the proxied interface's package to be imported. Import-Package was: " + importPackage

// The actual assertion: the package used only by Greeting's method signature is imported because
// bnd (7.2.0+) inspects the methods of interfaces passed to Proxy.newProxyInstance.
// See https://github.com/bndtools/bnd/wiki/Changes-in-7.2.0 (-noproxyinterfaces disables this).
assert importPackage.contains("org.apache.felix.proxy.model") :
"Expected the proxy interface's method-signature package (org.apache.felix.proxy.model) " +
"to be imported via Proxy.newProxyInstance detection. Import-Package was: " + importPackage
Loading
Loading