Skip to content

Commit

Permalink
Merge pull request #1280 from flexn-io/fix/eject
Browse files Browse the repository at this point in the history
fix eject packaging
  • Loading branch information
mihaiblaga89 authored Dec 8, 2023
2 parents 1bc7abf + 8c42fcd commit 8c8aadd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const TASK_APP_CREATE = 'app create';
export const TASK_WORKSPACE_CONFIGURE = 'workspace configure';
export const TASK_CONFIGURE_SOFT = 'configureSoft';
export const TASK_KILL = 'kill';
export const TASK_EJECT = 'eject';

export const INJECTABLE_CONFIG_PROPS: Array<ConfigPropKey> = [
'id',
Expand Down
8 changes: 7 additions & 1 deletion packages/engine-rn-tvos/src/tasks/task.rnv.package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getConfigProp,
executeOrSkipTask,
shouldSkipTask,
TASK_EJECT,
} from '@rnv/core';
import { packageAndroid } from '@rnv/sdk-android';
import { packageBundleForXcode } from '@rnv/sdk-apple';
Expand All @@ -32,7 +33,12 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => {
switch (platform) {
case ANDROID_TV:
case FIRE_TV:
return packageAndroid(c);
// NOTE: react-native v0.73 triggers packaging automatically so we skipping it unless we need to
// package it explicitly for tasks where it is not triggered automatically
if (originTask === TASK_EJECT) {
return packageAndroid(c);
}
return true;
case TVOS:
return packageBundleForXcode(c);
default:
Expand Down
5 changes: 2 additions & 3 deletions packages/engine-rn/src/tasks/task.rnv.eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
ANDROID_WEAR,
MACOS,
IOS,
TASK_EJECT,
} from '@rnv/core';
import { ejectGradleProject } from '@rnv/sdk-android';
import { ejectXcodeProject } from '@rnv/sdk-apple';

const TASK_EJECT = 'eject';

export const taskRnvEject: RnvTaskFn = async (c, _parentTask, originTask) => {
logTask('taskRnvEject');
const { platform } = c;
Expand Down Expand Up @@ -61,7 +60,7 @@ export const taskRnvEject: RnvTaskFn = async (c, _parentTask, originTask) => {
export default {
description: 'Eject current project app to self contained native project',
fn: taskRnvEject,
task: 'eject',
task: TASK_EJECT,
params: PARAMS.withBase(PARAMS.withConfigure()),
platforms: [IOS, MACOS, ANDROID, ANDROID_TV, FIRE_TV, ANDROID_WEAR],
};
9 changes: 8 additions & 1 deletion packages/engine-rn/src/tasks/task.rnv.package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
MACOS,
IOS,
getConfigProp,
TASK_EJECT,
} from '@rnv/core';
import { packageAndroid } from '@rnv/sdk-android';
import { packageBundleForXcode } from '@rnv/sdk-apple';
Expand All @@ -40,7 +41,13 @@ export const taskRnvPackage: RnvTaskFn = async (c, parentTask, originTask) => {
case ANDROID_TV:
case FIRE_TV:
case ANDROID_WEAR:
return packageAndroid(c);
// NOTE: react-native v0.73 triggers packaging automatically so we skipping it unless we need to
// package it explicitly for tasks where it is not triggered automatically

if (originTask === TASK_EJECT) {
return packageAndroid(c);
}
return true;
default:
logErrorPlatform(c);
return false;
Expand Down
8 changes: 3 additions & 5 deletions packages/sdk-android/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ import {
composeDevicesArray,
} from './deviceManager';
import { CLI_ANDROID_ADB } from './constants';
import { runReactNativeAndroid } from '@rnv/sdk-react-native';
import { runReactNativeAndroid, packageReactNativeAndroid } from '@rnv/sdk-react-native';

export const packageAndroid = async (_c: Context) => {
export const packageAndroid = async (c: Context) => {
logTask('packageAndroid');

// TODO disabled for now, doesn't make sense to pack it if gradle does it again and it triggers errors about duplicate resources
// return packageReactNativeAndroid(c);
return true;
return packageReactNativeAndroid(c);
};

export const getAndroidDeviceToRunOn = async (c: Context) => {
Expand Down

0 comments on commit 8c8aadd

Please sign in to comment.