Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency name.remal.gradle-plugins.toolkit:build-logic to v0.71.0 #534

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
String rootSnapshotVersion = project.ext.rootSnapshotVersion = '4-SNAPSHOT'
dependencies {
//classpath("$rootGroupId:$rootArtifactId:$rootSnapshotVersion") { version { strictly(rootSnapshotVersion) } }
classpath 'name.remal.gradle-plugins.toolkit:build-logic:0.70.6'
classpath 'name.remal.gradle-plugins.toolkit:build-logic:0.71.0'
}
repositories {
mavenCentral()
Expand Down Expand Up @@ -52,19 +52,16 @@ gradlePlugin {

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

tasks.named('generateJava') { Task task ->
generateSources.forMainSourceSet.java {
String repositoryHtmlUrl = project.ext['repository-html-url']
inputs.property('repository-html-url', repositoryHtmlUrl)
classFile(project.calculateBaseJavaPackage(), 'DocUtils') {
it.writePackage()
it.println("")
it.writeStaticImport("lombok.AccessLevel", "PRIVATE")
it.println("")
it.writeImport("lombok.NoArgsConstructor")
it.println("")
it.println("@NoArgsConstructor(access = PRIVATE)")
it.writeBlock("abstract class ${it.simpleName}") {
it.println("public static final String PLUGIN_REPOSITORY_HTML_URL = \"${it.escapeJava(repositoryHtmlUrl)}\";")
addStaticImport("lombok.AccessLevel", "PRIVATE")
addImport("lombok.NoArgsConstructor")

line("@NoArgsConstructor(access = PRIVATE)")
block("abstract class ${simpleName}") {
line("public static final String PLUGIN_REPOSITORY_HTML_URL = \"${escapeString(repositoryHtmlUrl)}\";")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package name.remal.gradle_plugins.test_source_sets;

import static java.lang.String.join;
import static name.remal.gradle_plugins.test_source_sets.TestSourceSetsPlugin.ALL_TESTS_TASK_NAME;
import static name.remal.gradle_plugins.toolkit.StringUtils.escapeGroovy;
import static name.remal.gradle_plugins.toolkit.testkit.GradleDependencyVersions.getCorrespondingKotlinVersion;

import lombok.RequiredArgsConstructor;
Expand All @@ -14,17 +14,16 @@
@RequiredArgsConstructor
class TestSourceSetsPluginFunctionalTest {

private final GradleProject project;
final GradleProject project;

@BeforeEach
void beforeEach() {
project.forBuildFile(build -> {
build.applyPlugin("name.remal.test-source-sets");
build.append("testSourceSets { additionalTest }");
build.registerDefaultTask(ALL_TESTS_TASK_NAME);
build.line("testSourceSets { additionalTest }");

build.append("repositories { mavenCentral() }");
build.append(
build.line("repositories { mavenCentral() }");
build.line(join("\n", new String[]{
"Dependency junitDependency = dependencies.create('junit:junit:4.13.2')",
"project.configurations.with { configurations ->",
" testSourceSets.all { SourceSet sourceSet ->",
Expand All @@ -49,10 +48,10 @@ void beforeEach() {
" stackTraceFilters('GROOVY')",
" }",
"}",
""
);
"",
}));

build.append(
build.line(join("\n", new String[]{
"file(\"src/test/java/pkg/JavaTest.java\").with {",
" parentFile.mkdirs()",
" write([",
Expand All @@ -65,9 +64,9 @@ void beforeEach() {
" ].join('\\n'), 'UTF-8')",
"}",
""
);
}));

build.append(
build.line(join("\n", new String[]{
"file(\"src/additionalTest/java/pkg/JavaAdditionalTest.java\").with {",
" parentFile.mkdirs()",
" write([",
Expand All @@ -80,33 +79,32 @@ void beforeEach() {
" ].join('\\n'), 'UTF-8')",
"}",
""
);
}));
});
}

@Test
void emptyBuildPerformsSuccessfully() {
project.getBuildFile().append(
project.getBuildFile().line(join("\n", new String[]{
"file(\"src/test/java\").deleteDir()",
"file(\"src/additionalTest/java\").deleteDir()",
""
);
}));

project.assertBuildSuccessfully();
project.assertBuildSuccessfully(ALL_TESTS_TASK_NAME);
}

@Test
void nonEmptyBuildPerformsSuccessfully() {
project.assertBuildSuccessfully();
project.assertBuildSuccessfully(ALL_TESTS_TASK_NAME);
}

@Test
void buildWithJacocoPerformsSuccessfully() {
project.forBuildFile(build -> {
build.applyPlugin("jacoco");
build.registerDefaultTask("jacocoAdditionalTestReport");
});
project.assertBuildSuccessfully();
project.assertBuildSuccessfully("jacocoAdditionalTestReport");
}

@Test
Expand All @@ -116,8 +114,8 @@ void kotlinBuildWithInternalVisibilityPerformsSuccessfully() {
val kotlinVersion = getCorrespondingKotlinVersion();
build.applyPlugin("org.jetbrains.kotlin.jvm", kotlinVersion);

build.append(
"dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib:" + escapeGroovy(kotlinVersion) + "' }",
build.line(join("\n", new String[]{
"dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib:" + build.escapeString(kotlinVersion) + "' }",
"file(\"src/main/kotlin/pkg/kotlinFile.kt\").with {",
" parentFile.mkdirs()",
" write([",
Expand All @@ -140,12 +138,12 @@ void kotlinBuildWithInternalVisibilityPerformsSuccessfully() {
" ].join('\\n'), 'UTF-8')",
"}",
""
);
}));
});

project.withoutConfigurationCache();

project.assertBuildSuccessfully();
project.assertBuildSuccessfully(ALL_TESTS_TASK_NAME);
}

}
Loading