-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[ML] Include 3rd party C++ component notices #30132
[ML] Include 3rd party C++ component notices #30132
Conversation
The overall NOTICE file for the ML X-Pack module should include the notices from the 3rd party C++ components as well as the 3rd party Java components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a suggestion. Also this build fails for me with:
> Task :distribution:archives:tar:checkMlCppNotice FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jason/src/elastic/elasticsearch/distribution/archives/build.gradle' line: 233
* What went wrong:
Execution failed for task ':distribution:archives:tar:checkMlCppNotice'.
> expected [/home/jason/src/elastic/elasticsearch/distribution/archives/tar/build/tar-extracted/elasticsearch-7.0.0-alpha1-SNAPSHOT/modules/x-pack/x-pack-ml/NOTICE.txt] to contain [Apache log4cxx] but it did not
distribution/archives/build.gradle
Outdated
@@ -219,6 +219,24 @@ subprojects { | |||
} | |||
check.dependsOn checkNotice | |||
|
|||
task checkMlCppNotice { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid adding this task to the task graph if the project is not tar
nor zip
? That way we do not have no-op tasks for oss-tar
and oss-zip
. Something like:
diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle
index 5cfbaf95f09..278d79712ae 100644
--- a/distribution/archives/build.gradle
+++ b/distribution/archives/build.gradle
@@ -219,24 +219,25 @@ subprojects {
}
check.dependsOn checkNotice
- task checkMlCppNotice {
- dependsOn buildDist, checkExtraction
- onlyIf toolExists
- doLast {
- if (project.name == 'zip' || project.name == 'tar') {
- // this is just a small sample from the C++ notices, the idea being that if we've added these lines we've probably added all the required lines
- final List<String> expectedLines = Arrays.asList("Apache log4cxx", "Boost Software License - Version 1.0 - August 17th, 2003")
- final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/modules/x-pack/x-pack-ml/NOTICE.txt")
- final List<String> actualLines = Files.readAllLines(noticePath)
- for (final String expectedLine : expectedLines) {
- if (actualLines.contains(expectedLine) == false) {
- throw new GradleException("expected [${noticePath}] to contain [${expectedLine}] but it did not")
+ if (project.name == 'tar' || project.name == 'zip') {
+ task checkMlCppNotice {
+ dependsOn buildDist, checkExtraction
+ onlyIf toolExists
+ doLast {
+ // this is just a small sample from the C++ notices, the idea being that if we've added these lines we've probably added all the required lines
+ final List<String> expectedLines = Arrays.asList("Apache log4cxx", "Boost Software License - Version 1.0 - August 17th, 2003")
+ final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/modules/x-pack/x-pack-ml/NOTICE.txt")
+ final List<String> actualLines = Files.readAllLines(noticePath)
+ for (final String expectedLine : expectedLines) {
+ if (actualLines.contains(expectedLine) == false) {
+ throw new GradleException("expected [${noticePath}] to contain [${expectedLine}] but it did not")
+ }
}
- }
}
}
+ check.dependsOn checkMlCppNotice
}
- check.dependsOn checkMlCppNotice
+
}
/*****************************************************************************
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I changed that in the 3rd commit.
Pinging @elastic/es-core-infra |
} | ||
include 'platform/licenses/**' | ||
} | ||
project.afterEvaluate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these need to be in an afterEvaluate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I see why (generateNotice is added as a task in an afterEvaluate), but this is incredibly fragile (depends on the order afterEvaluates are run in). I will work on a change to simplify this using gradle's new Provider stuff.
This is because this line in the ML
I was hoping it would mean that if
This has been a problem since the code was originally introduced into 5.4, but we get away with it in the case where everything is built from clean, so release builds were OK. @rjernst will you have time to switch the notice generation to use Gradle's new Provider stuff in time for the final 6.3.0 build candidate? If so then I'll wait for that before trying to sort out this dependency problem. |
I will try to do this today. |
@jasontedor @rjernst I pushed a2ef1cb to get the overall notice to be regenerated if the ML C++ notices change. Since this is a blocker for 6.3 I thought it was worth putting an interim solution in place even if there will be something better in the long term. Please can you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM; you can merge as-is and we can follow-up later.
run gradle build tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tricky hack, but ok for now. Simplifying the notice tasks to not be created in afterEvaluate has been difficult, sorry I haven't got it working yet. I will fix this more when I come up with a solution there.
Thanks for the reviews @rjernst and @jasontedor. I agree it’s a hack but at least we’ll be including the necessary notice files in 6.3 and hopefully it can be replaced with something more elegant in the future. |
* origin/master: [test] add java packaging test project (elastic#30161) Fix macros in changelog (elastic#30269) [DOCS] Fixes syskeygen command name [ML] Include 3rd party C++ component notices (elastic#30132) _cluster/state Skip Test for pre-6.4, not pre-7.0 (elastic#30264) Improve docs for disk watermarks (elastic#30249) [DOCS] Removes redundant Active Directory realm settings (elastic#30190) [DOCS] Removes redundant LDAP realm settings (elastic#30193) _cluster/state should always return cluster_uuid (elastic#30143) HTML5ify Javadoc for core and test framework (elastic#30234) Minor tweaks to reroute documentation (elastic#30246)
The overall NOTICE file for the ML X-Pack module should include the notices from the 3rd party C++ components as well as the 3rd party Java components.
The overall NOTICE file for the ML X-Pack module should include the notices from the 3rd party C++ components as well as the 3rd party Java components.
The overall NOTICE file for the ML X-Pack module should
include the notices from the 3rd party C++ components as
well as the 3rd party Java components.