Skip to content

Commit 3022b7e

Browse files
authored
Merge pull request #21 from arieldaniely/adder-gui
נוספה תוכנה ניידת להוספת ספרים ל-DB של זית
2 parents 51607f2 + 75ad7c3 commit 3022b7e

14 files changed

Lines changed: 815 additions & 11 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build Portable Seforim Importer
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
paths:
10+
- "generator/importer-app/**"
11+
- "generator/otzariasqlite/**"
12+
- "generator/catalog/**"
13+
- "generator/searchindex/**"
14+
- "generator/common/**"
15+
- "core/**"
16+
- "dao/**"
17+
- "buildSrc/**"
18+
- "gradle/**"
19+
- "build.gradle.kts"
20+
- "settings.gradle.kts"
21+
- "gradle.properties"
22+
- ".github/workflows/build-portable-importer.yml"
23+
pull_request:
24+
paths:
25+
- "generator/importer-app/**"
26+
- "generator/otzariasqlite/**"
27+
- "generator/catalog/**"
28+
- "generator/searchindex/**"
29+
- "generator/common/**"
30+
- "core/**"
31+
- "dao/**"
32+
- "buildSrc/**"
33+
- "gradle/**"
34+
- "build.gradle.kts"
35+
- "settings.gradle.kts"
36+
- "gradle.properties"
37+
- ".github/workflows/build-portable-importer.yml"
38+
39+
permissions:
40+
contents: read
41+
42+
jobs:
43+
portable-windows:
44+
runs-on: windows-latest
45+
46+
steps:
47+
- name: Checkout source
48+
uses: actions/checkout@v4
49+
with:
50+
submodules: recursive
51+
52+
- name: Set up JDK 25
53+
uses: actions/setup-java@v4
54+
with:
55+
distribution: temurin
56+
java-version: "25"
57+
58+
- name: Set up Gradle
59+
uses: gradle/actions/setup-gradle@v4
60+
61+
- name: Test and build portable ZIP
62+
shell: pwsh
63+
run: ./gradlew.bat :importer-app:jvmTest :importer-app:packagePortableZip --no-daemon
64+
65+
- name: Upload portable application
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: seforim-importer-windows-x64
69+
path: generator/importer-app/build/distributions/seforim-importer-windows-x64-*.zip
70+
if-no-files-found: error
71+
retention-days: 14

README.MD

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,32 @@ val books = repository.getBooksByCategory(categoryId)
8181
// Get book details
8282
val book = repository.getBook(bookId)
8383

84+
8485
// Get lines of text
8586
val lines = repository.getLines(bookId, startIndex, endIndex)
8687

