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

Migrate build system from Maven to Gradle #1121

Closed
wants to merge 6 commits into from

Conversation

cliu123
Copy link
Member

@cliu123 cliu123 commented Apr 13, 2021

opendistro-for-elasticsearch/security pull request intake form

Please provide as much details as possible to get feedback/acceptance on your PR quickly

  1. Category: (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
    Maintenance

  2. Github Issue # or road-map entry, if available:

  3. Description of changes:

  4. Why these changes are required?
    Security plugin has 2 build systems: Maven and Gradle(building .rpm and .deb packages). It's necessary to combine them into a single one(Gradle).

  5. What is the old behavior before changes and new behavior after changes? (Please add any example/logs/screen-shot if available)

  6. Testing done: (Please provide details of testing done: Unit testing, integration testing and manual testing)

  • Unit Tests
  • Manual Testing:
    • Ran ./gradlew clean build --no-daemon -Dbuild.snapshot=false -x test, artifacts are generated in gradle-build/distributions/
    • The following artifacts are generated:
      • opendistro_security-1.13.1.0.jar
      • opendistro-security-1.13.1.0.zip
      • opendistro-security-1.13.1.0-securityadmin-standalone.zip
      • opendistro-security-1.13.1.0-securityadmin-standalone.tar.gz
    • Installed security plugin generated by Gradle on ES. Securify configurations are loaded into elasticsearch-7.10.2/plugins/opendistro_security/securityconfig
    • Ran install_demo_configuration.sh, security settings are added into elasticsearch.yml file.
    • The plugin folder name in elasticsearch-7.10.2/plugins is opendistro_security
  1. TO-DOs, if any: (Please describe pending items and provide Github issues# for each of them)

  2. Is it backport from main branch? (If yes, please add backport PR # and commits #)

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

@cliu123 cliu123 requested a review from a team April 13, 2021 22:39
@cliu123 cliu123 force-pushed the migrate_build_system branch from 328b85d to e21acbe Compare April 14, 2021 15:48
Copy link
Contributor

@vrozov vrozov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please limit scope of the PR just to migration from maven to gradle build system. Anything not directly related to maven->gradle migration such as UT, java doc, JDK version upgrade should be part of a separate PR(s).

@cliu123 cliu123 force-pushed the migrate_build_system branch from e21acbe to 08a3f69 Compare April 14, 2021 17:15
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If gradle version upgrade is necessary, please move that to a separate PR as well.

build.gradle Outdated
}

dependencies {
compile('org.elasticsearch.plugin:transport-netty4-client:7.10.2') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compile is deprecated in favor of implementation. Can we use that instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing all compile with implementation fails compileJava task. Some of them indeed can be replaced. I didn't change them for consistency.

build.gradle Outdated
compile('org.apache.httpcomponents:httpclient-cache:4.5.3') {
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
}
compile('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.10.2') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define variable and reuse for same versions. Eg: 7.10.2 is used for a couple of dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

build.gradle Outdated
testImplementation 'org.elasticsearch:elasticsearch-ssl-config:7.10.2'
testImplementation 'org.elasticsearch.plugin:percolator-client:7.10.2'
compile 'org.elasticsearch.plugin:lang-mustache-client:7.10.2'
compile 'org.elasticsearch.plugin:parent-join-client:7.10.2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group all testImplementation, implementation, compileOnly, runtimeOnly dependencies

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By group, do you mean put dependencies with same scope together?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

configurations.all {
if (it.state != Configuration.State.UNRESOLVED) return
resolutionStrategy {
force 'commons-codec:commons-codec:1.14'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all the dependencies need force?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all these need force because otherwise some dependency conflicts come out.

@cliu123
Copy link
Member Author

cliu123 commented Apr 14, 2021

Please limit scope of the PR just to migration from maven to gradle build system. Anything not directly related to maven->gradle migration such as UT, java doc, JDK version upgrade should be part of a separate PR(s).

I've excluded java doc from compilation, I can remove the change in java doc.
But all other changes are necessary. If we move all these changes to separate PRs, we'd have to create quite a few PRs and merge them before this PR.
Would that help if I modify the title of the PR and add some description for those changes in the PR description to clarify the scope of the PR?

@vrozov
Copy link
Contributor

vrozov commented Apr 14, 2021

Change PR and commit title to something like "migrate build system from maven to gradle"

@vrozov
Copy link
Contributor

vrozov commented Apr 14, 2021

Changing PR title is necessary to avoid confusion regarding the goal of the PR, but it will not help with other issues. If version of gradle needs to be upgraded, it should be a separate PR and commit as in one large PR it is impossible to distinguish changes required for gradle upgrade and changes required for migrating from maven to gradle. The same applies to all other unrelated to maven -> gradle changes.

@cliu123 cliu123 force-pushed the migrate_build_system branch from 08a3f69 to ff003b2 Compare April 15, 2021 04:41
@cliu123 cliu123 changed the title Introduce Gradle build system Migrate build system from Maven to Gradle Apr 15, 2021
@cliu123 cliu123 force-pushed the migrate_build_system branch from 3184226 to c9b98cd Compare April 15, 2021 22:22
@cliu123 cliu123 force-pushed the migrate_build_system branch from c9b98cd to 3c360dc Compare April 15, 2021 22:26
@cliu123
Copy link
Member Author

cliu123 commented Jul 13, 2021

Will re-open later if needed.

@cliu123 cliu123 closed this Jul 13, 2021
gaobinlong pushed a commit to gaobinlong/security that referenced this pull request Aug 30, 2023
Signed-off-by: Peter Nied <[email protected]>
Co-authored-by: Darshit Chanpura <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants