Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last cleanups #9

Merged
merged 3 commits into from
Nov 10, 2023
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
55 changes: 55 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,58 @@ jobs:
with:
name: test-results-${{ matrix.os }}
path: "${{ github.workspace }}/**/build/reports/tests"

provide-agp-version-matrix:
runs-on: ubuntu-latest
outputs:
agp-versions: ${{ steps.build-agp-matrix.outputs.agp-versions }}
steps:
- id: agp-version-finder
uses: usefulness/agp-version-finder-action@v1

- id: build-agp-matrix
run: |
echo 'agp-versions=["${{ steps.agp-version-finder.outputs.latest-stable }}", "${{ steps.agp-version-finder.outputs.latest-alpha }}"]' >> $GITHUB_OUTPUT

integration-tests-android:
runs-on: ubuntu-latest
needs:
- provide-agp-version-matrix
strategy:
fail-fast: false
matrix:
gradle: [ current, release-candidate ]
java: [ 21 ]
agp: ${{ fromJSON(needs.provide-agp-version-matrix.outputs.agp-versions) }}

name: '[android] Gradle: ${{ matrix.gradle }}, Java: ${{ matrix.java }}, AGP: ${{ matrix.agp }}'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Write Gradle build properties to `~/.gradle/gradle.properties`
run: |
mkdir -p ~/.gradle
printf "org.gradle.jvmargs=-Xmx3G -XX:+UseParallelGC\n" >> ~/.gradle/gradle.properties
printf "org.gradle.vfs.watch=false\n" >> ~/.gradle/gradle.properties
shell: bash

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- uses: gradle/gradle-build-action@v2
continue-on-error: true
with:
build-root-directory: sample
gradle-version: ${{ matrix.gradle }}
arguments: assemble -PagpVersion=${{ matrix.agp }} --continue

- name: Upload reports
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: "sample-reports-${{ matrix.gradle }}-${{ matrix.java }}-${{ matrix.agp }}"
path: "${{ github.workspace }}/**/build/reports/"
4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ MIT License

Copyright (c) 2022 premex-byggappen

Copyright (c) 2023 developers at @usefulness

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
Expand All @@ -18,4 +20,4 @@ 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.
SOFTWARE.
73 changes: 32 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,47 @@
# Gross
# lincesee-for-android
___

Gradle Open Source Software
Turn raw [cashapp/licensee](https://github.com/cashapp/licensee) report into assets/Kotlin code that can be easily consumed from an Android app

## Plugin can be found at:
https://plugins.gradle.org/plugin/se.premex.gross
### Installation

### Getting started
Gross uses the output of another plugin which figures out all your dependencies: https://github.com/cashapp/licensee
Available on:

Add licensee and gross to your root project / module. We need both mavenCentral and gradle plugin portal for plugin resolution:
- [Gradle Plugin Portal](https://plugins.gradle.org/plugin/io.github.usefulness.licensee-for-android)
- [Maven Central](https://mvnrepository.com/artifact/io.github.usefulness/licensee-for-android)

settings.gradle.kts
```kotlin
pluginManagement {
repositories {
gradlePluginPortal()
}
}
#### Apply the plugin

dependencyResolutionManagement {
repositories {
mavenCentral()
}
```groovy
plugins {
id("app.cash.licensee") version "x.y.z"
id("io.github.usefulness.licensee-for-android") version "{{version}}"
}
```

build.gradle.kts
```kotlin
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("app.cash.licensee:licensee-gradle-plugin:1.7.0")
}
}

plugins {
id("app.cash.licensee")
id("se.premex.gross") version "0.1.0"
### Features
- Access licenses report directly by a generated Kotlin code (accessible via static `io.github.usefulness.licensee.Licensee` object)
- Read _licensee_ report copied to projects assets directory in runtime (via `assetManager.open("licensee_artifacts.json")`)

### Configuration

Options can be configured in the `licenseeForAndroid` extension:

```groovy
licenseeForAndroid {
enableKotlinCodeGeneration = false
enableAndroidAssetGeneration = true
androidAssetFileName = "licensee_artifacts.json"
singularVariantName = null
}
```

### Gradle dsl:
gross {
enableKotlinCodeGeneration.set(true)
enableAndroidAssetGeneration.set(true)
}
- `enableKotlinCodeGeneration` - Generates a static list of open source assets
- `enableAndroidAssetGeneration` - Enable asset generation. Will copy licensee report to android asset directory making it available as `androidAssetFileName`
- `androidAssetFileName` - The name of the asset file the licensee report gets copied to.
- `singularVariantName` - The name of the build variant that all variants will use to have always the same licensed, regardless of app variant. (i.e. "productionRelease")

## enableKotlinCodeGeneration
Generates a static list of open source assets in Gross.artifacts.

## enableAndroidAssetGeneration
Saves licensee report as an android asset. Default name is 'artifacts.json' but can be configured
using androidAssetFileName. Check out AssetLicenseParser for an example of how to consume the file.
### Credits
Huge thanks to [premex-ab/gross](https://github.com/premex-ab/gross) which this plugin forked from.
1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

93 changes: 0 additions & 93 deletions app/build.gradle.kts

This file was deleted.

21 changes: 0 additions & 21 deletions app/proguard-rules.pro

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions app/src/main/AndroidManifest.xml

This file was deleted.

Loading