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

Regen-api to update package name and Patch Container for Androidx Migration #192

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
path: electrode-native
- working-directory: electrode-native/
run: node setup-dev.js
- run: ern platform use 0.49.2
- run: ern platform use 1000.0.0
- run: yarn --frozen-lockfile
- working-directory: android/
run: ./gradlew createAndPublishErnDevContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import com.ern.api.impl.navigation.MiniAppNavigationFragment;
import com.ern.api.impl.navigation.NavigationLaunchConfig;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.NavigationBar;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeResponseListener;
import com.walmartlabs.electrode.reactnative.bridge.FailureMessage;
import com.walmartlabs.electrode.reactnative.bridge.None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import androidx.test.filters.LargeTest;

import com.ern.api.impl.navigation.MiniAppNavigationFragment;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.NavigationBar;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeResponseListener;
import com.walmartlabs.electrode.reactnative.bridge.FailureMessage;
import com.walmartlabs.electrode.reactnative.bridge.None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import com.ern.api.impl.navigation.MiniAppNavigationFragment;
import com.ern.api.impl.navigation.NavEventType;
import com.ern.api.impl.navigation.NavigationLaunchConfig;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigationApi.ern.model.NavEventData;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigationApi.ern.model.NavigationBarLeftButton;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.NavEventData;
import com.ernnavigation.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBarLeftButton;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeEventListener;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeResponseListener;
import com.walmartlabs.electrode.reactnative.bridge.FailureMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
import com.ern.api.impl.navigation.MenuItemProperties;
import com.ern.api.impl.navigation.MiniAppNavigationFragment;
import com.ern.api.impl.navigation.NavEventType;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigationApi.ern.model.NavEventData;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigationApi.ern.model.NavigationBarLeftButton;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.NavEventData;
import com.ernnavigation.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBarLeftButton;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeEventListener;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeResponseListener;
import com.walmartlabs.electrode.reactnative.bridge.FailureMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import androidx.lifecycle.OnLifecycleEvent;

import com.ern.api.impl.navigation.NavUtils;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.facebook.react.ReactRootView;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.facebook.react.ReactRootView;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import com.ern.api.impl.core.ElectrodeBaseFragmentDelegate;
import com.ern.api.impl.core.ElectrodeFragmentConfig;
import com.ern.api.impl.core.LaunchConfig;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.NavEventData;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigationApi.ern.model.NavigationBarLeftButton;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.NavEventData;
import com.ernnavigation.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBarLeftButton;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

import org.json.JSONObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

import com.ern.api.impl.core.ElectrodeReactFragmentActivityDelegate.StartMiniAppConfig;
import com.ern.api.impl.core.ElectrodeReactFragmentDelegate;
import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBarButton;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import androidx.fragment.app.FragmentActivity;

import com.ern.api.impl.core.ElectrodeReactFragmentActivityDelegate;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBar;

