-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2564 from vlsi/split_modules
- Loading branch information
Showing
2,265 changed files
with
1,881 additions
and
813 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
root = true | ||
|
||
[*] | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = space | ||
|
||
[{*.sh,gradlew}] | ||
end_of_line = lf | ||
|
||
[{*.bat,*.cmd}] | ||
end_of_line = crlf | ||
|
||
[*.md] | ||
# Trailing space means "paragraph continues" in markdown | ||
trim_trailing_whitespace = false | ||
|
||
[*.java] | ||
indent_size = 2 |
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
/local.properties | ||
build | ||
eclipse-build | ||
gradle.properties | ||
ivy* | ||
javadocs | ||
lib | ||
|
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} |
10 changes: 10 additions & 0 deletions
10
build-logic/basics/src/main/kotlin/testng.repositories.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,10 @@ | ||
// Can't use settings plugin: https://github.com/gradle/gradle/issues/17295 | ||
// dependencyResolutionManagement { | ||
// repositories { | ||
// mavenCentral() | ||
// } | ||
//} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
7 changes: 7 additions & 0 deletions
7
build-logic/basics/src/main/kotlin/testng.reproducible-builds.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,7 @@ | ||
tasks.withType<AbstractArchiveTask>().configureEach { | ||
// Ensure builds are reproducible | ||
isPreserveFileTimestamps = false | ||
isReproducibleFileOrder = true | ||
dirMode = "775".toInt(8) | ||
fileMode = "664".toInt(8) | ||
} |
5 changes: 5 additions & 0 deletions
5
build-logic/basics/src/main/kotlin/testng.versioning.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,5 @@ | ||
if (project != rootProject) { | ||
// The root project takes its version from /gradle.properties -> testng.version | ||
// All the rest projects take the version from the root | ||
version = rootProject.version | ||
} |
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,11 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation("org.sonarqube:org.sonarqube.gradle.plugin:2.8") | ||
} |
12 changes: 12 additions & 0 deletions
12
build-logic/code-quality/src/main/kotlin/testng.sonarqube.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,12 @@ | ||
plugins { | ||
id("org.sonarqube") | ||
} | ||
|
||
sonarqube { | ||
properties { | ||
property("sonar.host.url", "https://sonarcloud.io/") | ||
property("sonar.organization", "testng-team") | ||
property("sonar.github.repository", "cbeust/testng") | ||
property("sonar.github.login", "testng-bot") | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
build-logic/code-quality/src/main/kotlin/testng.testing.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,33 @@ | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.kotlin.dsl.withType | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
dependencies { | ||
testImplementation("org.assertj:assertj-core:_") | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
useTestNG() | ||
systemProperty("test.resources.dir", "build/resources/test") | ||
fun passProperty(name: String, default: String? = null) { | ||
val value = System.getProperty(name) ?: default | ||
value?.let { systemProperty(name, it) } | ||
} | ||
// Default verbose is 0, however, it can be adjusted vi -Dtestng.default.verbose=2 | ||
passProperty("testng.default.verbose", "0") | ||
// Allow running tests in a custom locale with -Duser.language=... | ||
passProperty("user.language") | ||
passProperty("user.country") | ||
|
||
@Suppress("unchecked_cast") | ||
val props = System.getProperties().propertyNames() as `java.util`.Enumeration<String> | ||
// Pass testng.* properties to the test JVM | ||
for (e in props) { | ||
if (e.startsWith("testng.")) { | ||
passProperty(e) | ||
} | ||
} | ||
} |
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,14 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation(project(":basics")) | ||
implementation(project(":code-quality")) | ||
implementation("com.github.vlsi.gradle-extensions:com.github.vlsi.gradle-extensions.gradle.plugin:1.74") | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin") | ||
} |
16 changes: 16 additions & 0 deletions
16
build-logic/jvm/src/main/kotlin/buildlogic/CopySpecExtensions.kt
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,16 @@ | ||
package buildlogic | ||
|
||
import org.apache.tools.ant.filters.FixCrLfFilter | ||
import org.gradle.api.file.CopySpec | ||
import org.gradle.kotlin.dsl.filter | ||
|
||
fun CopySpec.filterEolSimple(eol: String) { | ||
filteringCharset = "UTF-8" | ||
filter( | ||
FixCrLfFilter::class, mapOf( | ||
"eol" to FixCrLfFilter.CrLf.newInstance(eol), | ||
"fixlast" to true, | ||
"ctrlz" to FixCrLfFilter.AddAsisRemove.newInstance("asis") | ||
) | ||
) | ||
} |
69 changes: 69 additions & 0 deletions
69
build-logic/jvm/src/main/kotlin/testng.java-library.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,69 @@ | ||
import buildlogic.filterEolSimple | ||
|
||
plugins { | ||
`java-library` | ||
id("testng.java") | ||
id("testng.testing") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
tasks.withType<Javadoc>().configureEach { | ||
excludes.add("org/testng/internal/**") | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
inputs.property("java.version", System.getProperty("java.version")) | ||
inputs.property("java.vm.version", System.getProperty("java.vm.version")) | ||
options.apply { | ||
encoding = "UTF-8" | ||
compilerArgs.add("-Xlint:deprecation") | ||
compilerArgs.add("-Werror") | ||
} | ||
} | ||
|
||
tasks.withType<Jar>().configureEach { | ||
into("META-INF") { | ||
filterEolSimple("crlf") | ||
from("$rootDir/LICENSE.txt") | ||
from("$rootDir/NOTICE") | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
manifest { | ||
// providers.gradleProperty does not work | ||
// see https://github.com/gradle/gradle/issues/14972 | ||
val name = rootProject.findProperty("project.name") | ||
val vendor = rootProject.findProperty("project.vendor.name") | ||
attributes(mapOf( | ||
"Specification-Title" to name, | ||
"Specification-Version" to project.version, | ||
"Specification-Vendor" to vendor, | ||
"Implementation-Title" to name, | ||
"Implementation-Version" to project.version, | ||
"Implementation-Vendor" to vendor, | ||
"Implementation-Vendor-Id" to rootProject.findProperty("project.vendor.id"), | ||
"Implementation-Url" to rootProject.findProperty("project.url"), | ||
)) | ||
} | ||
} | ||
|
||
@Suppress("unused") | ||
val transitiveSourcesElements by configurations.creating { | ||
description = "Share sources folder with other projects for aggregation (e.g. sources, javadocs, etc)" | ||
isVisible = false | ||
isCanBeResolved = false | ||
isCanBeConsumed = true | ||
extendsFrom(configurations.implementation.get()) | ||
attributes { | ||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) | ||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) | ||
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders")) | ||
} | ||
// afterEvaluate is to allow creation of the new source sets | ||
afterEvaluate { | ||
sourceSets.main.get().java.srcDirs.forEach { outgoing.artifact(it) } | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
build-logic/jvm/src/main/kotlin/testng.java-platform.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,4 @@ | ||
plugins { | ||
id("testng.java") | ||
`java-platform` | ||
} |
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,13 @@ | ||
plugins { | ||
`java-base` | ||
id("testng.versioning") | ||
id("testng.repositories") | ||
// Improves Gradle Test logging | ||
// See https://github.com/vlsi/vlsi-release-plugins/tree/master/plugins/gradle-extensions-plugin | ||
id("com.github.vlsi.gradle-extensions") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} |
16 changes: 16 additions & 0 deletions
16
build-logic/jvm/src/main/kotlin/testng.kotlin-library.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,16 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("testng.java-library") | ||
kotlin("jvm") | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} |
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,14 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation(project(":jvm")) | ||
implementation("com.github.vlsi.gradle-extensions:com.github.vlsi.gradle-extensions.gradle.plugin:1.74") | ||
implementation("com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:7.0.0") | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin") | ||
} |
19 changes: 19 additions & 0 deletions
19
build-logic/publishing/src/main/kotlin/buildlogic/ConfigurationExtensions.kt
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,19 @@ | ||
package buildlogic | ||
|
||
import org.gradle.api.artifacts.Configuration | ||
import org.gradle.api.attributes.Category | ||
import org.gradle.api.attributes.Usage | ||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.kotlin.dsl.named | ||
|
||
fun Configuration.javaLibrary(objects: ObjectFactory, usage: String) = | ||
attributes { | ||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) | ||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(usage)) | ||
} | ||
|
||
fun Configuration.javaLibraryApi(objects: ObjectFactory) = | ||
javaLibrary(objects, Usage.JAVA_API) | ||
|
||
fun Configuration.javaLibraryRuntime(objects: ObjectFactory) = | ||
javaLibrary(objects, Usage.JAVA_RUNTIME) |
16 changes: 16 additions & 0 deletions
16
build-logic/publishing/src/main/kotlin/buildlogic/CopySpecExtensions.kt
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,16 @@ | ||
package buildlogic | ||
|
||
import org.apache.tools.ant.filters.FixCrLfFilter | ||
import org.gradle.api.file.CopySpec | ||
import org.gradle.kotlin.dsl.filter | ||
|
||
fun CopySpec.filterEolSimple(eol: String) { | ||
filteringCharset = "UTF-8" | ||
filter( | ||
FixCrLfFilter::class, mapOf( | ||
"eol" to FixCrLfFilter.CrLf.newInstance(eol), | ||
"fixlast" to true, | ||
"ctrlz" to FixCrLfFilter.AddAsisRemove.newInstance("asis") | ||
) | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
build-logic/publishing/src/main/kotlin/buildlogic/DependencyHandlerExtensions.kt
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,34 @@ | ||
package buildlogic | ||
|
||
import org.gradle.api.artifacts.Dependency | ||
import org.gradle.api.artifacts.component.ModuleComponentIdentifier | ||
import org.gradle.api.artifacts.component.ProjectComponentIdentifier | ||
import org.gradle.api.artifacts.dsl.DependencyHandler | ||
import org.gradle.api.artifacts.result.ResolvedVariantResult | ||
import org.gradle.api.attributes.Category | ||
import org.gradle.kotlin.dsl.create | ||
import org.gradle.kotlin.dsl.project | ||
|
||
/** | ||
* Converts the resolved result back to a dependency notation, so it can be resolved again. | ||
* Note: the conversion does not support "classifiers" | ||
*/ | ||
fun DependencyHandler.reconstruct(variant: ResolvedVariantResult): Dependency { | ||
val category = variant.attributes.run { | ||
keySet().firstOrNull { it.name == Category.CATEGORY_ATTRIBUTE.name }?.let { getAttribute(it) } | ||
} | ||
|
||
val id = variant.owner | ||
return when (id) { | ||
is ProjectComponentIdentifier -> project(id.projectPath) | ||
is ModuleComponentIdentifier -> create(id.group, id.module, id.version) | ||
else -> throw IllegalArgumentException("Can't convert $id to dependency") | ||
}.let { | ||
when (category) { | ||
Category.REGULAR_PLATFORM -> platform(it) | ||
Category.ENFORCED_PLATFORM -> enforcedPlatform(it) | ||
Category.LIBRARY -> it | ||
else -> throw IllegalStateException("Unexpected dependency type $category for id $id") | ||
} | ||
} | ||
} |
Oops, something went wrong.