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

Fix webos release run #1402

Merged
3 commits merged into from
Feb 26, 2024
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
14 changes: 11 additions & 3 deletions packages/sdk-webos/src/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
logError,
logSuccess,
logWarning,
getConfigProp,
} from '@rnv/core';
import { WebosDevice } from './types';
import {
Expand Down Expand Up @@ -231,18 +232,25 @@ export const runWebosSimOrDevice = async (c: RnvContext) => {
}

const tDir = getPlatformProjectDir(c);

if (!tDir) {
return Promise.reject(`Cannot determine getPlatformProjectDir value`);
}
const bundleAssets = getConfigProp(c, c.platform, 'bundleAssets');
const appLocation = bundleAssets ? path.join(tDir, 'build') : tDir;

if (!appLocation) {
return Promise.reject(`Cannot determine appLocation value`);
}
const tOut = path.join(platDir, 'output');
const configFilePath = path.join(tDir, 'appinfo.json');
const configFilePath = path.join(appLocation, 'appinfo.json');

const cnfg = JSON.parse(fsReadFileSync(configFilePath).toString());
const tId = cnfg.id;
const appPath = path.join(tOut, `${tId}_${cnfg.version}_all.ipk`);

// Start the fun
await execCLI(c, CLI_WEBOS_ARES_PACKAGE, `-o ${tOut} ${tDir} -n`);
await execCLI(c, CLI_WEBOS_ARES_PACKAGE, `-o ${tOut} ${appLocation} -n`);

// List all devices
const devicesResponse = await execCLI(c, CLI_WEBOS_ARES_DEVICE_INFO, '-D');
Expand Down Expand Up @@ -308,7 +316,7 @@ export const runWebosSimOrDevice = async (c: RnvContext) => {
return installAndLaunchApp(c, response.chosenDevice, appPath, tId);
}
} else {
return launchAppOnSimulator(c, platDir);
return launchAppOnSimulator(c, appLocation);
}
} else {
// Target specified, using that
Expand Down
21 changes: 18 additions & 3 deletions packages/sdk-webos/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import semver from 'semver';
import { runWebosSimOrDevice } from './deviceManager';
import { CLI_WEBOS_ARES_PACKAGE } from './constants';
import { waitForHost } from '@rnv/sdk-utils';
import { fsExistsSync } from '@rnv/core';

export const runWebOS = async (c: RnvContext) => {
const { hosted } = c.program;
Expand All @@ -45,11 +46,10 @@ export const runWebOS = async (c: RnvContext) => {
const resetCompleted = await confirmActiveBundler(c);
c.runtime.skipActiveServerCheck = !resetCompleted;
}
logTask('runWebOS', `target:${target} hosted:${!!isHosted}`);
return;
}

logTask('runWebOS', `target:${target} hosted:${!!isHosted}`);
if (isHosted) return;

const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true;

const env = getConfigProp(c, platform, 'environment');
Expand All @@ -61,6 +61,21 @@ export const runWebOS = async (c: RnvContext) => {

if (bundleAssets) {
await buildCoreWebpackProject(c);

const appPath = getPlatformBuildDir(c);

if (!appPath) {
throw new Error('Failed to resolve appPath');
}
// Copying required files to build folder, webpack doesn't have them in the build folder
const requiredFiles = ['appinfo.json', 'splashBackground.png', 'largeIcon.png', 'icon.png'];

requiredFiles.map((requiredFile) => {
const requiredFilePath = path.join(appPath, requiredFile);
if (fsExistsSync(requiredFilePath)) {
copyFileSync(requiredFilePath, path.join(appPath, 'build', requiredFile));
}
});
await runWebosSimOrDevice(c);
} else {
const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
Expand Down
Loading