Skip to content

Commit

Permalink
Add general code generation features (#88)
Browse files Browse the repository at this point in the history
* Update exception message

* Improve library import determination

* Remove factory method builder

* Add test for the constructor generation

* Update ALLOWED_PARAMETER_MODIFIERS constant value

* Add missing negation for the isDartConventionFileName check

* Remove trailing comma

* Set named option to true for a parameter

* Overhaul constructor generation to support more variants

* Improve new line handling

* Add required and this write to a parameter

* Update constructor structure

* Update type check to support nullable

* The type variable is now nullable and add method to set the type

* Emit new line when the "normal" parameters is not empty

* Add test which contains all parameter combinations

* Add method to check if a string is in the lowerCamelCase format and switch namePattern to RegEx from Kotlin

* Add test class for the lowerCamelCase regex

* Add EnumProperty structure

* Add writer class for the EnumPropertySpec object

* Add test class for the enum property writer

* Replace some string usages with constant variable calls

* Add documentation

* Add dokka and changeLog as new entries

* Update some plugin calls

* Update junit5 monorepo to v5.9.3

* Improve multiple parameter writer

* Add test for the property writer

* Add test for the enum write

* Improve enum test

* Add enum writer and improve line breaks

* Improve line breaks

* Integrate enum properties into the class structure

* Add constant values for a round open and close bracket

* Update some string to its constant value equivalent

* Remove internal keyword from the constructor

* Annotations should not be inlined over classes

* Update some boolean getter

* Add isLibrary boolean

* Improve generic write

* Add test which generates a rest api handler class

* Add test which test the cast option from a function

* Add typeCast variable

* Add tests for the new setter and property generation

* Add variable and methods for the new setter and property generation

* Update writer to add support for set and get functions

* Add some temp fix for the line breaks

* Improve intializer writing

* Deprecate FunctionType interface

* Add new test for a void method

* Improve line break writing

* Improve new line in the constructor write

* Remove unused methods

* Add some documentation and improve modifier usage

* Add more checks to the init block also add documentation

* Add new test and improve some other tests

* Add hasAllowedModifiers method

* Add some missing documentation

* Add parameter to improve readability which boolean does what

* Add documentation

* Add more test cases to the property spec and update them to a parameterized test

* Rename enum to CastType

* Rename Import interface to Directive

* Add base implementation for the Directive interface

* Rename some existing classes and update them to the new structure

* Update to the new structure and split relative "imports" into a own class

* Add RelativeDirective class

* Rename DartImportTest to DirectiveTest

* Remove old test class

* Rename PartImportTest to PartDirectiveTest

* Add changes from the import renaming

* Rename imports structure to directive

* Add ExportDirective

* Rename import dir to directive

* Update package import

* Rename imports call to directives

* Add documentation

* Update imports

* Add annotation generation to enum properties

* Integrate lambda option into the function structure

* Add lambda writing

* Add a test for a lambda method

* Update lambda call and a test

* Add ParameterizedTest for the simple properties and add test for a const property

* Add constantStack variable and sort the modifiers

* Improve class tests and add test for class constant values

* Add constantStack variable and method to add a constant to the builder

* Add constant write

* Change modifiers to a set

* Update modifier write

* Add emitProperties extension method

* Add constant writing

* Outsource extension method

* Add builder for const properties

* Remove unused variable and add more allowed modifier sets

* Add support for constants

* Add test case which contains constant values

* Add comment write

* Update documentation chars

* Add storage for comments

* Add test which has comments

* Add missing import

* Update failing test

* Add ability to add comments and add tests for that

* Add comment writing

* Improve multiline comment writing

* Add comment write to functions

* Update parameter and modifier usage

* Add support for comments to the constructor structure

* Add ability to add comments to a property

* Add file test which test the combination of several structures with comments

* Remove some unused imports and methods

* Rename emitComment method to emitDoc

* Update method call

* Add missing method to an array of properties

* Remove empty line

* Update all method, variables which contains comment to something with doc

* Update tests due the change to the comment method

* Add documentation

* Add documentation

* Add documentation

* Add documentation and remove methods which contains an iterable as parameter and replace them with an vararg parameter method

* Update method implementation from the SpecMethods interface

* Update dependency com.google.truth:truth to v1.1.4

* Remove some blank lines

* Add some empty lines and improve naming from the project

* Improve convention checks for the file name

* Include enumProperties to the hasNoContent boolean and add documentation

* Remove unused variable and add documentation

* Update annotation usage

* Remove FunctionType class and integration

* Remove unused import

* Remove todo

* Remove unused import

* Improve exception throw

* Rename COMMENT entry to DOCUMENTATION_CHAR and add documentation

* Remove constant value for allowed parameter modifiers

* Remove unused methods, structures and improve license header

* Add indent check to prevent invalid indent usage (#35)

* Add method to check if an indent string contains only spaces

* Update indent check

* Update exception type in the assertThrows method calls

* Add a test for the indent pattern

* Update names of some spec und builder classes (#34)

* Rename some classes to remove the Dart prefix from the file and class name

* Update imports of the used spec structures

---------

Co-authored-by: TheMeinerLP <p.glanz@madfix.me>

* Update dependency com.google.truth:truth to v1.1.5 (#33)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.kotlin:kotlin-test-junit to v1.8.22 (#32)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.kotlin.jvm to v1.8.22 (#31)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.dokka to v1.8.20 (#30)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.changelog to v2.1.0 (#28)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Remove Dart prefix from the class names

* Remove parameter import

* Update import from the ParameterSpec

* Update dependency gradle to v8.2 (#36)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.changelog to v2.1.1 (#39)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency org.jetbrains.kotlin.jvm to v1.9.0 (#37)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gradle to v8.2.1

* Remove some unused code parts

* Update dependency org.jetbrains.changelog to v2.1.2 (#41)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update junit5 monorepo to v5.10.0 (#43)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gradle to v8.3

* Move the dependency declaration to the settings.gradle.kts file

* Update dependency usage in the dependencies block

* Move all plugin declarations into the settings.gradle.kts file

* Update plugin usage

* Implement method to create a builder from a spec reference

* Enable commented parts and remove application plugin

* Add versionRef for the junit dependencies

* Add a test for the toBuilder method

* Remove unused imports

* Include missing parts to the toBuilder method

* Update actions/checkout action to v4

* Update compilerOption usage

* Add structure to support class structures as type (#54)

* Add TypeName class

* Add implementations for the TypeName

* Add test for the TypeName class

* Add TypeName usage to the annotation spec

* Add support for type names

* Add more logic to the type name structure and the implementations

* Add method to format a string with the lowerCamelCase pattern

* Add new tests

* Add dynamic and required as new entries

* Add documentation and support for TypeNames

* Add support for the new TypeName structure

* Update parameter writing to use the new typeName variable

* Add DynamicClassName implementation to represents the dynamic keyword from Dart

* Add more parameterizedBy method declarations

* Add a check for the name variable

* Add parseSimpleClass method

* Update a few tests to the new typename structure

* Add support for the typeName structure

* Update write process to write the typeName

* Update emit method

* Update tests to use the new typeName structure

* Add support for typeNames

* Update property usage to typeNames

* Add const value for the ConstClassName

* Add classname implementation for the const keyword

* Change superclass type to the typeName structure

* Update type writing to support typeNames

* Add internal keyword to the class

* Add some documentation

* Update documentation

* Add documentation to the class

* Update some ClassName usage

* Update out comment test

* Improve line handling

* Add documentation

* Remove wildcard import

* Improve documentation

* Remove unused import

* Remove public keywords and unused method

* Change dynamic word to const

* Add more tests for the typename structure

* Add missing documentation

* Add documentation to the new methods

* Move some class name fields into another file

* Update actions/checkout digest to 8ade135

* Update typeCast option from a method to use the TypeName structure (#58)

* Change typeCast type from string to TypeName

* Add new tests to test the new generic cast structure

* Remove methods which uses an iterable as parameter type (#59)

* Fix failing tests

* Update modifier handling

* Fix invalid property usage for const properties and seperate constants from normal properties (#61)

* Split the file constant into an own spec structure to reduce complexity

* Add test class for the FileConstWriter

* Integrate FileConstantSpec to replace the PropertySpec usage

* Add test for the new structure

* Improve property tests

* Update file const write

* Improve property writing

* Add emitFileConst method

* Update ALLOWED_CONST_MODIFIERS content

* Improve allowed modifiers check

* Replace check with require

* Update validation checks and dedicated method for a property as constant

* Mark type as nullable

* Deprecate ConstClassName

* Update type check

* Improve property tests

* Update content from the ALLOWED_CLASS_CONST_MODIFIERS constant

* Update to the new spec structure for constant values

* Update method call to write the constants

* Rename constant writer

* Update constant property access in the test cases

* Remove old place for the constant spec structure

* Change name of the constant property objects

* Fix failing tests

* Update dependency gradle to v8.4 (#60)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin org.jetbrains.kotlin.jvm to v1.9.10 (#49)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update actions/checkout digest to b4ffde6 (#65)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add abstraction layer for the code writers (#64)

* Add some interfaces to reduce writer complexity

* Update emit method call and improve code quality

* Remove unused import

* Update plugin org.jetbrains.changelog to v2.2.0 (#50)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update junit5 monorepo to v5.10.1 (#67)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin org.jetbrains.kotlin.jvm to v1.9.20 (#66)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin org.jetbrains.dokka to v1.9.10 (#51)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin org.jetbrains.kotlin.jvm to v1.9.21 (#68)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency gradle to v8.5 (#69)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update actions/setup-java action to v4 (#70)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency com.google.truth:truth to v1.2.0 (#71)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin org.jetbrains.kotlin.jvm to v1.9.22 (#72)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update issue templates (#73)

* Add license badge

* Fix license badge

* Fix wrong project name in a text

* Add config.yml file

* Update behaviour bug template

* Add title to the templates

* Improve text in the bug template

* Remove deprecated code (#76)

* Implement directive alphabetic sorting (#74)

* Add class which provides methods to sort directives

* Add test for the import sorting

* Update import handling in the file structure

* Improve directive structure to allow sorting

* Update directive writing

* Move directive tests to another directory

* Improve directive sorting and storing to minimize generation issues

* Add new test which tests the directive ordering at a test class

* Add override generation for functions

* Add documentation

* Improve documentation

* File ends now with an empty line

* Add write support for relative directives

* Move relative directive generation

* Remove print statement

* Add generation of export directives (#75)

* Add support for export directives

* Add variable to store the export directive objects

* Implement cast options

* Add ExportDirectiveTest class

* Remove unused import

* Add file test with export directive

* Fix some typos

* Improve documentation

* Improve code structure

* Improve documentation

* Revise typedef handling and generation (#77)

* Outsource typedefs into an own structure

* Add new extension method to write the typedef objects

* Add structure to manage or write typedef objects

* Integrate the updated typedef structure into other spec objects, writers

* Add test classes for the typedef structure

* Update given tests to support typedef creation

* Remove typedef as valid function modifier

* Remove empty line

* Remove unused code

* Improve code layout

* Remove out commented code

* Improve new line write

* Add support for multiple cast arguments

* Add test for the multiple cast arguments

* Remove unused import

* Improve documentation3

* Increase test coverage

* Update documentation

* Reduce code complexity which generates the directives (#79)

* Improve documentation

* Update basic directive tests

* Reduce complexity from the directive write process

* Update library keyword usage

* Revise parameter generation (#78)

* Add abstract keyword to the allowed keywords for functions

* Add class which allows parameter filtering

* Add second writeInitBlock which takes a spec object

* Remove bracket parameters from the emitParameters method

* Update writer structure

* Update writer structure

* Improve parameter write process for functions

* Improve parameter sorting

* Improve variable handling

* Add new test cases

* Remove this. call

* Improve parameter generation

* Add new test cases

* Fix wrong changes from the latest merge

* Update parameter generation in the typedefs

* Add and update tests

* Remove unused code

* Remove leading space

* Add usage of the DocumentationAppender

* Implement factory to create directive objects (#80)

* Add factory class to create directives

* Add directive type enum

* Update constructor definition from the directive implementations

* Add test for the new factory

* Update directive usage

* Remove wildcard import

* Fix test class

* Remove unused getter

* Remove unused import

* Mark ParameterFilter as internal

* Update copy method implementation

* Add documentation

* Remove empty line

* Remove unused import

* Replace empty string definitions with the constant equivalent

* Update documentation

* Improve documentation

* Improve code documentation

* Improve code structure to reduce duplicated code parts

* Remove unused imports

* Revise extension definition and generation (#81)

* Add support for TypeNames, unnamed extension and more

* Update extension tests

* Update documentation writing

* Update genericCast usage

* Add method to get the raw data from a TypeName

* Update cast writing

* Update extension tests

* Add jetbrains annnotations as dependency

* Add experimental annotation usage and restore methods

* Remove some methdods and update tests

* Add some ApiStatus annotation usage

* Remove unused import

* Update dependency com.google.truth:truth to v1.3.0 (#82)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix invalid enum generation when specific conditions are present (#84)

* Outsource enum tests into an own dedicated test class

* Add check to minimize wrong generate code for enum classes

* Add default annotations, documentation update (#85)

* Add common annotations from Dart

* Update basic annotation generation tests

* Update documentation

* Improve code structure

* Fix invalid name pattern (#87)

* Improve name pattern to allow files with multiple underscores and name tiles

* Remove unused import

* Add new test cases and cleanup class

* Improve file naming test

* Add test pr workflow

* Fix missing `this` call on parameters which don't have a type (#90)

* Fix missing this. call when the parameter has no type

* Add missing this call

* Prevent the addition of parameters to functions which don't  have a type

* Add constant for an error message

* Add missing tests

* Update message usage

* Update gradle/wrapper-validation-action action to v2 (#91)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Improve parameter write

* Update dependency gradle to v8.6 (#92)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update junit5 monorepo to v5.10.2 (#94)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency com.google.truth:truth to v1.4.0 (#93)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: TheMeinerLP <p.glanz@madfix.me>
  • Loading branch information
3 people authored Feb 10, 2024
1 parent cd74a03 commit e736532
Show file tree
Hide file tree
Showing 141 changed files with 9,756 additions and 1,098 deletions.
66 changes: 41 additions & 25 deletions .github/ISSUE_TEMPLATE/behavior-bug.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,58 @@
name: Behavior Bug
description: Report issues with plugin incompatibility or other behavior related issues.
description: Report issues with invalid code generation or other behavior bugs
title: "[Bug]: "
labels: [ "status: needs triage", "type: bug" ]
body:
- type: textarea
- type: markdown
attributes:
value: |
Thank you for reporting a bug to DartPoet!
Please fill out the information below to help us understand the issue.
- type: markdown
attributes:
value: |
Before filling the form fields, please consider the following:
- Search for existing issues in the [issue tracker](https://github.com/theEvilReaper/DartPoet/issues)
- type: input
attributes:
label: Expected behavior
description: What you expected to see.
label: DartPoet version
description: Please enter the version of DartPoet you are using.
placeholder: 1.0.0
validations:
required: true

required: false
- type: textarea
attributes:
label: Actual behavior
description: What you actually saw.
label: Describe the bug
description: |
A clear and concise description of what the bug is.
If you have a screenshot of the bug, please attach it below.
validations:
required: true

- type: textarea
attributes:
label: Steps to reproduce
description: This may include a video, or detailed instructions to help reconstruct the issue.
label: Steps to reproduce the bug
description: Tell us exactly how to reproduce the bug you are experiencing
placeholder: |
1. ...
2. ...
3. ...
validations:
required: true

- type: textarea
attributes:
label: Other
label: Code sample
description: |
Please include other helpful information below.
The more information we receive, the quicker and more effective we can be at finding the solution to the issue.
validations:
required: false

- type: markdown
attributes:
Please create a reproducible sample to show us the bug in action and attach it below between the lines with the backticks.
This helps us to verify that the bug is valid and prevents us from having to ask you for a sample later.
Without this we will unlikely be able to progress on the issue, and because of that
we regretfully will have to close it.
**Note**: Please do not upload screenshots of text. Instead, use code blocks
or the above mentioned ways to upload your code sample.
value: |
Before submitting this issue, please ensure the following:
1. You searched for and ensured there isn't already an open issue regarding this.
2. Your version of kotlin/java is supported by DartPoet.
3. You are running the latest version of DartPoet from [our github page](https://github.com/theEvilReaper/DartPoet).
```kotlin
[Paste your code here]
```
validations:
required: true
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: DartPoet discussions
url: https://github.com/theEvilReaper/DartPoet/discussions
about: If you have any questions or problems, please use the discussions section
emoji:
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Feature Request
description: Suggest an idea for DartPoet
title: "[Feature Request]: "
labels: [ "status: needs triage", "type: feature" ]
body:
- type: markdown
attributes:
value: |
Thank you for filling out a feature request for SolarSystem! Please be as detailed as possible so that we may consider and review the request easier.
Thank you for filling out a feature request for DartPoet! Please be as detailed as possible so that we may consider and review the request easier.
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in DartPoet.
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/maven-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish package to the Maven Central Repository
on:
push:
branches:
- main
- develop
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publishMavenJavaPublicationToMavenRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
24 changes: 24 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test PR
on: [pull_request]
jobs:
build_pr:
if: github.repository_owner == 'theEvilReaper'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Build with ${{ matrix.os }}
run: |
git config --global user.email "no-reply@github.com"
git config --global user.name "Github Actions"
./gradlew test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DartPoet

[![license](https://img.shields.io/github/license/theEvilReaper/DartPoet?style=for-the-badge&color=b2234c)](../LICENSE)

# **DartPoet is still in development and not ready for production use.**

## Description
Expand Down
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
113 changes: 101 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
signing
`maven-publish`
`java-library`
alias(libs.plugins.kotlin.jvm)
application
id("org.jetbrains.changelog") version "2.0.0"
alias(libs.plugins.changelog)
alias(libs.plugins.dokka)
}

group = "net.theevilreaper.dartpoet"
Expand All @@ -12,28 +17,48 @@ repositories {
}

dependencies {
testImplementation(libs.truth)
testImplementation(libs.kotlin.junit)
compileOnly(libs.jetbrains.annotations)
testImplementation(kotlin("test"))
testImplementation(libs.google.truth)
testImplementation(libs.junit.api)
testImplementation(libs.junit.params)
testRuntimeOnly(libs.junit.engine)
}

tasks {

test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
useK2 = true
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
}

kotlin {
jvmToolchain(17)
val sourceJar by tasks.register<Jar>("kotlinJar") {
from(sourceSets.main.get().allSource)
archiveClassifier.set("sources")
}

application {
mainClass.set("MainKt")
val dokkaJavadocJar by tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(rootProject.tasks.dokkaHtml)
from(rootProject.tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-docs")
}

val dokkaHtmlJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(rootProject.tasks.dokkaJavadoc)
from(rootProject.tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

kotlin {
jvmToolchain(17)
}

changelog {
Expand All @@ -42,4 +67,68 @@ changelog {
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components.findByName("java"))
groupId = "dev.themeinerlp"
artifactId = "dartpoet"
version = rootProject.version.toString()
artifact(dokkaJavadocJar)
artifact(dokkaHtmlJar)
artifact(sourceJar)
pom {
name.set("DartPoet")
description.set("A Kotlin API which allows the generation of code for dart")
url.set("https://github.com/theEvilReaper/DartPoet")
licenses {
license {
name.set("AGPL-3.0")
url.set("https://github.com/theEvilReaper/DartPoet/blob/develop/LICENSE")
}
}
issueManagement {
system.set("Github")
url.set("https://github.com/theEvilReaper/DartPoet/issues")
}
developers {
developer {
id.set("themeinerlp")
name.set("Phillipp Glanz")
email.set("p.glanz@madfix.me")
}
developer {
id.set("theEvilReaper")
name.set("Steffen Wonning")
email.set("steffenwx@gmail.com")
}
}
scm {
connection.set("scm:git@github.com:theEvilReaper/DartPoet.git")
developerConnection.set("scm:git@github.com:theEvilReaper/DartPoet.git")
url.set("https://github.com/theEvilReaper/DartPoet")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = if (version.toString().endsWith("SNAPSHOT")) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}
13 changes: 0 additions & 13 deletions gradle/libs.versions.toml

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit e736532

Please sign in to comment.