Skip to content

Commit 745e22d

Browse files
committed
chore: release v0.1.0
1 parent 8e2f217 commit 745e22d

7 files changed

Lines changed: 224 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
## 0.1.0 - 2026-02-09
4+
5+
### Features
6+
- Migrate plugin instrumentation from removed Transform API to AGP official Instrumentation API.
7+
- Add exception-safe trace pairing by injecting `Trace.endSection()` on exceptional exits.
8+
- Add 2x2 compatibility demo matrix (AGP 7.4.2 / 8.3.2 x local / remote plugin).
9+
- Add Gradle compatibility CI matrix to verify compile-time bytecode injection.
10+
11+
### Documentation
12+
- Rewrite README/README_zh to focus on version selection and usage path.
13+
- Add maintainer release instructions for Maven Central publishing.
14+
15+
## 0.0.6 - 2021-12-23
16+
17+
### Features
18+
- Legacy Transform API based instrumentation release.

CHANGELOG.zh.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# 更新日志
2+
3+
## 0.1.0 - 2026-02-09
4+
5+
### 新功能
6+
- 将插件插桩从已移除的 Transform API 迁移到 AGP 官方 Instrumentation API。
7+
- 增加异常路径兜底:在方法异常退出时也会注入 `Trace.endSection()`,保证 trace 配对。
8+
- 新增 2x2 兼容性 Demo 矩阵(AGP 7.4.2 / 8.3.2 x 本地/远程插件)。
9+
- 新增 Gradle 兼容性 CI 矩阵,自动验证编译期字节码插桩。
10+
11+
### 文档
12+
- 重写 README/README_zh,突出“如何选版本、怎么接入”。
13+
- 增加维护者 Maven Central 发版说明。
14+
15+
## 0.0.6 - 2021-12-23
16+
17+
### 新功能
18+
- 基于旧 Transform API 的插桩版本。

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TraceFix instruments bytecode at compile time and injects `android.os.Trace.begi
2020
1. Set plugin version in `gradle.properties`:
2121

2222
```properties
23-
TRACEFIX_VERSION=0.0.6
23+
TRACEFIX_VERSION=0.1.0
2424
```
2525

2626
2. Add plugin classpath in module or root `build.gradle`:
@@ -45,6 +45,23 @@ apply plugin: 'auto-add-systrace'
4545

4646
4. Build your app and inspect traces in Perfetto (`https://ui.perfetto.dev/#!/viewer`).
4747

48+
## Publish To Maven Central (Maintainers)
49+
50+
1. Export credentials:
51+
52+
```bash
53+
export OSSRH_USERNAME=...
54+
export OSSRH_PASSWORD=...
55+
export SIGNING_KEY='-----BEGIN PGP PRIVATE KEY BLOCK-----...'
56+
export SIGNING_PASSWORD=...
57+
```
58+
59+
2. Publish release artifact:
60+
61+
```bash
62+
./gradlew :android-systrace-plugin:publishReleaseToSonatype
63+
```
64+
4865
## Local Plugin (For Repo Development)
4966

5067
1. Publish plugin to local Maven:

README_zh.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TraceFix 是一个编译期字节码插桩插件,会在方法前后自动插
2020
1.`gradle.properties` 配置版本:
2121

2222
```properties
23-
TRACEFIX_VERSION=0.0.6
23+
TRACEFIX_VERSION=0.1.0
2424
```
2525

2626
2. 在 module 或 root 的 `build.gradle` 添加插件 classpath:
@@ -45,6 +45,23 @@ apply plugin: 'auto-add-systrace'
4545

4646
4. 编译后用 Perfetto 查看结果:`https://ui.perfetto.dev/#!/viewer`
4747

48+
## 发布到 Maven Central(维护者)
49+
50+
1. 配置发布凭据:
51+
52+
```bash
53+
export OSSRH_USERNAME=...
54+
export OSSRH_PASSWORD=...
55+
export SIGNING_KEY='-----BEGIN PGP PRIVATE KEY BLOCK-----...'
56+
export SIGNING_PASSWORD=...
57+
```
58+
59+
2. 执行发布:
60+
61+
```bash
62+
./gradlew :android-systrace-plugin:publishReleaseToSonatype
63+
```
64+
4865
## 本地插件用法(仓库开发)
4966

5067
1. 先发布到本地 Maven:

android-systrace-plugin/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ repositories {
3636

3737
ext {
3838
bintrayName = 'TraceFix' //bintray用户名
39-
artifact = bintrayName
40-
libraryName = 'TraceFix'
41-
libraryDescription = 'Auto add Systrace tag while building apk'
42-
libraryVersion = '0.0.6'
39+
artifact = bintrayName
40+
libraryName = 'TraceFix'
41+
libraryDescription = 'Auto add Systrace tag while building apk'
42+
libraryVersion = (rootProject.findProperty("TRACEFIX_VERSION") ?: '0.0.6').toString()
4343
}
4444

4545

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ android.enableJetifier=true
2020
# Kotlin code style for this project: "official" or "obsolete":
2121
kotlin.code.style=official
2222
# TraceFix plugin version
23-
TRACEFIX_VERSION=0.0.6
23+
TRACEFIX_VERSION=0.1.0
2424
# TraceFix plugin version, For local debug
2525
TRACEFIX_VERSION_DEBUG=1.0
2626
publishedGroupId=io.github.gracker
@@ -31,4 +31,4 @@ developerName=Jianwu Gao
3131
developerEmail=dreamtale.jg@gmail.com
3232
licenseName=The Apache Software License, Version 2.0
3333
licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt
34-
allLicenses=["Apache-2.0"]
34+
allLicenses=["Apache-2.0"]

gradle/java-publish.gradle

Lines changed: 146 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
23

34
tasks.withType(JavaCompile).configureEach {
45
options.encoding = "UTF-8"
@@ -18,30 +19,163 @@ tasks.register("javadocJarLocal", Jar) {
1819
from tasks.named("javadoc")
1920
}
2021

22+
def releaseVersion = (project.findProperty("TRACEFIX_VERSION")
23+
?: project.findProperty("libraryVersion")
24+
?: "0.0.6").toString()
25+
def debugVersion = (project.findProperty("TRACEFIX_VERSION_DEBUG")
26+
?: releaseVersion).toString()
27+
def publishGroupId = (project.findProperty("publishedGroupId") ?: "io.github.gracker").toString()
28+
def publishArtifactId = (project.findProperty("artifact") ?: project.name).toString()
29+
30+
def ossrhUsername = project.findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
31+
def ossrhPassword = project.findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
32+
def signingKey = project.findProperty("signingKey") ?: System.getenv("SIGNING_KEY")
33+
def signingPassword = project.findProperty("signingPassword") ?: System.getenv("SIGNING_PASSWORD")
34+
def signingKeyId = project.findProperty("signingKeyId") ?: System.getenv("SIGNING_KEY_ID")
35+
36+
def pomLibraryName = (project.findProperty("libraryName") ?: "TraceFix").toString()
37+
def pomDescription = (project.findProperty("libraryDescription") ?: "Auto add Systrace tag while building apk").toString()
38+
def pomSiteUrl = (project.findProperty("siteUrl") ?: "https://github.com/Gracker/TraceFix").toString()
39+
def pomGitUrl = (project.findProperty("gitUrl") ?: "https://github.com/Gracker/TraceFix.git").toString()
40+
def pomLicenseName = (project.findProperty("licenseName") ?: "The Apache Software License, Version 2.0").toString()
41+
def pomLicenseUrl = (project.findProperty("licenseUrl") ?: "http://www.apache.org/licenses/LICENSE-2.0.txt").toString()
42+
def pomDeveloperId = (project.findProperty("developerId") ?: "TraceFix").toString()
43+
def pomDeveloperName = (project.findProperty("developerName") ?: "TraceFix").toString()
44+
def pomDeveloperEmail = (project.findProperty("developerEmail") ?: "tracefix@example.com").toString()
45+
46+
def configurePomMetadata = { MavenPublication publication ->
47+
publication.pom {
48+
name.set(pomLibraryName)
49+
description.set(pomDescription)
50+
url.set(pomSiteUrl)
51+
licenses {
52+
license {
53+
name.set(pomLicenseName)
54+
url.set(pomLicenseUrl)
55+
}
56+
}
57+
developers {
58+
developer {
59+
id.set(pomDeveloperId)
60+
name.set(pomDeveloperName)
61+
email.set(pomDeveloperEmail)
62+
}
63+
}
64+
scm {
65+
connection.set(pomGitUrl)
66+
developerConnection.set(pomGitUrl)
67+
url.set(pomSiteUrl)
68+
}
69+
}
70+
}
71+
2172
publishing {
2273
repositories {
2374
maven {
2475
name = "tracefixRemote"
2576
url = rootProject.layout.buildDirectory.dir("tracefix-remote-repo")
2677
}
78+
79+
maven {
80+
name = "sonatype"
81+
def releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
82+
def snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
83+
url = releaseVersion.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
84+
credentials {
85+
username = ossrhUsername
86+
password = ossrhPassword
87+
}
88+
}
2789
}
2890

2991
publications {
3092
traceFixLocal(MavenPublication) {
3193
from components.java
32-
groupId = publishedGroupId
33-
artifactId = artifact
34-
version = TRACEFIX_VERSION_DEBUG
94+
groupId = publishGroupId
95+
artifactId = publishArtifactId
96+
version = debugVersion
3597
artifact tasks.named("sourcesJarLocal")
3698
artifact tasks.named("javadocJarLocal")
99+
configurePomMetadata(delegate)
100+
}
101+
102+
traceFixRelease(MavenPublication) {
103+
from components.java
104+
groupId = publishGroupId
105+
artifactId = publishArtifactId
106+
version = releaseVersion
107+
artifact tasks.named("sourcesJarLocal")
108+
artifact tasks.named("javadocJarLocal")
109+
configurePomMetadata(delegate)
37110
}
38111
}
39112
}
40113

114+
def isSonatypeReleaseTask = {
115+
gradle.startParameter.taskNames.any { taskName ->
116+
String normalized = taskName.toLowerCase()
117+
normalized.contains("sonatype") || normalized.endsWith("publishreleasetosonatype")
118+
}
119+
}
120+
121+
signing {
122+
required {
123+
isSonatypeReleaseTask()
124+
}
125+
if (isSonatypeReleaseTask()) {
126+
if (signingKey && signingPassword) {
127+
if (signingKeyId) {
128+
useInMemoryPgpKeys(signingKeyId.toString(), signingKey.toString(), signingPassword.toString())
129+
} else {
130+
useInMemoryPgpKeys(signingKey.toString(), signingPassword.toString())
131+
}
132+
} else {
133+
logger.lifecycle("SIGNING_KEY/SIGNING_PASSWORD not found. Signing will fail for Sonatype publish.")
134+
}
135+
sign publishing.publications.traceFixRelease
136+
}
137+
}
138+
139+
tasks.register("verifyReleasePublishConfig") {
140+
doLast {
141+
List<String> missing = []
142+
if (!ossrhUsername) {
143+
missing.add("ossrhUsername or OSSRH_USERNAME")
144+
}
145+
if (!ossrhPassword) {
146+
missing.add("ossrhPassword or OSSRH_PASSWORD")
147+
}
148+
if (!signingKey) {
149+
missing.add("signingKey or SIGNING_KEY (ASCII-armored private key)")
150+
}
151+
if (!signingPassword) {
152+
missing.add("signingPassword or SIGNING_PASSWORD")
153+
}
154+
if (!missing.isEmpty()) {
155+
throw new GradleException("Missing release publish config: " + missing.join(", "))
156+
}
157+
}
158+
}
159+
160+
tasks.withType(PublishToMavenRepository).configureEach { publishTask ->
161+
if (publishTask.name == "publishTraceFixReleasePublicationToSonatypeRepository") {
162+
publishTask.dependsOn("verifyReleasePublishConfig")
163+
}
164+
}
165+
166+
tasks.matching { it.name == "signTraceFixReleasePublication" }.configureEach { signTask ->
167+
signTask.onlyIf {
168+
isSonatypeReleaseTask()
169+
}
170+
if (isSonatypeReleaseTask()) {
171+
signTask.dependsOn("verifyReleasePublishConfig")
172+
}
173+
}
174+
41175
tasks.register("buildAndPublishToLocalMaven") {
42-
dependsOn("build", "publishToMavenLocal")
176+
dependsOn("build", "publishTraceFixLocalPublicationToMavenLocal")
43177
doLast {
44-
println "* published to maven local: ${publishedGroupId}:${artifact}:${TRACEFIX_VERSION_DEBUG}"
178+
println "* published to maven local: ${publishGroupId}:${publishArtifactId}:${debugVersion}"
45179
}
46180
}
47181

@@ -51,3 +185,10 @@ tasks.register("buildAndPublishToRemoteRepo") {
51185
println "* published to file repo: ${rootProject.buildDir}/tracefix-remote-repo"
52186
}
53187
}
188+
189+
tasks.register("publishReleaseToSonatype") {
190+
dependsOn("publishTraceFixReleasePublicationToSonatypeRepository")
191+
doLast {
192+
println "* published release: ${publishGroupId}:${publishArtifactId}:${releaseVersion}"
193+
}
194+
}

0 commit comments

Comments
 (0)