Skip to content

Commit

Permalink
change: Divide plugins into multiple functional groups to avoid addin…
Browse files Browse the repository at this point in the history
…g unnecessary dependencies (#159)
  • Loading branch information
mateuszkwiecinski authored Apr 9, 2021
1 parent 207b0de commit 832377b
Show file tree
Hide file tree
Showing 116 changed files with 1,548 additions and 294 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[*.{kt,kts}]
[*.{kt, kts}]
max_line_length = 140
indent_size = 4
insert_final_newline = true
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,15 @@ updates:
interval: "daily"
assignees:
- "mateuszkwiecinski"
- package-ecosystem: "gradle"
directory: "sample/android"
schedule:
interval: "daily"
assignees:
- "mateuszkwiecinski"
- package-ecosystem: "gradle"
directory: "sample/kotlin"
schedule:
interval: "daily"
assignees:
- "mateuszkwiecinski"
87 changes: 66 additions & 21 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,107 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Java

- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 8

- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
job-id: build-all-sample-projects
job-id: build
gradle-distribution-sha-256-sum-warning: false

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

- name: Code style
run: ./gradlew projectCodestyle

- name: Assemble
run: ./gradlew assemble

- name: Validate Plugins
run: ./gradlew validatePlugins validateTaskProperties
run: ./gradlew validatePlugins

- name: Jacoco test report
run: ./gradlew projectCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
run: ./gradlew test

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: test-results
path: "${{ github.workspace }}/**/build/reports/tests"
- name: Upload jacoco report
uses: actions/upload-artifact@v2

# - name: Upload jacoco report
# uses: actions/upload-artifact@v2
# with:
# name: jacoco-report
# path: "${{ github.workspace }}/**/build/reports/jacoco"

build-all-sample-android-projects:
runs-on: ubuntu-latest
strategy:
matrix:
gradle: [ 6.5.1, current, rc ]
task: [ build, projectTest, projectLint, projectCodeStyle, projectCoverage, issueLinksReport ]
name: (Android) Gradle version ${{ matrix.gradle }}, task ${{ matrix.task }}
steps:
- uses: actions/checkout@v2
with:
name: jacoco-report
path: "${{ github.workspace }}/**/build/reports/jacoco"
fetch-depth: 0

build-all-sample-projects:
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Pre-compile plugin using gradle wrapper
uses: burrunan/gradle-cache-action@v1
with:
job-id: build-all-sample-android-projects
gradle-distribution-sha-256-sum-warning: false
arguments: publishToMavenLocal -Pgroup=com.project.starter.local

- uses: eskatos/gradle-command-action@v1
with:
build-root-directory: sample/android
gradle-version: ${{ matrix.gradle }}
arguments: ${{ matrix.task }} -PuseMavenLocal

build-all-sample-kotlin-projects:
runs-on: ubuntu-latest
strategy:
matrix:
gradle: [ 6.5.1, current, rc]
task: [ build, projectTest, projectLint, projectCodeStyle, projectCoverage, issueLinksReport]
name: Gradle version ${{ matrix.gradle }}, task ${{ matrix.task }}
gradle: [ 6.5.1, current, rc ]
task: [ build, projectTest, projectCodeStyle, projectCoverage, issueLinksReport ]
name: (Kotlin) Gradle ${{ matrix.gradle }}, task ${{ matrix.task }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up JAVA 8

- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11

- name: Pre-compile plugin using gradle wrapper
uses: burrunan/gradle-cache-action@v1
with:
job-id: build-all-sample-projects
arguments: publishToMavenLocal -Pgroup=com.project.starter.local
job-id: build-all-sample-kotlin-projects
gradle-distribution-sha-256-sum-warning: false
arguments: publishToMavenLocal -Pgroup=com.project.starter.local

- uses: eskatos/gradle-command-action@v1
with:
build-root-directory: sample
build-root-directory: sample/kotlin
gradle-version: ${{ matrix.gradle }}
arguments: ${{ matrix.task }} -PuseMavenLocal
85 changes: 52 additions & 33 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,56 @@ on:
jobs:
generate-diff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
- id: dependency-diff
name: Generate dependency diff
uses: usefulness/dependency-tree-diff-action@v1
with:
configuration: 'runtimeClasspath'
project: 'plugins'
- uses: peter-evans/find-comment@v1
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Dependency diff
- uses: peter-evans/create-or-update-comment@v1
if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
Dependency diff:
```diff
${{ steps.dependency-diff.outputs.text-diff }}
```
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
gradle-distribution-sha-256-sum-warning: false

- id: dependency-diff-jvm
name: Generate dependency diff
uses: usefulness/dependency-tree-diff-action@v1
with:
configuration: 'runtimeClasspath'
project: 'jvm'

- id: dependency-diff-android
name: Generate dependency diff
uses: usefulness/dependency-tree-diff-action@v1
with:
configuration: 'runtimeClasspath'
project: 'android'

- uses: peter-evans/find-comment@v1
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Dependency diff

- uses: peter-evans/create-or-update-comment@v1
if: ${{ steps.dependency-diff-jvm.outputs.text-diff != null || steps.dependency-diff-android.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
Dependency diff:
`:jvm`:
```diff
${{ steps.dependency-diff-jvm.outputs.text-diff }}
```
`:android`:
```diff
${{ steps.dependency-diff-android.outputs.text-diff }}
```
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 17 additions & 13 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build app with Gradle
run: ./gradlew build
- name: Publish to Gradle Plugin Portal
run: ./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.gradle_publish_key }} -Pgradle.publish.secret=${{ secrets.gradle_publish_secret }}
- name: Publish to Github Package Registry
run: ./gradlew publish --continue || true
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up Java
uses: actions/setup-java@v1
with:
java-version: 8

- name: Build app with Gradle
run: ./gradlew build

- name: Publish to Gradle Plugin Portal
run: ./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.gradle_publish_key }} -Pgradle.publish.secret=${{ secrets.gradle_publish_secret }}

