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
+2 -4
View File
@@ -65,15 +65,13 @@ benchmark {
}
}
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
this as Zip
tasks.withType<Zip>().matching { it.name == "mainBenchmarkJar" }.configureEach {
isZip64 = true
archiveFileName.set("benchmarks.jar")
}
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
this as JavaExec
tasks.withType<JavaExec>().matching { it.name in benchmarkTasks }.configureEach {
dependsOn(":createIdeaHomeForTests")
systemProperty("idea.home.path", ideaHomePathForTests().canonicalPath)
systemProperty("idea.use.native.fs.for.win", false)
+4 -5
View File
@@ -863,7 +863,7 @@ tasks {
}
}
val zipCompiler by task<Zip> {
val zipCompiler by tasks.registering(Zip::class) {
dependsOn(dist)
destinationDirectory.set(file(distDir))
archiveFileName.set("kotlin-compiler-$kotlinVersion.zip")
@@ -879,10 +879,9 @@ val zipCompiler by task<Zip> {
fun Project.secureZipTask(zipTask: TaskProvider<Zip>): RegisteringDomainObjectDelegateProviderWithAction<out TaskContainer, Task> {
val checkSumTask = tasks.register("${zipTask.name}Checksum", Checksum::class) {
dependsOn(zipTask)
val compilerFile = zipTask.get().outputs.files.singleFile
files = files(compilerFile)
outputDir = compilerFile.parentFile
algorithm = Checksum.Algorithm.SHA256
inputFiles.setFrom(zipTask.map { it.outputs.files.singleFile })
outputDirectory.fileProvider(zipTask.map { it.outputs.files.singleFile.parentFile })
checksumAlgorithm.set(Checksum.Algorithm.SHA256)
}
val signTask = tasks.register("${zipTask.name}Sign", Sign::class) {
@@ -19,7 +19,7 @@ class JpsCompatiblePlugin : Plugin<Project> {
project.configurations.create("jpsTest")
if (project == project.rootProject) {
project.tasks.create("pill") {
project.tasks.register("pill") {
dependsOn(":pill:pill-importer:pill")
if (System.getProperty("pill.android.tests", "false") == "true") {
@@ -28,7 +28,7 @@ class JpsCompatiblePlugin : Plugin<Project> {
}
}
project.tasks.create("unpill") {
project.tasks.register("unpill") {
dependsOn(":pill:pill-importer:unpill")
}
}
@@ -6,6 +6,7 @@
import org.jetbrains.kotlin.tools.lib
import org.jetbrains.kotlin.tools.solib
import org.jetbrains.kotlin.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.target.*
import org.jetbrains.kotlin.konan.target.ClangArgs
import org.jetbrains.kotlin.konan.target.Family.*
@@ -144,7 +145,7 @@ dependencies {
testImplementation(kotlin("test-junit"))
}
val nativelibs = project.tasks.create<Copy>("nativelibs") {
val nativelibs = project.tasks.register<Copy>("nativelibs") {
val clangstubsSolib = solib("clangstubs")
dependsOn(clangstubsSolib)
@@ -161,9 +162,8 @@ kotlinNativeInterop {
genTask.inputs.dir(libclangextDir)
}
}
val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += listOf(
"-Xskip-prerelease-check",
@@ -195,14 +195,9 @@ tasks.withType<Test>().configureEach {
systemProperty("kotlin.native.interop.indexer.temp", File(buildDir, "testTemp"))
}
tasks.matching { it.name == "linkClangstubsSharedLibrary" }.all {
dependsOn(libclangextTask)
inputs.dir(libclangextDir)
}
// Please note that list of headers should be fixed manually.
// See KT-46231 for details.
tasks.create("updatePrebuilt") {
tasks.register("updatePrebuilt") {
dependsOn("genClangInteropStubs")
doLast {
+7 -7
View File
@@ -184,7 +184,7 @@ dependencies {
classes.dependsOn 'compilerClasses', 'cli_bcClasses'
jar {
tasks.named("jar") {
from sourceSets.cli_bc.output,
sourceSets.compiler.output,
sourceSets.filesInteropStubs.output,
@@ -196,8 +196,8 @@ jar {
def externalJars = ['compiler', 'stdlib', 'reflect', 'script_runtime']
task trove4jCopy(type: Copy) {
from configurations.getByName("trove4j_jar") {
tasks.register("trove4jCopy", Copy) {
from configurations.named("trove4j_jar") {
include "trove4j*.jar"
rename "trove4j(.*).jar", "trove4j.jar"
@@ -207,9 +207,9 @@ task trove4jCopy(type: Copy) {
externalJars.each { arg ->
def jar = arg.replace('_', '-') // :(
task("${arg}Copy", type: Copy) {
tasks.register("${arg}Copy", Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from configurations.getByName("kotlin_${arg}_jar") {
from configurations.named("kotlin_${arg}_jar") {
include "kotlin-${jar}*.jar"
rename "kotlin-${jar}(.*).jar", "kotlin-${jar}.jar"
@@ -218,12 +218,12 @@ externalJars.each { arg ->
}
}
task external_jars(type: Copy) {
tasks.register("external_jars", Copy) {
dependsOn externalJars.collect { "${it}Copy" }
dependsOn trove4jCopy
}
task debugCompiler(type: JavaExec) {
tasks.register("debugCompiler", JavaExec) {
dependsOn ':dist'
mainClass = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.fileTree("${distDir.canonicalPath}/konan/lib/") {
File diff suppressed because it is too large Load Diff
+51 -39
View File
@@ -179,22 +179,30 @@ apply plugin: GitClangFormatPlugin
apply plugin: 'maven-publish'
apply plugin: BasePlugin
task dist_compiler(dependsOn: "distCompiler")
task dist_runtime(dependsOn: "distRuntime")
task cross_dist(dependsOn: "crossDist")
task list_dist(dependsOn: "listDist")
tasks.register("dist_compiler") {
dependsOn("distCompiler")
}
tasks.register("dist_runtime") {
dependsOn("distRuntime")
}
tasks.register("cross_dist") {
dependsOn("crossDist")
}
tasks.register("list_dist") {
dependsOn("listDist")
}
tasks.named("build") {
dependsOn 'dist', 'distPlatformLibs'
}
task distCommonSources(type: CopyCommonSources) {
tasks.register("distCommonSources", CopyCommonSources) {
outputDir "$distDir/sources"
sourcePaths configurations.commonSources
zipSources true
}
task distNativeSources(type: Zip) {
tasks.register("distNativeSources", Zip) {
destinationDirectory = file("$distDir/sources")
archiveFileName = "kotlin-stdlib-native-sources.zip"
@@ -210,12 +218,12 @@ task distNativeSources(type: Zip) {
}
}
task distSources {
tasks.register("distSources") {
dependsOn(distCommonSources)
dependsOn(distNativeSources)
}
task shadowJar(type: ShadowJar) {
tasks.register("shadowJar", ShadowJar) {
mergeServiceFiles()
destinationDirectory.set(file("$distDir/konan/lib"))
archiveBaseName.set("kotlin-native")
@@ -230,7 +238,7 @@ task shadowJar(type: ShadowJar) {
}
}
task distCompiler(type: Copy) {
tasks.register("distCompiler", Copy) {
// Workaround: make distCompiler no-op if we are using custom dist:
// the dist is already in place and has the compiler, so we don't have to
// build and copy the compiler to dist.
@@ -319,7 +327,7 @@ task distCompiler(type: Copy) {
}
}
task distDef(type: Copy) {
tasks.register("distDef", Copy) {
destinationDir project.file("$distDir/konan/platformDef/")
platformManager.targetValues.each { target ->
@@ -333,15 +341,15 @@ task distDef(type: Copy) {
}
}
task listDist(type: Exec) {
tasks.register("listDist", Exec) {
commandLine 'find', distDir
}
task distRuntime(type: Copy) {
tasks.register("distRuntime", Copy) {
dependsOn "${hostName}CrossDistRuntime"
}
task distStdlibCache {
tasks.register("distStdlibCache") {
if (hostName in cacheableTargetNames) {
dependsOn("${hostName}StdlibCache")
}
@@ -350,24 +358,24 @@ task distStdlibCache {
def stdlib = 'klib/common/stdlib'
def stdlibDefaultComponent = "$stdlib/default"
task crossDistRuntime {
tasks.register("crossDistRuntime") {
dependsOn.addAll(targetList.collect { "${it}CrossDistRuntime" })
}
task crossDistPlatformLibs {
tasks.register("crossDistPlatformLibs") {
dependsOn.addAll(targetList.collect { "${it}PlatformLibs" })
}
task crossDistStdlib {
tasks.register("crossDistStdlib") {
dependsOn.addAll(targetList.collect { "${it}CrossDistStdlib" })
}
task crossDistStdlibCache {
tasks.register("crossDistStdlibCache") {
dependsOn.addAll(targetList.findAll { it in cacheableTargetNames }.collect { "${it}StdlibCache" })
}
targetList.each { target ->
task("${target}CrossDistStdlib", type: Copy) {
tasks.register("${target}CrossDistStdlib", Copy) {
dependsOn ":kotlin-native:runtime:${target}Stdlib"
// TODO: add explicit dependency on host task with IR klib stdlib parts
// As for now it is possibly to build up distribution from the tc-dist to crossdist
@@ -403,7 +411,7 @@ targetList.each { target ->
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task("${target}CrossDistBitcodeCopy", type: Copy) {
tasks.register("${target}CrossDistBitcodeCopy", Copy) {
def bitcodeFiles = configurations.runtimeBitcode.incoming.artifactView {
attributes {
attribute(TargetWithSanitizer.TARGET_ATTRIBUTE, new TargetWithSanitizer(platformManager.targetByName(target), null))
@@ -419,7 +427,7 @@ targetList.each { target ->
}
}
task("${target}CrossDistRuntime", type: Copy) {
tasks.register("${target}CrossDistRuntime", Copy) {
dependsOn ":kotlin-native:${target}CrossDistStdlib"
dependsOn "${target}CrossDistBitcodeCopy"
@@ -434,7 +442,7 @@ targetList.each { target ->
}
}
task("${target}PlatformLibs") {
tasks.register("${target}PlatformLibs") {
dependsOn ":kotlin-native:platformLibs:${target}Install"
if (target in cacheableTargetNames) {
dependsOn(":kotlin-native:platformLibs:${target}Cache")
@@ -442,7 +450,7 @@ targetList.each { target ->
}
if (target in cacheableTargetNames) {
task ("${target}StdlibCache", type: Copy) {
tasks.register("${target}StdlibCache", Copy) {
dependsOn "${target}CrossDistStdlib"
dependsOn ":kotlin-native:runtime:${target}StdlibCache"
@@ -454,7 +462,7 @@ targetList.each { target ->
}
}
task("${target}CrossDist") {
tasks.register("${target}CrossDist") {
dependsOn "${target}CrossDistRuntime", "distCompiler"
if (target in cacheableTargetNames) {
dependsOn "${target}StdlibCache"
@@ -462,19 +470,19 @@ targetList.each { target ->
}
}
task distPlatformLibs {
tasks.register("distPlatformLibs") {
dependsOn ':kotlin-native:platformLibs:hostInstall'
dependsOn ':kotlin-native:platformLibs:hostCache'
}
task dist {
tasks.register("dist") {
dependsOn "distCompiler",
"distRuntime",
"distDef",
"distStdlibCache"
}
task crossDist {
tasks.register("crossDist") {
dependsOn "distCompiler",
"crossDistRuntime",
"distDef",
@@ -482,11 +490,11 @@ task crossDist {
"crossDistStdlibCache"
}
task bundle {
tasks.register("bundle") {
dependsOn 'bundleRegular', 'bundlePrebuilt'
}
task bundleRegular(type: (isWindows()) ? Zip : Tar) {
tasks.register("bundleRegular", (isWindows()) ? Zip : Tar) {
def simpleOsName = HostManager.platformName()
archiveBaseName.set("kotlin-native-$simpleOsName")
archiveVersion.set(kotlinVersion)
@@ -502,7 +510,7 @@ task bundleRegular(type: (isWindows()) ? Zip : Tar) {
}
}
task bundlePrebuilt(type: (isWindows()) ? Zip : Tar) {
tasks.register("bundlePrebuilt", (isWindows()) ? Zip : Tar) {
dependsOn("crossDistPlatformLibs")
def simpleOsName = HostManager.platformName()
archiveBaseName.set("kotlin-native-prebuilt-$simpleOsName")
@@ -532,8 +540,12 @@ void configurePackingLicensesToBundle(AbstractArchiveTask task, boolean contains
}
}
configurePackingLicensesToBundle(bundleRegular, /* containsPlatformLibraries = */ false)
configurePackingLicensesToBundle(bundlePrebuilt, /* containsPlatformLibraries = */ true)
tasks.named("bundleRegular").configure {
configurePackingLicensesToBundle(it, /* containsPlatformLibraries = */ false)
}
tasks.named("bundlePrebuilt").configure {
configurePackingLicensesToBundle(it, /* containsPlatformLibraries = */ true)
}
configure([bundleRegular, bundlePrebuilt]) {
dependsOn("crossDist")
@@ -555,7 +567,7 @@ configure([bundleRegular, bundlePrebuilt]) {
}
}
task 'tc-dist'(type: (isWindows()) ? Zip : Tar) {
tasks.register("tc-dist", (isWindows()) ? Zip : Tar) {
dependsOn('dist')
dependsOn('distSources')
def simpleOsName = HostManager.platformName()
@@ -577,12 +589,12 @@ task 'tc-dist'(type: (isWindows()) ? Zip : Tar) {
}
}
task samples {
tasks.register("samples") {
dependsOn 'samplesZip', 'samplesTar'
}
task samplesZip(type: Zip)
task samplesTar(type: Tar) {
tasks.register("samplesZip", Zip)
tasks.register("samplesTar", Tar) {
archiveExtension = 'tar.gz'
compression = Compression.GZIP
}
@@ -616,10 +628,10 @@ configure([samplesZip, samplesTar]) {
exclude '**/*.kt.bc-build/'
}
project.tasks.register("copy_samples") {
tasks.register("copy_samples") {
dependsOn 'copySamples'
}
project.tasks.register("copySamples", CopySamples) {
tasks.register("copySamples", CopySamples) {
destinationDir file('build/samples-under-test')
}
@@ -638,7 +650,7 @@ tasks.register("compdb", Copy) {
}
targetList.each { targetName ->
task "${targetName}CheckPlatformAbiCompatibility"(type: CompareDistributionSignatures) {
tasks.register("${targetName}CheckPlatformAbiCompatibility", CompareDistributionSignatures) {
dependsOn "${targetName}PlatformLibs"
libraries = new CompareDistributionSignatures.Libraries.Platform(targetName)
@@ -649,7 +661,7 @@ targetList.each { targetName ->
}
}
task "checkStdlibAbiCompatibility"(type: CompareDistributionSignatures) {
tasks.register("checkStdlibAbiCompatibility", CompareDistributionSignatures) {
dependsOn "distRuntime"
libraries = CompareDistributionSignatures.Libraries.Standard.INSTANCE
+3 -3
View File
@@ -82,7 +82,7 @@ def platformManager = rootProject.project(":kotlin-native").ext.platformManager
platformManager.enabled.each { target ->
def loader = platformManager.loader(target)
task "${target}Dependencies"(type: NativeDep) {
tasks.register("${target}Dependencies", NativeDep) {
konanPropertiesLoader = loader
}
@@ -107,13 +107,13 @@ platformManager.enabled.each { target ->
}
}
task update {
tasks.register("update") {
dependsOn tasks.withType(NativeDep)
mustRunAfter(tasks.withType(NativeDep))
}
rootProject.project(":kotlin-native").ext.nativeDependencies = tasks.withType(NativeDep)
task rmDotKonan(type: Delete) {
tasks.register("rmDotKonan", Delete) {
def dir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
delete dir
}
+3 -3
View File
@@ -88,7 +88,7 @@ subprojects { proj ->
def rootBuildDirectory = projectDir.parentFile
task buildAnalyzer(type: GradleBuild) {
tasks.register("buildAnalyzer", GradleBuild) {
buildFile = "../tools/benchmarksAnalyzer/build.gradle"
tasks = [":${getAnalyzerTargetName()}Binaries".toString()]
startParameter.setProjectProperties(this.project.gradle.startParameter.projectProperties)
@@ -235,7 +235,7 @@ task registerExternalBenchmarks {
}
}
task registerBuild(type: BuildRegister) {
tasks.register("registerBuild", BuildRegister) {
onlyBranch = project.findProperty('kotlin.register.branch')
def uploadedFile = getUploadedFile(nativeJson)
if (uploadedFile != null) {
@@ -252,7 +252,7 @@ task registerBuild(type: BuildRegister) {
buildNumberSuffix = project.findProperty('buildNumberSuffix')
}
task registerExternalBuild(type: BuildRegister) {
tasks.register("registerExternalBuild", BuildRegister) {
onlyBranch = project.findProperty('kotlin.register.branch')
def uploadedFile = getUploadedFile(externalBenchmarksReport)
if (uploadedFile != null) {
+2 -2
View File
@@ -406,7 +406,7 @@ val hostRuntimeTests by tasks.registering {
dependsOn("${hostName}RuntimeTests")
}
val assemble by tasks.getting {
tasks.named("assemble") {
dependsOn(targetList.map { "${it}Runtime" })
}
@@ -414,7 +414,7 @@ val hostAssemble by tasks.registering {
dependsOn("${hostName}Runtime")
}
val clean by tasks.getting {
tasks.named("clean") {
doFirst {
delete(buildDir)
}
@@ -193,7 +193,7 @@ def getMingwPath() {
return directory
}
task assembleWeb(type: Sync) {
tasks.register("assembleWeb", Sync) {
def runtimeDependencies = kotlin.targets.js.compilations.main.runtimeDependencyFiles
from(files {
runtimeDependencies.collect { File file ->
@@ -46,7 +46,7 @@ class PathSpecification extends BaseKonanSpecification {
dynamic('dynamic')
}
task checkArtifacts(type: DefaultTask) {
tasks.register("checkArtifacts", DefaultTask) {
dependsOn(':build')
doLast {
for(artifact in konanArtifacts) {
@@ -29,8 +29,8 @@ class TaskSpecification extends BaseKonanSpecification {
when:
def project = KonanProject.createWithInterop(projectDirectory, ArtifactType.LIBRARY)
project.buildFile.append("""
task beforeInterop(type: DefaultTask) { doLast { println("Before Interop") } }
task beforeCompilation(type: DefaultTask) { doLast { println("Before compilation") } }
tasks.register("beforeInterop", DefaultTask) { doLast { println("Before Interop") } }
tasks.register("beforeCompilation", DefaultTask) { doLast { println("Before compilation") } }
""".stripIndent())
project.addSetting(KonanProject.DEFAULT_INTEROP_NAME,"dependsOn", "beforeInterop")
project.addSetting("dependsOn", "beforeCompilation")
@@ -147,7 +147,7 @@ class TaskSpecification extends BaseKonanSpecification {
BuildResult failOnPropertyAccess(KonanProject project, String property) {
project.buildFile.append("""
task testTask(type: DefaultTask) {
tasks.register("testTask", DefaultTask) {
doLast {
println(${project.defaultInteropConfig()}.$property)
}
@@ -158,7 +158,7 @@ class TaskSpecification extends BaseKonanSpecification {
BuildResult failOnTaskAccess(KonanProject project, String task) {
project.buildFile.append("""
task testTask(type: DefaultTask) {
tasks.register("testTask", DefaultTask) {
dependsOn $task
}
""".stripIndent())
+6 -3
View File
@@ -44,14 +44,16 @@ jar {
enabled false
}
task libraryJarWithoutIr(type: Jar, dependsOn: compileKotlin2Js) {
tasks.register("libraryJarWithoutIr", Jar) {
dependsOn(compileKotlin2Js)
archiveClassifier.set(null)
destinationDirectory = file("$buildDir/lib/dist")
from("$buildDir/classes/main")
manifestAttributes(manifest, project, 'Test')
}
task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
tasks.register("libraryJarWithIr", Zip) {
dependsOn(libraryJarWithoutIr)
archiveExtension = "jar"
destinationDirectory = file("$buildDir/libs")
@@ -69,7 +71,8 @@ task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
jar.dependsOn(libraryJarWithIr)
task sourcesJar(type: Jar, dependsOn: classes) {
tasks.register("sourcesJar", Jar) {
dependsOn(classes)
archiveClassifier.set('sources')
from (sourceSets.main.allSource)
}
+1 -1
View File
@@ -65,7 +65,7 @@ jar {
manifestAttributes(manifest, project, "internal")
}
task java9Jar(type: Jar) {
tasks.register("java9Jar", Jar) {
archiveClassifier.set("java9")
if (includeJava9) {
from sourceSets.java9.output
+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
@@ -416,7 +416,7 @@ class KotlinGradleIT : KGPBaseTest() {
buildGradle.appendText(
"""
task sourcesJar(type: Jar) {
tasks.register("sourcesJar", Jar) {
from sourceSets.main.allSource
archiveClassifier = 'source'
duplicatesStrategy = 'fail' // fail in case of Java source duplication, see KT-17564
@@ -219,7 +219,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
gradleBuildScript("libJvm").appendText(
"""
${'\n'}
task printCompileConfiguration(type: DefaultTask) {
tasks.register("printCompileConfiguration", DefaultTask) {
doFirst {
configurations.getByName("api").dependencies.each {
println("Dependency: '" + it.name + "'")
@@ -21,7 +21,8 @@ configurations {
}
}
task obfuscate(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
tasks.register("obfuscate", proguard.gradle.ProGuardTask) {
dependsOn(jar)
injars "${jar.archivePath}"
outjars "$buildDir/proguard/out.jar"
@@ -5,6 +5,6 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
@@ -5,6 +5,6 @@ subprojects {
}
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
@@ -5,6 +5,6 @@ subprojects {
}
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
@@ -33,7 +33,7 @@ dependencies {
implementation "org.mozilla:rhino:1.7.7.1"
}
task runRhino(type: JavaExec) {
tasks.register("runRhino", JavaExec) {
classpath = sourceSets.main.runtimeClasspath
workingDir = "${buildDir}/kotlin2js/main/"
mainClass = 'org.mozilla.javascript.tools.shell.Main'
@@ -19,7 +19,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}
task jarSources(type: Jar) {
tasks.register("jarSources", Jar) {
from sourceSets.main.allSource
archiveClassifier = 'source'
}
@@ -20,7 +20,7 @@ dependencies {
testImplementation"org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
}
task jarSources(type: Jar) {
tasks.register("jarSources", Jar) {
from sourceSets.main.allSource
archiveClassifier = 'source'
}
@@ -26,6 +26,6 @@ subprojects { project ->
}
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
@@ -23,6 +23,6 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
@@ -40,7 +40,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile) {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}
task runRhino(type: JavaExec) {
tasks.register("runRhino", JavaExec) {
dependsOn(tasks.named('processDceBrowserKotlinJs'))
classpath = kotlin.targets.browser.compilations.main.runtimeDependencyFiles
workingDir = "${buildDir}"
@@ -85,7 +85,7 @@ kotlin {
}
}
task resolveRuntimeDependencies(type: DefaultTask) {
tasks.register("resolveRuntimeDependencies", DefaultTask) {
doFirst {
// KT-26301
def configName = kotlin.targets.jvm6.compilations.main.runtimeDependencyConfigurationName
@@ -15,13 +15,14 @@ final File antHome = new File(buildDir, "ant-home")
final File antZip = new File(buildDir, "apache-ant-$antVersion-bin.zip")
final File antExe = new File(antHome, "apache-ant-$antVersion/bin/ant$ext")
task downloadAnt(type: Download) {
tasks.register("downloadAnt", Download) {
src antURL
dest antZip
overwrite false
}
task extractAnt(type: Sync, dependsOn: downloadAnt) {
tasks.register("extractAnt", Sync) {
dependsOn(downloadAnt)
from zipTree(antZip)
into antHome
}
@@ -26,7 +26,7 @@ dependencies {
}
final File dokkaHome = new File(buildDir, "dokka-home")
task setupDokka(type: Sync) {
tasks.register("setupDokka", Sync) {
from configurations.dokka
into dokkaHome
}
@@ -41,7 +41,8 @@ task setupCallDokka() {
dependsOn project('kotlin_big').tasks.getByName('extractLibs')
}
task callDokka(type: Exec, dependsOn: setupCallDokka) {
tasks.register("callDokka", Exec) {
dependsOn(setupCallDokka)
workingDir = projectDir
// -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
environment("ANT_OPTS", "-Xmx3G")
@@ -18,7 +18,7 @@ compileKotlin {
}
}
task copyCopyrightProfile(type: Copy) {
tasks.register("copyCopyrightProfile", Copy) {
from "$rootDir/.idea/copyright"
into "$buildDir/copyright"
include 'apache.xml'
@@ -28,7 +28,7 @@ processResources {
dependsOn(copyCopyrightProfile)
}
task run(type: JavaExec) {
tasks.register("run", JavaExec) {
group 'application'
mainClass = 'generators.GenerateStandardLibKt'
classpath sourceSets.main.runtimeClasspath
@@ -36,7 +36,7 @@ task run(type: JavaExec) {
systemProperty 'line.separator', '\n'
}
task generateStdlibTests(type: JavaExec) {
tasks.register("generateStdlibTests", JavaExec) {
group 'application'
mainClass = 'generators.GenerateStandardLibTestsKt'
classpath sourceSets.main.runtimeClasspath
@@ -44,7 +44,7 @@ task generateStdlibTests(type: JavaExec) {
systemProperty 'line.separator', '\n'
}
task generateUnicodeData(type: JavaExec) {
tasks.register("generateUnicodeData", JavaExec) {
group 'application'
mainClass = 'generators.unicode.GenerateUnicodeDataKt'
classpath sourceSets.main.runtimeClasspath