glassbricks / kotlinbard Goto Github PK
View Code? Open in Web Editor NEWKotlinPoet extensions to provide a fluent kotlin DSL for code generation.
License: Apache License 2.0
KotlinPoet extensions to provide a fluent kotlin DSL for code generation.
License: Apache License 2.0
Hey, first wanna say this project is awesome, much more readable than vanilla KotlinPoet!!
I think, however, there is currently a problem with nested control flows. A simple example
fun main() {
val potatoFun = buildFunction("test") {
addCode {
controlFlow("if (1 == 1)") {
controlFlow("if (2 == 2)") {
addStatement("val nice = true")
addStatement("val cool = true")
addCode {
addStatement("val amazing = false")
}
}
}
}
}
println(potatoFun.toString())
}
should, in theory, correspond to
fun test() {
if (1 == 1) {
if (2 == 2) {
val nice = true
val cool = true
val amazing = false
}
}
}
However, currently, KotlinBard will generate the following
fun test() {
val amazing = false
if (1 == 1) {
if (2 == 2) {
val nice = true
val cool = true
}
}
}
My project versions, if that helps, are
kotlin -> 1.4
kotlinPoet -> 1.6.0
kotlinBard -> 0.2.0
Here are some ideas possible more compact syntax for adding elements inside builders.
Current syntax:
buildElement(){
addSubelement(){ }
}
Ideas to enhance this:
val mySpec = element(){
+subelement(){ }
}
Pros:
+mySpec
or +mySpec.withModifications()
Cons:
+
val mySpec = element(){
this add subelement(){ }
// or
this addXXX subelement(){ }
}
Pros:
Cons:
this
repeatedly)val mySpec = buildElement(){
subelement(){ }
}
Pros:
Cons:
JFrog announced decommission: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
Here example of how I moved from bintray to maven central: mfarsikov/kotlite@1194559#diff-c0dfa6bc7a8685217f70a860145fbdf416d449eaff052fa28352c5cec1a98c06
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.