Skip to content

Commit 854bf88

Browse files
arunkumar9t2MinhNguyen-nvm
authored andcommitted
Refactor code organization and setup maven publishing (#3)
Fixes #4
1 parent 190fe5a commit 854bf88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+435
-344
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release App Sizer
22

33
on:
44
release:
5-
types: [created]
5+
types: [ created ]
66

77
env:
88
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
@@ -56,47 +56,47 @@ jobs:
5656
asset_name: app-sizer-cli-${{ env.VERSION }}.jar.sha256
5757
asset_content_type: text/plain
5858

59-
release-plugin:
60-
runs-on: ubuntu-latest
61-
permissions:
62-
contents: write
63-
packages: write
64-
65-
steps:
66-
- uses: actions/checkout@v4
67-
with:
68-
fetch-depth: 0
69-
70-
- name: Set up JDK 11
71-
uses: actions/setup-java@v4
72-
with:
73-
distribution: "zulu"
74-
java-version: "11"
75-
cache: 'gradle'
76-
77-
- name: Get version
78-
id: get_version
79-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
80-
81-
- name: Import GPG key
82-
uses: crazy-max/ghaction-import-gpg@v5
83-
with:
84-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
85-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
86-
87-
- name: Validate Gradle wrapper
88-
uses: gradle/wrapper-validation-action@v1
89-
90-
- name: Publish to Maven Central
91-
env:
92-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
93-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
94-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
95-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
96-
VERSION: ${{ env.VERSION }}
97-
run: |
98-
./gradlew :gradle-plugin:publish \
99-
-Pversion=${VERSION} \
100-
--no-daemon \
101-
--no-parallel \
102-
--stacktrace
59+
# release-plugin:
60+
# runs-on: ubuntu-latest
61+
# permissions:
62+
# contents: write
63+
# packages: write
64+
#
65+
# steps:
66+
# - uses: actions/checkout@v4
67+
# with:
68+
# fetch-depth: 0
69+
#
70+
# - name: Set up JDK 11
71+
# uses: actions/setup-java@v4
72+
# with:
73+
# distribution: "zulu"
74+
# java-version: "11"
75+
# cache: 'gradle'
76+
#
77+
# - name: Get version
78+
# id: get_version
79+
# run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
80+
#
81+
# - name: Import GPG key
82+
# uses: crazy-max/ghaction-import-gpg@v5
83+
# with:
84+
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
85+
# passphrase: ${{ secrets.GPG_PASSPHRASE }}
86+
#
87+
# - name: Validate Gradle wrapper
88+
# uses: gradle/wrapper-validation-action@v1
89+
#
90+
# - name: Publish to Maven Central
91+
# env:
92+
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
93+
# OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
94+
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
95+
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
96+
# VERSION: ${{ env.VERSION }}
97+
# run: |
98+
# ./gradlew :gradle-plugin:publish \
99+
# -Pversion=${VERSION} \
100+
# --no-daemon \
101+
# --no-parallel \
102+
# --stacktrace

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sample/.idea/*
77
.DS_Store
88
/build/
99
build/
10+
!**/src/**/build/
1011
/captures
1112

1213

.gitlab-ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ buildscript {
4747
```
4848
In the app module 's `build.gradle`
4949
```groovy
50-
apply plugin: "com.grab.app-sizer"
50+
plugins {
51+
id "com.grab.sizer" version "<version>"
52+
}
5153
5254
// AppSizer configuration
5355
appSizer {

app-sizer/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
*/
2727

2828
plugins {
29-
id 'com.grab.sizer.kotlin'
29+
id 'com.grab.sizer.build.kotlin'
30+
alias(libs.plugins.dokka.gradle.plugin)
3031
}
32+
apply from: "../gradle/publishing.gradle"
3133

3234
dependencies {
3335
/**

app-sizer/src/main/kotlin/com/grab/sizer/AppSizer.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,5 @@ class AppSizer(
6868
}
6969
}
7070
}
71-
7271
}
7372
}

build-logic/build.gradle.kts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,19 @@ plugins {
3030
`kotlin-dsl`
3131
}
3232

33-
34-
repositories {
35-
google()
36-
mavenCentral()
37-
maven {
38-
url = uri("https://plugins.gradle.org/m2/")
39-
}
40-
maven {
41-
setUrl("https://artifacts.gitlab.myteksi.net/artifactory/mobile--android")
42-
credentials {
43-
username = System.getenv("READ_USER")
44-
password = System.getenv("READ_PASSWORD")
45-
}
46-
}
47-
}
48-
4933
dependencies {
50-
implementation (libs.kotlin.gradle.plugin)
34+
implementation(libs.kotlin.gradle.plugin)
5135
}
5236

5337
gradlePlugin {
5438
plugins {
55-
register("sizerKotlinBuildPlugin"){
56-
id = "com.grab.sizer.kotlin"
57-
implementationClass = "com.grab.sizer.buildplugin.AppSizerConfigPlugin"
39+
register("build") {
40+
id = "com.grab.sizer.build.common"
41+
implementationClass = "com.grab.sizer.build.BuildPlugin"
42+
}
43+
register("kotlin") {
44+
id = "com.grab.sizer.build.kotlin"
45+
implementationClass = "com.grab.sizer.jvm.KotlinPlugin"
5846
}
5947
}
6048
}

build-logic/gradle.properties

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

build-logic/gradlew

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-logic/gradlew.bat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)