Skip to content

Commit a7e446d

Browse files
Renju MenonRenju Menon
authored andcommitted
Ensure publish of assembled AAR and add jitpack.yml
1 parent 8a61a5c commit a7e446d

File tree

2 files changed

+32
-30
lines changed

2 files changed

+32
-30
lines changed

android-pdf-viewer/build.gradle

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
minSdkVersion 21
1111
targetSdkVersion 35
1212
versionCode 1
13-
versionName "4.0.11"
13+
versionName "4.0.12"
1414
}
1515

1616
compileOptions {
@@ -26,48 +26,37 @@ android {
2626

2727
dependencies {
2828
implementation 'androidx.core:core:1.3.1'
29-
// we embed pdfium (fat-aar) — on JitPack we publish pdfium first to mavenLocal
30-
embed project(path: ':pdfium', configuration: 'default')
29+
embed project(':pdfium')
3130
}
3231

3332
afterEvaluate {
34-
// keep task wiring for fat-aar if needed
35-
def debugEmbedTask = tasks.findByName('explodeCom.github.marain87Pdfium-debug.aarDebug')
36-
def releaseEmbedTask = tasks.findByName('explodeCom.github.marain87Pdfium-release.aarRelease')
33+
// Task dependencies for fat-aar
34+
tasks.findByName('extractDeepLinksDebug')?.dependsOn(tasks.findByName('explodeCom.github.marain87Pdfium-debug.aarDebug'))
35+
tasks.findByName('extractDeepLinksRelease')?.dependsOn(tasks.findByName('explodeCom.github.marain87Pdfium-release.aarRelease'))
3736

38-
if (debugEmbedTask) {
39-
tasks.named('extractDeepLinksDebug').configure {
40-
dependsOn(debugEmbedTask)
41-
}
42-
}
43-
if (releaseEmbedTask) {
44-
tasks.named('extractDeepLinksRelease').configure {
45-
dependsOn(releaseEmbedTask)
46-
}
37+
// Create AAR artifact lazily
38+
def aarFile = file("$buildDir/outputs/aar/${project.name}-release.aar")
39+
40+
// Register the artifact without checking existence during configuration
41+
def aarArtifact = artifacts.add('archives', aarFile) {
42+
type 'aar'
43+
builtBy 'assembleRelease'
4744
}
4845

49-
// Robust publishing: pick the assembled *.aar from build/outputs/aar and publish that file
46+
// Publishing configuration
5047
publishing {
5148
publications {
5249
aar(MavenPublication) {
5350
groupId = 'com.github.T-Pro'
5451
artifactId = 'AndroidPdfViewer'
55-
version = '4.0.11'
52+
version = '4.0.12'
5653

57-
def aarDir = file("$buildDir/outputs/aar")
58-
def aarFiles = fileTree(dir: aarDir).matching { include('*.aar') }.files
59-
if (aarFiles.isEmpty()) {
60-
throw new GradleException("No AAR found in ${aarDir}. Run :${project.path}:assembleRelease first.")
61-
}
62-
def aarFile = aarFiles.iterator().next()
63-
println "Publishing AAR file: ${aarFile}"
64-
artifact(aarFile)
54+
// Use the lazy artifact
55+
artifact aarArtifact
6556
}
6657
}
67-
6858
repositories {
69-
// publish to the JitPack container's local maven repo during CI build
7059
mavenLocal()
7160
}
7261
}
73-
}
62+
}

jitpack.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
# jitpack.yml (place at repo root)
2+
jdk:
3+
- openjdk17
4+
15
install:
6+
- chmod +x ./gradlew
27
- ./gradlew --no-daemon -v
38

49
script:
5-
# 1) assemble the modules (creates the AAR files)
10+
# 1) assemble release artifacts (creates AARs)
611
- ./gradlew :pdfium:assembleRelease :android-pdf-viewer:assembleRelease -x lint -x test --no-daemon --stacktrace
712

813
# 2) publish assembled artifacts to the container's mavenLocal
9-
- ./gradlew :pdfium:publishReleasePublicationToMavenLocal :android-pdf-viewer:publishAarPublicationToMavenLocal --no-daemon --stacktrace
14+
- ./gradlew :pdfium:publishReleasePublicationToMavenLocal :android-pdf-viewer:publishAarPublicationToMavenLocal --no-daemon --stacktrace
15+
16+
after_success:
17+
- echo "---- build outputs for android-pdf-viewer ----"
18+
- ls -la android-pdf-viewer/build/outputs/aar || true
19+
- echo "---- mavenLocal path: AndroidPdfViewer (T-Pro) ----"
20+
- ls -la ~/.m2/repository/com/github/T-Pro/AndroidPdfViewer || true
21+
- echo "---- mavenLocal path: PdfiumAndroid (marain87) ----"
22+
- ls -la ~/.m2/repository/com/github/marain87/PdfiumAndroid || true

0 commit comments

Comments
 (0)