- name: Publish to Github Package Registry
run: ./gradlew publish --continue || true
25 changes: 14 additions & 11 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build app with Gradle
run: ./gradlew assemble
- name: Publish to Github Package Registry
run: ./gradlew publish --continue || true
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up Java
uses: actions/setup-java@v1
with:
java-version: 8

- name: Build app with Gradle
run: ./gradlew assemble

- name: Publish to Github Package Registry
run: ./gradlew publish --continue || true
7 changes: 5 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## Changed
- The `issuechecker` dependency has been moved from `jcenter()` to `mavenCentral()`
- `kapt` is not enabled automatically by default. use `useKapt` config property to change the default behavior
- Update Kotlin plugin to [1.4.31](https://github.com/JetBrains/kotlin/releases/tag/v1.4.31)
- `kapt` is not enabled automatically by default
- Update Kotlin plugin to [1.4.32](https://github.com/JetBrains/kotlin/releases/tag/v1.4.32)
- Divide plugins into multiple functional groups to avoid adding unnecessary dependencies
- Update _Detekt_ to version _1.16.0_ see [release notes](https://github.com/detekt/detekt/releases/tag/v1.16.0)
- Update _kotlinter-gradle_ to version _3.4.0_, see [release notes](https://github.com/jeremymailen/kotlinter-gradle/releases/tag/3.4.0)

## [0.23.0] - 2021-02-06
## Changed
Expand Down
46 changes: 46 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id 'java-gradle-plugin'
id 'com.starter.library.kotlin'
id 'pl.droidsonroids.jacoco.testkit' version '1.0.7'
id 'com.starter.publishing'
}

repositories {
mavenCentral()
google()
gradlePluginPortal()
}

dependencies {
api 'com.android.tools.build:gradle:4.1.3'
implementation project(":jvm")
implementation project(":config")
implementation project(":versioning")
implementation project(":quality")

testImplementation project(":testing")
}

jacoco {
toolVersion = "0.8.6"
}
tasks.withType(Test) {
useJUnitPlatform()
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}

gradlePlugin {
plugins {
androidLibrary {
id = 'com.starter.library.android'
displayName = 'Android Library Plugin'
implementationClass = 'com.project.starter.modules.plugins.AndroidLibraryPlugin'
}
androidApplication {
id = 'com.starter.application.android'
displayName = 'Android Applicataion Plugin'
implementationClass = 'com.project.starter.modules.plugins.AndroidApplicationPlugin'
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.project.starter.modules.extensions

import com.project.starter.quality.extensions.JavaSourcesAware

@Suppress("UnnecessaryAbstractClass")
abstract class AndroidExtension {
var javaFilesAllowed: Boolean? = null
abstract class AndroidExtension : JavaSourcesAware {
override var javaFilesAllowed: Boolean? = null
var defaultVariants: List<String> = emptyList()
var coverageExclusions: List<String> = emptyList()
val useKapt: Boolean? = null
}

open class AndroidLibraryConfigExtension : AndroidExtension() {
Expand Down
Loading

0 comments on commit 832377b

Please sign in to comment.