Skip to content

Commit 3201c2a

Browse files
authored
Merge pull request #3 from kdroidFilter/chore/restructure-webview-compose
Refactor build files and move compose module
2 parents 62ff83c + 32cc1f3 commit 3201c2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+236
-3
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- "**"
7+
8+
jobs:
9+
build-rust-macos-aarch64:
10+
runs-on: macos-14
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Rust
16+
uses: dtolnay/rust-toolchain@stable
17+
18+
- name: Build Rust library
19+
working-directory: wrywebview
20+
run: cargo build --release --target aarch64-apple-darwin
21+
22+
- name: Upload native library
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: native-darwin-aarch64
26+
path: wrywebview/target/aarch64-apple-darwin/release/libcomposewebview_wry.dylib
27+
retention-days: 1
28+
29+
build-rust-macos-x86_64:
30+
runs-on: macos-13
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Rust
36+
uses: dtolnay/rust-toolchain@stable
37+
38+
- name: Build Rust library
39+
working-directory: wrywebview
40+
run: cargo build --release --target x86_64-apple-darwin
41+
42+
- name: Upload native library
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: native-darwin-x86_64
46+
path: wrywebview/target/x86_64-apple-darwin/release/libcomposewebview_wry.dylib
47+
retention-days: 1
48+
49+
build-rust-linux:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
55+
- name: Install dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libxdo-dev
59+
60+
- name: Setup Rust
61+
uses: dtolnay/rust-toolchain@stable
62+
63+
- name: Build Rust library
64+
working-directory: wrywebview
65+
run: cargo build --release --target x86_64-unknown-linux-gnu
66+
67+
- name: Upload native library
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: native-linux-x86_64
71+
path: wrywebview/target/x86_64-unknown-linux-gnu/release/libcomposewebview_wry.so
72+
retention-days: 1
73+
74+
build-rust-windows:
75+
runs-on: windows-latest
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
80+
- name: Setup Rust
81+
uses: dtolnay/rust-toolchain@stable
82+
83+
- name: Build Rust library
84+
working-directory: wrywebview
85+
run: cargo build --release --target x86_64-pc-windows-msvc
86+
87+
- name: Upload native library
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: native-windows-x86_64
91+
path: wrywebview/target/x86_64-pc-windows-msvc/release/composewebview_wry.dll
92+
retention-days: 1
93+
94+
publish:
95+
needs:
96+
- build-rust-macos-aarch64
97+
- build-rust-macos-x86_64
98+
- build-rust-linux
99+
- build-rust-windows
100+
runs-on: macos-14
101+
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
105+
- name: Download macOS aarch64 native library
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: native-darwin-aarch64
109+
path: wrywebview/target/aarch64-apple-darwin/release/
110+
111+
- name: Download macOS x86_64 native library
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: native-darwin-x86_64
115+
path: wrywebview/target/x86_64-apple-darwin/release/
116+
117+
- name: Download Linux native library
118+
uses: actions/download-artifact@v4
119+
with:
120+
name: native-linux-x86_64
121+
path: wrywebview/target/x86_64-unknown-linux-gnu/release/
122+
123+
- name: Download Windows native library
124+
uses: actions/download-artifact@v4
125+
with:
126+
name: native-windows-x86_64
127+
path: wrywebview/target/x86_64-pc-windows-msvc/release/
128+
129+
- name: Verify native libraries
130+
run: |
131+
echo "=== Native libraries downloaded ==="
132+
ls -la wrywebview/target/aarch64-apple-darwin/release/
133+
ls -la wrywebview/target/x86_64-apple-darwin/release/
134+
ls -la wrywebview/target/x86_64-unknown-linux-gnu/release/
135+
ls -la wrywebview/target/x86_64-pc-windows-msvc/release/
136+
137+
- name: Set up JDK
138+
uses: actions/setup-java@v4
139+
with:
140+
java-version: "17"
141+
distribution: "temurin"
142+
143+
- name: Setup Rust (for UniFFI bindgen)
144+
uses: dtolnay/rust-toolchain@stable
145+
146+
- name: Publish to Maven Central
147+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
148+
env:
149+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVENCENTRALUSERNAME }}
150+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVENCENTRALPASSWORD }}
151+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNINGINMEMORYKEY }}
152+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNINGKEYID }}
153+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNINGPASSWORD }}

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ plugins {
1212
alias(libs.plugins.kotlinAtomicfu) apply false
1313
alias(libs.plugins.kotlinJvm) apply false
1414
alias(libs.plugins.kotlinMultiplatform) apply false
15+
alias(libs.plugins.mavenPublish) apply false
1516
}

