Merge pull request #17 from Microsoft/revert-15-users/roniga/tasklib

Revert "Users/roniga/tasklib"
This commit is contained in:
Rohit Nigam 2015-12-24 22:47:57 +05:30
Родитель 47222bba8a 0e989b202c
Коммит 74c291d14f
5 изменённых файлов: 25 добавлений и 71 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -79,5 +79,4 @@ local.properties
## Application Specific
_build
_package
tests/Tools/target
_temp
tests/Tools/target

Просмотреть файл

@ -7,22 +7,18 @@ var istanbul = require("gulp-istanbul");
var path = require("path");
var shell = require('shelljs')
var gutil = require('gulp-util');
var fs = require('fs');
var buildDirectory = "_build";
var packageDirectory = "_package";
var sourcePaths = {
typescriptFiles: "src/**/*.ts",
copyFiles: ["src/*.json", "src/*.md", "src/Images/*", "src/Tasks/**/*.json", "src/Tasks/**/*.md", "src/Tasks/**/*.png", "src/Tasks/**/*.svg"],
tasksPath: "src/Tasks"
copyFiles: ["src/*.json", "src/*.md", "src/Images/*", "src/Tasks/**/*.json", "src/Tasks/**/*.md", "src/Tasks/**/*.png", "src/Tasks/**/*.svg"]
};
var testPaths = {
typescriptFiles: "tests/**/*.ts",
compiledJSFiles: buildDirectory + "/**/*Tests*.js"
};
var manifestFile = "vss-extension.json";
var tempPath = path.join(__dirname, '_temp');
var tempNodeModules = path.join(tempPath, 'node_modules');
var jsCoverageDir = path.join(buildDirectory, "codecoverage");
@ -34,19 +30,15 @@ var compilation = tsb.create({
verbose: false
});
gulp.task("compile", ["lint"], function () {
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles], { base: "." })
gulp.task("compile", ["lint"], function() {
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles], { base: "." })
.pipe(compilation())
.pipe(gulp.dest(buildDirectory))
.pipe(istanbul({ includeUntested: true }))
.pipe(istanbul({includeUntested: true}))
.pipe(istanbul.hookRequire());
});
gulp.task("build", ["compile", "gettasklib"], function() {
fs.readdirSync(sourcePaths.tasksPath).filter(function (file) {
return fs.statSync(path.join(sourcePaths.tasksPath, file)).isDirectory();
}).forEach(copyTaskLib);
gulp.task("build", ["compile"], function() {
return gulp.src(sourcePaths.copyFiles, { base: "." })
.pipe(gulp.dest(buildDirectory));
});
@ -58,7 +50,7 @@ gulp.task("lint", function() {
});
gulp.task("clean", function(done) {
return rimraf([buildDirectory, packageDirectory, tempPath], function() {
return rimraf(buildDirectory, function() {
// rimraf deletes the directory asynchronously
done();
});
@ -94,28 +86,30 @@ gulp.task("watch", function() {
gulp.task("default", ["build"]);
gulp.task("gettasklib", function (cb) {
getLatestTaskLib(cb);
});
var createPackage = function (cb) {
runMavenAndGenerateVsix(cb);
var srcBuildDirectory = buildDirectory + "/src";
runMaven(function () {
createVsix(manifestFile, srcBuildDirectory, packageDirectory, cb);
}, function (err) {
cb(new gutil.PluginError({
plugin: "package",
message: err
}));
});
}
var runMavenAndGenerateVsix = function(cb) {
var runMaven = function(successcb, failcb) {
var mavenPath = shell.which('mvn');
if (!mavenPath) {
cb(createError('mvn.exe needs to be in the path. Could not find.'));
failcb('mvn.exe needs to be in the path. Could not find.');
return;
}
shell.exec("mvn package", {silent:true}, function(code, output) {
if (code !== 0) {
cb(createError(output));
return;
failcb(output);
}
else {
var srcBuildDirectory = buildDirectory + "/src";
createVsix(manifestFile, srcBuildDirectory, packageDirectory, cb);
successcb();
}
});
}
@ -123,47 +117,13 @@ var runMavenAndGenerateVsix = function(cb) {
var createVsix = function(manifestFile, srcBuildDirectory, packageDirectory, cb) {
shell.exec("tfx extension create --manifest-globs " + manifestFile + " --root " + srcBuildDirectory + " --output-path " + packageDirectory, {silent:true}, function(code, output) {
if (code !== 0) {
cb(createError(output));
cb(new gutil.PluginError({
plugin: "package",
message: output
}));
}
else {
cb();
}
});
}
var getLatestTaskLib = function(cb) {
gutil.log('Getting latest vso-task-lib');
shell.mkdir('-p', path.join(tempPath, 'node_modules'));
shell.cp("-f", "package.json", tempPath);
shell.pushd(tempPath);
var npmPath = shell.which('npm');
if (!npmPath) {
cb(createError('npm not found. ensure npm 3 or greater is installed'));
return;
}
var cmdline = '"' + npmPath + '" install --production';
shell.exec(cmdline, { silent: true }, function (code, output) {
shell.popd();
if (code !== 0) {
cb(createError('npm failed to install vso-task-lib. Output : ' + output));
}
else {
cb();
}
});
}
var createError = function (err) {
return new gutil.PluginError({
plugin: "package",
message: err
});
}
var copyTaskLib = function(taskName) {
var targetPath = path.join(buildDirectory, "src", "Tasks", taskName);
shell.mkdir('-p', targetPath);
shell.cp('-rf', path.join(tempPath, 'node_modules'), targetPath);
}

Просмотреть файл

@ -11,7 +11,6 @@
},
"devDependencies": {
"chai": "^3.4.1",
"fs": "^0.0.2",
"gulp": "^3.9.0",
"gulp-istanbul": "^0.10.3",
"gulp-mocha": "^2.1.3",

Просмотреть файл

@ -18,7 +18,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build.profile.id>dev</build.profile.id>
<skip.jacoco.check>true</skip.jacoco.check>
<skip.unittests>true</skip.unittests>
</properties>
<profiles>
@ -28,7 +27,6 @@
<build.profile.id>ci</build.profile.id>
<!-- All tests are run. -->
<skip.jacoco.check>false</skip.jacoco.check>
<skip.unittests>false</skip.unittests>
</properties>
</profile>
<profile>

Просмотреть файл

@ -54,11 +54,9 @@
<configuration>
<includes>
<include>**/*UnitTests.java</include>
<include>**/*PlatformTests.java</include>
</includes>
<reportsDirectory>../../_build/testReports/vmOpsTool</reportsDirectory>
<testClassesDirectory>../../_build/tests/tools/vmOpsTool</testClassesDirectory>
<skipTests>${skip.unittests}</skipTests>
</configuration>
</plugin>
@ -67,7 +65,7 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<includes>
<include>**/*PlatformTests.java</include>
</includes>
<reportsDirectory>../../_build/testReports/vmOpsTool</reportsDirectory>