Adopt configuration-avoidance where possible

Before this change `./gradlew help` (with native enabled)
Created immediately: 1322
Created during configuration: 1541

after this change:
Created immediately: 596
Created during configuration: 1509

To know more about configuration avoidance: https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
This commit is contained in:
cristiangarcia
2023-06-06 14:27:42 +00:00
committed by Space Team
parent ad8909113d
commit 46d113605b
33 changed files with 623 additions and 609 deletions
+17 -11
View File
@@ -71,7 +71,7 @@ dependencies {
testApi project(':kotlin-test:kotlin-test-js')
}
task prepareComparableSource(type: Copy) {
tasks.register("prepareComparableSource", Copy) {
def fs = services.get(FileSystemOperations)
doFirst {
fs.delete {
@@ -84,7 +84,7 @@ task prepareComparableSource(type: Copy) {
into builtinsSrcDir2
}
task prepareBuiltinsSources(type: Copy) {
tasks.register("prepareBuiltinsSources", Copy) {
def fs = services.get(FileSystemOperations)
doFirst {
fs.delete {
@@ -153,7 +153,7 @@ compileTestKotlin2Js {
}
}
task compileJs(type: NoDebugJavaExec) {
tasks.register("compileJs", NoDebugJavaExec) {
dependsOn compileBuiltinsKotlin2Js, compileKotlin2Js
inputs.files(compileBuiltinsKotlin2Js.outputs.files).withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files(compileKotlin2Js.outputs.files).withPathSensitivity(PathSensitivity.RELATIVE)
@@ -246,7 +246,8 @@ jar {
enabled false
}
task libraryJarWithoutIr(type: Jar, dependsOn: compileJs) {
tasks.register("libraryJarWithoutIr", Jar) {
dependsOn(compileJs)
archiveClassifier = null
manifestAttributes(manifest, project, 'Main')
destinationDirectory = file("$buildDir/lib/dist")
@@ -267,7 +268,8 @@ task libraryJarWithoutIr(type: Jar, dependsOn: compileJs) {
filesMatching("*.*") { it.mode = 0b110100100 } // KTI-401
}
task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
tasks.register("libraryJarWithIr", Zip) {
dependsOn(libraryJarWithoutIr)
archiveExtension = "jar"
destinationDirectory = file("$buildDir/libs")
@@ -285,7 +287,8 @@ task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
jar.dependsOn(libraryJarWithIr)
task sourcesJar(type: Jar, dependsOn: compileJs) {
tasks.register("sourcesJar", Jar) {
dependsOn(compileJs)
dependsOn(":kotlin-stdlib-js-ir:sourcesJar")
archiveClassifier.set('sources')
includeEmptyDirs false
@@ -298,7 +301,7 @@ task sourcesJar(type: Jar, dependsOn: compileJs) {
}
}
task distSourcesJar(type: Jar) {
tasks.register("distSourcesJar", Jar) {
dependsOn(sourcesJar, configurations.commonSources)
destinationDirectory = file("$buildDir/lib/dist")
archiveClassifier.set('sources')
@@ -331,19 +334,22 @@ node {
}
// Otherwise Node ignores nodeModulesDir
task deleteLegacyNodeModules(type: Delete) {
tasks.register("deleteLegacyNodeModules", Delete) {
delete "$projectDir/node_modules"
}
task installMocha(type: NpmTask, dependsOn: [deleteLegacyNodeModules]) {
tasks.register("installMocha", NpmTask) {
dependsOn(deleteLegacyNodeModules)
args = ['install', 'mocha@8.0.1']
}
task installTeamcityReporter(type: NpmTask, dependsOn: [deleteLegacyNodeModules]) {
tasks.register("installTeamcityReporter", NpmTask) {
dependsOn(deleteLegacyNodeModules)
args = ['install', 'mocha-teamcity-reporter@3.0.0']
}
task runMocha(type: NodeTask, dependsOn: [testClasses, installMocha, ':kotlin-test:kotlin-test-js:testClasses']) {
tasks.register("runMocha", NodeTask) {
dependsOn(testClasses, installMocha, ':kotlin-test:kotlin-test-js:testClasses')
script = file("${buildDir}/node_modules/mocha/bin/mocha")
if (project.hasProperty("teamcity")) {
+2 -1
View File
@@ -224,7 +224,8 @@ compileLongRunningTestKotlin {
configureFrontendIr(project)
task longRunningTest(type: Test, dependsOn: longRunningTestClasses) {
tasks.register("longRunningTest", Test) {
dependsOn(longRunningTestClasses)
group = "verification"
testClassesDirs = sourceSets.longRunningTest.output.classesDirs
classpath = sourceSets.longRunningTest.runtimeClasspath