Skip to content

Commit ff9eddf

Browse files
committed
Add snapshots
1 parent f2afe1e commit ff9eddf

6 files changed

Lines changed: 85 additions & 14 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@ name: Deploy to Maven Central
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
confirm:
7-
description: 'Type "yes" to confirm deployment to Maven Central'
8-
required: true
9-
default: ''
105

116
permissions:
127
contents: read
138

149
jobs:
1510
deploy:
16-
if: github.event.inputs.confirm == 'yes'
1711
runs-on: ubuntu-latest
1812

1913
steps:

.github/workflows/snapshot.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Sonatype Snapshot
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dependency_snapshot:
7+
description: 'Use snapshot annotation and lint dependencies'
8+
type: boolean
9+
default: false
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: 'recursive'
22+
fetch-depth: 0
23+
24+
- name: set up JDK
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '21'
28+
distribution: 'temurin'
29+
cache: gradle
30+
31+
- name: Publish snapshot to Sonatype
32+
run: |
33+
echo 'org.gradle.caching=true' >> gradle.properties
34+
echo 'org.gradle.parallel=true' >> gradle.properties
35+
echo 'org.gradle.vfs.watch=true' >> gradle.properties
36+
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
37+
echo 'publishSnapshot=true' >> gradle.properties
38+
echo 'dependencySnapshot=${{ github.event.inputs.dependency_snapshot }}' >> gradle.properties
39+
./gradlew publishApiPublicationToSnapshotsRepository
40+
./gradlew --stop
41+
env:
42+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }}
43+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }}
44+
ORG_GRADLE_PROJECT_snapshotsUsername: ${{ secrets.OSSRHUSERNAME }}
45+
ORG_GRADLE_PROJECT_snapshotsPassword: ${{ secrets.OSSRHPASSWORD }}

api/build.gradle.kts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ plugins {
66

77
android {
88
namespace = "io.github.libxposed.api"
9-
compileSdk = 36
10-
buildToolsVersion = "36.1.0"
9+
compileSdk = 37
10+
buildToolsVersion = "37.0.0"
1111
androidResources.enable = false
1212
enableKotlin = false
1313

@@ -32,14 +32,21 @@ android {
3232
}
3333
}
3434

35+
val libVersion = "102.0.0"
36+
val publishSnapshot = providers.gradleProperty("publishSnapshot").orNull == "true"
37+
val dependencySnapshot = providers.gradleProperty("dependencySnapshot").orNull == "true"
38+
fun String.real(snapshot: Boolean) = if (snapshot) "$this-SNAPSHOT" else this
39+
val libxposedAnnotation = "io.github.libxposed:annotation:" + libs.versions.libxposed.annotation.get()
40+
val libxposedLint = "io.github.libxposed:lint:" + libs.versions.libxposed.lint.get()
41+
3542
dependencies {
3643
compileOnly(libs.androidx.annotation)
37-
compileOnly(libs.libxposed.annotation)
38-
lintPublish(libs.libxposed.lint)
44+
compileOnly(libxposedAnnotation.real(dependencySnapshot))
45+
lintPublish(libxposedLint.real(dependencySnapshot))
3946
}
4047

4148
val androidJavadoc by tasks.registering(Javadoc::class) {
42-
title = "libxposed API $version"
49+
title = "libxposed API $libVersion"
4350
source(layout.projectDirectory.dir("src/main/java"))
4451
destinationDir = layout.buildDirectory.dir("javadoc").get().asFile
4552

@@ -73,7 +80,7 @@ publishing {
7380
register<MavenPublication>("api") {
7481
artifactId = "api"
7582
group = "io.github.libxposed"
76-
version = "102.0.0"
83+
version = libVersion.real(publishSnapshot)
7784
artifact(javadocJar)
7885
pom {
7986
name.set("api")
@@ -107,6 +114,11 @@ publishing {
107114
url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
108115
credentials(PasswordCredentials::class)
109116
}
117+
maven {
118+
name = "snapshots"
119+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
120+
credentials(PasswordCredentials::class)
121+
}
110122
maven {
111123
name = "GitHubPackages"
112124
url = uri("https://maven.pkg.github.com/libxposed/api")

build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
val dependencySnapshot = providers.gradleProperty("dependencySnapshot").orNull == "true"
2+
3+
allprojects {
4+
configurations.configureEach {
5+
if (dependencySnapshot) {
6+
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
7+
}
8+
9+
}
10+
}
11+
112
tasks.register("Delete", Delete::class) {
213
delete(rootProject.layout.buildDirectory)
314
}

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[versions]
22
agp = "9.2.1"
3+
libxposed-annotation = "1.0.0"
4+
libxposed-lint = "1.0.0"
35

46
[plugins]
57
agp-lib = { id = "com.android.library", version.ref = "agp" }
68

79
[libraries]
810
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.10.0" }
9-
libxposed-annotation = { module = "io.github.libxposed:annotation", version = "1.0.0" }
10-
libxposed-lint = { module = "io.github.libxposed:lint", version = "1.0.0" }

settings.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ dependencyResolutionManagement {
1414
includeGroup("io.github.libxposed")
1515
}
1616
}
17+
maven {
18+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
19+
mavenContent {
20+
snapshotsOnly()
21+
}
22+
content {
23+
includeGroup("io.github.libxposed")
24+
}
25+
}
1726
google()
1827
mavenCentral()
1928
}

0 commit comments

Comments
 (0)