Skip to content

Commit 7448565

Browse files
authored
Merge pull request gradle#1345 from gradle/eskatos/repo/cleanup
Cleanup repository keeping samples and samples-tests
2 parents cd78487 + 3478828 commit 7448565

File tree

631 files changed

+1037
-45779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+1037
-45779
lines changed

.github/CONTRIBUTING.md

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
# Contributing to Gradle Kotlin DSL
2+
23
Thank you for considering making a contribution to Gradle Kotlin DSL! This guide explains how to setup your environment for Gradle Kotlin DSL development and where to get help if you encounter trouble.
34

4-
## Development Setup
5-
In order to make changes to Gradle, you'll need:
5+
## Where is the code?
6+
7+
This repository (`gradle/kotlin-dsl`) contains extra samples for the Gradle Kotlin DSL only. If you intend to contribute an extra sample keep reading.
8+
9+
The Gradle Kotlin DSL code can be found in the [gradle/gradle](https://github.com/gradle/gradle) git repository in the `:kotlinDsl*` sub-projects.
10+
Please direct your contributions to that repository and see [how to contribute to Gradle](https://github.com/gradle/gradle/blob/master/CONTRIBUTING.md).
11+
12+
## Accept Developer Certificate of Origin
13+
14+
In order for your contributions to be accepted, you must [sign off](https://git-scm.com/docs/git-commit#git-commit---signoff) your Git commits to indicate that you agree to the terms of [Developer Certificate of Origin](https://developercertificate.org/).
15+
16+
## Follow the Code of Conduct
17+
18+
In order to foster a more inclusive community, Gradle has adopted the [Contributor Covenant](https://www.contributor-covenant.org/version/1/4/code-of-conduct/).
19+
20+
Contributors must follow the Code of Conduct outlined at [https://gradle.org/conduct/](https://gradle.org/conduct/).
21+
22+
## Making Changes
23+
24+
### Development Setup
25+
26+
In order to make changes to the Gradle Kotlin DSL Samples, you'll need:
627

728
* A text editor or IDE. We use and recommend the very latest [IntelliJ IDEA CE](http://www.jetbrains.com/idea/).
829
* A [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (JDK) version 1.8 or higher
930
* [git](https://git-scm.com/) and a [GitHub account](https://github.com/join)
1031

11-
Gradle Kotlin DSL uses a pull request model for contributions. Fork [gradle/kotlin-dsl](https://github.com/gradle/kotlin-dsl) and clone your fork. Active development happens in the `develop` branch, so make sure you check out this branch after cloning the repository.
32+
Gradle Kotlin DSL uses a pull request model for contributions. Fork [gradle/kotlin-dsl](https://github.com/gradle/kotlin-dsl) and clone your fork.
1233

1334
Configure your Git username and email with
1435
```
@@ -18,25 +39,19 @@ git config user.email user@example.com
1839

1940
Before importing the project into IntelliJ IDEA make sure to run `./gradlew check` at least once so all required files are generated.
2041

21-
## Making Changes
22-
2342
### Development Workflow
2443

25-
After making changes, you can test them by running `./gradlew check`.
44+
Samples are located in the `samples/` directory of this repository.
2645

27-
To try out a change in behavior manually, use the Gradle distribution from `./build/custom`, just make sure to stop all Gradle daemons before using it (`./gradlew --stop`).
46+
To add a new sample, simply create a new directory under `samples/`. That directory must include a [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), please copy it from another sample directory.
2847

29-
You can debug Gradle by adding `-Dorg.gradle.debug=true` when executing. Gradle will wait for you to attach at debugger at `localhost:5005` by default.
48+
A test runs `tasks` on each sample, so your new sample will automatically be smoke-tested. Please consider adding a more precise test.
3049

31-
### Getting Help
50+
Samples are tested using [gradle/exemplar](https://github.com/gradle/exemplar). If your test can be expressed using [exemplar external samples](https://github.com/gradle/exemplar#configuring-external-samples), add the configuration files to `subprojects/samples-tests/src/exemplar/samples/$yourSampleDir`. Otherwise please add a JUnit based test in `subprojects/samples-tests/src/test/kotlin` extending from `AbstractSampleTest`.
3251

33-
If you run into any trouble, please reach out to us in the #kotlin-dsl channel of the [Gradle Community Slack](https://join.slack.com/t/gradle-community/shared_invite/enQtNDE3MzAwNjkxMzY0LTYwMTk0MWUwN2FiMzIzOWM3MzBjYjMxNWYzMDE1NGIwOTJkMTQ2NDEzOGM2OWIzNmU1ZTk5MjVhYjFhMTI3MmE).
52+
After making changes, you can test them by running `./gradlew check`.
3453

35-
### Resources
36-
37-
* The [Gradle Kotlin DSL Primer](https://docs.gradle.org/current/userguide/kotlin_dsl.html) is a must read.
38-
* The Gradle [user manual](https://docs.gradle.org/current/userguide/userguide.html) and [guides](https://gradle.org/guides/) contain Kotlin DSL build script samples that demonstrate how to use all Gradle features.
39-
* Some [diagrams](../doc/c4) provide a good overview of how the Kotlin DSL is structured and interacts with Gradle, Gradle plugins, IDEs.
54+
You can debug Gradle by adding `-Dorg.gradle.debug=true` when executing. Gradle will wait for you to attach a debugger at `localhost:5005` by default.
4055

4156
### Creating Commits And Writing Commit Messages
4257

@@ -48,11 +63,21 @@ Please consider reading [How to Write a Git Commit Message](http://chris.beams.i
4863
* If your commit pertains to a GitHub issue, include (`See #123`) in the commit message on a separate line
4964
* [Sign off](https://git-scm.com/docs/git-commit#git-commit---signoff) your Git commits to indicate that you agree to the terms of [Developer Certificate of Origin](https://developercertificate.org/).
5065

51-
### Submitting Your Change
66+
## Submitting Your Change
5267

5368
All code contributions should be submitted via a [pull request](https://help.github.com/articles/using-pull-requests) from a [forked GitHub repository](https://help.github.com/articles/fork-a-repo).
5469

5570
Once received, the pull request will be reviewed by a Gradle Kotlin DSL developer.
5671

72+
## Getting Help
73+
74+
If you run into any trouble, please reach out to us in the #kotlin-dsl channel of the [Gradle Community Slack](https://join.slack.com/t/gradle-community/shared_invite/enQtNDE3MzAwNjkxMzY0LTYwMTk0MWUwN2FiMzIzOWM3MzBjYjMxNWYzMDE1NGIwOTJkMTQ2NDEzOGM2OWIzNmU1ZTk5MjVhYjFhMTI3MmE).
75+
76+
## Resources
77+
78+
* The [Gradle Kotlin DSL Primer](https://docs.gradle.org/current/userguide/kotlin_dsl.html) is a must read.
79+
* The Gradle [user manual](https://docs.gradle.org/current/userguide/userguide.html) and [guides](https://gradle.org/guides/) contain Kotlin DSL build script samples that demonstrate how to use all Gradle features.
80+
* Some [diagrams](../doc/c4) provide a good overview of how the Kotlin DSL is structured and interacts with Gradle, Gradle plugins, IDEs.
81+
5782
## Our Thanks
5883
We deeply appreciate your effort toward improving Gradle. If you enjoyed this process, perhaps you should consider getting [paid to develop Gradle](https://gradle.com/careers)?

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# gradle
22
.gradle
3-
/build
3+
build
44

55
# idea
66
.idea

.mrconfig

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ matrix:
77
jdk: oraclejdk8
88
- os: linux
99
sudo: required
10-
jdk: openjdk8
11-
- os: linux
12-
sudo: required
13-
jdk: oraclejdk9
10+
jdk: openjdk11
1411

15-
script: ./gradlew :provider:check --info --stacktrace --console=plain --max-workers=1 --no-daemon -Dkotlin.compiler.execution.strategy="in-process" -Dkotlin.colors.enabled=false
12+
script: ./gradlew check --info --stacktrace --console=plain --max-workers=1 --no-daemon --build-cache -Dkotlin.colors.enabled=false
1613

1714
before_cache:
1815
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Gradle Kotlin DSL
22
=================
33

4-
[![TeamCity Build](https://builds.gradle.org/app/rest/builds/buildType:GradleKotlinDSL_Develop/statusIcon.svg)](https://builds.gradle.org/viewType.html?buildTypeId=GradleKotlinDSL_Develop)
54
[![TravisCI Build](https://img.shields.io/travis/gradle/kotlin-dsl/develop.svg)](https://travis-ci.org/gradle/kotlin-dsl)
65
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
76

build.gradle.kts

Lines changed: 17 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,30 @@
1-
import org.jetbrains.gradle.ext.CopyrightConfiguration
2-
import org.jetbrains.gradle.ext.ProjectSettings
3-
import org.jetbrains.gradle.ext.TaskTriggersConfig
4-
5-
import java.time.LocalDate
6-
7-
8-
buildscript {
9-
10-
build.loadExtraPropertiesOf(project)
11-
12-
}
1+
import org.gradle.internal.hash.HashUtil
132

143
plugins {
154
base
16-
kotlin("jvm") apply false
17-
id("org.jetbrains.gradle.plugin.idea-ext") version "0.4.2"
18-
}
19-
20-
allprojects {
21-
group = "org.gradle"
22-
version = "1.2.0-SNAPSHOT"
23-
}
24-
25-
val publishedPluginsVersion by extra { "1.1.3" }
26-
val futurePluginsVersion = "1.1.4"
27-
project(":plugins") {
28-
group = "org.gradle.kotlin"
29-
version = futurePluginsVersion
30-
}
31-
32-
// --- Configure publications ------------------------------------------
33-
val distributionProjects =
34-
listOf(
35-
project(":provider"),
36-
project(":provider-plugins"),
37-
project(":tooling-models"),
38-
project(":tooling-builders"))
39-
40-
// For documentation and meaningful `./gradlew dependencies` output
41-
val distribution by configurations.creating
42-
dependencies {
43-
distributionProjects.forEach {
44-
distribution(it)
45-
}
46-
}
47-
48-
allprojects {
49-
repositories {
50-
gradlePluginPortal()
51-
repositories {
52-
maven {
53-
name = "kotlinx"
54-
url = uri("https://kotlin.bintray.com/kotlinx/")
55-
}
56-
}
57-
}
58-
}
59-
60-
61-
// -- Integration testing ----------------------------------------------
62-
val prepareIntegrationTestFixtures by tasks.registering(GradleBuild::class) {
63-
dir = file("fixtures")
64-
}
65-
66-
val customInstallationDir = file("$buildDir/custom/gradle-${gradle.gradleVersion}")
67-
68-
val copyCurrentDistro by tasks.registering(Copy::class) {
69-
description = "Copies the current Gradle distro into '$customInstallationDir'."
70-
71-
from(gradle.gradleHomeDir)
72-
into(customInstallationDir)
73-
exclude("**/*kotlin*")
74-
75-
// preserve last modified date on each file to make it easier
76-
// to check which files were patched by next step
77-
val copyDetails = mutableListOf<FileCopyDetails>()
78-
eachFile { copyDetails.add(this) }
79-
doLast {
80-
copyDetails.forEach { details ->
81-
File(customInstallationDir, details.path).setLastModified(details.lastModified)
82-
}
83-
}
84-
85-
// don't bother recreating it
86-
onlyIf { !customInstallationDir.exists() }
87-
}
88-
89-
val customInstallation by tasks.registering(Copy::class) {
90-
description = "Copies latest gradle-kotlin-dsl snapshot over the custom installation."
91-
dependsOn(copyCurrentDistro)
92-
from(distribution)
93-
into("$customInstallationDir/lib")
94-
}
95-
96-
97-
// -- Performance testing ----------------------------------------------
98-
val benchmark by tasks.registering(integration.Benchmark::class) {
99-
excludingSamplesMatching(
100-
"android",
101-
"source-control"
102-
)
103-
latestInstallation = customInstallationDir
104-
dependsOn(customInstallation)
1055
}
1066

7+
tasks {
1078

108-
// -- IntelliJ IDEA configuration --------------------------------------
109-
idea {
110-
project {
111-
this as ExtensionAware
112-
configure<ProjectSettings> {
113-
this as ExtensionAware
114-
doNotDetectFrameworks("android", "web")
115-
configure<TaskTriggersConfig> {
116-
// Build the `customInstallation` after the initial import to:
117-
// 1. ensure generated code is available to the IDE
118-
// 2. allow integration tests to be executed
119-
afterSync(customInstallation.get())
9+
val samplesWrappers by registering {
10+
doLast {
11+
val wrapperFiles = wrapper.get().run {
12+
listOf(scriptFile, batchScript, jarFile, propertiesFile).associateBy { it.name }
12013
}
121-
configure<CopyrightConfiguration> {
122-
useDefault = "ASL2"
123-
profiles {
124-
create("ASL2") {
125-
keyword = "Copyright"
126-
notice = """
127-
Copyright ${LocalDate.now().year} the original author or authors.
128-
129-
Licensed under the Apache License, Version 2.0 (the "License");
130-
you may not use this file except in compliance with the License.
131-
You may obtain a copy of the License at
132-
133-
http://www.apache.org/licenses/LICENSE-2.0
134-
135-
Unless required by applicable law or agreed to in writing, software
136-
distributed under the License is distributed on an "AS IS" BASIS,
137-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138-
See the License for the specific language governing permissions and
139-
limitations under the License.
140-
""".trimIndent()
14+
val hashes = wrapperFiles.mapValues { HashUtil.sha256(it.value) }
15+
file("samples").walk().filter { it.isFile && it.name in wrapperFiles }.forEach { sampleWrapperFile ->
16+
wrapperFiles.getValue(sampleWrapperFile.name).let { wrapperFile ->
17+
if (HashUtil.sha256(sampleWrapperFile) != hashes.getValue(sampleWrapperFile.name)) {
18+
logger.lifecycle("Updating ${sampleWrapperFile.relativeTo(rootDir)}")
19+
wrapperFile.copyTo(sampleWrapperFile, overwrite = true)
14120
}
14221
}
14322
}
14423
}
14524
}
25+
26+
wrapper {
27+
distributionType = Wrapper.DistributionType.ALL
28+
finalizedBy(samplesWrappers)
29+
}
14630
}

buildSrc/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

buildSrc/build.gradle.kts

Lines changed: 0 additions & 56 deletions
This file was deleted.

buildSrc/settings.gradle.kts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)