Skip to content

Commit

Permalink
Version 1.0 - move to 'org.gradlex'
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Aug 18, 2022
1 parent c9764cd commit 3eaede4
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 122 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
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
26 changes: 18 additions & 8 deletions README.md
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.
Expand All @@ -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")
}
```

Expand All @@ -50,7 +55,7 @@ In your convention plugin, apply the plugin.

```
plugins {
id("de.jjohannes.java-module-testing")
id("org.gradlex.java-module-testing")
}
```

Expand Down Expand Up @@ -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.
69 changes: 17 additions & 52 deletions build.gradle.kts
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]")
}
}

Expand Down
8 changes: 8 additions & 0 deletions gradle/checkstyle/checkstyle.xml
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>
15 changes: 15 additions & 0 deletions gradle/checkstyle/header.txt
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.
*/
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation("de.jjohannes.gradle:extra-java-module-info:0.12")
implementation("de.jjohannes.gradle:java-module-dependencies:0.7")
implementation("de.jjohannes.gradle:java-module-testing:0.1")
}
implementation("org.gradlex:extra-java-module-info:1.0")
implementation("org.gradlex:java-module-dependencies:1.0")
implementation("org.gradlex:java-module-testing:1.0")
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("de.jjohannes.extra-java-module-info")
id("de.jjohannes.java-module-dependencies")
id("org.gradlex.extra-java-module-info")
id("org.gradlex.java-module-dependencies")
}

group = "org.my"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("java")
id("org.my.gradle.base")
id("de.jjohannes.java-module-testing")
id("org.gradlex.java-module-testing")
}

javaModuleTesting.whitebox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ plugins {
}

dependencies {
implementation("de.jjohannes.gradle:java-module-testing:0.1")
implementation("org.gradlex:java-module-testing:1.0")
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("java")
id("org.my.gradle.base")
id("de.jjohannes.java-module-testing")
id("org.gradlex.java-module-testing")
}

javaModuleTesting.whitebox(
Expand Down
13 changes: 8 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("com.gradle.enterprise") version "3.10"
id("com.gradle.enterprise") version "3.11.1"
}

dependencyResolutionManagement {
Expand All @@ -9,9 +9,12 @@ dependencyResolutionManagement {
rootProject.name = "java-module-testing"

gradleEnterprise {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
val runsOnCI = providers.environmentVariable("CI").getOrElse("false").toBoolean()
if (runsOnCI) {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
package de.jjohannes.gradle.moduletesting;

import de.jjohannes.gradle.moduletesting.internal.ModuleInfoParser;
import de.jjohannes.gradle.moduletesting.internal.bridges.JavaModuleDependenciesBridge;
import de.jjohannes.gradle.moduletesting.internal.provider.WhiteboxTestCompileArgumentProvider;
import de.jjohannes.gradle.moduletesting.internal.provider.WhiteboxTestRuntimeArgumentProvider;
/*
* 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.gradlex.javamodule.testing.internal.ModuleInfoParser;
import org.gradlex.javamodule.testing.internal.bridges.JavaModuleDependenciesBridge;
import org.gradlex.javamodule.testing.internal.provider.WhiteboxTestCompileArgumentProvider;
import org.gradlex.javamodule.testing.internal.provider.WhiteboxTestRuntimeArgumentProvider;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
Expand Down
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);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
package de.jjohannes.gradle.moduletesting;
/*
* 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.provider.ListProperty;
import org.gradle.api.provider.Property;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
package de.jjohannes.gradle.moduletesting.internal;
/*
* 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.internal;

import org.gradle.api.file.ProjectLayout;
import org.gradle.api.file.RegularFile;
Expand Down
Loading

0 comments on commit 3eaede4

Please sign in to comment.