-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor examples and integration tests (#7)
* refactor examples and integration tests - example and integration test projects are automatically copied from Dokka src - integration tests will use the example and integration tests projects * prep dokkatoo example projects * updating integration tests and test projects * git ignore gradle.properties in dokkatoo examples * add code for includeBuild-ing the example projects * setup dokkatoo gradle-example * a bit of integration-test refactoring * add remoteUrl util function * rm setting null into dokkatooCacheDirectory (it's not necessary) * update a couple of build script comments * implement GradleExampleTest * update .gitignore to be more comprehensive * add options for increasing DokkaGenerator memory, and also increase the memory * increase Gradle memory * fix BasicProjectIntegrationTest * try fixing task updateGradlePropertiesInDokkatooExamples * move the integration tests into separate sourceSets * the integration tests keep running out of memory, so fork on every test * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try fixing testMavenRepo on Windows * try increases MaxMetaspace Kotlin/dokka#1405 * try fixing updateTestReportCss task output warnings * more memory increasing
- Loading branch information
Showing
233 changed files
with
3,928 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,69 @@ | ||
# Ignore Gradle project-specific cache directory | ||
### Gradle ### | ||
.gradle | ||
build/ | ||
|
||
# Ignore Gradle build output directory | ||
build | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!gradle/wrapper/gradle-wrapper.properties | ||
|
||
|
||
### Kotlin/JVM ### | ||
*.class | ||
*.log | ||
|
||
hs_err_pid* | ||
replay_pid* | ||
*.hprof | ||
|
||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
|
||
### IntelliJ ### | ||
.idea | ||
|
||
|
||
### Eclipse ### | ||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
.settings/ | ||
.loadpath | ||
.recommenders | ||
.classpath | ||
|
||
.apt_generated/ | ||
.apt_generated_test/ | ||
.project | ||
|
||
|
||
### Linux ### | ||
*~ | ||
.fuse_hidden* | ||
.Trash-* | ||
.nfs* | ||
|
||
|
||
### Windows ### | ||
[Dd]esktop.ini | ||
$RECYCLE.BIN/ | ||
*.lnk | ||
|
||
|
||
### macOS ### | ||
.DS_Store | ||
._* | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
########################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
buildSrc/src/main/kotlin/buildsrc/conventions/dokka-source-downloader.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package buildsrc.conventions | ||
|
||
import buildsrc.conventions.utils.asConsumer | ||
import buildsrc.conventions.utils.asProvider | ||
import buildsrc.conventions.utils.dropDirectories | ||
|
||
plugins { | ||
id("buildsrc.conventions.base") | ||
} | ||
|
||
val kotlinDokkaSource by configurations.creating { | ||
asConsumer() | ||
attributes { | ||
attribute(Usage.USAGE_ATTRIBUTE, objects.named("externals-dokka-src")) | ||
} | ||
} | ||
|
||
val kotlinDokkaSourceElements by configurations.registering { | ||
asProvider() | ||
attributes { | ||
attribute(Usage.USAGE_ATTRIBUTE, objects.named("externals-dokka-src")) | ||
} | ||
} | ||
|
||
dependencies { | ||
kotlinDokkaSource("kotlin:dokka:1.7.20@zip") | ||
} | ||
|
||
val prepareDokkaSource by tasks.registering(Sync::class) { | ||
group = "dokka setup" | ||
description = "Download & unpack Kotlin Dokka source code" | ||
from( | ||
kotlinDokkaSource.incoming | ||
.artifactView { lenient(true) } | ||
.artifacts | ||
.resolvedArtifacts.map { artifacts -> | ||
artifacts.map { zipTree(it.file) } | ||
} | ||
) { | ||
// drop the first dir (dokka-$version) | ||
eachFile { | ||
relativePath = relativePath.dropDirectories(1) | ||
} | ||
} | ||
into(temporaryDir) | ||
exclude( | ||
"*.github", | ||
"*.gradle", | ||
"**/gradlew", | ||
"**/gradlew.bat", | ||
"**/gradle/wrapper/gradle-wrapper.jar", | ||
"**/gradle/wrapper/gradle-wrapper.properties", | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
buildSrc/src/main/kotlin/buildsrc/conventions/dokkatoo-example-projects-base.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package buildsrc.conventions | ||
|
||
import buildsrc.conventions.Maven_publish_test_gradle.MavenPublishTest | ||
import buildsrc.conventions.utils.asConsumer | ||
import buildsrc.conventions.utils.asProvider | ||
import buildsrc.tasks.SetupDokkaProjects | ||
|
||
plugins { | ||
id("buildsrc.conventions.base") | ||
} | ||
|
||
|
||
val exampleProjectsAttribute = Attribute.of("example-projects", String::class.java) | ||
dependencies.attributesSchema { | ||
attribute(exampleProjectsAttribute) | ||
} | ||
|
||
|
||
val exampleProjects by configurations.registering { | ||
asConsumer() | ||
isVisible = false | ||
attributes { attribute(exampleProjectsAttribute, "dokka") } | ||
} | ||
|
||
val exampleProjectsElements by configurations.registering { | ||
asProvider() | ||
isVisible = true | ||
attributes { attribute(exampleProjectsAttribute, "dokka") } | ||
} |
70 changes: 70 additions & 0 deletions
70
buildSrc/src/main/kotlin/buildsrc/conventions/dokkatoo-example-projects.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package buildsrc.conventions | ||
|
||
import buildsrc.conventions.Maven_publish_test_gradle.MavenPublishTest | ||
import buildsrc.tasks.SetupDokkaProjects | ||
|
||
plugins { | ||
id("buildsrc.conventions.base") | ||
id("buildsrc.conventions.dokka-source-downloader") | ||
id("buildsrc.conventions.maven-publish-test") | ||
id("buildsrc.conventions.dokkatoo-example-projects-base") | ||
} | ||
|
||
|
||
val prepareDokkaSourceTask = tasks.named<Sync>("prepareDokkaSource") | ||
|
||
val setupDokkaTemplateProjects by tasks.registering(SetupDokkaProjects::class) { | ||
dependsOn(prepareDokkaSourceTask) | ||
destinationToSources.convention(emptyMap()) | ||
dokkaSourceDir.set( | ||
layout.dir( | ||
prepareDokkaSourceTask.map { it.destinationDir } | ||
) | ||
) | ||
} | ||
|
||
val mavenPublishTestExtension = extensions.getByType<MavenPublishTest>() | ||
|
||
val updateGradlePropertiesInDokkatooExamples by tasks.registering { | ||
group = "dokkatoo examples" | ||
|
||
mustRunAfter(tasks.withType<SetupDokkaProjects>()) | ||
|
||
val gradlePropertiesFiles = | ||
layout.projectDirectory.asFileTree | ||
.matching { | ||
include( | ||
"**/*dokkatoo*/settings.gradle.kts", | ||
"**/*dokkatoo*/settings.gradle", | ||
) | ||
}.elements.map { settingsFiles -> | ||
settingsFiles.map { | ||
it.asFile.resolveSibling("gradle.properties") | ||
} | ||
} | ||
|
||
outputs.files(gradlePropertiesFiles) | ||
|
||
val testMavenRepoPath = mavenPublishTestExtension.testMavenRepo.map { | ||
it.asFile.invariantSeparatorsPath | ||
} | ||
inputs.property("testMavenRepoPath", testMavenRepoPath) | ||
|
||
doLast task@{ | ||
gradlePropertiesFiles.get().forEach { | ||
it.writeText( | ||
""" | ||
|# DO NOT EDIT - Generated by ${this@task.path} | ||
| | ||
|testMavenRepo=${testMavenRepoPath.get()} | ||
| | ||
""".trimMargin() | ||
) | ||
} | ||
} | ||
} | ||
|
||
tasks.assemble { | ||
dependsOn(setupDokkaTemplateProjects) | ||
dependsOn(updateGradlePropertiesInDokkatooExamples) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.