Merge pull request #18 from Microsoft/users/roniga/fix_revert
Users/roniga/fix revert
This commit is contained in:
Коммит
f09dd92217
|
@ -79,4 +79,5 @@ local.properties
|
|||
## Application Specific
|
||||
_build
|
||||
_package
|
||||
tests/Tools/target
|
||||
tests/Tools/target
|
||||
_temp
|
86
gulpfile.js
86
gulpfile.js
|
@ -7,18 +7,22 @@ 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"]
|
||||
copyFiles: ["src/*.json", "src/*.md", "src/Images/*", "src/Tasks/**/*.json", "src/Tasks/**/*.md", "src/Tasks/**/*.png", "src/Tasks/**/*.svg"],
|
||||
tasksPath: "src/Tasks"
|
||||
};
|
||||
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");
|
||||
|
||||
|
@ -30,15 +34,19 @@ 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"], function() {
|
||||
gulp.task("build", ["compile", "gettasklib"], function() {
|
||||
fs.readdirSync(sourcePaths.tasksPath).filter(function (file) {
|
||||
return fs.statSync(path.join(sourcePaths.tasksPath, file)).isDirectory();
|
||||
}).forEach(copyTaskLib);
|
||||
|
||||
return gulp.src(sourcePaths.copyFiles, { base: "." })
|
||||
.pipe(gulp.dest(buildDirectory));
|
||||
});
|
||||
|
@ -50,7 +58,7 @@ gulp.task("lint", function() {
|
|||
});
|
||||
|
||||
gulp.task("clean", function(done) {
|
||||
return rimraf(buildDirectory, function() {
|
||||
return rimraf(buildDirectory, function () {
|
||||
// rimraf deletes the directory asynchronously
|
||||
done();
|
||||
});
|
||||
|
@ -86,30 +94,28 @@ gulp.task("watch", function() {
|
|||
|
||||
gulp.task("default", ["build"]);
|
||||
|
||||
gulp.task("gettasklib", function (cb) {
|
||||
getLatestTaskLib(cb);
|
||||
});
|
||||
|
||||
var createPackage = function (cb) {
|
||||
var srcBuildDirectory = buildDirectory + "/src";
|
||||
runMaven(function () {
|
||||
createVsix(manifestFile, srcBuildDirectory, packageDirectory, cb);
|
||||
}, function (err) {
|
||||
cb(new gutil.PluginError({
|
||||
plugin: "package",
|
||||
message: err
|
||||
}));
|
||||
});
|
||||
runMavenAndGenerateVsix(cb);
|
||||
}
|
||||
|
||||
var runMaven = function(successcb, failcb) {
|
||||
var runMavenAndGenerateVsix = function(cb) {
|
||||
var mavenPath = shell.which('mvn');
|
||||
if (!mavenPath) {
|
||||
failcb('mvn.exe needs to be in the path. Could not find.');
|
||||
cb(createError('mvn.exe needs to be in the path. Could not find.'));
|
||||
return;
|
||||
}
|
||||
shell.exec("mvn package", {silent:true}, function(code, output) {
|
||||
if (code !== 0) {
|
||||
failcb(output);
|
||||
cb(createError(output));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
successcb();
|
||||
var srcBuildDirectory = buildDirectory + "/src";
|
||||
createVsix(manifestFile, srcBuildDirectory, packageDirectory, cb);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -117,13 +123,47 @@ var runMaven = function(successcb, failcb) {
|
|||
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(new gutil.PluginError({
|
||||
plugin: "package",
|
||||
message: output
|
||||
}));
|
||||
cb(createError(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,6 +11,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.1",
|
||||
"fs": "^0.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-istanbul": "^0.10.3",
|
||||
"gulp-mocha": "^2.1.3",
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -18,6 +18,7 @@
|
|||
<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>
|
||||
|
@ -27,6 +28,7 @@
|
|||
<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,9 +54,11 @@
|
|||
<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>
|
||||
|
||||
|
@ -65,7 +67,7 @@
|
|||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<includes>
|
||||
<include>**/*PlatformTests.java</include>
|
||||
</includes>
|
||||
<reportsDirectory>../../_build/testReports/vmOpsTool</reportsDirectory>
|
||||
|
|
Загрузка…
Ссылка в новой задаче