/**
* @deprecated This delegate is no longer in use. Change to use {@link com.ern.api.impl.core.ElectrodeBaseActivityDelegate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBarButton;

/**
* Interface that helps native to override the menuItem properties.
Expand All @@ -40,7 +40,7 @@ public interface MenuItemDataProvider {

/**
* Use when the left up indicator needs an override from native.
* When react native sends a {@link com.ernnavigationApi.ern.model.NavigationBar} with a {@link com.ernnavigationApi.ern.model.NavigationBarLeftButton} native has an opportunity to provide the id and drawable resource from native side.
* When react native sends a {@link com.ernnavigation.ern.model.NavigationBar} with a {@link com.ernnavigation.ern.model.NavigationBarLeftButton} native has an opportunity to provide the id and drawable resource from native side.
*
* @param iconName {@link String} name if the iconName provided by React Native component.
* @return int return {@link #NONE} when you don't need an override.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import androidx.annotation.Nullable;
import androidx.core.view.MenuItemCompat;

import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBarButton;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import androidx.annotation.Nullable;

import com.ern.api.impl.core.ElectrodeReactFragmentDelegate;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBar;

import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.ernnavigation.ern.model.NavigationBar;
import com.walmartlabs.electrode.reactnative.bridge.helpers.Logger;

import org.json.JSONException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import androidx.annotation.NonNull;

import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBarButton;

/**
* Click listener that a fragment can implement if it want to handle a action bar menu item click inside a fragment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.ernnavigationApi.ern.api.EnNavigationApi;
import com.ernnavigationApi.ern.model.ErnNavRoute;
import com.ernnavigation.ern.api.EnNavigationApi;
import com.ernnavigation.ern.model.ErnNavRoute;
import com.walmartlabs.electrode.reactnative.bridge.BridgeFailureMessage;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeRequestHandler;
import com.walmartlabs.electrode.reactnative.bridge.ElectrodeBridgeResponseListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.os.Bundle;

import com.ernnavigationApi.ern.model.NavigationBar;
import com.ernnavigation.ern.model.NavigationBar;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down
62 changes: 61 additions & 1 deletion android/moviesreloaded/ern.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,74 @@ task copyApiImplSrc(type: Copy) {
into "$CONTAINER_PATH/lib/src/main/java/com/ern/api/impl"
}

// Patch container sources for in-progress androidx migration (Jan 2022) - Remove later

task patchApiSrc(type: Copy) {
from "$CONTAINER_PATH/lib/src/main/java/com/ernnavigationApi/ern"
into "$buildDir/tmp/patched-api"
filter { line -> line.replaceAll('android\\.support', 'androidx') }
filter { line -> line.replaceAll('ernnavigationApi', 'ernnavigation') }
}
task deleteApiSrc(type: Delete) {
delete "$CONTAINER_PATH/lib/src/main/java/com/ernnavigationApi"
}
task replaceApiSrc(type: Copy) {
from "$buildDir/tmp/patched-api"
into "$CONTAINER_PATH/lib/src/main/java/com/ernnavigation/ern"
}

task patchBridgeSrc(type: Copy) {
from "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge"
into "$buildDir/tmp/patched-bridge"
filter { line -> line.replaceAll('android\\.support', 'androidx') }
}
task deleteBridgeSrc(type: Delete) {
delete "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge"
}
task replaceBridgeSrc(type: Copy) {
from "$buildDir/tmp/patched-bridge"
into "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge"
}

task patchPluginsSrc(type: Copy) {
from "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins"
into "$buildDir/tmp/patched-plugins"
filter { line -> line.replaceAll('android\\.support', 'androidx') }
}
task deletePluginsSrc(type: Delete) {
delete "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins"
}
task replacePluginsSrc(type: Copy) {
from "$buildDir/tmp/patched-plugins"
into "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins"
}

task patchContainer {
dependsOn deleteApiImplSrc
dependsOn copyApiImplSrc
dependsOn patchApiSrc
dependsOn deleteApiSrc
dependsOn replaceApiSrc
dependsOn patchBridgeSrc
dependsOn deleteBridgeSrc
dependsOn replaceBridgeSrc
dependsOn patchPluginsSrc
dependsOn deletePluginsSrc
dependsOn replacePluginsSrc
tasks.findByName('copyApiImplSrc').mustRunAfter 'deleteApiImplSrc'
tasks.findByName('patchApiSrc').mustRunAfter 'copyApiImplSrc'
tasks.findByName('deleteApiSrc').mustRunAfter 'patchApiSrc'
tasks.findByName('replaceApiSrc').mustRunAfter 'deleteApiSrc'
tasks.findByName('patchBridgeSrc').mustRunAfter 'replaceApiSrc'
tasks.findByName('deleteBridgeSrc').mustRunAfter 'patchBridgeSrc'
tasks.findByName('replaceBridgeSrc').mustRunAfter 'deleteBridgeSrc'
tasks.findByName('patchPluginsSrc').mustRunAfter 'replaceBridgeSrc'
tasks.findByName('deletePluginsSrc').mustRunAfter 'patchPluginsSrc'
tasks.findByName('replacePluginsSrc').mustRunAfter 'deletePluginsSrc'
}

task publishErnContainer(type: Exec) {
commandLine "ern", "publish-container", "-p", "ern-container-publisher-maven@1.0.5", "-u", "file://$HOMEDIR/.m2/repository", "--platform", "android", "-e", '{"artifactId":"container-movies-reloaded","groupId":"com.walmartlabs.ern"}'
commandLine "ern", "publish-container", "-p", "maven", "-u", "file://$HOMEDIR/.m2/repository", "--platform", "android", "-e", '{"artifactId":"container-movies-reloaded","groupId":"com.walmartlabs.ern"}'
}

task createAndPublishErnDevContainer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.ern.api.impl.navigation.MenuItemProperties;
import com.ern.api.impl.navigation.MiniAppNavigationFragment;
import com.ern.api.impl.navigation.OnNavBarItemClickListener;
import com.ernnavigationApi.ern.model.NavigationBarButton;
import com.ernnavigation.ern.model.NavigationBarButton;
import com.walmartlabs.moviesreloaded.R;

public class MenuItemDemoFragment extends MiniAppNavigationFragment implements OnNavBarItemClickListener {
Expand Down