Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release App Sizer

on:
release:
types: [created]
types: [ created ]

env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
Expand Down Expand Up @@ -56,47 +56,47 @@ jobs:
asset_name: app-sizer-cli-${{ env.VERSION }}.jar.sha256
asset_content_type: text/plain

release-plugin:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "11"
cache: 'gradle'

- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Publish to Maven Central
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
VERSION: ${{ env.VERSION }}
run: |
./gradlew :gradle-plugin:publish \
-Pversion=${VERSION} \
--no-daemon \
--no-parallel \
--stacktrace
# release-plugin:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# packages: write
#
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Set up JDK 11
# uses: actions/setup-java@v4
# with:
# distribution: "zulu"
# java-version: "11"
# cache: 'gradle'
#
# - name: Get version
# id: get_version
# run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
#
# - name: Import GPG key
# uses: crazy-max/ghaction-import-gpg@v5
# with:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# passphrase: ${{ secrets.GPG_PASSPHRASE }}
#
# - name: Validate Gradle wrapper
# uses: gradle/wrapper-validation-action@v1
#
# - name: Publish to Maven Central
# env:
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# VERSION: ${{ env.VERSION }}
# run: |
# ./gradlew :gradle-plugin:publish \
# -Pversion=${VERSION} \
# --no-daemon \
# --no-parallel \
# --stacktrace
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sample/.idea/*
.DS_Store
/build/
build/
!**/src/**/build/
/captures


Expand Down
39 changes: 0 additions & 39 deletions .gitlab-ci.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ buildscript {
```
In the app module 's `build.gradle`
```groovy
apply plugin: "com.grab.app-sizer"
plugins {
id "com.grab.sizer" version "<version>"
}

// AppSizer configuration
appSizer {
Expand Down
4 changes: 3 additions & 1 deletion app-sizer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
*/

plugins {
id 'com.grab.sizer.kotlin'
id 'com.grab.sizer.build.kotlin'
alias(libs.plugins.dokka.gradle.plugin)
}
apply from: "../gradle/publishing.gradle"

dependencies {
/**
Expand Down
1 change: 0 additions & 1 deletion app-sizer/src/main/kotlin/com/grab/sizer/AppSizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,5 @@ class AppSizer(
}
}
}

}
}
28 changes: 8 additions & 20 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,19 @@ plugins {
`kotlin-dsl`
}


repositories {
google()
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
maven {
setUrl("https://artifacts.gitlab.myteksi.net/artifactory/mobile--android")
credentials {
username = System.getenv("READ_USER")
password = System.getenv("READ_PASSWORD")
}
}
}

dependencies {
implementation (libs.kotlin.gradle.plugin)
implementation(libs.kotlin.gradle.plugin)
}

gradlePlugin {
plugins {
register("sizerKotlinBuildPlugin"){
id = "com.grab.sizer.kotlin"
implementationClass = "com.grab.sizer.buildplugin.AppSizerConfigPlugin"
register("build") {
id = "com.grab.sizer.build.common"
implementationClass = "com.grab.sizer.build.BuildPlugin"
}
register("kotlin") {
id = "com.grab.sizer.build.kotlin"
implementationClass = "com.grab.sizer.jvm.KotlinPlugin"
}
}
}
1 change: 1 addition & 0 deletions build-logic/gradle.properties
1 change: 1 addition & 0 deletions build-logic/gradlew
1 change: 1 addition & 0 deletions build-logic/gradlew.bat
21 changes: 21 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

rootProject.name = "build-logic"
38 changes: 38 additions & 0 deletions build-logic/src/main/kotlin/com/grab/sizer/build/BuildPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* MIT License
*
* Copyright (c) 2024. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

package com.grab.sizer.build

import com.grab.sizer.gradle.ConfigurablePlugin

class BuildPlugin : ConfigurablePlugin({
allprojects {
group = project.findProperty("groupId")!!
version = project.findProperty("versionName")!!
description = "A tool designed to analyze the download size of Android applications"
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,13 @@
* SOFTWARE
*/

package com.grab.sizer.buildplugin
package com.grab.sizer.gradle

import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/** This plugin represents a build configuration
* of java-libraries/kotlin modules.
*/

class AppSizerConfigPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.plugins.apply("org.jetbrains.kotlin.jvm")
project.plugins.apply("org.jetbrains.kotlin.kapt")
project.version = if (System.getenv("CI") != null) "SNAPSHOT-08" else "SNAPSHOT"

project.tasks.withType(KotlinCompile::class.java).forEach {
it.kotlinOptions.jvmTarget = "11"
}

project.tasks.withType(JavaCompile::class.java).configureEach {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
}
}
open class ConfigurablePlugin(
private val configuration: Project.() -> Unit
) : Plugin<Project> {
override fun apply(project: Project): Unit = configuration(project)
}
60 changes: 60 additions & 0 deletions build-logic/src/main/kotlin/com/grab/sizer/jvm/Kotlin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* MIT License
*
* Copyright (c) 2024. Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
*/

package com.grab.sizer.jvm

import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.gradle.api.JavaVersion
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.configure

fun Project.javaCommon() {
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

internal fun Project.kotlinCommon() {
the<KotlinProjectExtension>().apply {
jvmToolchain(17)
}
tasks.withType<KotlinCompilationTask<KotlinCommonCompilerOptions>>().configureEach {
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_8)
freeCompilerArgs.addAll()
}
}
}

Loading