Skip to content

Commit 3381d6d

Browse files
Copilotpeterkir
andcommitted
feat(osgi): configure eclipse resource filter + add README.md
- osgi/.project: add <filteredResources> with FOLDER+EXCLUDE_ALL filters (type=10, org.eclipse.ui.ide.multiFilter) for the 5 Eclipse sub-project directories (cnf, io.klib.bootstrap.api/app/core/test.integration). The _root project now shows only workspace-level files in Eclipse. - osgi/README.md: document prerequisites, project structure, Gradle build commands, run/debug bndrun launchers, unit + OSGi integration tests, bndrun re-resolve steps, and Eclipse+BNDTools import instructions. Agent-Logs-Url: https://github.com/klibio/bootstrap/sessions/0cdef0bb-30ee-4da3-9e52-80aab7dbab53 Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
1 parent 4777814 commit 3381d6d

2 files changed

Lines changed: 212 additions & 0 deletions

File tree

osgi/.project

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,51 @@
88
</buildSpec>
99
<natures>
1010
</natures>
11+
<filteredResources>
12+
<filter>
13+
<id>1</id>
14+
<name></name>
15+
<type>10</type>
16+
<matcher>
17+
<id>org.eclipse.ui.ide.multiFilter</id>
18+
<arguments>1.0-name-matches-false-false-cnf</arguments>
19+
</matcher>
20+
</filter>
21+
<filter>
22+
<id>2</id>
23+
<name></name>
24+
<type>10</type>
25+
<matcher>
26+
<id>org.eclipse.ui.ide.multiFilter</id>
27+
<arguments>1.0-name-matches-false-false-io.klib.bootstrap.api</arguments>
28+
</matcher>
29+
</filter>
30+
<filter>
31+
<id>3</id>
32+
<name></name>
33+
<type>10</type>
34+
<matcher>
35+
<id>org.eclipse.ui.ide.multiFilter</id>
36+
<arguments>1.0-name-matches-false-false-io.klib.bootstrap.app</arguments>
37+
</matcher>
38+
</filter>
39+
<filter>
40+
<id>4</id>
41+
<name></name>
42+
<type>10</type>
43+
<matcher>
44+
<id>org.eclipse.ui.ide.multiFilter</id>
45+
<arguments>1.0-name-matches-false-false-io.klib.bootstrap.core</arguments>
46+
</matcher>
47+
</filter>
48+
<filter>
49+
<id>5</id>
50+
<name></name>
51+
<type>10</type>
52+
<matcher>
53+
<id>org.eclipse.ui.ide.multiFilter</id>
54+
<arguments>1.0-name-matches-false-false-io.klib.bootstrap.test.integration</arguments>
55+
</matcher>
56+
</filter>
57+
</filteredResources>
1158
</projectDescription>

