Skip to content

Commit 1cfd059

Browse files
committed
useless build-step removed.
1 parent f153051 commit 1cfd059

File tree

4 files changed

+89
-70
lines changed

4 files changed

+89
-70
lines changed

.github/workflows/gradle.yml

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,57 @@
1-
name: Gradle
2-
1+
name: CI
32
on:
43
push:
54
branches: [ master ]
65
paths-ignore:
76
- '**/README.md'
87
- '**/.gitignore'
98
- '.run/**'
10-
pull_request:
11-
branches: [ master ]
12-
paths-ignore:
13-
- '**/README.md'
14-
- '**/.gitignore'
15-
- '.run/**'
9+
tags:
10+
- "[0-9]+.[0-9]+.[0-9]+"
1611

1712
jobs:
1813
build:
19-
name: 🎉 Build
14+
name: Build Gradle Plugin
2015
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
2119
steps:
2220

2321
# Testing the plugin source requires checking out into `buildSrc`.
2422
- name: 🚚 Get latest code
2523
uses: actions/checkout@v4
2624

2725
# https://github.com/actions/setup-java
28-
- name: Set up AWS Corretto JDK 17
26+
- name: Setup JDK
2927
uses: actions/setup-java@v4
3028
with:
29+
architecture: x64
3130
distribution: corretto
3231
java-version: '17'
33-
architecture: x64
3432

35-
- name: 🔢 Configure build
36-
shell: bash
37-
env:
38-
JAVA_KEYSTORE_DEBUG: ${{ secrets.JAVA_KEYSTORE_DEBUG }}
39-
JAVA_KEYSTORE_UPLOAD: ${{ secrets.JAVA_KEYSTORE_UPLOAD }}
40-
JAVA_KEYSTORE_PROPERTIES: ${{ secrets.JAVA_KEYSTORE_PROPERTIES }}
41-
AGC_API_CONFIG: ${{ secrets.AGC_API_CONFIG }}
42-
AGC_APP_RELEASE_CONFIG: ${{ secrets.AGC_APP_RELEASE_CONFIG }}
43-
AGC_APP_DEBUG_CONFIG: ${{ secrets.AGC_APP_DEBUG_CONFIG }}
44-
run: |
45-
chmod +x ./gradlew
46-
mkdir ~/.android
47-
mkdir $GITHUB_WORKSPACE/distribution
48-
mkdir -p $GITHUB_WORKSPACE/mobile/src/huaweiDebug
49-
mkdir -p $GITHUB_WORKSPACE/mobile/src/huaweiRelease
50-
echo $JAVA_KEYSTORE_DEBUG > ~/.android/debug.keystore
51-
echo $JAVA_KEYSTORE_UPLOAD > ~/.android/upload.keystore
52-
echo $JAVA_KEYSTORE_PROPERTIES > $GITHUB_WORKSPACE/keystore.properties
53-
echo $AGC_API_CONFIG > $GITHUB_WORKSPACE/distribution/agc-apiclient.json
54-
echo $AGC_APP_DEBUG_CONFIG > $GITHUB_WORKSPACE/mobile/src/huaweiDebug/agconnect-services.json
55-
echo $AGC_APP_RELEASE_CONFIG > $GITHUB_WORKSPACE/mobile/src/huaweiRelease/agconnect-services.json
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
with:
36+
gradle-version: '9.0.0'
37+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
38+
build-scan-terms-of-use-agree: "yes"
39+
build-scan-publish: false
5640

57-
- name: Build with Gradle
41+
- name: Gradle Build
5842
env:
59-
AGC_PACKAGE_ID: ${{ secrets.AGC_PACKAGE_ID }}
43+
GITHUB_ACTOR: ${ENV.GITHUB_ACTOR}
44+
GITHUB_TOKEN: ${SECRETS.GITHUB_TOKEN}
6045
run: |
61-
./gradlew :build
46+
mkdir build
47+
gradle --no-daemon :build :publishGitHubPublicationToGitHubPackagesRepository
6248
cd ./build/libs
6349
ls -la | grep jar
6450
6551
- name: 📦 Retain Artifact (JAR)
6652
id: retain-plugin-jar
6753
uses: actions/upload-artifact@v4
6854
with:
69-
name: buildSrc
55+
name: agconnect-publishing-gradle-plugin
7056
path: ./build/libs/*.jar
7157
retention-days: 14

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ buildscript {
3535
maven { url 'https://jitpack.io' }
3636
}
3737
dependencies {
38-
classpath "com.android.tools.build:gradle:8.11.0"
39-
classpath "com.huawei.agconnect:agcp:1.9.3.300"
38+
classpath "com.android.tools.build:gradle:8.11.1"
39+
classpath "com.huawei.agconnect:agcp:1.9.3.302"
4040
classpath "io.syslogic:agconnect-publishing-gradle-plugin:1.4.1"
4141
}
4242
}
@@ -73,13 +73,20 @@ plugins {
7373
````groovy
7474
/** Huawei AppGallery Connect: agc-apiclient.json */
7575
def json_agc = "distribution${File.separator}agconnect_apiclient.json"
76-
if (rootProject.file(json_agc).exists()) {
77-
agcPublishing {
78-
configFile = rootProject.file(json_agc).absolutePath
79-
releaseType = 1
80-
verbose = false
81-
logHttp = true
82-
}
76+
77+
agcPublishing {
78+
configFile = rootProject.file(json_agc).absolutePath
79+
releaseType = 1
80+
verbose = false
81+
logHttp = true
82+
}
83+
````
84+
85+
````kotlin
86+
configure<PublishingExtensionImpl> {
87+
configFile = rootProject.file(json_agc).absolutePath
88+
verbose = false
89+
logHttp = true
8390
}
8491
````
8592

build.gradle.kts

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ gradlePlugin {
4343
}
4444
}
4545

