Permalink
Please sign in to comment.
Showing
with
195 additions
and 164 deletions.
- +0 −155 build.gradle
- +193 −8 build.gradle.kts
- +2 −1 settings.gradle
155
build.gradle
| @@ -1,155 +0,0 @@ | ||
| -buildscript { | ||
| - ext.kotlinVersion = file('kotlin-version.txt').text.trim() | ||
| - ext.kotlinRepo = 'https://repo.gradle.org/gradle/repo' | ||
| - repositories { | ||
| - maven { url kotlinRepo } | ||
| - } | ||
| - dependencies { | ||
| - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" | ||
| - classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.1.1' | ||
| - } | ||
| -} | ||
| - | ||
| - | ||
| -apply from: 'build.gradle.kts' | ||
| - | ||
| - | ||
| -// --- Enable automatic generation of API extensions ------------------- | ||
| -File apiExtensionsOutputDir = file('src/generated/kotlin') | ||
| -task generateConfigurationExtensions(type: codegen.GenerateConfigurationExtensions) { | ||
| - outputFile = new File(apiExtensionsOutputDir, 'org/gradle/script/lang/kotlin/ConfigurationsExtensions.kt') | ||
| -} | ||
| -task generateKotlinDependencyExtensions(type: codegen.GenerateKotlinDependencyExtensions) { | ||
| - outputFile = new File(apiExtensionsOutputDir, 'org/gradle/script/lang/kotlin/KotlinDependencyExtensions.kt') | ||
| - embeddedKotlinVersion = kotlinVersion | ||
| - gradleScriptKotlinRepository = kotlinRepo | ||
| -} | ||
| -task generateExtensions { | ||
| - dependsOn generateConfigurationExtensions | ||
| - dependsOn generateKotlinDependencyExtensions | ||
| -} | ||
| -sourceSets { | ||
| - main.kotlin.srcDirs += apiExtensionsOutputDir | ||
| -} | ||
| -compileKotlin.dependsOn generateExtensions | ||
| - | ||
| - | ||
| -// -- Performance testing ---------------------------------------------- | ||
| -// | ||
| -// 1. Creates a custom Gradle installation with latest gradle-script-kotlin jar | ||
| -// | ||
| -// 2. Benchmarks latest installation against configured wrapper | ||
| -// | ||
| -def customInstallationDir = file("$buildDir/custom/gradle-${gradle.gradleVersion}") | ||
| - | ||
| -task copyCurrentDistro(type: Copy) { | ||
| - description "Copies the current Gradle distro into '${customInstallationDir}'." | ||
| - | ||
| - from gradle.gradleHomeDir | ||
| - into customInstallationDir | ||
| - exclude "**/*kotlin*" | ||
| - | ||
| - // preserve last modified date on each file to make it easier | ||
| - // to check which files were patched by next step | ||
| - def copyDetails = [] | ||
| - eachFile { copyDetails << it } | ||
| - doLast { | ||
| - copyDetails.each { FileCopyDetails details -> | ||
| - def target = new File(customInstallationDir, details.path) | ||
| - target.setLastModified(details.lastModified) | ||
| - } | ||
| - } | ||
| - | ||
| - // don't bother recreating it | ||
| - onlyIf { !customInstallationDir.exists() } | ||
| -} | ||
| - | ||
| -task customInstallation(type: Copy, dependsOn: copyCurrentDistro) { | ||
| - description 'Copies latest gradle-script-kotlin snapshot over the custom installation.' | ||
| - | ||
| - from configurations.compile | ||
| - from tasks.jar | ||
| - into "$customInstallationDir/lib" | ||
| -} | ||
| - | ||
| -test.dependsOn customInstallation | ||
| - | ||
| -task benchmark(type: integration.Benchmark, dependsOn: customInstallation) { | ||
| - latestInstallation = customInstallationDir | ||
| -} | ||
| - | ||
| - | ||
| -// -- Integration testing --------------------------------------------- | ||
| - | ||
| -// Checks a single sample, for instance: | ||
| -// | ||
| -// check-hello-kotlin | ||
| -// | ||
| -tasks.addRule('Pattern: check-<SAMPLE>') { taskName -> | ||
| - if (taskName.startsWith ('check-')) { | ||
| - def checkSample = task ("$taskName-task", type: integration.CheckSample) { | ||
| - dependsOn customInstallation | ||
| - installation = customInstallationDir | ||
| - sampleDir = file("samples/${taskName - 'check-'}") | ||
| - } | ||
| - task(taskName).dependsOn(checkSample) | ||
| - } | ||
| -} | ||
| - | ||
| -task checkSamples { | ||
| - description 'Checks all samples' | ||
| - file('samples').eachDir { | ||
| - if (!it.name.contains('android')) { | ||
| - dependsOn "check-${it.name}" | ||
| - } | ||
| - } | ||
| -} | ||
| -check.dependsOn checkSamples | ||
| - | ||
| -task prepareIntegrationTestFixtures(type: GradleBuild) { | ||
| - dir = file('fixtures') | ||
| -} | ||
| -test.dependsOn prepareIntegrationTestFixtures | ||
| - | ||
| - | ||
| -// --- classpath.properties -------------------------------------------- | ||
| -File generatedResourcesDir = file("$buildDir/generate-resources/main") | ||
| -task generateClasspathManifest(type: codegen.GenerateClasspathManifest) { | ||
| - outputDirectory = generatedResourcesDir | ||
| -} | ||
| -sourceSets { | ||
| - main.output.dir generatedResourcesDir, builtBy: generateClasspathManifest | ||
| -} | ||
| - | ||
| - | ||
| -// --- Configure publications ------------------------------------------ | ||
| -def buildTagFor(String version) { | ||
| - switch (version.substring(version.lastIndexOf('-') + 1)) { | ||
| - case 'SNAPSHOT': | ||
| - return 'snapshot' | ||
| - case ~/M\d+[a-z]*$/: | ||
| - return 'milestone' | ||
| - default: | ||
| - return 'release' | ||
| - } | ||
| -} | ||
| - | ||
| -def targetRepoKey = "libs-${buildTagFor(project.version)}s-local" | ||
| - | ||
| -artifactory { | ||
| - contextUrl = 'https://repo.gradle.org/gradle' | ||
| - publish { | ||
| - repository { | ||
| - repoKey = targetRepoKey | ||
| - username = project.findProperty('artifactory_user') ?: 'nouser' | ||
| - password = project.findProperty('artifactory_password') ?: 'nopass' | ||
| - maven = true | ||
| - } | ||
| - defaults { | ||
| - publications('mavenJava') | ||
| - } | ||
| - } | ||
| - resolve { | ||
| - repoKey = 'repo' | ||
| - } | ||
| -} |
201
build.gradle.kts
| @@ -1 +1,2 @@ | ||
| -rootProject.name='gradle-script-kotlin' | ||
| +rootProject.name = 'gradle-script-kotlin' | ||
| +rootProject.buildFileName = 'build.gradle.kts' |
0 comments on commit
b02916c