Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('yuniql/input_version: ' + versionSpec);
console.log('yuniql/input_workspacePath: ' + workspacePath);
console.log('yuniql/input_connectionString: ' + connectionString);
console.log('yuniql/input_targetPlatform: ' + targetPlatform);
console.log('yuniql/input_autoCreateDatabase: ' + autoCreateDatabase);
console.log('yuniql/input_targetVersion: ' + targetVersion);
console.log('yuniql/input_tokenKeyValuePair: ' + tokenKeyValuePair);
console.log('yuniql/input_delimiter: ' + delimiter);
console.log('yuniql/input_additionalArguments: ' + additionalArguments);
console.log('yuniql/var_osPlat: ' + osPlat);
console.log('yuniql/var_osArch: ' + osArch);
//picksup the version downloaded from install task
let versionLocation: string = '';
if (toolLib.isExplicitVersion(versionSpec)) {
versionLocation = versionSpec;
} else {
//use v0.0.0 as placeholder for latest version
versionLocation = 'v0.0.0'
}
if (osPlat == 'win32') {
var yuniqlBasePath = path.join(toolLib.findLocalTool('yuniql', versionLocation));
console.log('yuniql/var_yuniqlBasePath: ' + yuniqlBasePath);
var yuniqlExecFilePath = path.join(yuniqlBasePath, 'yuniql.exe');
console.log('yuniql/var_yuniqlExecFilePath: ' + yuniqlExecFilePath);
//set the plugin path
// var pluginsPath = path.join(yuniqlBasePath, '.plugins');
// console.log('var_pluginsPath: ' + pluginsPath);
export async function getYuniql(versionSpec: string, checkLatest: boolean) {
try {
console.log('yuniql/var_osPlat: ' + osPlat);
console.log('yuniql/var_osArch: ' + osArch);
// when version is explicit, we dont check the latest
let version: string = '';
if (toolLib.isExplicitVersion(versionSpec)) {
checkLatest = false;
console.log('yuniql/var_isExplicitVersion: true');
console.log('yuniql/var_checkLatest: false');
}
// when version is explicit, we check the cache first
let toolPath: string = '';
if (!checkLatest) {
toolPath = toolLib.findLocalTool('yuniql', versionSpec);
}
// when cached version doesnt exists, we download a fresh copy
if (!toolPath) {
//when version is explicit, use the version specified, else we acquire latest version
if (toolLib.isExplicitVersion(versionSpec)) {
version = versionSpec;
async function getTfx(versionSpec: string, checkLatest: boolean) {
if (toolLib.isExplicitVersion(versionSpec)) {
checkLatest = false; // check latest doesn't make sense when explicit version
}
let toolPath: string;
if (!checkLatest) {
toolPath = toolLib.findLocalTool('tfx', versionSpec);
}
if (!toolPath) {
let version: string;
if (toolLib.isExplicitVersion(versionSpec)) {
version = versionSpec;
}
else {
version = queryLatestMatch(versionSpec);
if (!version) {
public isVersionInstalled(version: string): boolean {
if (!toolLib.isExplicitVersion(version)) {
throw tl.loc("ExplicitVersionRequired", version);
}
var isInstalled: boolean = false;
if (this.packageType == utils.Constants.sdk) {
isInstalled = tl.exist(path.join(this.installationPath, utils.Constants.relativeSdkPath, version)) && tl.exist(path.join(this.installationPath, utils.Constants.relativeSdkPath, `${version}.complete`));
}
else {
isInstalled = tl.exist(path.join(this.installationPath, utils.Constants.relativeRuntimePath, version)) && tl.exist(path.join(this.installationPath, utils.Constants.relativeRuntimePath, `${version}.complete`));
}
isInstalled ? console.log(tl.loc("VersionFoundInCache", version)) : console.log(tl.loc("VersionNotFoundInCache", version));
return isInstalled;
}
public isVersionInstalled(version: string): boolean {
if (!toolLib.isExplicitVersion(version)) {
throw tl.loc("ExplicitVersionRequired", version);
}
var isInstalled: boolean = false;
if (this.packageType == utils.Constants.sdk) {
isInstalled = tl.exist(path.join(this.installationPath, utils.Constants.relativeSdkPath, version)) && tl.exist(path.join(this.installationPath, utils.Constants.relativeSdkPath, `${version}.complete`));
}
else {
isInstalled = tl.exist(path.join(this.installationPath, utils.Constants.relativeRuntimePath, version)) && tl.exist(path.join(this.installationPath, utils.Constants.relativeRuntimePath, `${version}.complete`));
}
isInstalled ? console.log(tl.loc("VersionFoundInCache", version)) : console.log(tl.loc("VersionNotFoundInCache", version));
return isInstalled;
}