Skip to content

Commit 9a6ebeb

Browse files
mmerrukohesara
authored andcommitted
Use bnd-maven-plugin instead of maven-bundle-plugin and helper class, and add support for publishing static resources such as themes and widgetsets.
1 parent d0a8608 commit 9a6ebeb

File tree

30 files changed

+784
-577
lines changed

30 files changed

+784
-577
lines changed

buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java

-224
This file was deleted.

client-compiled/bnd.bnd

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bundle-SymbolicName: ${project.groupId}.client.compiled
2+
Bundle-Name: Default Widgetset
3+
Bundle-Version: ${osgi.bundle.version}
4+
Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
5+
*
6+
Export-Package: com.vaadin.osgi.widgetset;-noimport:=true

client-compiled/pom.xml

+20-56
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
<scope>provided</scope>
3030
</dependency>
3131

32+
<dependency>
33+
<groupId>${project.groupId}</groupId>
34+
<artifactId>vaadin-shared</artifactId>
35+
<version>${project.version}</version>
36+
<scope>provided</scope>
37+
</dependency>
38+
3239
<dependency>
3340
<groupId>${project.groupId}</groupId>
3441
<artifactId>vaadin-client</artifactId>
@@ -49,40 +56,19 @@
4956
<version>${project.version}</version>
5057
<scope>provided</scope>
5158
</dependency>
59+
60+
<dependency>
61+
<groupId>org.osgi</groupId>
62+
<artifactId>osgi.core</artifactId>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.osgi</groupId>
66+
<artifactId>osgi.cmpn</artifactId>
67+
</dependency>
5268
</dependencies>
5369

5470
<build>
5571
<plugins>
56-
<plugin>
57-
<groupId>org.codehaus.mojo</groupId>
58-
<artifactId>exec-maven-plugin</artifactId>
59-
<executions>
60-
<execution>
61-
<id>generate-export-package</id>
62-
<phase>package</phase>
63-
<goals>
64-
<goal>exec</goal>
65-
</goals>
66-
<configuration>
67-
<classpathScope>compile</classpathScope>
68-
<executable>${java.home}/bin/java</executable>
69-
<arguments>
70-
<argument>-Dvaadin.version=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</argument>
71-
<argument>-DincludeNumberPackages=1</argument>
72-
73-
<argument>-classpath</argument>
74-
<classpath />
75-
76-
<argument>com.vaadin.buildhelpers.GeneratePackageExports</argument>
77-
78-
<argument>${project.build.directory}/${project.build.finalName}.${project.packaging}</argument>
79-
<argument>VAADIN/widgetsets</argument>
80-
</arguments>
81-
</configuration>
82-
</execution>
83-
</executions>
84-
</plugin>
85-
8672
<plugin>
8773
<groupId>com.vaadin</groupId>
8874
<artifactId>vaadin-maven-plugin</artifactId>
@@ -103,32 +89,10 @@
10389
</execution>
10490
</executions>
10591
</plugin>
106-
107-
108-
<plugin>
109-
<groupId>org.apache.felix</groupId>
110-
<artifactId>maven-bundle-plugin</artifactId>
111-
<extensions>true</extensions>
112-
<configuration>
113-
<instructions>
114-
<Bundle-Version>${osgi.bundle.version}</Bundle-Version>
115-
<Bundle-RequiredExecutionEnvironment>${osgi.execution.environment}</Bundle-RequiredExecutionEnvironment>
116-
<!-- Export package is handled in exec plugin -->
117-
<Export-Package></Export-Package>
118-
<Import-Package></Import-Package>
119-
</instructions>
120-
</configuration>
121-
<executions>
122-
<execution>
123-
<id>bundle-manifest</id>
124-
<phase>prepare-package</phase>
125-
<goals>
126-
<goal>manifest</goal>
127-
</goals>
128-
</execution>
129-
</executions>
130-
</plugin>
131-
92+
<plugin>
93+
<groupId>biz.aQute.bnd</groupId>
94+
<artifactId>bnd-maven-plugin</artifactId>
95+
</plugin>
13296
<plugin>
13397
<groupId>org.apache.maven.plugins</groupId>
13498
<artifactId>maven-jar-plugin</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2000-2016 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package com.vaadin.osgi.widgetset;
17+
18+
import org.osgi.service.component.ComponentContext;
19+
import org.osgi.service.component.annotations.Activate;
20+
import org.osgi.service.component.annotations.Component;
21+
import org.osgi.service.component.annotations.Reference;
22+
import org.osgi.service.http.HttpService;
23+
24+
import com.vaadin.osgi.resources.OSGiVaadinResources;
25+
import com.vaadin.osgi.resources.VaadinResourceService;
26+
27+
@Component(immediate = true)
28+
public class DefaultWidgetsetContribution {
29+
private HttpService httpService;
30+
31+
private static final String WIDGETSET_NAME = "com.vaadin.DefaultWidgetSet";
32+
33+
@Activate
34+
void startup(ComponentContext context) throws Exception {
35+
VaadinResourceService service = OSGiVaadinResources.getService();
36+
service.publishWidgetset(WIDGETSET_NAME, httpService);
37+
}
38+
39+
@Reference
40+
void setHttpService(HttpService httpService) {
41+
this.httpService = httpService;
42+
}
43+
44+
void unsetHttpService(HttpService httpService) {
45+
this.httpService = null;
46+
}
47+
}

compatibility-client-compiled/bnd.bnd

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bundle-SymbolicName: ${project.groupId}.compatibility.client.compiled
2+
Bundle-Name: Compatibility Widgetset
3+
Bundle-Version: ${osgi.bundle.version}
4+
Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
5+
*
6+
Export-Package: com.vaadin.osgi.compatibility.widgetset;-noimport:=true

0 commit comments

Comments
 (0)