Skip to content

Commit 8a61a5c

Browse files
Renju MenonRenju Menon
authored andcommitted
Fix JitPack build setup with local maven publishadd jitpack.yml
1 parent fcca692 commit 8a61a5c

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

android-pdf-viewer/build.gradle

Lines changed: 13 additions & 26 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.7"
13+
versionName "4.0.11"
1414
}
1515

1616
compileOptions {
@@ -26,26 +26,12 @@ android {
2626

2727
dependencies {
2828
implementation 'androidx.core:core:1.3.1'
29-
//api project(':pdfium') use this to run the sample module
29+
// we embed pdfium (fat-aar) — on JitPack we publish pdfium first to mavenLocal
3030
embed project(path: ':pdfium', configuration: 'default')
3131
}
3232

3333
afterEvaluate {
34-
def bundleReleaseLintTask = tasks.findByName('bundleReleaseLocalLintAar')
35-
def mergeJarsReleaseTask = tasks.findByName('mergeJarsRelease')
36-
def bundleDebugLintTask = tasks.findByName('bundleDebugLocalLintAar')
37-
def mergeJarsDebugTask = tasks.findByName('mergeJarsDebug')
38-
39-
if (bundleReleaseLintTask && mergeJarsReleaseTask) {
40-
bundleReleaseLintTask.dependsOn(mergeJarsReleaseTask)
41-
bundleReleaseLintTask.mustRunAfter(mergeJarsReleaseTask)
42-
}
43-
44-
if (bundleDebugLintTask && mergeJarsDebugTask) {
45-
bundleDebugLintTask.dependsOn(mergeJarsDebugTask)
46-
bundleDebugLintTask.mustRunAfter(mergeJarsDebugTask)
47-
}
48-
34+
// keep task wiring for fat-aar if needed
4935
def debugEmbedTask = tasks.findByName('explodeCom.github.marain87Pdfium-debug.aarDebug')
5036
def releaseEmbedTask = tasks.findByName('explodeCom.github.marain87Pdfium-release.aarRelease')
5137

@@ -54,33 +40,34 @@ afterEvaluate {
5440
dependsOn(debugEmbedTask)
5541
}
5642
}
57-
5843
if (releaseEmbedTask) {
5944
tasks.named('extractDeepLinksRelease').configure {
6045
dependsOn(releaseEmbedTask)
6146
}
6247
}
63-
}
6448

65-
afterEvaluate {
49+
// Robust publishing: pick the assembled *.aar from build/outputs/aar and publish that file
6650
publishing {
6751
publications {
6852
aar(MavenPublication) {
6953
groupId = 'com.github.T-Pro'
7054
artifactId = 'AndroidPdfViewer'
71-
version = '4.10.0'
55+
version = '4.0.11'
7256

73-
// path to the assembled AAR produced by assembleRelease
74-
def aarFile = file("$buildDir/outputs/aar/${project.getName()}-release.aar")
75-
if (!aarFile.exists()) {
76-
throw new GradleException("AAR not found: ${aarFile}. Run :${project.path}:assembleRelease first.")
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.")
7761
}
62+
def aarFile = aarFiles.iterator().next()
63+
println "Publishing AAR file: ${aarFile}"
7864
artifact(aarFile)
7965
}
8066
}
8167

8268
repositories {
69+
// publish to the JitPack container's local maven repo during CI build
8370
mavenLocal()
8471
}
8572
}
86-
}
73+
}

jitpack.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ install:
22
- ./gradlew --no-daemon -v
33

44
script:
5-
- ./gradlew :pdfium:assembleRelease :android-pdf-viewer:assembleRelease -x lint -x test
6-
- ./gradlew :android-pdf-viewer:publishAarPublicationToMavenLocal -x lint -x test
5+
# 1) assemble the modules (creates the AAR files)
6+
- ./gradlew :pdfium:assembleRelease :android-pdf-viewer:assembleRelease -x lint -x test --no-daemon --stacktrace
7+
8+
# 2) publish assembled artifacts to the container's mavenLocal
9+
- ./gradlew :pdfium:publishReleasePublicationToMavenLocal :android-pdf-viewer:publishAarPublicationToMavenLocal --no-daemon --stacktrace

0 commit comments

Comments
 (0)