-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #8
- Loading branch information
Showing
14 changed files
with
231 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v3 | ||
|
||
- name: Update Gradle Wrapper Script Permissions | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew clean build --info |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.set-vars.outputs.version }} | ||
missing: ${{ steps.set-vars.outputs.missing }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- id: set-vars | ||
name: Set variables | ||
run: | | ||
version=$(grep "version" build.gradle.kts | awk '{ print $3 }' | tr -d \''"\\') | ||
missing=$(if [ "$(git ls-remote origin refs/tags/$version)" ]; then echo false; else echo true; fi) | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
echo "missing=$missing" >> "$GITHUB_OUTPUT" | ||
publish: | ||
needs: prepare | ||
if: needs.prepare.outputs.missing == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v3 | ||
|
||
- name: Update Gradle Wrapper Script Permissions | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew clean build --info | ||
|
||
- name: Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ needs.prepare.outputs.version }} | ||
skipIfReleaseExists: true | ||
allowUpdates: true | ||
makeLatest: latest | ||
|
||
- name: Publish Gradle Plugin | ||
run: > | ||
./gradlew publishPlugins --info | ||
-Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} | ||
-Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,45 @@ | ||
# Gradle SourceGen Plugin | ||
|
||
[![Build Status](https://github.com/Scalified/gradle-sourcegen-plugin/actions/workflows/gradle.yml/badge.svg)](https://github.com/Scalified/gradle-sourcegen-plugin/actions) | ||
[![Build Status](https://github.com/Scalified/gradle-sourcegen-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/Scalified/gradle-sourcegen-plugin/actions) | ||
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v?label=Plugin&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Fcom%2Fscalified%2Fplugins%2Fgradle%2Fsourcegen%2Fcom.scalified.plugins.gradle.sourcegen.gradle.plugin%2Fmaven-metadata.xml)](https://plugins.gradle.org/plugin/com.scalified.plugins.gradle.sourcegen) | ||
|
||
## Description | ||
|
||
[Gradle SourceGen Plugin](https://plugins.gradle.org/plugin/com.scalified.plugins.gradle.sourcegen) configures directory for generated sources | ||
[Gradle SourceGen Plugin](https://plugins.gradle.org/plugin/com.scalified.plugins.gradle.sourcegen) configures directory for the generated sources | ||
|
||
## Requirements | ||
|
||
* [Gradle 7+](https://gradle.org/) | ||
|
||
## Changelog | ||
|
||
[Changelog](CHANGELOG.md) | ||
* [Gradle 8+](https://gradle.org/) | ||
|
||
## Applying | ||
|
||
Build script snippet for plugins DSL for Gradle 2.1 and later: | ||
|
||
```gradle | ||
```kotlin | ||
plugins { | ||
id "com.scalified.plugins.gradle.sourcegen" version "<version>" | ||
id "com.scalified.plugins.gradle.sourcegen" version "$VERSION" | ||
} | ||
``` | ||
|
||
Build script snippet for use in older Gradle versions or where dynamic configuration is required: | ||
|
||
```gradle | ||
buildscript { | ||
repositories { | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "gradle.plugin.com.scalified.plugins.gradle:sourcegen:<version>" | ||
} | ||
} | ||
apply plugin: "com.scalified.plugins.gradle.sourcegen" | ||
``` | ||
|
||
## Usage | ||
|
||
After applying the plugin, the following takes place: | ||
|
||
1. A directory, specified in the **sourcegen.location** property (**src/main/generated** by default) created (if missing) | ||
1. A directory, specified in the `sourcegen.location` property (`src/main/generated` by default) created (if missing) | ||
2. The created directory is configured: | ||
* as an output for annotation processor generated sources | ||
* for clean up during **clean** task | ||
* as marked generated sources root in IntelliJ IDEA (only if it is reside within **src/main**) | ||
* for clean up during `clean` task | ||
* as marked generated sources root in IntelliJ IDEA (only if it is resided within `src/main`) | ||
|
||
## Configuration | ||
|
||
Currently the following configuration parameters supported (default values are shown): | ||
Currently, the following configuration parameters are supported (default values are shown): | ||
|
||
```gradle | ||
```kotlin | ||
sourcegen { | ||
location = 'src/main/generated' // directory for generated source code | ||
location = "src/main/generated" // directory for the generated source code | ||
} | ||
``` | ||
|
||
If you need more configuration options, you may <a href="mailto:[email protected]?subject=[Gradle SourceGen Plugin]: Proposals And Suggestions">send a request</a> with description | ||
If you need more configuration options, you may <a href="mailto:[email protected]?subject=[Gradle SourceGen Plugin]: Proposals And Suggestions">send a request</a> with the description | ||
|
||
## License | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[versions] | ||
gradle-publish = "1.3.0" | ||
|
||
[plugins] | ||
gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-publish" } | ||
|
||
[libraries] | ||
kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" } |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
sourcegen/src/main/kotlin/com/scalified/plugins/gradle/sourcegen/Defaults.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2024 Scalified | ||
* | ||
* 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.scalified.plugins.gradle.sourcegen | ||
|
||
internal const val SOURCE_GEN = "sourcegen" | ||
|
||
internal const val LOCATION = "src/main/generated" |
Oops, something went wrong.