-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Generate a test dependencies file to support unit tests in entitlements #127486
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
ee7acf3
add task skeleton
jdconrad 619fd63
generate file for test dependencies
jdconrad 1de3d1d
fix policy file
jdconrad 9841168
update
jdconrad a69872e
convert to json file isntead of properties file
jdconrad 73af578
fix dependency link
jdconrad 40cc22f
start of jar entry lookup
jdconrad 06522bd
Merge remote-tracking branch 'upstream/main' into eut2
jdconrad 65c7d72
generate file with class to module info
jdconrad a9984fe
add module info to build info file
jdconrad 445d3bf
added files to resources
jdconrad 2c1a15f
protect task for plugins with no source
jdconrad 73e6379
separate into separate plugin
jdconrad 036fed8
add output for server
jdconrad fdf526e
remove todo
jdconrad 7d7f8cd
Merge branch 'main' into eut2
jdconrad 5f4c870
clean up
jdconrad 729559b
add module info for directory
jdconrad 9867a39
add module inference when plugin is not modular
jdconrad c4764b9
Merge branch 'main' into eut2
jdconrad ff80fda
Merge branch 'main' into eut2
jdconrad f6585fc
[CI] Auto commit changes from spotless
927f9bf
Merge branch 'main' into eut2
jdconrad 32cadde
Merge branch 'main' into eut2
jdconrad 887e600
add comments
jdconrad 9949f91
Merge remote-tracking branch 'upstream/main' into eut2
prdoyle e57cd37
First pass addressing PR comments
prdoyle 444da3d
WIP non-working TestBuildInfoPluginFuncTest
prdoyle dd56d50
TestBuildInfoPluginFuncTest
prdoyle 854df10
Tweaks
prdoyle 931deb9
TestBuildInfoPluginFuncTest check the file's contents
prdoyle 461af45
Merge branch 'main' into eut2
jdconrad 33ce238
Use Files.walkFileTree
prdoyle 460ea40
some response to pr comments
jdconrad 8833e6e
Merge remote-tracking branch 'origin/eut2' into eut2
jdconrad 1266847
update gradle values to use callable
jdconrad a38969c
Split out extractModuleNameFromJar into smaller steps
prdoyle 0df276a
fix test
jdconrad 69742cf
Merge remote-tracking branch 'origin/eut2' into eut2
jdconrad 1d1c27d
Merge branch 'main' into eut2
jdconrad 75496f4
remove extraneous callable
jdconrad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
63 changes: 63 additions & 0 deletions
63
...ols/src/integTest/groovy/org/elasticsearch/gradle/test/TestBuildInfoPluginFuncTest.groovy
This file contains hidden or 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,63 @@ | ||
| package org.elasticsearch.gradle.test | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper | ||
|
|
||
| import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest | ||
| import org.gradle.testkit.runner.TaskOutcome | ||
|
|
||
| class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest { | ||
| def "works"() { | ||
| given: | ||
| file("src/main/java/com/example/Example.java") << """ | ||
| package com.example; | ||
|
|
||
| public class Example { | ||
| } | ||
| """ | ||
|
|
||
| file("src/main/java/module-info.java") << """ | ||
| module com.example { | ||
| exports com.example; | ||
| } | ||
| """ | ||
|
|
||
| buildFile << """ | ||
| import org.elasticsearch.gradle.plugin.GenerateTestBuildInfoTask; | ||
|
|
||
| plugins { | ||
| id 'java' | ||
| id 'elasticsearch.test-build-info' | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| tasks.withType(GenerateTestBuildInfoTask.class) { | ||
| componentName = 'example-component' | ||
| outputFile = new File('build/generated-build-info/plugin-test-build-info.json') | ||
| } | ||
| """ | ||
|
|
||
| when: | ||
| def result = gradleRunner('generateTestBuildInfo').build() | ||
| def task = result.task(":generateTestBuildInfo") | ||
|
|
||
|
|
||
| then: | ||
| task.outcome == TaskOutcome.SUCCESS | ||
|
|
||
| def output = file("build/generated-build-info/plugin-test-build-info.json") | ||
| output.exists() == true | ||
|
|
||
| def location = Map.of( | ||
| "module", "com.example", | ||
| "representative_class", "com/example/Example.class" | ||
| ) | ||
| def expectedOutput = Map.of( | ||
| "component", "example-component", | ||
| "locations", List.of(location) | ||
| ) | ||
| new ObjectMapper().readValue(output, Map.class) == expectedOutput | ||
| } | ||
| } |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.