Skip to content

Commit 003fa64

Browse files
authored
refactor: refactor of addon archetype (#5778)
* refactor: refactor of addon archetype Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * fix: copyright Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * fix: copyright Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * refactor: updated with suggestions Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> --------- Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com>
1 parent a070580 commit 003fa64

3 files changed

Lines changed: 71 additions & 9 deletions

File tree

kura/tools/kura-addon-archetype/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
<directory>src/main/resources</directory>
3737
<filtering>true</filtering>
3838
<includes>
39-
<include>archetype-resources/test/test-env/framework/kura.properties</include>
39+
<include>archetype-resources/tests/test-env/framework/kura.properties</include>
4040
<include>META-INF/maven/archetype-metadata.xml</include>
4141
</includes>
4242
</resource>
4343
<resource>
4444
<directory>src/main/resources</directory>
4545
<excludes>
46-
<exclude>archetype-resources/test/test-env/framework/kura.properties</exclude>
46+
<exclude>archetype-resources/tests/test-env/framework/kura.properties</exclude>
4747
<exclude>META-INF/maven/archetype-metadata.xml</exclude>
4848
</excludes>
4949
</resource>

kura/tools/kura-addon-archetype/src/main/resources/archetype-resources/distrib/pom.xml

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3+
34
Copyright (c) 2025 Eurotech and/or its affiliates and others
4-
5+
56
This program and the accompanying materials are made
67
available under the terms of the Eclipse Public License 2.0
78
which is available at https://www.eclipse.org/legal/epl-2.0/
8-
9+
910
SPDX-License-Identifier: EPL-2.0
1011
1112
Contributors:
1213
Eurotech
14+
1315
-->
1416
<project xmlns="http://maven.apache.org/POM/4.0.0"
1517
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -77,7 +79,7 @@
7779
</goals>
7880
<configuration>
7981
<sourceFile>${project.basedir}/../bundles/${jar.name}/target/${jar.name}-${project.version}.jar</sourceFile>
80-
<destinationFile>target/${jar.name}_${project.version}.jar</destinationFile>
82+
<destinationFile>target/input_files/${jar.name}_${project.version}.jar</destinationFile>
8183
</configuration>
8284
</execution>
8385
</executions>
@@ -96,12 +98,16 @@
9698
</goals>
9799
<configuration>
98100
<verbose>true</verbose>
99-
<deb>${basedir}/target/${package.name}_${project.version}_${deb.architecture}.deb</deb>
101+
<deb>${basedir}/target/deb/${package.name}_${project.version}_${deb.architecture}.deb</deb>
100102
<controlDir>${project.basedir}/deb/control</controlDir>
101103
<skipPOMs>false</skipPOMs>
102104
<dataSet>
105+
<!-- Repeate the 'data' schema multiple time if you want to manage
106+
different files indipendentely, specifying for each one the mapper:
107+
it is usefull if different files require different prefix (aka:
108+
different destination location) or specific user, group and filemode -->
103109
<data>
104-
<src>${basedir}/target/${jar.name}_${project.version}.jar</src>
110+
<src>${basedir}/target/input_files/${jar.name}_${project.version}.jar</src>
105111
<dst>${jar.name}_${project.version}.jar</dst>
106112
<type>file</type>
107113
<mapper>
@@ -112,6 +118,27 @@
112118
<filemode>600</filemode>
113119
</mapper>
114120
</data>
121+
122+
<!--
123+
124+
If all the source file are managed in the same way, it is also
125+
possible to specify a 'directory' data type to include all the files
126+
present in the specify path
127+
128+
<data>
129+
<src>${basedir}/target/input_files</src>
130+
<dst>${jar.name}_${project.version}.jar</dst>
131+
<type>directory</type>
132+
<mapper>
133+
<type>perm</type>
134+
<prefix>${addon.installation.dir}</prefix>
135+
<user>kurad</user>
136+
<group>kurad</group>
137+
<filemode>600</filemode>
138+
</mapper>
139+
</data>
140+
141+
-->
115142
</dataSet>
116143
</configuration>
117144
</execution>
@@ -131,6 +158,7 @@
131158
</goals>
132159
<configuration>
133160
<name>${package.name}</name>
161+
<workarea>${basedir}/target/rpm</workarea>
134162
<needarch>${rpm.architecture}</needarch>
135163
<group>Applications/System</group>
136164
<targetOS>linux</targetOS>
@@ -139,17 +167,46 @@
139167
<license>EPL 2.0 (https://www.eclipse.org/legal/epl-2.0/)</license>
140168

141169
<mappings>
170+
<!-- Repeate the 'mapping' schema multiple time if you want to
171+
manage different files indipendentely, specifying for each one the
172+
different parameters: it is usefull if different files require
173+
different 'directory' (aka: different destination location) or
174+
specific username, groupname and filemode -->
175+
<mapping>
176+
<directory>${addon.installation.dir}</directory>
177+
<filemode>600</filemode>
178+
<username>kurad</username>
179+
<groupname>kurad</groupname>
180+
<sources>
181+
<!-- It is also possible to specify multiple times the
182+
'source' to include different files from different
183+
locations, but with the same 'directory', 'filemode',
184+
'username' and 'groupname'-->
185+
<source>
186+
<location>${basedir}/target/input_files/${jar.name}_${project.version}.jar</location>
187+
</source>
188+
</sources>
189+
</mapping>
190+
191+
<!--
192+
193+
If all the source file are managed in the same way, it is also possible to specify the path to a
194+
directory to include all the files present in that
195+
142196
<mapping>
143197
<directory>${addon.installation.dir}</directory>
144198
<filemode>600</filemode>
145199
<username>kurad</username>
146200
<groupname>kurad</groupname>
147201
<sources>
148202
<source>
149-
<location>${basedir}/target/${jar.name}_${project.version}.jar</location>
203+
<location>
204+
${basedir}/target/input_files</location>
150205
</source>
151206
</sources>
152207
</mapping>
208+
209+
-->
153210
</mappings>
154211

155212
<requires>
@@ -162,4 +219,4 @@
162219

163220
</plugins>
164221
</build>
165-
</project>
222+
</project>

kura/tools/kura-addon-archetype/src/main/resources/archetype-resources/tests/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@
306306
<id>org.eclipse.equinox.event</id>
307307
<versionRange>0.0.0</versionRange>
308308
</requirement>
309+
<requirement>
310+
<type>p2-installable-unit</type>
311+
<id>org.eclipse.equinox.wireadmin</id>
312+
<versionRange>0.0.0</versionRange>
313+
</requirement>
309314
<requirement>
310315
<type>eclipse-plugin</type>
311316
<id>org.eclipse.kura.useradmin.store</id>

0 commit comments

Comments
 (0)