-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
274 additions
and
122 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,7 @@ | ||
# Java Module Testing Gradle Plugin - Changelog | ||
|
||
## Version 1.0 | ||
* Moved project to [GradleX](https://gradlex.org) - new plugin ID: `org.gradlex.java-module-testing` | ||
|
||
## Versions 0.1 | ||
* Initial features added |
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,24 +1,29 @@ | ||
# Java Module Testing Gradle plugin | ||
|
||
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fgradlex-org%2Fjava-module-testing%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/gradlex-org/java-module-testing/goto?ref=main) | ||
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v?label=Plugin%20Portal&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Forg%2Fgradlex%2Fjava-module-testing%2Forg.gradlex.java-module-testing.gradle.plugin%2Fmaven-metadata.xml)](https://plugins.gradle.org/plugin/org.gradlex.java-module-testing) | ||
|
||
A Gradle 7.4+ plugin to turn a [JVM Test Suite](https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html#sec:jvm_test_suite_configuration) | ||
into **Blackbox** or **Whitebox** Test Suite for Java Modules. | ||
into a **Blackbox** or **Whitebox** Test Suite for Java Modules. | ||
|
||
This plugin is maintained by me, [Jendrik Johannes](https://github.com/jjohannes). | ||
I offer consulting and training for Gradle and/or the Java Module System - please [reach out](mailto:[email protected]) if you are interested. | ||
There is also my [YouTube channel](https://www.youtube.com/playlist?list=PLWQK2ZdV4Yl2k2OmC_gsjDpdIBTN0qqkE) on Gradle topics. | ||
|
||
If you have a suggestion or a question, please [open an issue](https://github.com/jjohannes/java-module-testing/issues/new). | ||
If you have a suggestion or a question, please [open an issue](https://github.com/gradlex-org/java-module-testing/issues/new). | ||
|
||
# Java Modules with Gradle | ||
|
||
If you plan to build Java Modules with Gradle, you should consider using these plugins on top of Gradle core: | ||
|
||
- [`id("de.jjohannes.java-module-dependencies")`](https://github.com/jjohannes/java-module-dependencies) | ||
- [`id("org.gradlex.java-module-dependencies")`](https://github.com/gradlex-org/java-module-dependencies) | ||
Avoid duplicated dependency definitions and get your Module Path under control | ||
- [`id("de.jjohannes.java-module-testing")`](https://github.com/jjohannes/java-module-testing) | ||
- [`id("org.gradlex.java-module-testing")`](https://github.com/gradlex-org/java-module-testing) | ||
Proper test setup for Java Modules | ||
- [`id("de.jjohannes.extra-java-module-info")`](https://github.com/jjohannes/extra-java-module-info) | ||
- [`id("org.gradlex.extra-java-module-info")`](https://github.com/gradlex-org/extra-java-module-info) | ||
Only if your (existing) project cannot avoid using non-module legacy Jars | ||
|
||
[Here is a sample](https://github.com/jjohannes/java-module-testing/tree/main/samples/use-all-java-module-plugins) | ||
[Here is a sample](https://github.com/gradlex-org/java-module-testing/tree/main/samples/use-all-java-module-plugins) | ||
that shows all plugins in combination. | ||
|
||
[Full Java Module System Project Setup](https://github.com/jjohannes/gradle-project-setup-howto/tree/java_module_system) is a full-fledged Java Module System project setup using these plugins. | ||
|
@@ -40,7 +45,7 @@ Add this to the build file of your convention plugin's build | |
|
||
``` | ||
dependencies { | ||
implementation("de.jjohannes.gradle:java-module-testing:0.1") | ||
implementation("org.gradlex:java-module-testing:1.0") | ||
} | ||
``` | ||
|
||
|
@@ -50,7 +55,7 @@ In your convention plugin, apply the plugin. | |
|
||
``` | ||
plugins { | ||
id("de.jjohannes.java-module-testing") | ||
id("org.gradlex.java-module-testing") | ||
} | ||
``` | ||
|
||
|
@@ -112,3 +117,8 @@ Changes for test runtime (`:test`): | |
- Now, the main and test classes are both used as locations for test discovery. | ||
By this, Gradle will find the `moudle-info.class` of the main module for the tests. | ||
Using `--patch-module`, _main classes_, _main resources_, _test classes_, and _test resources_ folders are all merged to be treated as one module during test runtime. | ||
|
||
# Disclaimer | ||
|
||
Gradle and the Gradle logo are trademarks of Gradle, Inc. | ||
The GradleX project is not endorsed by, affiliated with, or associated with Gradle or Gradle, Inc. in any way. |
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,66 +1,31 @@ | ||
plugins { | ||
id("java-gradle-plugin") | ||
id("maven-publish") | ||
id("com.gradle.plugin-publish") version "0.16.0" | ||
id("groovy") | ||
id("org.gradlex.internal.plugin-publish-conventions") version "0.4" | ||
} | ||
|
||
|
||
group = "de.jjohannes.gradle" | ||
version = "0.1" | ||
group = "org.gradlex" | ||
version = "1.0" | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(8)) | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
dependencies { | ||
testImplementation("org.gradle.exemplar:samples-check:1.0.0") | ||
} | ||
|
||
val pluginId = "de.jjohannes.java-module-testing" | ||
val pluginClass = "de.jjohannes.gradle.moduletesting.JavaModuleTestingPlugin" | ||
val pluginName = "Java Module Testing Gradle Plugin" | ||
val pluginDescription = "A plugin to test Java Modules (whitebox and blackbox) without the hassle." | ||
val pluginBundleTags = listOf("java", "modularity", "jigsaw", "jpms", "testing") | ||
val pluginGitHub = "https://github.com/jjohannes/java-module-testing" | ||
|
||
gradlePlugin { | ||
plugins { | ||
create(project.name) { | ||
id = pluginId | ||
implementationClass = pluginClass | ||
displayName = pluginName | ||
description = pluginDescription | ||
} | ||
} | ||
} | ||
|
||
pluginBundle { | ||
website = pluginGitHub | ||
vcsUrl = pluginGitHub | ||
tags = pluginBundleTags | ||
} | ||
|
||
publishing { | ||
publications.withType<MavenPublication>().all { | ||
pom.name.set(pluginName) | ||
pom.description.set(pluginDescription) | ||
pom.url.set(pluginGitHub) | ||
pom.licenses { | ||
license { | ||
name.set("Apache License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
pom.developers { | ||
developer { | ||
id.set("jjohannes") | ||
name.set("Jendrik Johannes") | ||
email.set("[email protected]") | ||
} | ||
} | ||
pom.scm { | ||
url.set(pluginGitHub) | ||
} | ||
pluginPublishConventions { | ||
id("${project.group}.${project.name}") | ||
implementationClass("org.gradlex.javamodule.testing.JavaModuleTestingPlugin") | ||
displayName("Java Module Testing Gradle Plugin") | ||
description("A plugin to test Java Modules (whitebox and blackbox) without the hassle.") | ||
tags("gradlex", "java", "modularity", "jigsaw", "jpms", "testing") | ||
gitHub("https://github.com/gradlex-org/java-module-testing") | ||
developer { | ||
id.set("jjohannes") | ||
name.set("Jendrik Johannes") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
|
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,8 @@ | ||
<!DOCTYPE module PUBLIC | ||
"-//Puppy Crawl//DTD Check Configuration 1.2//EN" | ||
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> | ||
<module name="Checker"> | ||
<module name="Header"> | ||
<property name="headerFile" value="${config_loc}/header.txt"/> | ||
</module> | ||
</module> |
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,15 @@ | ||
/* | ||
* Copyright 2022 the GradleX team. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
4 changes: 2 additions & 2 deletions
4
...les/use-all-java-module-plugins/build-logic/src/main/kotlin/org.my.gradle.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
2 changes: 1 addition & 1 deletion
2
...-all-java-module-plugins/build-logic/src/main/kotlin/org.my.gradle.java-module.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
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
2 changes: 1 addition & 1 deletion
2
...va-module-testing-plugin/build-logic/src/main/kotlin/org.my.gradle.java-module.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
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
20 changes: 0 additions & 20 deletions
20
src/main/java/de/jjohannes/gradle/moduletesting/JavaModuleTestingPlugin.java
This file was deleted.
Oops, something went wrong.
28 changes: 22 additions & 6 deletions
28
...letesting/JavaModuleTestingExtension.java → ...e/testing/JavaModuleTestingExtension.java
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
36 changes: 36 additions & 0 deletions
36
src/main/java/org/gradlex/javamodule/testing/JavaModuleTestingPlugin.java
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,36 @@ | ||
/* | ||
* Copyright 2022 the GradleX team. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradlex.javamodule.testing; | ||
|
||
import org.gradle.api.NonNullApi; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.util.GradleVersion; | ||
|
||
@SuppressWarnings("unused") | ||
@NonNullApi | ||
public abstract class JavaModuleTestingPlugin implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
if (GradleVersion.current().compareTo(GradleVersion.version("7.4")) < 0) { | ||
throw new RuntimeException("This plugin requires Gradle 7.4+"); | ||
} | ||
|
||
project.getExtensions().create("javaModuleTesting", JavaModuleTestingExtension.class); | ||
} | ||
} |
18 changes: 17 additions & 1 deletion
18
...e/moduletesting/WhiteboxJvmTestSuite.java → ...amodule/testing/WhiteboxJvmTestSuite.java
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
18 changes: 17 additions & 1 deletion
18
...uletesting/internal/ModuleInfoParser.java → ...le/testing/internal/ModuleInfoParser.java
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.