WordPress-Android icon indicating copy to clipboard operation
WordPress-Android copied to clipboard

Include FluxC `2.99.0` modules with their git history and unit tests

Open wzieba opened this issue 4 months ago • 4 comments

Description

[!TIP] This PR is a result of git filter-repo filtering. To read more about the process, please see internal post: paqN3M-m2-p2. The project discussed there is different, but the same rules apply here.

This PR introduces source code of 3 FluxC modules: fluxc, fluxc-annotations and fluxc-processor in version 2.99.0 into WordPress-Android codebase.

It also includes unit tests that were included in example module, but were technically unit tests of fluxc. To not include example module, I had to alter the git history and modify paths: see the step 1 below.

This PR does not integrate these modules to the build. As you can see below, we only include 3 directories.

image

The attached git-history is extracted from the FluxC repository using git filter-repo. The process contains following phases.

1. Replace unit tests path

Because unit tests in FluxC project were placed in example module, which I didn't want to move, I had to alter the git history and modify paths, effectively moving test directory of example module to fluxc:

git filter-repo \
--path-rename example/src/test:fluxc/src/test \
--force  #needed when filtering after tag checkout 

2. Leave only FluxC modules

In this step, we strip all not needed directories and files, leaving only FluxC ones:

git filter-repo \
--path fluxc-annotations \
--path fluxc-processor \
--path fluxc \
--force  #needed when filtering after tag checkout 

3. Remove Woo-specific unit tests

In unit tests of example module we had a set of Woo-specific unit tests, that required plugin:woocommerce module to run and are not needed in scope of WordPress-Android project. I identified them and removed with:

git filter-repo --path fluxc/src/test/java/org/wordpress/android/fluxc/endpoints/WCWPAPIEndpointTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/model/customer/WCCustomerMapperTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/jitm/JitmRestClientTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/persistence/CustomerSqlUtilsTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/persistence/mappers/WooPaymentsDepositsOverviewMapperTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/store/CouponStoreTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/store/WCCustomerStoreTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/store/WCInboxStoreTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/store/WCWooPaymentsStoreTest.kt \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/wc/ \
    --path fluxc/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/wc/ \
    --invert-paths \ # important line: inverts the logic
    --force  #needed when filtering after tag checkout 

Review

There's not much to review in this specific PR. The final result will be possible to review in the integration PR.

You can verify that the last commit in this PR is the same as the commit from 2.99.0 release of FluxC (link). The same in a sense of content/message - hashes will be different as we rewrote history.

wzieba avatar Oct 16 '24 11:10 wzieba