marios proto
10/10/2020, 7:02 PMTransform.newSources
function with a simple example to generate some code, within Android Studio
the code is taken from arrow-meta documentation, as
val Meta.transformNewSource: CliPlugin
get() = "Transform New Source" {
meta(
classDeclaration(this, { name == "TestClass" }) {
Transform.newSources(
"""
package com.example.arrowexplorer
//metadebug
class ${name}_Generated {
fun sayHi() = println("Hi!")
}
""".file("${name}_Generated")
)
}
)
}
The problem is I cannot find the generated class file or reference it later.
The file actually exists here on this path
/Users/userA/Library/Application Support/kotlin/daemon/build/generated/source/kapt/main/TestClass_Generated.kt
Also tried to use the
file("${name}_Generated", filePath ="/path")
without success.
Any help how can I include the generated file in my project?David Stone
10/10/2020, 7:08 PMDavid Stone
10/10/2020, 7:10 PMmarios proto
10/10/2020, 7:14 PMmarios proto
10/10/2020, 7:17 PMraulraja
10/10/2020, 9:52 PMmarios proto
10/11/2020, 12:55 PMfilepath
option on file (..,filePath ="")
and that only changes it under the /daemon/
path. default path is as,
/Users/userA/Library/Application Support/kotlin/daemon/build/generated/source/kapt/main
Had to add a custom output path to include in the sourcesets, under the daemon
folder, as you suggested to make the classes visible in my IDE.
Would be nice to have an option of selecting any path for the code generation in the futureraulraja
10/11/2020, 12:56 PMmarios proto
10/11/2020, 1:33 PMRachel
10/19/2020, 4:05 PMmaster
branch and explained in the README file 🙌Rachel
10/19/2020, 4:06 PMRachel
10/19/2020, 4:08 PMmarios proto
10/19/2020, 4:09 PMSystem.setProperty("arrow.meta.generated.source.output","[/Users/userA/Documents/tests/arrow-meta-android-example-master/app/files]");
marios proto
10/19/2020, 4:09 PMDavid Stone
10/19/2020, 4:46 PMRachel
10/19/2020, 5:51 PMRachel
10/19/2020, 5:53 PMfilePath
Rachel
10/19/2020, 5:54 PMRachel
10/20/2020, 8:59 AMfilePath
is already available for latest SNAPSHOT.
It's necessary the usual configuration to use fresh SNAPSHOTs:
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
or --refresh-dependencies
Thanks!!dalexander
10/20/2020, 9:49 PMdalexander
10/20/2020, 9:51 PMRachel
10/20/2020, 9:59 PMfilepath
(second arg for file - the example uses a relative one): https://github.com/arrow-kt/arrow-meta/blob/master/compiler-plugin/src/test/kotlin/arrow/meta/quotes/transform/plugins/TransformNewSourcePlugin.kt#L109 because of a recent fix. Please, feel free to re-open the issue in order to fix the default path. Thanks!! 🙌dalexander
10/21/2020, 11:56 AMdalexander
10/21/2020, 12:01 PMRachel
10/21/2020, 12:11 PMRachel
10/27/2020, 9:16 PMraulraja
10/27/2020, 10:04 PMmarios proto
10/28/2020, 1:15 PM