Skip to content

Commit 7b0b2c8

Browse files
committed
AGP 8.12.0
2 parents ddbb487 + 2abcec5 commit 7b0b2c8

File tree

7 files changed

+131
-74
lines changed

7 files changed

+131
-74
lines changed

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
mkdir build
4848
chmod +x ./gradlew
4949
PLUGIN_VERSION=$(cat ./gradle/libs.versions.toml | grep plugin_version | grep -Po '[\d.]+' | head -n1)
50-
PACKAGE=https://maven.pkg.github.com/${{ env.GITHUB_ACTOR }}/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NS }}/${{ env.PLUGIN_NAME }}/$PLUGIN_VERSION/${{ env.PLUGIN_NAME }}-$PLUGIN_VERSION.jar
50+
PACKAGE=https://maven.pkg.github.com/${{ env.GITHUB_ACTOR }}/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NS }}/${{ env.PLUGIN_NAME }}/${PLUGIN_VERSION}/${{ env.PLUGIN_NAME }}-${PLUGIN_VERSION}.jar
5151
if wget --user ${{ env.GITHUB_ACTOR }} --password ${{ env.GITHUB_TOKEN }} -q --method=HEAD $PACKAGE; then
5252
echo "::notice::Version $PLUGIN_VERSION already published."
5353
echo "PUBLISHED=true" >> "$GITHUB_ENV"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ configure<PublishingExtensionImpl> {
9292

9393
This configuration is entirely optional, while providing the config file at the default location:
9494

95-
`distribution/agconnect_apiclient.json`.
95+
- `distribution/agconnect_apiclient.json`.
9696

9797
### Plugin Tasks
9898

build.gradle.kts

Lines changed: 52 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,54 @@
1-
import org.codehaus.groovy.runtime.DefaultGroovyMethods.head
2-
31
// :buildSrc
42
plugins {
53
alias(buildSrc.plugins.maven.publish)
64
alias(buildSrc.plugins.gradle.plugin)
75
alias(buildSrc.plugins.gradle.publish)
86
}
97

10-
project.ext.set("github_handle", "syslogic")
11-
project.ext.set("group_id", "io.syslogic")
12-
project.ext.set("plugin_display_name", "AppGallery Connect Publishing Plugin")
13-
project.ext.set("plugin_description", "It uploads Android APK/ABB artifacts with AppGallery Connect Publishing API.")
14-
project.ext.set("plugin_identifier", "agconnect-publishing-gradle-plugin")
15-
project.ext.set("plugin_class", "io.syslogic.agconnect.PublishingPlugin")
16-
project.ext.set("plugin_id", "io.syslogic.agconnect.publishing")
17-
project.ext.set("plugin_version", buildSrc.versions.plugin.version.get())
8+
val pluginId: String by extra(buildSrc.versions.plugin.id.get())
9+
val pluginCls: String by extra(buildSrc.versions.plugin.cls.get())
10+
val pluginGroup: String by extra(buildSrc.versions.plugin.group.get())
11+
val pluginVersion: String by extra(buildSrc.versions.plugin.version.get())
12+
val pluginName: String by extra(buildSrc.versions.plugin.name.get())
13+
val pluginDesc: String by extra(buildSrc.versions.plugin.desc.get())
14+
val pluginIdentifier: String by extra(buildSrc.versions.plugin.identifier.get())
15+
val pluginEmail: String by extra(buildSrc.versions.plugin.email.get())
16+
val pluginDev: String by extra(buildSrc.versions.plugin.dev.get())
17+
val githubHandle: String by extra(buildSrc.versions.github.handle.get())
18+
19+
20+
gradlePlugin {
21+
plugins {
22+
create("PublishingPlugin") {
23+
id = pluginId
24+
implementationClass = pluginCls
25+
displayName = pluginName
26+
description = pluginDesc
27+
}
28+
}
29+
}
1830

1931
dependencies {
2032

2133
api(dependencyNotation = gradleApi())
22-
//noinspection DependencyNotationArgument
2334
api(dependencyNotation = buildSrc.android.gradle)
2435

25-
//noinspection DependencyNotationArgument
2636
implementation(dependencyNotation = buildSrc.annotations)
27-
//noinspection DependencyNotationArgument
2837
implementation(dependencyNotation = buildSrc.bundles.http.components)
2938

3039
testImplementation(dependencyNotation = buildSrc.junit)
3140
testImplementation(dependencyNotation = gradleTestKit())
32-
//noinspection DependencyNotationArgument
3341
testImplementation(dependencyNotation = buildSrc.annotations)
3442
testImplementation(dependencyNotation = project)
3543
}
3644

37-
gradlePlugin {
38-
plugins {
39-
create("PublishingPlugin") {
40-
id = "${project.ext.get("plugin_id")}"
41-
implementationClass = "${project.ext.get("plugin_class")}"
42-
displayName = "${project.ext.get("plugin_display_name")}"
43-
description = "${project.ext.get("plugin_description")}"
44-
}
45-
}
46-
}
47-
4845
tasks.withType<Test>().configureEach {
4946
useJUnitPlatform()
5047
}
5148

5249
tasks.withType<Jar>().configureEach {
53-
archiveBaseName.set("${project.ext.get("plugin_identifier")}")
54-
archiveVersion.set("${project.ext.get("plugin_version")}")
50+
archiveBaseName.set(pluginIdentifier)
51+
archiveVersion.set(pluginVersion)
5552
}
5653

5754
// Gradle 9.0 deprecation fix
@@ -61,7 +58,7 @@ val implCls: Configuration by configurations.creating {
6158
}
6259

6360
val javadocs by tasks.registering(Javadoc::class) {
64-
title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API"
61+
title = "$pluginName $pluginVersion API"
6562
classpath += implCls.asFileTree.filter {it.extension == "jar"}
6663
destinationDir = rootProject.file("build/javadoc")
6764
source = sourceSets.main.get().allJava
@@ -82,19 +79,20 @@ val sourcesJar by tasks.registering(Jar::class) {
8279
from(sourceSets.main.get().java.srcDirs)
8380
}
8481

85-
group = "${project.ext.get("group_id")}"
86-
version = "${project.ext.get("plugin_version")}"
87-
8882
artifacts {
8983
archives(javadocJar)
9084
archives(sourcesJar)
9185
}
9286

87+
group = pluginGroup
88+
version = pluginVersion
89+
9390
configure<PublishingExtension> {
91+
9492
repositories {
9593
maven {
9694
name = "GitHubPackages"
97-
url = uri("https://maven.pkg.github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}")
95+
url = uri("https://maven.pkg.github.com/${githubHandle}/${pluginIdentifier}")
9896
credentials {
9997
username = System.getenv("GITHUB_ACTOR")
10098
password = System.getenv("GITHUB_TOKEN")
@@ -103,41 +101,34 @@ configure<PublishingExtension> {
103101
}
104102

105103
publications {
106-
register<MavenPublication>("GPR") {
104+
register<MavenPublication>("Plugin") {
107105
from(components.getByName("java"))
108-
groupId = "${project.ext.get("group_id")}"
109-
artifactId = "${project.ext.get("plugin_identifier")}"
110-
version = "${project.ext.get("plugin_version")}"
106+
groupId = pluginGroup
107+
artifactId = pluginIdentifier
108+
version = pluginVersion
111109
pom {
112-
name = "${project.ext.get("plugin_display_name")}"
113-
description = "${project.ext.get("plugin_description")}"
114-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
110+
name = pluginName
111+
description = pluginDesc
112+
url = "https://github.com/${githubHandle}/${pluginIdentifier}"
115113
scm {
116-
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
117-
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
118-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
114+
connection = "scm:git:git://github.com/${githubHandle}/${pluginIdentifier}.git"
115+
developerConnection = "scm:git:ssh://github.com/${githubHandle}/${pluginIdentifier}.git"
116+
url = "https://github.com/${githubHandle}/${pluginIdentifier}/"
119117
}
120-
}
121-
}
122-
123-
register<MavenPublication>("JitPack") {
124-
from(components.getByName("java"))
125-
groupId = "${project.ext.get("group_id")}"
126-
artifactId = "${project.ext.get("plugin_identifier")}"
127-
version = "${project.ext.get("plugin_version")}"
128-
pom {
129-
name = "${project.ext.get("plugin_display_name")}"
130-
description = "${project.ext.get("plugin_description")}"
131-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
132-
scm {
133-
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
134-
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
135-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
118+
developers {
119+
developer {
120+
name = pluginDev
121+
email = pluginEmail
122+
id = githubHandle
123+
}
124+
}
125+
licenses {
126+
license {
127+
name = "MIT License"
128+
url = "http://www.opensource.org/licenses/mit-license.php"
129+
}
136130
}
137131
}
138132
}
139133
}
140134
}
141-
142-
// tasks.withType<MavenPublication>().forEach { pub: MavenPublication ->
143-
// }

gradle/libs.versions.toml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
[versions]
2-
android_gradle = "8.12.0"
3-
gradle_publish = "1.3.1"
4-
plugin_version = "1.4.2"
5-
annotations = "26.0.2"
6-
httpcore = "4.4.16"
7-
httpclient = "4.5.14"
8-
httpmime = "4.5.14"
9-
junit = "5.13.4"
10-
gson = "2.13.1"
2+
github_handle = "syslogic"
3+
plugin_name = "AppGallery Connect Publishing Plugin"
4+
plugin_desc = "It publishes APK/ABB artifacts to Huawei AppGallery."
5+
plugin_cls = "io.syslogic.agconnect.PublishingPlugin"
6+
plugin_identifier = "agconnect-publishing-gradle-plugin"
7+
plugin_id = "io.syslogic.agconnect.publishing"
8+
plugin_email = "syslogic@users.noreply.github.com"
9+
plugin_dev = "Martin Zeitler"
10+
plugin_group = "io.syslogic"
11+
12+
plugin_version = "1.4.2"
13+
14+
android_gradle = "8.12.0"
15+
gradle_publish = "1.3.1"
16+
annotations = "26.0.2"
17+
httpcore = "4.4.16"
18+
httpclient = "4.5.14"
19+
httpmime = "4.5.14"
20+
junit = "5.13.4"
21+
gson = "2.13.1"
1122

1223
[plugins]
13-
maven_publish = { id = "maven-publish" }
1424
gradle_plugin = { id = "org.gradle.java-gradle-plugin" }
1525
gradle_publish = { id = "com.gradle.plugin-publish", version.ref = "gradle_publish" }
26+
maven_publish = { id = "maven-publish" }
1627

17-
# The plugin can be defined in other projects alike this, for example:
28+
# The plugin can be added to other projects alike this:
1829
# agconnect_publishing = { id = "io.syslogic.agconnect.publishing", version.ref = "plugin_version" }
1930

2031
[libraries]

screenshots/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/repository.xcf

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pluginManagement {
1111
mavenCentral {
1212
content {
1313
includeGroupByRegex("org.apache.*")
14+
excludeGroupByRegex("com.gradle.*")
1415
}
1516
}
1617
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package io.syslogic.agconnect;
2+
3+
import org.gradle.testkit.runner.BuildResult;
4+
import org.gradle.testkit.runner.GradleRunner;
5+
import org.junit.jupiter.api.Assertions;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
8+
9+
import java.io.BufferedWriter;
10+
import java.io.File;
11+
import java.io.FileWriter;
12+
import java.io.IOException;
13+
import java.util.List;
14+
15+
/**
16+
* AGConnect Publishing Test
17+
* @author Martin Zeitler
18+
*/
19+
class PublishingTest {
20+
21+
GradleRunner runner;
22+
List<String> buildArgs = List.of(":build");
23+
24+
/**
25+
* Setting up {@link GradleRunner}, when running from directory `buildSrc`.
26+
* Eventually could also copy to @tmpDir and then inject the configuration.
27+
*/
28+
@BeforeEach
29+
public void setup() {
30+
if (new File("").getAbsoluteFile().getName().equals("buildSrc")) {
31+
this.runner = GradleRunner.create()
32+
.withProjectDir(new File("../"))
33+
.withPluginClasspath()
34+
.withDebug(true)
35+
.forwardOutput();
36+
} else {
37+
// This needs a Huawei Android project to test with.
38+
}
39+
}
40+
41+
@Test
42+
public void testLibraryBuild() {
43+
BuildResult result = this.runner.withArguments(this.buildArgs).build();
44+
Assertions.assertNotNull(result);
45+
Assertions.assertTrue(result.getOutput().contains("BUILD SUCCESSFUL"));
46+
}
47+
48+
private void writeFile(File destination, String content) throws IOException {
49+
try (BufferedWriter output = new BufferedWriter(new FileWriter(destination))) {
50+
output.write(content);
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)