Skip to content

Commit 4a544a5

Browse files
committed
Fix publishing and add API docs
1 parent 49b4a83 commit 4a544a5

5 files changed

Lines changed: 337 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
run: sbt --client examples/nativeLink
7878

7979
- name: Build website
80-
run: sbt --client buildWebsite
80+
run: sbt --client "buildWebsite; copyAPIDocs"
8181

8282
- name: Publish gh-pages
8383
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')

build.sbt

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ lazy val root = project
5555
pango,
5656
`gir-schema`,
5757
girepository,
58-
codegenTests
58+
codegenTests,
59+
runtime
5960
)
6061
.enablePlugins(sbtdocker.DockerPlugin)
6162
.enablePlugins(ScalaUnidocPlugin)
@@ -255,10 +256,7 @@ lazy val glib = project
255256

256257
lazy val runtime = project
257258
.in(file("runtime"))
258-
.enablePlugins(ScalaNativePlugin)
259-
.settings(
260-
scalaVersion := Versions.Scala3
261-
)
259+
.configure(pkgConfiguredSimple)
262260

263261
lazy val compilationFlags =
264262
taskKey[Unit]("Generate compilation flags at the root of the project")
@@ -674,6 +672,7 @@ lazy val generateXsd = TaskKey[Unit]("generateXsd")
674672
lazy val `gir-schema` = project
675673
.in(file("gir-schema"))
676674
.configure(pkgConfiguredSimple)
675+
.settings(noPublishing)
677676
.enablePlugins(ScalaxbPlugin)
678677
.settings(
679678
Compile / generateXsd := {
@@ -709,14 +708,49 @@ lazy val docs =
709708
)
710709

711710
lazy val buildWebsite = taskKey[Unit]("Build website in _site folder")
711+
712+
buildWebsite / fileInputs += ((docs / baseDirectory).value / "pages").toGlob / "*.md"
713+
buildWebsite / fileInputs += ((docs / baseDirectory).value / "assets").toGlob / "*"
714+
712715
buildWebsite := Def.taskDyn {
713716
val root = (ThisBuild / baseDirectory).value / "_site"
714717

718+
(buildWebsite / changedInputFiles).value
719+
715720
(docs / Compile / run).toTask(
716721
s" build --destination ${root.toString} --force"
717722
)
718723
}.value
719724

725+
lazy val copyAPIDocs = taskKey[Unit]("")
726+
copyAPIDocs := {
727+
728+
val root = (ThisBuild / baseDirectory).value / "_site"
729+
730+
val destination = root / "api"
731+
732+
val log = sLog.value
733+
734+
List(
735+
"gtk4" -> (gtk4 / Compile / doc).value,
736+
"gdk4" -> (gdk4 / Compile / doc).value,
737+
"gsk4" -> (gsk4 / Compile / doc).value,
738+
"gobject" -> (gobject / Compile / doc).value,
739+
"harfbuzz" -> (harfbuzz / Compile / doc).value,
740+
"cairo" -> (cairo / Compile / doc).value,
741+
"gdkpixbuf" -> (gdkpixbuf / Compile / doc).value,
742+
"glib" -> (glib / Compile / doc).value,
743+
"gio" -> (gio / Compile / doc).value,
744+
"pango" -> (pango / Compile / doc).value
745+
).foreach { case (name, docs) =>
746+
log.info(
747+
s"Copying API docs for $name (from $docs to ${destination / name})"
748+
)
749+
IO.createDirectory(destination / name)
750+
IO.copyDirectory(docs, destination / name)
751+
}
752+
}
753+
720754
def pkgConfig(pkg: String, arg: String) = {
721755
import sys.process.*
722756
s"pkg-config --$arg $pkg".!!.trim.split(" ").toList

docs/assets/extra.css

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
/* Modern typography and readability improvements */
2+
3+
:root {
4+
--sb-font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
5+
--sb-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
6+
7+
--sb-text-color: #111827;
8+
--sb-text-muted: #6b7280;
9+
--sb-bg-color: #ffffff;
10+
--sb-bg-secondary: #f9fafb;
11+
--sb-border-color: #e5e7eb;
12+
--sb-primary-color: #2563eb;
13+
--sb-primary-hover: #1d4ed8;
14+
15+
--sb-header-bg: #0f172a;
16+
--sb-aside-bg: #f8fafc;
17+
--sb-aside-width: 240px;
18+
--sb-max-width: 1280px;
19+
20+
--content-max-width: 720px;
21+
}
22+
23+
/* Body */
24+
.sb-body {
25+
font-size: 15px;
26+
line-height: 1.65;
27+
-webkit-font-smoothing: antialiased;
28+
-moz-osx-font-smoothing: grayscale;
29+
}
30+
31+
/* Header — tighter, cleaner */
32+
.sb-header {
33+
padding: 0.75rem 1.75rem;
34+
border-bottom: 1px solid rgba(255,255,255,0.06);
35+
}
36+
37+
.sb-title-link {
38+
font-size: 1.125rem;
39+
font-weight: 700;
40+
letter-spacing: -0.01em;
41+
}
42+
43+
.sb-title-tagline {
44+
font-size: 0.75rem;
45+
letter-spacing: 0.01em;
46+
opacity: 0.55;
47+
}
48+
49+
/* Sidebar */
50+
.sb-aside {
51+
top: 56px;
52+
height: calc(100vh - 56px);
53+
padding: 1.25rem 0;
54+
border-right: 1px solid var(--sb-border-color);
55+
}
56+
57+
.sb-navbar-link {
58+
font-size: 0.875rem;
59+
padding: 0.375rem 1.25rem;
60+
border-left: 2px solid transparent;
61+
color: #374151;
62+
letter-spacing: 0.005em;
63+
}
64+
65+
.sb-navbar-link:hover {
66+
color: var(--sb-primary-color);
67+
border-left-color: var(--sb-primary-color);
68+
background: transparent;
69+
}
70+
71+
.sb-navbar-link-0 {
72+
font-weight: 500;
73+
}
74+
75+
.sb-navbar-link-1 {
76+
font-size: 0.8125rem;
77+
padding: 0.3rem 1rem;
78+
color: var(--sb-text-muted);
79+
}
80+
81+
/* Article */
82+
.sb-article {
83+
padding: 2.5rem 3rem 3rem;
84+
max-width: calc(100% - var(--sb-aside-width));
85+
font-size: 0.9375rem;
86+
line-height: 1.75;
87+
}
88+
89+
.sb-article > div {
90+
max-width: var(--content-max-width);
91+
}
92+
93+
.sb-article h1 {
94+
font-size: 1.75rem;
95+
font-weight: 700;
96+
letter-spacing: -0.03em;
97+
line-height: 1.25;
98+
margin: 0 0 1.25rem;
99+
color: #0f172a;
100+
}
101+
102+
.sb-article h2 {
103+
font-size: 1.125rem;
104+
font-weight: 600;
105+
letter-spacing: -0.015em;
106+
margin: 2.25rem 0 0.75rem;
107+
padding-bottom: 0.5rem;
108+
border-bottom: 1px solid var(--sb-border-color);
109+
color: #0f172a;
110+
}
111+
112+
.sb-article h3 {
113+
font-size: 1rem;
114+
font-weight: 600;
115+
margin: 1.75rem 0 0.5rem;
116+
color: #1e293b;
117+
}
118+
119+
.sb-article p {
120+
margin: 0.875rem 0;
121+
color: #1f2937;
122+
}
123+
124+
.sb-article a {
125+
color: var(--sb-primary-color);
126+
text-decoration-thickness: 1px;
127+
text-underline-offset: 2px;
128+
}
129+
130+
.sb-article a:hover {
131+
color: var(--sb-primary-hover);
132+
text-decoration: underline;
133+
}
134+
135+
/* Inline code */
136+
.sb-article code:not(pre code) {
137+
font-family: var(--sb-font-mono);
138+
font-size: 0.875em;
139+
background: #f1f5f9;
140+
color: #0f172a;
141+
padding: 0.15em 0.4em;
142+
border-radius: 4px;
143+
border: 1px solid #e2e8f0;
144+
}
145+
146+
/* Code blocks */
147+
.sb-article pre {
148+
border-radius: 8px;
149+
margin: 1.5rem 0;
150+
font-size: 0.8125rem;
151+
line-height: 1.65;
152+
overflow-x: auto;
153+
border: 1px solid #1e293b;
154+
}
155+
156+
.sb-article pre code {
157+
font-family: var(--sb-font-mono);
158+
font-size: inherit;
159+
}
160+
161+
/* Lists */
162+
.sb-article ul,
163+
.sb-article ol {
164+
margin: 0.75rem 0;
165+
padding-left: 1.5rem;
166+
}
167+
168+
.sb-article li {
169+
margin: 0.2rem 0;
170+
line-height: 1.6;
171+
}
172+
173+
.sb-article li > p {
174+
margin: 0;
175+
}
176+
177+
/* Tables */
178+
.sb-article table {
179+
width: 100%;
180+
border-collapse: collapse;
181+
font-size: 0.875rem;
182+
margin: 1.5rem 0;
183+
border: 1px solid var(--sb-border-color);
184+
border-radius: 6px;
185+
overflow: hidden;
186+
}
187+
188+
.sb-article thead tr {
189+
background-color: #f1f5f9;
190+
}
191+
192+
.sb-article th {
193+
padding: 0.625rem 1rem;
194+
font-weight: 600;
195+
font-size: 0.8125rem;
196+
text-align: left;
197+
color: #374151;
198+
border-bottom: 1px solid var(--sb-border-color);
199+
border-right: 1px solid var(--sb-border-color);
200+
}
201+
202+
.sb-article th:last-child {
203+
border-right: none;
204+
}
205+
206+
.sb-article td {
207+
padding: 0.5rem 1rem;
208+
border-bottom: 1px solid var(--sb-border-color);
209+
border-right: 1px solid var(--sb-border-color);
210+
color: #1f2937;
211+
vertical-align: middle;
212+
}
213+
214+
.sb-article td:last-child {
215+
border-right: none;
216+
}
217+
218+
.sb-article tbody tr:last-child td {
219+
border-bottom: none;
220+
}
221+
222+
.sb-article tbody tr:nth-child(even) {
223+
background-color: #f9fafb;
224+
}
225+
226+
.sb-article tbody tr:hover {
227+
background-color: #eff6ff;
228+
}
229+
230+
/* Footer */
231+
.sb-footer {
232+
font-size: 0.8125rem;
233+
padding: 1.25rem 2rem;
234+
color: #64748b;
235+
}
236+
237+
/* Search input */
238+
.sb-search-input {
239+
font-size: 0.8125rem;
240+
padding: 0.4rem 0.875rem;
241+
border-radius: 6px;
242+
}
243+
244+
/* Responsive */
245+
@media (max-width: 1024px) {
246+
.sb-article {
247+
padding: 2rem 2rem 2.5rem;
248+
max-width: calc(100% - 220px);
249+
}
250+
}
251+
252+
@media (max-width: 768px) {
253+
.sb-article {
254+
padding: 1.5rem 1.25rem;
255+
max-width: 100%;
256+
font-size: 0.9375rem;
257+
}
258+
259+
.sb-article h1 {
260+
font-size: 1.5rem;
261+
}
262+
263+
.sb-article h2 {
264+
font-size: 1.0625rem;
265+
}
266+
}

docs/pages/api.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: API
3+
---
4+
5+
The gtk-sn project is built from several individually published modules that map to individual GNOME libraries or identifiable
6+
components.
7+
8+
The API docs for each library are hosted on this website:
9+
10+
- [GObject](./api/gobject/index.html)
11+
12+
- [Glib](./api/glib/index.html)
13+
14+
- [Gtk 4](./api/gtk4/index.html)
15+
16+
- [Glib](./api/glib/index.html)
17+
18+
- [Gio](./api/gio/index.html)
19+
20+
- [Pango](./api/pango/index.html)
21+
22+
- [Cairo](./api/cairo/index.html)
23+
24+
- [GdkPixbuf](./api/gdkpixbuf/index.html)
25+
26+
- [Harfbuzz](./api/harfbuzz/index.html)
27+
28+
- [Gdk 4](./api/gdk4/index.html)
29+
30+
- [Gsk 4](./api/gsk4/index.html)

docs/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Home
33
index: true
44
---
55

6-
Welcome to the website of the *Gtk for Scala 3 Native* project.
6+
Welcome to the website of the **Gtk for Scala 3 Native** project.
77

88
We build and publish bindings for the [Gtk](https://www.gtk.org/) library to Scala 3 Native.
99

0 commit comments

Comments
 (0)