demo-shared/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ kotlin {
3939
implementation(libs.kotlinx.coroutinesCore)
4040
implementation(libs.kotlinx.serializationJson)
4141

42-
implementation(project(":wrywebview-compose"))
42+
implementation(project(":webview-compose"))
4343
}
4444

4545
jvmMain.dependencies {

gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@ org.gradle.caching=true
88

99
#Android
1010
android.useAndroidX=true
11+
12+
#Maven Publishing
13+
GROUP=io.github.kdroidfilter
14+
VERSION_NAME=0.1.0-SNAPSHOT
15+
POM_INCEPTION_YEAR=2024
16+
POM_URL=https://github.com/kdroidFilter/ComposeDesktopNativeWebiew
17+
POM_LICENSE_NAME=MIT License
18+
POM_LICENSE_URL=https://opensource.org/licenses/MIT
19+
POM_LICENSE_DIST=repo
20+
POM_SCM_URL=https://github.com/kdroidFilter/ComposeDesktopNativeWebiew
21+
POM_SCM_CONNECTION=scm:git:git://github.com/kdroidFilter/ComposeDesktopNativeWebiew.git
22+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/kdroidFilter/ComposeDesktopNativeWebiew.git
23+
POM_DEVELOPER_ID=kdroidFilter
24+
POM_DEVELOPER_NAME=kdroidFilter
25+
POM_DEVELOPER_URL=https://github.com/kdroidFilter

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
androidx-activity = "1.12.2"
3+
mavenPublish = "0.35.0"
34
androidx-lifecycle = "2.9.6"
45
androidGradlePlugin = "8.12.3"
56
composeHotReload = "1.0.0"
@@ -43,3 +44,4 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref =
4344
gobleyCargo = { id = "dev.gobley.cargo", version.ref = "gobley" }
4445
gobleyRust = { id = "dev.gobley.rust", version.ref = "gobley" }
4546
gobleyUniffi = { id = "dev.gobley.uniffi", version.ref = "gobley" }
47+
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ include(":demo")
3636
include(":demo-shared")
3737
include(":demo-android")
3838
include(":wrywebview")
39-
include(":wrywebview-compose")
39+
include(":webview-compose")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import com.vanniktech.maven.publish.KotlinMultiplatform
2+
13
plugins {
24
alias(libs.plugins.androidLibrary)
35
alias(libs.plugins.kotlinMultiplatform)
46
alias(libs.plugins.composeMultiplatform)
57
alias(libs.plugins.composeCompiler)
8+
alias(libs.plugins.mavenPublish)
69
}
710

811
kotlin {
@@ -87,3 +90,16 @@ fun org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget.setUpiOSObserver()
8790
}
8891
}
8992
}
93+
94+
mavenPublishing {
95+
configure(KotlinMultiplatform(sourcesJar = true))
96+
publishToMavenCentral()
97+
if (project.findProperty("signingInMemoryKey") != null) {
98+
signAllPublications()
99+
}
100+
coordinates(artifactId = "composewebview")
101+
pom {
102+
name.set("ComposeWebView")
103+
description.set("Compose Multiplatform WebView library for Desktop, Android and iOS")
104+
}
105+
}

wrywebview-compose/src/androidMain/kotlin/io/github/kdroidfilter/webview/cookie/AndroidCookieManager.kt renamed to webview-compose/src/androidMain/kotlin/io/github/kdroidfilter/webview/cookie/AndroidCookieManager.kt

File renamed without changes.

wrywebview-compose/src/androidMain/kotlin/io/github/kdroidfilter/webview/cookie/Cookie.android.kt renamed to webview-compose/src/androidMain/kotlin/io/github/kdroidfilter/webview/cookie/Cookie.android.kt

File renamed without changes.

0 commit comments

Comments
 (0)