osgi/README.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# io.klib Bootstrap — OSGi Workspace
2+
3+
This directory contains the [bnd](https://bnd.bndtools.org/) Gradle workspace for the
4+
`io.klib.bootstrap` OSGi application. It uses **Java 21** and is built with the
5+
**Gradle 8.13** wrapper included in this folder.
6+
7+
---
8+
9+
## Prerequisites
10+
11+
| Tool | Version | Notes |
12+
|------|---------|-------|
13+
| Java JDK | 21+ | Gradle will auto-provision via toolchain if not found |
14+
| (Optional) Eclipse IDE | 2024-12+ | Import with [BNDTools 7+](https://bndtools.org/) plug-in |
15+
16+
> No Maven or `bnd` CLI installation is required — everything runs through `./gradlew`.
17+
18+
---
19+
20+
## Project structure
21+
22+
```
23+
osgi/ ← bnd workspace root (_root Eclipse project)
24+
├── cnf/ ← workspace configuration (Eclipse project: cnf)
25+
│ ├── build.bnd ← workspace-wide bnd settings (Java 21, version, etc.)
26+
│ ├── ext/
27+
│ │ ├── repositories.bnd ← repository plug-in definitions
28+
│ │ └── junit5.bnd ← JUnit 5 / osgi-test BSN macro variables
29+
│ └── pom.xml ← Maven Central artifact list for BndPomRepository
30+
├── io.klib.bootstrap.api/ ← public service interfaces + ProvisionResult record
31+
├── io.klib.bootstrap.core/ ← DS @Component implementations + unit tests
32+
├── io.klib.bootstrap.app/ ← application launcher bndrun files
33+
│ ├── launch.bndrun ← production launcher (Felix + SCR + bundles)
34+
│ └── debug.bndrun ← debug launcher (adds Gogo shell, -runtrace)
35+
├── io.klib.bootstrap.test.integration/ ← OSGi integration tests (osgi-test)
36+
│ └── integration.bndrun ← integration test launcher
37+
├── build.gradle ← workspace root Gradle build
38+
├── settings.gradle ← Gradle settings (bnd workspace plug-in)
39+
├── gradlew / gradlew.bat ← Gradle 8.13 wrapper scripts
40+
└── README.md ← this file
41+
```
42+
43+
---
44+
45+
## Building
46+
47+
```bash
48+
# From the osgi/ directory:
49+
cd osgi
50+
51+
# Full workspace build (compile + unit tests + OSGi integration tests)
52+
./gradlew build
53+
54+
# Compile only
55+
./gradlew assemble
56+
57+
# Run only unit tests (io.klib.bootstrap.core)
58+
./gradlew test
59+
60+
# Run only OSGi integration tests
61+
./gradlew :io.klib.bootstrap.test.integration:testOSGi
62+
```
63+
64+
> **Tip:** On Windows, replace `./gradlew` with `gradlew.bat`.
65+
66+
---
67+
68+
## Running the application
69+
70+
The application is launched via the `io.klib.bootstrap.app` bndrun files.
71+
72+
### Production launch
73+
74+
```bash
75+
# Gradle task (recommended)
76+
./gradlew :io.klib.bootstrap.app:run.launch
77+
78+
# Export a self-contained runnable JAR/directory first, then launch it
79+
./gradlew :io.klib.bootstrap.app:export.launch
80+
```
81+
82+
### Debug launch (with Felix Gogo interactive shell)
83+
84+
```bash
85+
./gradlew :io.klib.bootstrap.app:run.debug
86+
```
87+
88+
---
89+
90+
## Running the tests
91+
92+
### JUnit 5 unit tests (no OSGi framework required)
93+
94+
```bash
95+
./gradlew :io.klib.bootstrap.core:test
96+
```
97+
98+
### OSGi integration tests (full Felix container)
99+
100+
```bash
101+
./gradlew :io.klib.bootstrap.test.integration:testOSGi
102+
```
103+
104+
Test reports are written to:
105+
106+
```
107+
io.klib.bootstrap.test.integration/generated/test-reports/testOSGi/
108+
```
109+
110+
---
111+
112+
## Re-resolving bndrun files
113+
114+
The `-runbundles` list in each `.bndrun` file is pre-resolved and committed.
115+
If you add new `-runrequires` entries or change dependency versions, re-resolve with:
116+
117+
```bash
118+
# Resolve launch.bndrun
119+
./gradlew :io.klib.bootstrap.app:resolve.launch
120+
121+
# Resolve debug.bndrun
122+
./gradlew :io.klib.bootstrap.app:resolve.debug
123+
124+
# Resolve integration.bndrun
125+
./gradlew :io.klib.bootstrap.test.integration:resolve
126+
```
127+
128+
---
129+
130+
## Importing into Eclipse with BNDTools
131+
132+
1. Install **Eclipse IDE for Java Developers** (2024-12 or later).
133+
2. Install the **BNDTools** plug-in via the Eclipse Marketplace.
134+
3. In Eclipse: **File → Import → Existing Projects into Workspace**.
135+
4. Set the root directory to this `osgi/` folder.
136+
5. Select **all** projects found (including `_root` and `cnf`).
137+
6. Click **Finish**.
138+
139+
Eclipse will resolve the workspace dependencies automatically via the
140+
`BndPomRepository` configuration in `cnf/ext/repositories.bnd`.
141+
142+
> The `_root` project is configured with resource filters so that the Eclipse
143+
> Project Explorer shows only workspace-level files (`build.gradle`,
144+
> `settings.gradle`, `gradlew`, …) while hiding the bundle sub-project
145+
> directories that are already visible as separate Eclipse projects.
146+
147+
---
148+
149+
## Key version numbers
150+
151+
| Component | Version |
152+
|-----------|---------|
153+
| Java | 21 |
154+
| Gradle wrapper | 8.13 |
155+
| bnd / BNDTools | 7.1.0 |
156+
| Apache Felix Framework | 7.0.5 |
157+
| Apache Felix SCR | 2.2.6 |
158+
| JUnit 5 | 5.11.4 |
159+
| osgi-test | 1.3.0 |
160+
161+
---
162+
163+
## License
164+
165+
[MIT](https://opensource.org/licenses/MIT) — © klibio contributors

0 commit comments

Comments
 (0)