Skip to content

Commit 95bfcd2

Browse files
authored
Verify the standalone build on every pull request (#2)
Every module is built two ways: inside the android-sdk aggregate build, and on its own. Development happens in the aggregate build, so the standalone side rots silently — it is only exercised when the publish workflow runs, which is to say on release day. Add a `build.yml` that assembles the module on its own for every pull request, so this drift surfaces when the change is made instead of at release time. Where needed this commit also repairs the standalone build itself (missing wrapper/settings, missing version-catalog entries, dependency versions that had drifted from the aggregate build).
1 parent b413b07 commit 95bfcd2

8 files changed

Lines changed: 453 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build
2+
3+
# 単体ビルドの検証。
4+
#
5+
# ## なぜ要るのか
6+
#
7+
# このモジュールは android-sdk の集約ビルドと、自分だけの単体ビルドの
8+
# 2 通りで組まれる。開発は集約ビルドで行うため、**単体ビルド側の設定が
9+
# 静かに腐る。** 実際 1.3.0 のリリースでは、publish ワークフローを回して
10+
# 初めて次のような不備がまとめて露見した:
11+
#
12+
# - gradlew / settings.gradle.kts が無くて ./gradlew が叩けない
13+
# - version catalog に依存の定義が無い(集約側の catalog にはある)
14+
# - coroutines が推移的に古い版になり 3 引数 resume が通らない
15+
# - ベンダ SDK の版が集約ビルドと食い違う
16+
#
17+
# publish のときにしか単体ビルドしないと、リリース当日に気づくことになる。
18+
# ここで PR ごとに回して、変更した時点で分かるようにする。
19+
20+
on:
21+
pull_request:
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Java
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: '17'
38+
cache: 'gradle'
39+
40+
- name: Build core and compose locally
41+
run: |
42+
git clone --depth 1 https://github.com/MapConductor/android-sdk-core.git _core
43+
cd _core
44+
./gradlew --no-daemon publishToMavenLocal
45+
cd ..
46+
47+
mkdir -p "$HOME/.gradle/init.d"
48+
cat > "$HOME/.gradle/init.d/use-local-maven.init.gradle" << 'EOF'
49+
gradle.settingsEvaluated { settings ->
50+
settings.dependencyResolutionManagement.repositories {
51+
mavenLocal()
52+
}
53+
}
54+
EOF
55+
56+
git clone --depth 1 https://github.com/MapConductor/android-sdk-compose.git _compose
57+
cd _compose
58+
./gradlew --no-daemon publishToMavenLocal
59+
cd ..
60+
61+
# apiCheck は集約ビルド(android-sdk)の gradle/api-surface.gradle.kts が
62+
# 提供するタスクで、単体ビルドには存在しない。ここでは組み立てだけを見る。
63+
- name: Assemble
64+
run: ./gradlew --no-daemon -PskipSampleApp=true assembleRelease

build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ android {
4848
}
4949
}
5050

51+
val libraryGroupId = project.findProperty("libraryGroupId") as String? ?: "com.mapconductor"
52+
val libraryArtifactId = "for-openmobilemaps"
53+
val libraryVersion = project.findProperty("libraryVersion") as String? ?: "1.0.0"
54+
5155
dependencies {
5256
implementation(platform(libs.androidx.compose.bom))
5357
implementation(libs.androidx.ui)
@@ -74,9 +78,6 @@ dependencies {
7478
testImplementation(libs.junit)
7579
}
7680

77-
val libraryGroupId = project.findProperty("libraryGroupId") as String? ?: "com.mapconductor"
78-
val libraryArtifactId = "for-openmobilemaps"
79-
val libraryVersion = project.findProperty("libraryVersion") as String? ?: "1.0.0"
8081

8182
// Set project version for NMCP plugin
8283
version = libraryVersion

gradle/libs.versions.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[versions]
2+
openmobilemaps = "4.0.0"
3+
coroutines = "1.9.0"
4+
agp = "9.2.1"
5+
kotlin = "2.4.10"
6+
7+
composeBom = "2025.02.00"
8+
coreKtx = "1.16.0"
9+
lifecycleRuntimeKtx = "2.8.7"
10+
okhttp = "5.3.2"
11+
playServicesMaps = "20.0.0"
12+
activityCompose = "1.9.3"
13+
ktLint = "14.2.0"
14+
15+
junit = "4.13.2"
16+
junitVersion = "1.3.0"
17+
espressoCore = "3.7.0"
18+
19+
[libraries]
20+
openmobilemaps-mapscore = { module = "io.openmobilemaps:mapscore", version.ref = "openmobilemaps" }
21+
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
22+
# Jetpack Compose (with BOM)
23+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
24+
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
25+
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
26+
androidx-foundation = { group = "androidx.compose.foundation", name = "foundation" }
27+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
28+
29+
# Lifecycle
30+
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
31+
androidx-lifecycle-common-java8 = { group = "androidx.lifecycle", name = "lifecycle-common-java8", version.ref = "lifecycleRuntimeKtx" }
32+
33+
# Google Maps
34+
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
35+
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
36+
37+
# Sample app
38+
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
39+
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
40+
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
41+
42+
# Test
43+
junit = { group = "junit", name = "junit", version.ref = "junit" }
44+
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
45+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
46+
47+
[plugins]
48+
android-application = { id = "com.android.application", version.ref = "agp" }
49+
android-library = { id = "com.android.library", version.ref = "agp" }
50+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
51+
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
52+
jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLint" }

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Apr 11 01:40:57 PDT 2025
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)