46-
4746
tasks.withType<Test>().configureEach {
4847
useJUnitPlatform()
4948
}
@@ -62,7 +61,7 @@ val implCls: Configuration by configurations.creating {
6261
val javadocs by tasks.registering(Javadoc::class) {
6362
title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API"
6463
classpath += implCls.asFileTree.filter {it.extension == "jar"}
65-
setDestinationDir(project.file("/build/javadoc"))
64+
destinationDir = rootProject.file("build/javadoc")
6665
source = sourceSets.main.get().allJava
6766
// options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
6867
// options.linkSource = true
@@ -72,7 +71,7 @@ val javadocs by tasks.registering(Javadoc::class) {
7271

7372
val javadocJar by tasks.registering(Jar::class) {
7473
archiveClassifier.set("javadoc")
75-
from(project.file("/build/javadoc"))
74+
from(rootProject.file("build/javadoc"))
7675
dependsOn(javadocs)
7776
}
7877

@@ -89,23 +88,49 @@ artifacts {
8988
archives(sourcesJar)
9089
}
9190

92-
afterEvaluate {
93-
publishing {
94-
publications {
95-
create<MavenPublication>("release") {
96-
from(components.getByName("java"))
97-
groupId = "${project.ext.get("group_id")}"
98-
artifactId = "${project.ext.get("plugin_identifier")}"
99-
version = "${project.ext.get("plugin_version")}"
100-
pom {
101-
name = "${project.ext.get("plugin_display_name")}"
102-
description = "${project.ext.get("plugin_description")}"
103-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
104-
scm {
105-
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
106-
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
107-
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
108-
}
91+
configure<PublishingExtension> {
92+
repositories {
93+
maven {
94+
name = "GitHubPackages"
95+
url = uri("https://maven.pkg.github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}")
96+
credentials {
97+
username = System.getenv("GITHUB_ACTOR")
98+
password = System.getenv("GITHUB_TOKEN")
99+
}
100+
}
101+
}
102+
publications {
103+
104+
register<MavenPublication>("GitHub") {
105+
from(components.getByName("java"))
106+
groupId = "${project.ext.get("group_id")}"
107+
artifactId = "${project.ext.get("plugin_identifier")}"
108+
version = "${project.ext.get("plugin_version")}"
109+
pom {
110+
name = "${project.ext.get("plugin_display_name")}"
111+
description = "${project.ext.get("plugin_description")}"
112+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
113+
scm {
114+
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
115+
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
116+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
117+
}
118+
}
119+
}
120+
121+
register<MavenPublication>("JitPack") {
122+
from(components.getByName("java"))
123+
groupId = "${project.ext.get("group_id")}"
124+
artifactId = "${project.ext.get("plugin_identifier")}"
125+
version = "${project.ext.get("plugin_version")}"
126+
pom {
127+
name = "${project.ext.get("plugin_display_name")}"
128+
description = "${project.ext.get("plugin_description")}"
129+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
130+
scm {
131+
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
132+
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
133+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
109134
}
110135
}
111136
}

settings.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// settings.gradle.kts
2+
23
pluginManagement {
34
repositories {
4-
mavenCentral {
5-
content {
6-
includeGroupByRegex("org.apache.*")
7-
}
8-
}
95
gradlePluginPortal {
106
content {
117
excludeGroupByRegex("org.apache.*")
128
includeGroupByRegex("com.gradle.*")
139
}
1410
}
11+
mavenCentral {
12+
content {
13+
includeGroupByRegex("org.apache.*")
14+
}
15+
}
1516
}
1617
}
1718

0 commit comments

Comments
 (0)