8788
// Get table of contents
8889
val toc = repository.getBookToc(bookId)
8990
```
9091

92+
### Desktop importer
93+
94+
To import a local database, books directory, and separate JSON links directory
95+
through a graphical interface:
96+
97+
```bash
98+
./gradlew :importer-app:run
99+
```
100+
101+
Build the portable Windows application (bundled runtime, no installation) with:
102+
103+
```powershell
104+
./gradlew.bat :importer-app:packagePortableZip
105+
```
106+
107+
Extract the ZIP and run `seforim-importer.exe`. See
108+
`generator/importer-app/README.md` for input layout and generated artifacts.
109+
91110
## Database Generation
92111

93112
### Recommended pipeline (Sefaria → SQLite → Otzaria)

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ plugins {
55
alias(libs.plugins.kotlinx.serialization).apply(false)
66
alias(libs.plugins.sqlDelight).apply(false)
77
alias(libs.plugins.android.application).apply(false)
8+
alias(libs.plugins.compose).apply(false)
9+
alias(libs.plugins.compose.compiler).apply(false)
810
}
911

1012
tasks.register("generateSeforimDb") {

generator/importer-app/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Seforim Importer Desktop
2+
3+
A small desktop application for adding local text books and JSON links to a
4+
SeforimLibrary SQLite database. After import it rebuilds `catalog.pb` and both
5+
Lucene indexes.
6+
7+
## Inputs
8+
9+
- Database: an existing `.db` file or a path for a new database.
10+
- Books: either the source root, its Hebrew Otzaria child directory,
11+
or any directory containing `.txt` books.
12+
- Links: a directory whose direct children are `.json` link files.
13+
- Maximum memory: heap limit for each import/index subprocess (8 GB by default).
14+
15+
The importer accepts the metadata and manifest files from the parent of the
16+
selected books directory when they are available. They remain optional, matching
17+
the existing Otzaria importer behavior.
18+
19+
## Outputs
20+
21+
For a selected `library.db`, the application creates or updates:
22+
23+
- `library.db`
24+
- `catalog.pb` in the database directory
25+
- `library.db.lucene/`
26+
- `library.db.lookup.lucene/`
27+
- `library.db.buildstate`
28+
29+
Books already represented in the database are skipped. Link JSON files are
30+
processed on every run. Acronym enrichment is intentionally skipped by the
31+
standalone application so it never requires a network download.
32+
33+
## Run during development
34+
35+
```bash
36+
./gradlew :importer-app:run
37+
```
38+
39+
## Build the portable application
40+
41+
The primary distribution is a self-contained ZIP. It includes the application
42+
and its Java runtime, so the destination computer does not need Java installed.
43+
44+
```powershell
45+
./gradlew.bat :importer-app:packagePortableZip
46+
```
47+
48+
The resulting archive is written under `build/distributions/`. Extract the
49+
complete `seforim-importer` directory and run `seforim-importer.exe`. Do not
50+
move the EXE away from its `app` and `runtime` directories.
51+
52+
## Optional installer
53+
54+
```powershell
55+
./gradlew.bat :importer-app:packageMsi
56+
```
57+
58+
## GitHub Actions
59+
60+
`.github/workflows/build-portable-importer.yml` runs the tests and builds the
61+
portable Windows ZIP. The ZIP is uploaded as a workflow artifact.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import org.gradle.api.tasks.bundling.Zip
2+
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
3+
4+
plugins {
5+
alias(libs.plugins.multiplatform)
6+
alias(libs.plugins.compose)
7+
alias(libs.plugins.compose.compiler)
8+
}
9+
10+
group = "io.github.kdroidfilter.seforimlibrary"
11+
version = "1.0.0"
12+
13+
kotlin {
14+
jvmToolchain(libs.versions.jvmToolchain.get().toInt())
15+
jvm()
16+
17+
sourceSets {
18+
jvmMain.dependencies {
19+
implementation(project(":otzariasqlite"))
20+
implementation(project(":catalog"))
21+
implementation(project(":searchindex"))
22+
implementation(compose.desktop.currentOs)
23+
implementation(libs.kotlinx.coroutines.swing)
24+
}
25+
26+
jvmTest.dependencies {
27+
implementation(kotlin("test"))
28+
}
29+
}
30+
}
31+
32+
compose.desktop {
33+
application {
34+
mainClass = "io.github.kdroidfilter.seforimlibrary.importer.MainKt"
35+
36+
nativeDistributions {
37+
modules("java.sql", "java.desktop", "jdk.unsupported", "jdk.incubator.vector")
38+
targetFormats(TargetFormat.Msi, TargetFormat.Dmg, TargetFormat.Deb)
39+
packageName = "seforim-importer"
40+
packageVersion = version.toString()
41+
description = "Import local Jewish texts and links into SeforimLibrary"
42+
vendor = "SeforimLibrary"
43+
jvmArgs("--enable-native-access=ALL-UNNAMED", "--add-modules=jdk.incubator.vector")
44+
}
45+
}
46+
}
47+
48+
val portableOsClassifier = when {
49+
System.getProperty("os.name").startsWith("Windows", ignoreCase = true) -> "windows-x64"
50+
System.getProperty("os.name").startsWith("Mac", ignoreCase = true) -> "macos"
51+
else -> "linux-x64"
52+
}
53+
54+
tasks.register<Zip>("packagePortableZip") {
55+
group = "distribution"
56+
description = "Build a portable application folder with its bundled runtime and package it as a ZIP."
57+
dependsOn("createDistributable")
58+
59+
from(layout.buildDirectory.dir("compose/binaries/main/app/seforim-importer")) {
60+
into("seforim-importer")
61+
}
62+
destinationDirectory.set(layout.buildDirectory.dir("distributions"))
63+
archiveFileName.set("seforim-importer-$portableOsClassifier-${project.version}.zip")
64+
isPreserveFileTimestamps = false
65+
isReproducibleFileOrder = true
66+
}

0 commit comments

Comments
 (0)