Skip to content

Commit

Permalink
eclipse-theiaGH-147: Enabled Windows CI.
Browse files Browse the repository at this point in the history
Closes eclipse-theia#147.

Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
kittaakos committed Aug 7, 2017
1 parent 048b540 commit e8beacc
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 26 deletions.
24 changes: 24 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
shallow_clone: true

branches:
only:
- master

platform:
- x64

install:
- cinst yarn
- ps: npm install --global --production windows-build-tools
# Open the firewall ports for selenium.
- netsh advfirewall firewall add rule name="SeleniumIn" dir=in action=allow protocol=TCP localport=4444
- netsh advfirewall firewall add rule name="SeleniumOut" dir=out action=allow protocol=TCP localport=4444

before_build:
- node --version && npm --version && yarn --version && python --version

build_script:
- yarn

test_script:
- yarn run test
6 changes: 6 additions & 0 deletions examples/electron/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ exports.config = {
// your test setup with almost no effort. Unlike plugins, they don't add new
// commands. Instead, they hook themselves up into the test process.
services: ['selenium-standalone'],

seleniumArgs: {
seleniumArgs: ["-port", "4444"],
javaArgs: ["-Xmx1024m", "-Djna.nosys=true"]
},

//
// Framework you want to run your specs with.
// The following are supported: Mocha, Jasmine, and Cucumber
Expand Down
4 changes: 2 additions & 2 deletions generator-theia/src/common/app-package-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class AppPackageGenerator extends AbstractGenerator {
}

protected compilePackage(): NodePackage {
const dependendencies = this.isWeb() ? {} : {}
const dependencies = this.isWeb() ? {} : {}
const scripts = this.isWeb() ? {
"start": "concurrently -n backend,frontend -c blue,green \"yarn run start:backend\" \"yarn run start:frontend\"",
"start:backend": "yarn run build:backend && node ./src-gen/backend/main.js --port=3000| bunyan",
Expand All @@ -38,7 +38,7 @@ export class AppPackageGenerator extends AbstractGenerator {
return {
...this.model.pck,
"dependencies": sortByKey({
...dependendencies,
...dependencies,
...this.model.pck.dependencies
}),
"scripts": sortByKey({
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
"build:generator": "lerna run prepare --scope generator-theia --stream",
"link:generator": "lerna exec --scope generator-theia --stream -- yarn link && yarn link generator-theia",
"prepare:packages": "yarn run bootstrap && yarn run clean && yarn run clean:rebuild && yarn run build",
"bootstrap": "node scripts/generate.js && lerna bootstrap --scope \"@theia/*\" --hoist -- --no-optional",
"refresh": "lerna clean --scope \"@theia/*\" --yes && yarn run bootstrap",
"clean": "lerna run clean --scope \"@theia/*\" --parallel",
"build": "lerna run build --scope \"@theia/*\" --stream",
"bootstrap": "node scripts/generate && node scripts/lerna bootstrap --scope \"@theia/*\" --hoist -- --no-optional",
"refresh": "node scripts/lerna clean --scope \"@theia/*\" --yes && yarn run bootstrap",
"clean": "node scripts/lerna run clean --scope \"@theia/*\" --parallel",
"build": "node scripts/lerna run build --scope \"@theia/*\" --stream",
"test": "yarn run test:theia && yarn run test:electron && yarn run test:browser",
"test:theia": "lerna run test --scope \"@theia/!(example-)*\" --parallel",
"test:browser": "yarn run rebuild:browser && lerna run test --scope \"@theia/example-browser\"",
"test:electron": "yarn run rebuild:electron && lerna run test --scope \"@theia/example-electron\"",
"test:theia": "node scripts/lerna run test --scope \"@theia/!(example-)*\" --parallel",
"test:browser": "yarn run rebuild:browser && node scripts/lerna run test --scope \"@theia/example-browser\"",
"test:electron": "yarn run rebuild:electron && node scripts/lerna run test --scope \"@theia/example-electron\"",
"clean:rebuild": "rimraf .browser_modules",
"rebuild:browser": "node scripts/rebuild.js --target=browser",
"rebuild:electron": "node scripts/rebuild.js --target=electron",
"rebuild:browser": "node scripts/rebuild --target=browser",
"rebuild:electron": "node scripts/rebuild --target=electron",
"rebuild:electron:debug": "DEBUG=electron-rebuild && yarn run rebuild:electron",
"watch": "lerna run watch --scope \"@theia/!(example-)*\" --parallel",
"publish": "yarn && yarn test && yarn run publish:latest && node scripts/update-versions.js",
"publish": "yarn && yarn test && yarn run publish:latest && node scripts/update-versions",
"publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --skip-git",
"publish:next": "lerna publish --registry=https://registry.npmjs.org/ --canary=next --npm-tag=next --force-publish --skip-git --yes"
}
}
}
9 changes: 8 additions & 1 deletion packages/filesystem/src/node/node-filesystem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ import { FileSystemWatcher, FileChange, FileChangeType, createFileSystemPreferen
import { FileSystemNode } from "./node-filesystem";
import { ChokidarFileSystemWatcherServer } from './chokidar-filesystem-watcher';

function tmpdirPath() {
const path = os.tmpdir();
if (path.charAt(1) === ':' && process.platform === 'win32') {
return `${path.charAt(0).toLowerCase()}${path.slice(1)}`;
}
return path;
}
const expect = chai.expect;
const uuidV1 = require('uuid/v1');
const TEST_ROOT = FileUri.create(os.tmpdir()).resolve("node-fs-root");
const TEST_ROOT = FileUri.create(tmpdirPath()).resolve("node-fs-root");

describe("NodeFileSystem", () => {

Expand Down
24 changes: 24 additions & 0 deletions scripts/lerna.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2017 TypeFox and others.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
// @ts-check
const path = require('path');
const cp = require('child_process');

const lernaPath = path.resolve(__dirname, '..', 'node_modules', 'lerna', 'bin', 'lerna');

if (process.platform === 'win32') {
console.log('Parallel lerna execution is disabled on Windows. Falling back to sequential execution with the \'--concurrency==1\' flag.');
if (process.argv.indexOf('--concurrency==1') === -1) {
process.argv.push('--concurrency==1');
}
const parallelIndex = process.argv.indexOf('--parallel');
if (parallelIndex !== -1) {
process.argv[parallelIndex] = '--stream';
}
console.log('Running lerna as: ' + process.argv.join(' '));
}
require(lernaPath);
30 changes: 18 additions & 12 deletions scripts/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,49 @@
// @ts-check
const fs = require('fs-extra');
const path = require('path');
const cp = require('child_process');
const { target, modules } = require('yargs').array('modules').argv;

const nodeModulesPath = path.join(process.cwd(), 'node_modules');
const browserModulesPath = path.join(process.cwd(), '.browser_modules');
const modulesToProcess = modules || ['node-pty']

if (target === 'electron' && !fs.existsSync(browserModulesPath)) {
const dependencies = {}
const dependencies = {};
for (const module of modulesToProcess) {
console.log("Processing "+module)
const src = path.join(nodeModulesPath, module)
console.log("Processing " + module);
const src = path.join(nodeModulesPath, module);
const dest = path.join(browserModulesPath, module);
const packJson = fs.readJsonSync(path.join(src, 'package.json'))
dependencies[module] = packJson.version;
fs.copySync(src, dest);
}
const packFile = path.join(process.cwd(),"package.json");
const packFile = path.join(process.cwd(), "package.json");
const packageText = fs.readFileSync(packFile);
const pack = fs.readJsonSync(packFile);
const pack = fs.readJsonSync(packFile);
try {
Object.assign(pack.dependencies, dependencies)
fs.writeFileSync(packFile, JSON.stringify(pack, null, " "));
require(path.join(process.cwd(),'node_modules','.bin','electron-rebuild'));
const electronRebuildPath = path.join(process.cwd(), 'node_modules', '.bin', 'electron-rebuild');
if (process.platform === 'win32') {
cp.spawnSync('cmd', ['/c', electronRebuildPath]);
} else {
require(electronRebuildPath);
}
} finally {
setTimeout(() => {
fs.writeFile(packFile, packageText);
}, 100)
}, 100);
}
} else if (target === 'browser' && fs.existsSync(browserModulesPath)) {
for (const moduleName of fs.readdirSync(browserModulesPath)) {
console.log("Reverting "+moduleName)
const src = path.join(browserModulesPath, moduleName)
console.log("Reverting " + moduleName);
const src = path.join(browserModulesPath, moduleName);
const dest = path.join(nodeModulesPath, moduleName);
fs.removeSync(dest)
fs.removeSync(dest);
fs.copySync(src, dest);
}
fs.removeSync(browserModulesPath);
} else {
console.log('native node modules are already rebuilt for ' + target)
}
console.log('native node modules are already rebuilt for ' + target);
}

0 comments on commit e8beacc

Please sign in to comment.