From 44008e25053c05c584820c9ee26ff0694174e5b1 Mon Sep 17 00:00:00 2001 From: Uday Date: Fri, 25 Sep 2026 14:56:29 +0530 Subject: [PATCH 1/3] RTECO-132 - Add e2e tests for shared build logic dependency propagation (Classic + FlexPack) Adds two end-to-end tests verifying that a dependency declared only in a shared buildSrc convention plugin (never in the api module's own build.gradle) is correctly present in the published build-info, for both Gradle execution modes: - TestGradleBuildSharedBuildLogicClassic: plugin auto-injected via the init script (default jf gradle mode). - TestGradleBuildSharedBuildLogicFlexPack: native mode (JFROG_RUN_NATIVE=true). New fixture: testdata/gradle/buildsrcdependency (root + buildSrc + api, convention plugin declares org.slf4j:slf4j-api, api uses it via a real class without declaring it directly). The FlexPack test explicitly removes any leftover .jfrog config before running, since ShouldRunNative refuses native mode when a .jfrog/projects/gradle.yaml is found via upward directory search, and this fixture name is shared with the Classic test. --- gradle_test.go | 89 +++++++++++++++++++ .../buildsrcdependency/api/build.gradle | 15 ++++ .../main/java/com/example/api/PersonList.java | 12 +++ .../gradle/buildsrcdependency/build.gradle | 3 + .../buildsrcdependency/buildSrc/build.gradle | 7 ++ .../groovy/java-common-conventions.gradle | 11 +++ .../gradle/buildsrcdependency/settings.gradle | 2 + 7 files changed, 139 insertions(+) create mode 100644 testdata/gradle/buildsrcdependency/api/build.gradle create mode 100644 testdata/gradle/buildsrcdependency/api/src/main/java/com/example/api/PersonList.java create mode 100644 testdata/gradle/buildsrcdependency/build.gradle create mode 100644 testdata/gradle/buildsrcdependency/buildSrc/build.gradle create mode 100644 testdata/gradle/buildsrcdependency/buildSrc/src/main/groovy/java-common-conventions.gradle create mode 100644 testdata/gradle/buildsrcdependency/settings.gradle diff --git a/gradle_test.go b/gradle_test.go index 725c2641d..e7b79fecf 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -552,6 +552,95 @@ func TestGradleBuildWithFlexPackKotlinDSL(t *testing.T) { cleanGradleTest(t) } +// TestGradleBuildSharedBuildLogicClassic verifies that a dependency declared only in a +// shared convention plugin living in buildSrc (not in the api module's own build.gradle) +// is correctly present in the published build-info, when using Classic mode (the plugin +// is auto-injected into every project via the init script). +func TestGradleBuildSharedBuildLogicClassic(t *testing.T) { + initGradleTest(t) + buildGradlePath := createGradleProject(t, "buildsrcdependency") + configFilePath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "buildspecs", tests.GradleConfig) + destPath := filepath.Join(filepath.Dir(buildGradlePath), ".jfrog", "projects") + createConfigFile(destPath, configFilePath, t) + oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath)) + defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir) + + buildName := tests.GradleBuildName + "-shared-build-logic-classic" + buildNumber := "1" + + // Run from within the project directory (already the cwd via changeWD above) instead of + // passing -b/--build-file: newer Gradle versions reject that flag when combined with + // task-specific command-line options. + runJfrogCli(t, "gradle", "clean", "artifactoryPublish", "--build-name="+buildName, "--build-number="+buildNumber) + assert.NoError(t, artifactoryCli.Exec("bp", buildName, buildNumber)) + + assertSharedConventionDependencyInBuildInfo(t, buildName, buildNumber) + cleanGradleTest(t) +} + +// TestGradleBuildSharedBuildLogicFlexPack is the same check as +// TestGradleBuildSharedBuildLogicClassic, but using FlexPack (native) mode instead. +func TestGradleBuildSharedBuildLogicFlexPack(t *testing.T) { + initGradleTest(t) + buildGradlePath := createGradleProject(t, "buildsrcdependency") + oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath)) + defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir) + + buildName := tests.GradleBuildName + "-shared-build-logic-flexpack" + buildNumber := "1" + setEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, "JFROG_RUN_NATIVE", "true") + defer setEnvCallBack() + + // Defensive: ShouldRunNative refuses native mode if any .jfrog/projects/gradle.yaml is + // found (via an upward directory search from cwd). This fixture directory name is reused + // by TestGradleBuildSharedBuildLogicClassic, and if that test's config file isn't fully + // removed by the shared harness cleanup before this test starts (e.g. a lingering Gradle + // daemon file lock), native mode would silently be skipped. Remove it explicitly so this + // test's outcome never depends on that cleanup having completed. + assert.NoError(t, os.RemoveAll(".jfrog")) + + err := runJfrogCliWithoutAssertion("gradle", "clean", "build", "--build-name="+buildName, "--build-number="+buildNumber) + assert.NoError(t, err) + assert.NoError(t, artifactoryCli.Exec("bp", buildName, buildNumber)) + + assertSharedConventionDependencyInBuildInfo(t, buildName, buildNumber) + cleanGradleTest(t) +} + +// assertSharedConventionDependencyInBuildInfo asserts the published build-info has an +// "api" module whose dependencies include org.slf4j:slf4j-api — a dependency declared +// only in the shared buildSrc convention plugin, never in api's own build.gradle. +func assertSharedConventionDependencyInBuildInfo(t *testing.T, buildName, buildNumber string) { + publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, buildName, buildNumber) + if err != nil { + assert.NoError(t, err) + return + } + if !found { + assert.True(t, found, "build info was expected to be found") + return + } + buildInfo := publishedBuildInfo.BuildInfo + var apiModule *buildinfo.Module + for i := range buildInfo.Modules { + if strings.Contains(buildInfo.Modules[i].Id, "api") { + apiModule = &buildInfo.Modules[i] + break + } + } + if !assert.NotNil(t, apiModule, "api module missing from build-info") { + return + } + hasSharedDep := false + for _, dep := range apiModule.Dependencies { + if strings.HasPrefix(dep.Id, "org.slf4j:slf4j-api") { + hasSharedDep = true + break + } + } + assert.True(t, hasSharedDep, "shared dependency (org.slf4j:slf4j-api, declared only in the shared convention plugin) missing from api module's dependencies") +} + func createGradleProject(t *testing.T, projectName string) string { // Copy the entire project directory including source files projectSrc := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "gradle", projectName) diff --git a/testdata/gradle/buildsrcdependency/api/build.gradle b/testdata/gradle/buildsrcdependency/api/build.gradle new file mode 100644 index 000000000..a82909111 --- /dev/null +++ b/testdata/gradle/buildsrcdependency/api/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'java-common-conventions' + id 'maven-publish' +} + +group = 'com.example' +version = '1.0.0' + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} diff --git a/testdata/gradle/buildsrcdependency/api/src/main/java/com/example/api/PersonList.java b/testdata/gradle/buildsrcdependency/api/src/main/java/com/example/api/PersonList.java new file mode 100644 index 000000000..a0642892f --- /dev/null +++ b/testdata/gradle/buildsrcdependency/api/src/main/java/com/example/api/PersonList.java @@ -0,0 +1,12 @@ +package com.example.api; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PersonList { + private static final Logger logger = LoggerFactory.getLogger(PersonList.class); + + public void log() { + logger.info("PersonList using slf4j-api pulled in only via the shared convention plugin"); + } +} diff --git a/testdata/gradle/buildsrcdependency/build.gradle b/testdata/gradle/buildsrcdependency/build.gradle new file mode 100644 index 000000000..281335e1c --- /dev/null +++ b/testdata/gradle/buildsrcdependency/build.gradle @@ -0,0 +1,3 @@ +// Root build file intentionally left plain. Neither Classic mode (plugin +// auto-injected via init script) nor FlexPack mode requires any plugin +// application here. diff --git a/testdata/gradle/buildsrcdependency/buildSrc/build.gradle b/testdata/gradle/buildsrcdependency/buildSrc/build.gradle new file mode 100644 index 000000000..15bac7130 --- /dev/null +++ b/testdata/gradle/buildsrcdependency/buildSrc/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + mavenCentral() +} diff --git a/testdata/gradle/buildsrcdependency/buildSrc/src/main/groovy/java-common-conventions.gradle b/testdata/gradle/buildsrcdependency/buildSrc/src/main/groovy/java-common-conventions.gradle new file mode 100644 index 000000000..016340a68 --- /dev/null +++ b/testdata/gradle/buildsrcdependency/buildSrc/src/main/groovy/java-common-conventions.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.slf4j:slf4j-api:2.0.9' +} diff --git a/testdata/gradle/buildsrcdependency/settings.gradle b/testdata/gradle/buildsrcdependency/settings.gradle new file mode 100644 index 000000000..e0afb4dd8 --- /dev/null +++ b/testdata/gradle/buildsrcdependency/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'buildsrcdependency' +include 'api' From 3d429ec9359bc21be6f4a8f1d2808a22ad737514 Mon Sep 17 00:00:00 2001 From: Uday Date: Fri, 25 Sep 2026 15:14:29 +0530 Subject: [PATCH 2/3] RTECO-132 - Add lib submodule to prove convention plugin scoping Adds a "lib" submodule to the buildsrcdependency fixture that deliberately does NOT apply the shared java-common-conventions plugin. Extends the shared-build-logic test assertions to also verify lib's published build-info does NOT contain org.slf4j:slf4j-api, proving the convention plugin's dependency only reaches subprojects that actually apply it, not the whole build. --- gradle_test.go | 50 ++++++++++++------- .../buildsrcdependency/lib/build.gradle | 22 ++++++++ .../src/main/java/com/example/lib/Utils.java | 7 +++ .../gradle/buildsrcdependency/settings.gradle | 1 + 4 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 testdata/gradle/buildsrcdependency/lib/build.gradle create mode 100644 testdata/gradle/buildsrcdependency/lib/src/main/java/com/example/lib/Utils.java diff --git a/gradle_test.go b/gradle_test.go index e7b79fecf..cd44e4bd1 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -607,9 +607,13 @@ func TestGradleBuildSharedBuildLogicFlexPack(t *testing.T) { cleanGradleTest(t) } -// assertSharedConventionDependencyInBuildInfo asserts the published build-info has an -// "api" module whose dependencies include org.slf4j:slf4j-api — a dependency declared -// only in the shared buildSrc convention plugin, never in api's own build.gradle. +// assertSharedConventionDependencyInBuildInfo asserts the published build-info has: +// - an "api" module (applies the shared java-common-conventions plugin) whose +// dependencies include org.slf4j:slf4j-api — a dependency declared only in the +// shared buildSrc convention plugin, never in api's own build.gradle. +// - a "lib" module (does NOT apply the shared convention plugin) whose dependencies +// do NOT include org.slf4j:slf4j-api, proving the shared dependency only reaches +// subprojects that actually apply the convention plugin. func assertSharedConventionDependencyInBuildInfo(t *testing.T, buildName, buildNumber string) { publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, buildName, buildNumber) if err != nil { @@ -621,24 +625,36 @@ func assertSharedConventionDependencyInBuildInfo(t *testing.T, buildName, buildN return } buildInfo := publishedBuildInfo.BuildInfo - var apiModule *buildinfo.Module - for i := range buildInfo.Modules { - if strings.Contains(buildInfo.Modules[i].Id, "api") { - apiModule = &buildInfo.Modules[i] - break - } + + apiModule := findModuleByIdSubstring(buildInfo.Modules, "com.example:api") + if assert.NotNil(t, apiModule, "api module missing from build-info") { + assert.True(t, moduleHasDependency(apiModule, "org.slf4j:slf4j-api"), + "shared dependency (org.slf4j:slf4j-api, declared only in the shared convention plugin) missing from api module's dependencies") } - if !assert.NotNil(t, apiModule, "api module missing from build-info") { - return + + libModule := findModuleByIdSubstring(buildInfo.Modules, "com.example:lib") + if assert.NotNil(t, libModule, "lib module missing from build-info") { + assert.False(t, moduleHasDependency(libModule, "org.slf4j:slf4j-api"), + "lib does not apply the shared convention plugin, so org.slf4j:slf4j-api must not appear in its dependencies") + } +} + +func findModuleByIdSubstring(modules []buildinfo.Module, idSubstring string) *buildinfo.Module { + for i := range modules { + if strings.Contains(modules[i].Id, idSubstring) { + return &modules[i] + } } - hasSharedDep := false - for _, dep := range apiModule.Dependencies { - if strings.HasPrefix(dep.Id, "org.slf4j:slf4j-api") { - hasSharedDep = true - break + return nil +} + +func moduleHasDependency(module *buildinfo.Module, depIdPrefix string) bool { + for _, dep := range module.Dependencies { + if strings.HasPrefix(dep.Id, depIdPrefix) { + return true } } - assert.True(t, hasSharedDep, "shared dependency (org.slf4j:slf4j-api, declared only in the shared convention plugin) missing from api module's dependencies") + return false } func createGradleProject(t *testing.T, projectName string) string { diff --git a/testdata/gradle/buildsrcdependency/lib/build.gradle b/testdata/gradle/buildsrcdependency/lib/build.gradle new file mode 100644 index 000000000..8b8e92bbb --- /dev/null +++ b/testdata/gradle/buildsrcdependency/lib/build.gradle @@ -0,0 +1,22 @@ +// Intentionally does NOT apply the shared java-common-conventions plugin from +// buildSrc, so it must not receive org.slf4j:slf4j-api (or anything else the +// convention plugin declares). +plugins { + id 'java-library' + id 'maven-publish' +} + +repositories { + mavenCentral() +} + +group = 'com.example' +version = '1.0.0' + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} diff --git a/testdata/gradle/buildsrcdependency/lib/src/main/java/com/example/lib/Utils.java b/testdata/gradle/buildsrcdependency/lib/src/main/java/com/example/lib/Utils.java new file mode 100644 index 000000000..aef512b41 --- /dev/null +++ b/testdata/gradle/buildsrcdependency/lib/src/main/java/com/example/lib/Utils.java @@ -0,0 +1,7 @@ +package com.example.lib; + +public class Utils { + public static String greet() { + return "hello from lib"; + } +} diff --git a/testdata/gradle/buildsrcdependency/settings.gradle b/testdata/gradle/buildsrcdependency/settings.gradle index e0afb4dd8..b00039095 100644 --- a/testdata/gradle/buildsrcdependency/settings.gradle +++ b/testdata/gradle/buildsrcdependency/settings.gradle @@ -1,2 +1,3 @@ rootProject.name = 'buildsrcdependency' include 'api' +include 'lib' From df8f2ee0f158c108e5619edbb43164618adf9192 Mon Sep 17 00:00:00 2001 From: Uday Date: Fri, 25 Sep 2026 15:31:50 +0530 Subject: [PATCH 3/3] RTECO-132 - Add build-logic variant of shared build logic e2e tests Adds TestGradleBuildSharedBuildLogicBuildLogicClassic and TestGradleBuildSharedBuildLogicBuildLogicFlexPack, mirroring the existing buildSrc-based tests but with the shared convention plugin living in an included build-logic build instead. Covers the same positive (api gets org.slf4j:slf4j-api) and negative (lib, which does not apply the convention plugin, does not) assertions, for both Classic and FlexPack modes. New fixture: testdata/gradle/buildlogicdependency (root + build-logic + api + lib), mirroring buildsrcdependency's structure. --- gradle_test.go | 47 +++++++++++++++++++ .../buildlogicdependency/api/build.gradle | 15 ++++++ .../main/java/com/example/api/PersonList.java | 12 +++++ .../build-logic/build.gradle | 7 +++ .../build-logic/settings.gradle | 1 + .../groovy/java-common-conventions.gradle | 11 +++++ .../gradle/buildlogicdependency/build.gradle | 3 ++ .../buildlogicdependency/lib/build.gradle | 22 +++++++++ .../src/main/java/com/example/lib/Utils.java | 7 +++ .../buildlogicdependency/settings.gradle | 7 +++ 10 files changed, 132 insertions(+) create mode 100644 testdata/gradle/buildlogicdependency/api/build.gradle create mode 100644 testdata/gradle/buildlogicdependency/api/src/main/java/com/example/api/PersonList.java create mode 100644 testdata/gradle/buildlogicdependency/build-logic/build.gradle create mode 100644 testdata/gradle/buildlogicdependency/build-logic/settings.gradle create mode 100644 testdata/gradle/buildlogicdependency/build-logic/src/main/groovy/java-common-conventions.gradle create mode 100644 testdata/gradle/buildlogicdependency/build.gradle create mode 100644 testdata/gradle/buildlogicdependency/lib/build.gradle create mode 100644 testdata/gradle/buildlogicdependency/lib/src/main/java/com/example/lib/Utils.java create mode 100644 testdata/gradle/buildlogicdependency/settings.gradle diff --git a/gradle_test.go b/gradle_test.go index cd44e4bd1..346e14039 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -607,6 +607,53 @@ func TestGradleBuildSharedBuildLogicFlexPack(t *testing.T) { cleanGradleTest(t) } +// TestGradleBuildSharedBuildLogicBuildLogicClassic is the same check as +// TestGradleBuildSharedBuildLogicClassic, but the shared convention plugin lives in an +// included build-logic build instead of buildSrc. +func TestGradleBuildSharedBuildLogicBuildLogicClassic(t *testing.T) { + initGradleTest(t) + buildGradlePath := createGradleProject(t, "buildlogicdependency") + configFilePath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "buildspecs", tests.GradleConfig) + destPath := filepath.Join(filepath.Dir(buildGradlePath), ".jfrog", "projects") + createConfigFile(destPath, configFilePath, t) + oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath)) + defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir) + + buildName := tests.GradleBuildName + "-shared-build-logic-buildlogic-classic" + buildNumber := "1" + + runJfrogCli(t, "gradle", "clean", "artifactoryPublish", "--build-name="+buildName, "--build-number="+buildNumber) + assert.NoError(t, artifactoryCli.Exec("bp", buildName, buildNumber)) + + assertSharedConventionDependencyInBuildInfo(t, buildName, buildNumber) + cleanGradleTest(t) +} + +// TestGradleBuildSharedBuildLogicBuildLogicFlexPack is the same check as +// TestGradleBuildSharedBuildLogicFlexPack, but the shared convention plugin lives in an +// included build-logic build instead of buildSrc. +func TestGradleBuildSharedBuildLogicBuildLogicFlexPack(t *testing.T) { + initGradleTest(t) + buildGradlePath := createGradleProject(t, "buildlogicdependency") + oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath)) + defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir) + + buildName := tests.GradleBuildName + "-shared-build-logic-buildlogic-flexpack" + buildNumber := "1" + setEnvCallBack := clientTestUtils.SetEnvWithCallbackAndAssert(t, "JFROG_RUN_NATIVE", "true") + defer setEnvCallBack() + + // See TestGradleBuildSharedBuildLogicFlexPack for why this is needed. + assert.NoError(t, os.RemoveAll(".jfrog")) + + err := runJfrogCliWithoutAssertion("gradle", "clean", "build", "--build-name="+buildName, "--build-number="+buildNumber) + assert.NoError(t, err) + assert.NoError(t, artifactoryCli.Exec("bp", buildName, buildNumber)) + + assertSharedConventionDependencyInBuildInfo(t, buildName, buildNumber) + cleanGradleTest(t) +} + // assertSharedConventionDependencyInBuildInfo asserts the published build-info has: // - an "api" module (applies the shared java-common-conventions plugin) whose // dependencies include org.slf4j:slf4j-api — a dependency declared only in the diff --git a/testdata/gradle/buildlogicdependency/api/build.gradle b/testdata/gradle/buildlogicdependency/api/build.gradle new file mode 100644 index 000000000..a82909111 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/api/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'java-common-conventions' + id 'maven-publish' +} + +group = 'com.example' +version = '1.0.0' + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} diff --git a/testdata/gradle/buildlogicdependency/api/src/main/java/com/example/api/PersonList.java b/testdata/gradle/buildlogicdependency/api/src/main/java/com/example/api/PersonList.java new file mode 100644 index 000000000..a0642892f --- /dev/null +++ b/testdata/gradle/buildlogicdependency/api/src/main/java/com/example/api/PersonList.java @@ -0,0 +1,12 @@ +package com.example.api; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PersonList { + private static final Logger logger = LoggerFactory.getLogger(PersonList.class); + + public void log() { + logger.info("PersonList using slf4j-api pulled in only via the shared convention plugin"); + } +} diff --git a/testdata/gradle/buildlogicdependency/build-logic/build.gradle b/testdata/gradle/buildlogicdependency/build-logic/build.gradle new file mode 100644 index 000000000..15bac7130 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/build-logic/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + mavenCentral() +} diff --git a/testdata/gradle/buildlogicdependency/build-logic/settings.gradle b/testdata/gradle/buildlogicdependency/build-logic/settings.gradle new file mode 100644 index 000000000..6ef2ba876 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/build-logic/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'build-logic' diff --git a/testdata/gradle/buildlogicdependency/build-logic/src/main/groovy/java-common-conventions.gradle b/testdata/gradle/buildlogicdependency/build-logic/src/main/groovy/java-common-conventions.gradle new file mode 100644 index 000000000..016340a68 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/build-logic/src/main/groovy/java-common-conventions.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.slf4j:slf4j-api:2.0.9' +} diff --git a/testdata/gradle/buildlogicdependency/build.gradle b/testdata/gradle/buildlogicdependency/build.gradle new file mode 100644 index 000000000..281335e1c --- /dev/null +++ b/testdata/gradle/buildlogicdependency/build.gradle @@ -0,0 +1,3 @@ +// Root build file intentionally left plain. Neither Classic mode (plugin +// auto-injected via init script) nor FlexPack mode requires any plugin +// application here. diff --git a/testdata/gradle/buildlogicdependency/lib/build.gradle b/testdata/gradle/buildlogicdependency/lib/build.gradle new file mode 100644 index 000000000..1ce7cd888 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/lib/build.gradle @@ -0,0 +1,22 @@ +// Intentionally does NOT apply the shared java-common-conventions plugin from +// build-logic, so it must not receive org.slf4j:slf4j-api (or anything else the +// convention plugin declares). +plugins { + id 'java-library' + id 'maven-publish' +} + +repositories { + mavenCentral() +} + +group = 'com.example' +version = '1.0.0' + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} diff --git a/testdata/gradle/buildlogicdependency/lib/src/main/java/com/example/lib/Utils.java b/testdata/gradle/buildlogicdependency/lib/src/main/java/com/example/lib/Utils.java new file mode 100644 index 000000000..aef512b41 --- /dev/null +++ b/testdata/gradle/buildlogicdependency/lib/src/main/java/com/example/lib/Utils.java @@ -0,0 +1,7 @@ +package com.example.lib; + +public class Utils { + public static String greet() { + return "hello from lib"; + } +} diff --git a/testdata/gradle/buildlogicdependency/settings.gradle b/testdata/gradle/buildlogicdependency/settings.gradle new file mode 100644 index 000000000..cc6ffd7bd --- /dev/null +++ b/testdata/gradle/buildlogicdependency/settings.gradle @@ -0,0 +1,7 @@ +pluginManagement { + includeBuild 'build-logic' +} + +rootProject.name = 'buildlogicdependency' +include 'api' +include 'lib'