-
-
Notifications
You must be signed in to change notification settings - Fork 197
Reimplement livesync #2883
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
Reimplement livesync #2883
Conversation
Current implementation restart the app on each css and xml change, we need to fix it. |
run ci |
lib/commands/debug.ts
Outdated
debugData.pathToAppPackage = this.$platformService.lastOutputPath(this.debugService.platform, buildConfig, projectData); | ||
|
||
this.printDebugInformation(await this.debugService.debug<string[]>(debugData, debugOptions)); | ||
// TODO: Fix this call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already fixed
lib/commands/debug.ts
Outdated
@@ -114,29 +132,37 @@ export class DebugIOSCommand extends DebugPlatformCommand { | |||
super.printDebugInformation(information); | |||
} | |||
} | |||
|
|||
public platform = "iOS"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a constant here
lib/commands/debug.ts
Outdated
return await super.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$projectData, this.$platformsData.availablePlatforms.Android); | ||
} | ||
|
||
public platform = "Android"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a constant here
lib/definitions/livesync.d.ts
Outdated
useLiveEdit?: boolean; | ||
} | ||
|
||
interface ILatestAppPackageInstalledSettings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface should be IDictionary<IDictionary<boolean>>
@@ -75,7 +75,7 @@ export class SocketProxyFactory extends EventEmitter implements ISocketProxyFact | |||
|
|||
public async createWebSocketProxy(factory: () => Promise<net.Socket>): Promise<ws.Server> { | |||
// NOTE: We will try to provide command line options to select ports, at least on the localhost. | |||
const localPort = await this.$net.getAvailablePortInRange(8080); | |||
const localPort = await this.$net.getFreePort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it didn't work with multiple iOS devices. For some reason the second device's socket connection could not be established due to an EADDRINUSE
error.
It did work for Android however but I decided it was not worth the research at the time - we don't actually lose anything with this change other than the fact that every debug session will be on a random port rather than the first being on 8080, the second on 8081 and so on.
} | ||
|
||
private async startWatcher(projectData: IProjectData, | ||
liveSyncData: ILiveSyncInfo): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be moved on the line above
|
||
if (liveSyncInfo.filesToRemove.length) { | ||
const filePaths = liveSyncInfo.filesToRemove; | ||
let platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
} | ||
|
||
if (existingFiles.length) { | ||
let platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
|
||
const mappedFiles = _.map(filePaths, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData)); | ||
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME); | ||
let localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, mappedFiles, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
lib/services/platform-service.ts
Outdated
@@ -545,8 +554,9 @@ export class PlatformService extends EventEmitter implements IPlatformService { | |||
} | |||
|
|||
private async getDeviceBuildInfoFilePath(device: Mobile.IDevice, projectData: IProjectData): Promise<string> { | |||
let deviceAppData = this.$deviceAppDataFactory.create(projectData.projectId, device.deviceInfo.platform, device); | |||
let deviceRootPath = path.dirname(await deviceAppData.getDeviceProjectRootPath()); | |||
// let deviceAppData = this.$deviceAppDataFactory.create(projectData.projectId, device.deviceInfo.platform, device); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code 😃
👍 After green builds. |
Expose * saveBuildInfoFile - method which should be used in cloud builds * livesyncService - which can be used to perform livesync with require-d tns
In case the app is not installed on a device when `tns run <platform>` is started, each change reinstalls the application. The problem is in the "isApplicationInstalled" check which was relying on the result of the first execution (when the app has not been installed). Fix this by always checking if the app is installed.
74a5f07
to
c6127ea
Compare
9ba0f87
to
083f3f6
Compare
We need to explicitly skip this step on Windows due to lack of tooling that is properly licensed.
083f3f6
to
f32f243
Compare
require()
-dtns run
command that will be executed on all available devices (iOS and Android on macOS, Android on all other OSes).Merge after telerik/mobile-cli-lib#974
Ping @rosen-vladimirov @TsvetanMilanov