apache / incubator-kie-issues

Apache License 2.0
12 stars 1 forks source link

EPIC - Replace copyright headers and comments to compliance with ASF policy #413

Closed eduardocerqueira closed 8 months ago

eduardocerqueira commented 1 year ago

For the full list of repos pls see #428

TASKS

Read the instructions below and find the tasks on this epic.

What is the goal? As part of migration kie repos to Apache, we need to remove Red Hat's copyrights and apply the ASF header [1], replacing the code header for all files, ideally all files should have ASF header, no matter the file extension.

How? For Java maven based project, the best alternative is using license-maven-plugin [3] if the repo doesn't follow a maven base project then it is up to you, let your inspiration to drive it, perhaps creating a script would work.

sharing some tips:

mvn com.mycila:license-maven-plugin:remove
mvn com.mycila:license-maven-plugin:format
mvn checkstyle:check
grep -R --exclude-dir=target -i "Red Hat" *
grep -R --exclude-dir=target -i -E "copyright|Red Hat"

mvn license:format -Dlicense.header=licensesheader.txt
mvn -Dtest=ServerlessWorkflowCodestartTest test -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dsnap

Things to check before submitting your PR

  1. Before changing anyting, ensure you can build and run all tests in your local environment and they pass!
  2. After replacing the headers to ASF [1] and removing Red Hat copyrights ensure your project builds and all tests are passing, so your changes didn't introduce a bug.
  3. Verify checkstyle and do a last check seeking for Red Hat in your project root folder.
mvn checkstyle:check
grep -R --exclude-dir=target -i "Red Hat" *
grep -R --exclude-dir=target -i -E "copyright|Red Hat"

[1] https://www.apache.org/legal/src-headers.html#headers [2] https://github.com/orgs/apache/projects/295/views/1?pane=issue&itemId=40502472 [3] https://mycila.carbou.me/license-maven-plugin/reports/4.2/license-maven-plugin/plugin-info.html [4] https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/kogito-build/kogito-build-no-bom-parent/pom.xml#L49 [5] https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/kogito-build/kogito-build-no-bom-parent/pom.xml#L491

porcelli commented 1 year ago

Apache headers reference: https://www.apache.org/legal/src-headers.html

ederign commented 1 year ago

First dry run for ts and js files : https://github.com/kiegroup/kie-tools/pull/1919

ederign commented 1 year ago

Second round. TS/JS/Java/GO done https://github.com/kiegroup/kie-tools/pull/1920

KIE tools is the most complicated one. As soon as we wrap up it, we can easily do others repositories.

@porcelli splitting in small around of files/projects would mean that we would need 10's of PRs. So I've talked with Tiago, and we will do at least on KIE tools as a single shot.

porcelli commented 1 year ago

It's fine to me;

my concern is that a single PR will be very hard to do a proper review, so basically will end up having to trust the script at some extent.

eduardocerqueira commented 1 year ago

Perhaps we need more discussion to find them a better alternative for the code-review. IMO we should rely on CI for validating the changes where I assume it will run checkstyle check, compile and smoke tests

Here is the work I got completed for Kogito-examples repo. I haven't sent a PR yet as I want to get some initial feedback, pls check the commit into my forked/branch:

https://github.com/eduardocerqueira/kogito-examples/commit/4055c97083051d6b6027cc4630e625714f490171

summary: 1544 files changed

steps:

update licensesheader.txt with content from https://www.apache.org/legal/src-headers.html
mvn com.mycila:license-maven-plugin:remove
mvn com.mycila:license-maven-plugin:format -Dlicense.header=licensesheader.txt
tiagobento commented 1 year ago

On the KIE Tools side, I'm fine with a huge PR, as long as the CI is green... looking at the CI logs might be a good way to verify that everything is running as intended and the uploaded artifacts are performing as expected...

If someone really wants to skim through the files, I think downloading Eder's branch and opening a local Git tool to see the changes is a valid alternative... With that said, this is NOT how I think code reviews should be done, but since this is a one-time thing, I don't see many problems with it.

ederign commented 1 year ago

@eduardocerqueira @porcelli, one topic for the call tomorrow: shall I migrate other repos? Or we are going to split somehow? I saw that @eduardocerqueira started some.

eduardocerqueira commented 1 year ago

Hi @ederign

I got the work done -- but just need to send the PR -- for these repos below:

I was planning to start https://github.com/kiegroup/drools for the next week which my plan is to submit all those PRs by begin of the week.

ederign commented 1 year ago

ok, I'll take optaplanner and kie benchmarks (Going from the list from bottom )

ederign commented 1 year ago

FYI: optaplanner doesn't have RHT apache headers: https://github.com/ederign/optaplanner/commit/5868098e8b41dd67d6eb3addc4a60d9777d7ac18

porcelli commented 1 year ago

@ederign but optaplanner is moving - @mdproctor correct me if I'm wrong.

ederign commented 1 year ago

Yes it's moving! I wonder if we should add Apache header for all java files to keep consistency. @mdproctor wdyt?

yesamer commented 8 months ago

All subtasks completed!