Smallville7123
03/31/2019, 12:56 AMShan
03/31/2019, 3:26 PMlocal.properties
file into a buildscript with the gradle kotlin dsl? I can only find really old posts that don't seem to work anymore. For context, I'm trying to load a GPG user/pass/keyring into my buildscript for publishing a release version of my project to sonatype.. if anyone knows a better way to do this I am all ears.Smallville7123
04/02/2019, 9:52 PMbuild.gradle.kts
) that i want to split into smaller filessvenjacobs
04/03/2019, 7:09 AMapply(from = "...")
do not evaluate plugins. For instance in common.gradle.kts
I get an error because implementation()
is not found. I know that in this case I can use "implementation"()
but that doesn't solve the actual problem. In other base modules where I load the Android plugin for instance suddenly android { ... }
is not found. How do I solve this with Kotlin DSL?Smallville7123
04/03/2019, 10:10 PMSmallville7123
04/05/2019, 12:46 AMCould not get unknown property 'compileDebugKotlin' for project ':app' of type org.gradle.api.Project.
compileDebugKotlin.dependsOn MyTask
mingkangpan
04/06/2019, 9:25 PMhmole
04/07/2019, 12:49 PMgradlePlugin
dsl forces you to write same thing twicepalaiokostas
04/07/2019, 4:55 PMAlowaniak
04/08/2019, 12:40 PMPaulius Ruminas
04/09/2019, 6:21 AMtask jarTest(type: Jar) {
from sourceSets.test.output
classifier = 'test'
}
configurations {
testOutput
}
artifacts {
testOutput jarTest
}
ModuleB build.gradle:
testImplementation project(path: ':ModuleA', configuration: 'testOutput')
Robert
04/09/2019, 7:49 PMgradle build
seems to work, but when I click to run a specific test in the editor, it fails with the error abovethana
04/10/2019, 8:15 AMnpm start
and the backend part can be startet via ./gradlew bootRun
. to ease start of the whole application i'd like to provide a gradle task which would start both.
while starting each part alone is wasy, is there a way to start both in parallel with a single task? How would this tasks look like?thana
04/10/2019, 11:46 AMSmallville7123
04/10/2019, 1:48 PM[macropreprocessor@macro-pc kotlin]$ kotlinc-jvm -include-runtime -d main.jar main.kt -classpath ./
main.kt:1:26: error: unresolved reference: globalVariables
import preprocessor.base.globalVariables
^
main.kt:2:27: error: unresolved reference: Sync
import preprocessor.utils.Sync
^
main.kt:3:32: error: unresolved reference: abort
import preprocessor.utils.core.abort
^
main.kt:7:5: error: unresolved reference: globalVariables
globalVariables.abortOnComplete = false
^
main.kt:8:5: error: unresolved reference: globalVariables
globalVariables.abortAsGradle = false
^
main.kt:11:5: error: unresolved reference: globalVariables
globalVariables.initGlobals(root, proj)
^
main.kt:12:5: error: unresolved reference: Sync
Sync().findSourceFilesOrNull(globalVariables.projectDirectory)
^
main.kt:12:34: error: unresolved reference: globalVariables
Sync().findSourceFilesOrNull(globalVariables.projectDirectory)
^
main.kt:14:9: error: unresolved reference: globalVariables
if (globalVariables.abortOnComplete) abort()
^
main.kt:14:42: error: unresolved reference: abort
if (globalVariables.abortOnComplete) abort()
^
[macropreprocessor@macro-pc kotlin]$ pwd
/home/macropreprocessor/AndroidStudioProjects/kppmaster/buildSrc/src/main/kotlin
import preprocessor.base.globalVariables
import preprocessor.utils.Sync
import preprocessor.utils.core.abort
fun main() {
println("starting KOTLIN_PRE_PROCESSOR")
globalVariables.abortOnComplete = false
globalVariables.abortAsGradle = false
val root = "/home/macropreprocessor/AndroidStudioProjects/kppmaster"
val proj = "/home/macropreprocessor/AndroidStudioProjects/kppmaster/app"
globalVariables.initGlobals(root, proj)
Sync().findSourceFilesOrNull(globalVariables.projectDirectory)
println("KOTLIN_PRE_PROCESSOR finished")
if (globalVariables.abortOnComplete) abort()
}
Davor Maric
04/10/2019, 1:53 PMkotlin-dsl
+ buildSrc
to fresh multi-module android project?
Gradle: 4.10.1
AS: 3.3
Kotlin: 1.3.21
OS: macOS latest
When submitting the project to git, I am unable to rebuild it properly. It yells at me that the project is unlinked, and there are no runconfigurations set upjanvladimirmostert
04/10/2019, 6:44 PMtasks.register<Jar>("uberJar") {
archiveClassifier.set("uber")
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
but i'm not seeing a fat jar in build/libs when doing gradle build
`
https://docs.gradle.org/current/userguide/working_with_files.html#sec:creating_uber_jar_exampledwursteisen
04/10/2019, 6:46 PMdwursteisen
04/11/2019, 8:35 AMtasks.withName("build").dependsOn("uberJar")
(I’m not sure of my code, but it should be something like that: getting the task build
and adding uberJar
as a dependent taskSmallville7123
04/11/2019, 9:45 AMDavide Giuseppe Farella
04/11/2019, 4:20 PMapk
output with gradle-dsl
x80486
04/11/2019, 6:42 PMtask distribution(type: Zip) {
archiveName = "${project.name}.zip"
dependsOn assemble
dirMode 0755
fileMode 0644
from compileJava
from processResources
into("lib") {
from configurations.runtimeClasspath
}
}
snowe
04/11/2019, 7:45 PMpublishing
plugin? e.g. class PublishingPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
plugins.apply(org.gradle.api.publish.maven.plugins.MavenPublishPlugin::class)
tasks.named("publishing") {
// have task here, but not publishing task. what is the publishing task type?
repositories {
maven {
}
}
}
}
}
Slackbot
04/11/2019, 8:27 PMsnowe
04/11/2019, 8:35 PMSmallville7123
04/12/2019, 2:27 AMA.A.kt
so it can be imported in build.gradle.kts
via import A.A
so i can test if it actually compiled in gradle as to how it should be converted from gradle to a kotlinc-jvm
compilable package)
A/A.kt
package A
import A.B.B
fun main() {
B().main()
}
A/B/B.kt
package A.B
class B {
fun main() {
println("hello")
}
}
$ kotlinc-jvm -include-runtime -d main.jar A/A.kt -classpath ./
A/A.kt:2:12: error: unresolved reference: B
import A.B.B
^
A/A.kt:6:9: error: unresolved reference: B
B().main()
^
Smallville7123
04/12/2019, 5:14 AMSmallville7123
04/12/2019, 5:19 AMSmallville7123
04/12/2019, 6:42 AM> Plugin with id 'kpp' not found.
my buildSrc/build.gradle.kts
is plugins {
kotlin("multiplatform") version "1.3.21"
}
repositories {
jcenter()
mavenCentral()
}
kotlin {
jvm {
val main by compilations.getting {
kotlinOptions {
// Setup the Kotlin compiler options for the 'main' compilation:
jvmTarget = "1.8"
}
compileKotlinTask // get the Kotlin task 'compileKotlinJvm'
output // get the main compilation output
}
compilations["test"].runtimeDependencyFiles // get the test runtime classpath
}
// Configure all compilations of all targets:
targets.all {
compilations.all {
kotlinOptions {
allWarningsAsErrors = true
}
}
}
}
Smallville7123
04/12/2019, 7:01 AMbuild.gradle
and build.gradle.kts
cannot coexistSmallville7123
04/12/2019, 7:01 AMbuild.gradle
and build.gradle.kts
cannot coexistgildor
04/12/2019, 7:04 AM