Skip to content

Commit ddd6d4a

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

File tree

4 files changed

+95
-70
lines changed

4 files changed

+95
-70
lines changed

.github/workflows/gradle.yml

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,58 @@
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: ${{ GITHUB.REPOSITORY_OWNER }}
44+
GITHUB_TOKEN: ${{ SECRETS.GITHUB_TOKEN }}
6045
run: |
61-
./gradlew :build
46+
mkdir build
47+
chmod +x ./gradlew
48+
gradle --no-daemon :build :publish
6249
cd ./build/libs
6350
ls -la | grep jar
6451
6552
- name: 📦 Retain Artifact (JAR)
6653
id: retain-plugin-jar
6754
uses: actions/upload-artifact@v4
6855
with:
69-
name: buildSrc
56+
name: agconnect-publishing-gradle-plugin
7057
path: ./build/libs/*.jar
7158
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: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.codehaus.groovy.runtime.DefaultGroovyMethods.head
2+
13
// :buildSrc
24
plugins {
35
alias(buildSrc.plugins.maven.publish)
@@ -43,7 +45,6 @@ gradlePlugin {
4345
}
4446
}
4547

46-
4748
tasks.withType<Test>().configureEach {
4849
useJUnitPlatform()
4950
}
@@ -62,7 +63,7 @@ val implCls: Configuration by configurations.creating {
6263
val javadocs by tasks.registering(Javadoc::class) {
6364
title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API"
6465
classpath += implCls.asFileTree.filter {it.extension == "jar"}
65-
setDestinationDir(project.file("/build/javadoc"))
66+
destinationDir = rootProject.file("build/javadoc")
6667
source = sourceSets.main.get().allJava
6768
// options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
6869
// options.linkSource = true
@@ -72,7 +73,7 @@ val javadocs by tasks.registering(Javadoc::class) {
7273

7374
val javadocJar by tasks.registering(Jar::class) {
7475
archiveClassifier.set("javadoc")
75-
from(project.file("/build/javadoc"))
76+
from(rootProject.file("build/javadoc"))
7677
dependsOn(javadocs)
7778
}
7879

@@ -89,25 +90,54 @@ artifacts {
8990
archives(sourcesJar)
9091
}
9192

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-
}
93+
configure<PublishingExtension> {
94+
repositories {
95+
maven {
96+
name = "GitHubPackages"
97+
url = uri("https://maven.pkg.github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}")
98+
credentials {
99+
username = System.getenv("GITHUB_ACTOR")
100+
password = System.getenv("GITHUB_TOKEN")
101+
}
102+
}
103+
}
104+
105+
publications {
106+
register<MavenPublication>("GPR") {
107+
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")}"
111+
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")}"
115+
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")}/"
119+
}
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")}/"
109136
}
110137
}
111138
}
112139
}
113140
}
141+
142+
// tasks.withType<MavenPublication>().forEach { pub: MavenPublication ->
143+
// }

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)