Remove KoreBuild
This commit is contained in:
parent
27e373b277
commit
510dab8407
|
|
@ -16,3 +16,4 @@ node_modules
|
|||
*.snk
|
||||
.nuget/NuGet.exe
|
||||
project.lock.json
|
||||
.build
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<metadata>
|
||||
<id>KoreBuild-dotnet</id>
|
||||
<title>The ProjectK build tools</title>
|
||||
<version>0.0</version>
|
||||
<authors>.NET Foundation</authors>
|
||||
<owners>.NET Foundation</owners>
|
||||
<description>ProjectK build tooling</description>
|
||||
<language>en-US</language>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="build\*.*" target="build" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
use namespace="System"
|
||||
|
||||
functions
|
||||
@{
|
||||
string CreateDayBasedVersionNumber()
|
||||
{
|
||||
var start = new DateTime(2015, 1, 1);
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
string version = "0";
|
||||
// If the computer date is set before the start date, then the version is 0
|
||||
if (now >= start)
|
||||
{
|
||||
var yearsSinceStart = (now.Year - start.Year) + 1;
|
||||
version = yearsSinceStart + now.ToString("MMdd");
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
string BuildNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return "t" + DateTime.UtcNow.ToString("yyMMddHHmmss");
|
||||
}
|
||||
}
|
||||
|
||||
string DotBuildFolderPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BUILD_FOLDER");
|
||||
}
|
||||
}
|
||||
|
||||
string KoreBuildFolderPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("KOREBUILD_FOLDER");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,883 +0,0 @@
|
|||
use namespace='System'
|
||||
use namespace='System.Collections.Generic'
|
||||
use namespace='System.Globalization'
|
||||
use namespace='System.IO'
|
||||
use namespace='System.Text'
|
||||
|
||||
functions @{
|
||||
public class JsonArray : JsonValue
|
||||
{
|
||||
private readonly JsonValue[] _array;
|
||||
|
||||
public JsonArray(JsonValue[] array, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
|
||||
_array = array;
|
||||
}
|
||||
|
||||
public int Length { get { return _array.Length; } }
|
||||
public IEnumerable<JsonValue> Values { get { return _array; }}
|
||||
public JsonValue this[int index] { get { return _array[index]; }}
|
||||
}
|
||||
|
||||
public class JsonBoolean : JsonValue
|
||||
{
|
||||
public JsonBoolean(JsonToken token)
|
||||
: base(token.Line, token.Column)
|
||||
{
|
||||
if (token.Type == JsonTokenType.True)
|
||||
{
|
||||
Value = true;
|
||||
}
|
||||
else if (token.Type == JsonTokenType.False)
|
||||
{
|
||||
Value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Token value should be either True or False.", "token");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Value { get; private set; }
|
||||
|
||||
public static implicit operator bool (JsonBoolean jsonBoolean)
|
||||
{
|
||||
return jsonBoolean.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonString : JsonValue
|
||||
{
|
||||
private readonly string _value;
|
||||
|
||||
public JsonString(string value, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
public static implicit operator string (JsonString instance)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return instance.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonNull : JsonValue
|
||||
{
|
||||
public JsonNull(int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonValue
|
||||
{
|
||||
public JsonValue(int line, int column)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public int Line { get; private set; }
|
||||
|
||||
public int Column { get; private set; }
|
||||
}
|
||||
|
||||
public class JsonObject : JsonValue
|
||||
{
|
||||
private readonly IDictionary<string, JsonValue> _data;
|
||||
|
||||
public JsonObject(IDictionary<string, JsonValue> data, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public ICollection<string> Keys
|
||||
{
|
||||
get { return _data.Keys; }
|
||||
}
|
||||
|
||||
public JsonValue Value(string key)
|
||||
{
|
||||
JsonValue result;
|
||||
if (!_data.TryGetValue(key, out result))
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public JsonObject ValueAsJsonObject(string key)
|
||||
{
|
||||
return Value(key) as JsonObject;
|
||||
}
|
||||
|
||||
public JsonString ValueAsString(string key)
|
||||
{
|
||||
return Value(key) as JsonString;
|
||||
}
|
||||
|
||||
public int ValueAsInt(string key)
|
||||
{
|
||||
var number = Value(key) as JsonNumber;
|
||||
if (number == null)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
return Convert.ToInt32(number.Raw);
|
||||
}
|
||||
|
||||
public bool ValueAsBoolean(string key, bool defaultValue = false)
|
||||
{
|
||||
var boolVal = Value(key) as JsonBoolean;
|
||||
if (boolVal != null)
|
||||
{
|
||||
return boolVal.Value;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public bool? ValueAsNullableBoolean(string key)
|
||||
{
|
||||
var boolVal = Value(key) as JsonBoolean;
|
||||
if (boolVal != null)
|
||||
{
|
||||
return boolVal.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] ValueAsStringArray(string key)
|
||||
{
|
||||
var list = Value(key) as JsonArray;
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = new string[list.Length];
|
||||
|
||||
for (int i = 0; i < list.Length; ++i)
|
||||
{
|
||||
var jsonString = list[i] as JsonString;
|
||||
if (jsonString != null)
|
||||
{
|
||||
result[i] = jsonString.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal object ValueAsJsonObject(object packIncludePropertyName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonNumber : JsonValue
|
||||
{
|
||||
private readonly string _raw;
|
||||
private readonly double _double;
|
||||
|
||||
public JsonNumber(JsonToken token)
|
||||
: base(token.Line, token.Column)
|
||||
{
|
||||
try
|
||||
{
|
||||
_raw = token.Value;
|
||||
_double = double.Parse(_raw, NumberStyles.Float);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidFloatNumberFormat(_raw),
|
||||
ex,
|
||||
token.Line,
|
||||
token.Column);
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_FloatNumberOverflow(_raw),
|
||||
ex,
|
||||
token.Line,
|
||||
token.Column);
|
||||
}
|
||||
}
|
||||
|
||||
public double Double
|
||||
{
|
||||
get { return _double; }
|
||||
}
|
||||
|
||||
public string Raw
|
||||
{
|
||||
get { return _raw; }
|
||||
}
|
||||
}
|
||||
|
||||
public static class Json
|
||||
{
|
||||
public static JsonValue Deserialize(string content)
|
||||
{
|
||||
using (var reader = new StringReader(content))
|
||||
{
|
||||
return Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonValue Deserialize(TextReader reader)
|
||||
{
|
||||
if (reader == null)
|
||||
{
|
||||
throw new ArgumentNullException("reader");
|
||||
}
|
||||
|
||||
var buffer = new JsonBuffer(reader);
|
||||
|
||||
var result = DeserializeInternal(buffer.Read(), buffer);
|
||||
|
||||
// There are still unprocessed char. The parsing is not finished. Error happened.
|
||||
var nextToken = buffer.Read();
|
||||
if (nextToken.Type != JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_UnfinishedJSON(nextToken.Value),
|
||||
nextToken);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JsonValue DeserializeInternal(JsonToken next, JsonBuffer buffer)
|
||||
{
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.LeftSquareBracket)
|
||||
{
|
||||
return DeserializeArray(next, buffer);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.LeftCurlyBracket)
|
||||
{
|
||||
return DeserializeObject(next, buffer);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.String)
|
||||
{
|
||||
return new JsonString(next.Value, next.Line, next.Column);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.True || next.Type == JsonTokenType.False)
|
||||
{
|
||||
return new JsonBoolean(next);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Null)
|
||||
{
|
||||
return new JsonNull(next.Line, next.Column);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Number)
|
||||
{
|
||||
return new JsonNumber(next);
|
||||
}
|
||||
|
||||
throw new JsonDeserializerException(JsonDeserializerResource.Format_InvalidTokenExpectation(
|
||||
next.Value, "'{', (char)'[', true, false, null, JSON string, JSON number, or the end of the file"),
|
||||
next);
|
||||
}
|
||||
|
||||
private static JsonArray DeserializeArray(JsonToken head, JsonBuffer buffer)
|
||||
{
|
||||
var list = new List<JsonValue>();
|
||||
while (true)
|
||||
{
|
||||
var next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.RightSquareBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
list.Add(DeserializeInternal(next, buffer));
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON array", (char)']', (char)','),
|
||||
next);
|
||||
}
|
||||
else if (next.Type == JsonTokenType.RightSquareBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (next.Type != JsonTokenType.Comma)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON array", (char)','),
|
||||
next);
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonArray(list.ToArray(), head.Line, head.Column);
|
||||
}
|
||||
|
||||
private static JsonObject DeserializeObject(JsonToken head, JsonBuffer buffer)
|
||||
{
|
||||
var dictionary = new Dictionary<string, JsonValue>();
|
||||
|
||||
// Loop through each JSON entry in the input object
|
||||
while (true)
|
||||
{
|
||||
var next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)'}'),
|
||||
next);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Colon)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxNotExpected("JSON object", (char)':'),
|
||||
next);
|
||||
}
|
||||
else if (next.Type == JsonTokenType.RightCurlyBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (next.Type != JsonTokenType.String)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object member name", "JSON string"),
|
||||
next);
|
||||
}
|
||||
|
||||
var memberName = next.Value;
|
||||
if (dictionary.ContainsKey(memberName))
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_DuplicateObjectMemberName(memberName),
|
||||
next);
|
||||
}
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type != JsonTokenType.Colon)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)':'),
|
||||
next);
|
||||
}
|
||||
|
||||
dictionary[memberName] = DeserializeInternal(buffer.Read(), buffer);
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.RightCurlyBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (next.Type != JsonTokenType.Comma)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)',', (char)'}'),
|
||||
next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonObject(dictionary, head.Line, head.Column);
|
||||
}
|
||||
}
|
||||
|
||||
internal class JsonBuffer
|
||||
{
|
||||
public const string ValueNull = "null";
|
||||
public const string ValueTrue = "true";
|
||||
public const string ValueFalse = "false";
|
||||
|
||||
private readonly StringBuilder _buffer = new StringBuilder();
|
||||
private readonly StringBuilder _codePointBuffer = new StringBuilder(4);
|
||||
private readonly TextReader _reader;
|
||||
private JsonToken _token;
|
||||
private int _line;
|
||||
private int _column;
|
||||
|
||||
public JsonBuffer(TextReader reader)
|
||||
{
|
||||
_reader = reader;
|
||||
_line = 1;
|
||||
}
|
||||
|
||||
public JsonToken Read()
|
||||
{
|
||||
int first;
|
||||
while (true)
|
||||
{
|
||||
first = ReadNextChar();
|
||||
|
||||
if (first == -1)
|
||||
{
|
||||
_token.Type = JsonTokenType.EOF;
|
||||
return _token;
|
||||
}
|
||||
else if (!IsWhitespace(first))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_token.Value = ((char)first).ToString();
|
||||
_token.Line = _line;
|
||||
_token.Column = _column;
|
||||
|
||||
if (first == (char)'{')
|
||||
{
|
||||
_token.Type = JsonTokenType.LeftCurlyBracket;
|
||||
}
|
||||
else if (first == (char)'}')
|
||||
{
|
||||
_token.Type = JsonTokenType.RightCurlyBracket;
|
||||
}
|
||||
else if (first == (char)'[')
|
||||
{
|
||||
_token.Type = JsonTokenType.LeftSquareBracket;
|
||||
}
|
||||
else if (first == (char)']')
|
||||
{
|
||||
_token.Type = JsonTokenType.RightSquareBracket;
|
||||
}
|
||||
else if (first == (char)':')
|
||||
{
|
||||
_token.Type = JsonTokenType.Colon;
|
||||
}
|
||||
else if (first == (char)',')
|
||||
{
|
||||
_token.Type = JsonTokenType.Comma;
|
||||
}
|
||||
else if (first == (char)'"')
|
||||
{
|
||||
_token.Type = JsonTokenType.String;
|
||||
_token.Value = ReadString();
|
||||
}
|
||||
else if (first == (char)'t')
|
||||
{
|
||||
ReadLiteral(ValueTrue);
|
||||
_token.Type = JsonTokenType.True;
|
||||
}
|
||||
else if (first == (char)'f')
|
||||
{
|
||||
ReadLiteral(ValueFalse);
|
||||
_token.Type = JsonTokenType.False;
|
||||
}
|
||||
else if (first == (char)'n')
|
||||
{
|
||||
ReadLiteral(ValueNull);
|
||||
_token.Type = JsonTokenType.Null;
|
||||
}
|
||||
else if ((first >= (char)'0' && first <= (char)'9') || first == (char)'-')
|
||||
{
|
||||
_token.Type = JsonTokenType.Number;
|
||||
_token.Value = ReadNumber(first);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_IllegalCharacter(first),
|
||||
_token);
|
||||
}
|
||||
|
||||
// JsonToken is a value type
|
||||
return _token;
|
||||
}
|
||||
|
||||
private int ReadNextChar()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var value = _reader.Read();
|
||||
_column++;
|
||||
|
||||
if (value == -1)
|
||||
{
|
||||
// This is the end of file
|
||||
return -1;
|
||||
}
|
||||
else if (value == (char)'\n')
|
||||
{
|
||||
// This is a new line. Let the next loop read the first charactor of the following line.
|
||||
// Set position ahead of next line
|
||||
_column = 0;
|
||||
_line++;
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (value == (char)'\r')
|
||||
{
|
||||
// Skip the carriage return.
|
||||
// Let the next loop read the following char
|
||||
}
|
||||
else
|
||||
{
|
||||
// Returns the normal value
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadNumber(int firstRead)
|
||||
{
|
||||
_buffer.Clear();
|
||||
_buffer.Append((char)firstRead);
|
||||
|
||||
while (true)
|
||||
{
|
||||
var next = _reader.Peek();
|
||||
|
||||
if ((next >= (char)'0' && next <= (char)'9') ||
|
||||
next == (char)'.' ||
|
||||
next == (char)'e' ||
|
||||
next == (char)'E')
|
||||
{
|
||||
_buffer.Append((char)ReadNextChar());
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _buffer.ToString();
|
||||
}
|
||||
|
||||
private void ReadLiteral(string literal)
|
||||
{
|
||||
for (int i = 1; i < literal.Length; ++i)
|
||||
{
|
||||
var next = _reader.Peek();
|
||||
if (next != literal[i])
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_UnrecognizedLiteral(literal),
|
||||
_line, _column);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadNextChar();
|
||||
}
|
||||
}
|
||||
|
||||
var tail = _reader.Peek();
|
||||
if (tail != (char)'}' &&
|
||||
tail != (char)']' &&
|
||||
tail != (char)',' &&
|
||||
tail != (char)'\n' &&
|
||||
tail != -1 &&
|
||||
!IsWhitespace(tail))
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_IllegalTrailingCharacterAfterLiteral(tail, literal),
|
||||
_line, _column);
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadString()
|
||||
{
|
||||
_buffer.Clear();
|
||||
var escaped = false;
|
||||
|
||||
while (true)
|
||||
{
|
||||
var next = ReadNextChar();
|
||||
|
||||
if (next == -1 || next == (char)'\n')
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.JSON_OpenString,
|
||||
_line, _column);
|
||||
}
|
||||
else if (escaped)
|
||||
{
|
||||
if ((next == (char)'"') || (next == (char)'\\') || (next == (char)'/'))
|
||||
{
|
||||
_buffer.Append((char)next);
|
||||
}
|
||||
else if (next == (char)'b')
|
||||
{
|
||||
// (char)'\b' backspace
|
||||
_buffer.Append('\b');
|
||||
}
|
||||
else if (next == (char)'f')
|
||||
{
|
||||
// (char)'\f' form feed
|
||||
_buffer.Append('\f');
|
||||
}
|
||||
else if (next == (char)'n')
|
||||
{
|
||||
// (char)'\n' line feed
|
||||
_buffer.Append('\n');
|
||||
}
|
||||
else if (next == (char)'r')
|
||||
{
|
||||
// (char)'\r' carriage return
|
||||
_buffer.Append('\r');
|
||||
}
|
||||
else if (next == (char)'t')
|
||||
{
|
||||
// (char)'\t' tab
|
||||
_buffer.Append('\t');
|
||||
}
|
||||
else if (next == (char)'u')
|
||||
{
|
||||
// (char)'\uXXXX' unicode
|
||||
var unicodeLine = _line;
|
||||
var unicodeColumn = _column;
|
||||
|
||||
_codePointBuffer.Clear();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
next = ReadNextChar();
|
||||
if (next == -1)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.JSON_InvalidEnd,
|
||||
unicodeLine,
|
||||
unicodeColumn);
|
||||
}
|
||||
else
|
||||
{
|
||||
_codePointBuffer[i] = (char)next;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var unicodeValue = int.Parse(_codePointBuffer.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
_buffer.Append((char)unicodeValue);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidUnicode(_codePointBuffer.ToString()),
|
||||
ex,
|
||||
unicodeLine,
|
||||
unicodeColumn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxNotExpected("charactor escape", "\\" + next),
|
||||
_line,
|
||||
_column);
|
||||
}
|
||||
|
||||
escaped = false;
|
||||
}
|
||||
else if (next == (char)'\\')
|
||||
{
|
||||
escaped = true;
|
||||
}
|
||||
else if (next == (char)'"')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buffer.Append((char)next);
|
||||
}
|
||||
}
|
||||
|
||||
return _buffer.ToString();
|
||||
}
|
||||
|
||||
private static bool IsWhitespace(int value)
|
||||
{
|
||||
return value == (char)' ' || value == (char)'\t' || value == (char)'\r';
|
||||
}
|
||||
}
|
||||
|
||||
public enum JsonTokenType
|
||||
{
|
||||
LeftCurlyBracket, // [
|
||||
LeftSquareBracket, // {
|
||||
RightCurlyBracket, // ]
|
||||
RightSquareBracket, // }
|
||||
Colon, // :
|
||||
Comma, // ,
|
||||
Null,
|
||||
True,
|
||||
False,
|
||||
Number,
|
||||
String,
|
||||
EOF
|
||||
}
|
||||
|
||||
public struct JsonToken
|
||||
{
|
||||
public JsonTokenType Type;
|
||||
public string Value;
|
||||
public int Line;
|
||||
public int Column;
|
||||
}
|
||||
|
||||
public class JsonDeserializerException : Exception
|
||||
{
|
||||
public JsonDeserializerException(string message, Exception innerException, int line, int column)
|
||||
: base(message, innerException)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public JsonDeserializerException(string message, int line, int column)
|
||||
: base(message)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public JsonDeserializerException(string message, JsonToken nextToken)
|
||||
: base(message)
|
||||
{
|
||||
Line = nextToken.Line;
|
||||
Column = nextToken.Column;
|
||||
}
|
||||
|
||||
public int Line { get; private set; }
|
||||
|
||||
public int Column { get; private set; }
|
||||
}
|
||||
|
||||
internal class JsonDeserializerResource
|
||||
{
|
||||
internal static string Format_IllegalCharacter(int value)
|
||||
{
|
||||
return string.Format("Illegal character (char)'{0}' (Unicode hexadecimal {0:X4}).", value);
|
||||
}
|
||||
|
||||
internal static string Format_IllegalTrailingCharacterAfterLiteral(int value, string literal)
|
||||
{
|
||||
return string.Format("Illegal character(char)'{0}'(Unicode hexadecimal { 0:X4}) after the literal name (char)'{1}'.", value, literal);
|
||||
}
|
||||
|
||||
internal static string Format_UnrecognizedLiteral(string literal)
|
||||
{
|
||||
return string.Format("Invalid JSON literal.Expected literal(char)'{0}'.", literal);
|
||||
}
|
||||
|
||||
internal static string Format_DuplicateObjectMemberName(string memberName)
|
||||
{
|
||||
return Format_InvalidSyntax("JSON object", string.Format("Duplicate member name(char)'{0}'", memberName));
|
||||
}
|
||||
|
||||
internal static string Format_InvalidFloatNumberFormat(string raw)
|
||||
{
|
||||
return string.Format("Invalid float number format: {0}", raw);
|
||||
}
|
||||
|
||||
internal static string Format_FloatNumberOverflow(string raw)
|
||||
{
|
||||
return string.Format("Float number overflow: {0}", raw);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntax(string syntaxName, string issue)
|
||||
{
|
||||
return string.Format("Invalid {0}syntax. {1}.", syntaxName, issue);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxNotExpected(string syntaxName, char unexpected)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Unexpected(char)'{1}'.", syntaxName, unexpected);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxNotExpected(string syntaxName, string unexpected)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Unexpected { 1}.", syntaxName, unexpected);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, char expectation)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected(char)'{1}'.", syntaxName, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, string expectation)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected {1}.", syntaxName, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, char expectation1, char expectation2)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected(char)'{1}' or(char)'{2}'.", syntaxName, expectation1, expectation2);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidTokenExpectation(string tokenValue, string expectation)
|
||||
{
|
||||
return string.Format("Unexpected token(char)'{0}'.Expected {1}.", tokenValue, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidUnicode(string unicode)
|
||||
{
|
||||
return string.Format("Invalid Unicode[{0}]", unicode);
|
||||
}
|
||||
|
||||
internal static string Format_UnfinishedJSON(string nextTokenValue)
|
||||
{
|
||||
return string.Format("Invalid JSON end.Unprocessed token {0}.", nextTokenValue);
|
||||
}
|
||||
|
||||
internal static string JSON_OpenString
|
||||
{
|
||||
get { return Format_InvalidSyntaxExpectation("JSON string", (char)'\"'); }
|
||||
}
|
||||
|
||||
internal static string JSON_InvalidEnd
|
||||
{
|
||||
get { return "Invalid JSON. Unexpected end of file."; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
@ECHO off
|
||||
SETLOCAL
|
||||
|
||||
IF "%KOREBUILD_FOLDER%"=="" (
|
||||
ECHO Error: KOREBUILD_FOLDER is not set.
|
||||
EXIT /B 1
|
||||
)
|
||||
IF "%NUGET_PATH%"=="" (
|
||||
ECHO Error: NUGET_PATH is not set.
|
||||
EXIT /B 1
|
||||
)
|
||||
IF "%KOREBUILD_DOTNET_CHANNEL%"=="" (
|
||||
SET KOREBUILD_DOTNET_CHANNEL=beta
|
||||
)
|
||||
|
||||
IF "%KOREBUILD_DOTNET_VERSION%"=="" (
|
||||
SET KOREBUILD_DOTNET_VERSION=1.0.0.001540
|
||||
)
|
||||
|
||||
IF NOT EXIST %~dp0Sake (
|
||||
"%NUGET_PATH%" install Sake -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||
)
|
||||
|
||||
IF NOT EXIST %~dp0xunit.runner.console (
|
||||
"%NUGET_PATH%" install xunit.runner.console -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||
)
|
||||
|
||||
IF NOT EXIST %~dp0xunit.core (
|
||||
"%NUGET_PATH%" install xunit.core -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||
)
|
||||
|
||||
IF "%KOREBUILD_SKIP_RUNTIME_INSTALL%"=="1" (
|
||||
ECHO Skipping runtime installation because KOREBUILD_SKIP_RUNTIME_INSTALL = 1
|
||||
GOTO :SKIP_RUNTIME_INSTALL
|
||||
)
|
||||
|
||||
SET DOTNET_LOCAL_INSTALL_FOLDER=%LOCALAPPDATA%\Microsoft\dotnet\cli
|
||||
SET DOTNET_LOCAL_INSTALL_FOLDER_BIN=%DOTNET_LOCAL_INSTALL_FOLDER%\bin
|
||||
|
||||
CALL %~dp0dotnet-install.cmd -Channel %KOREBUILD_DOTNET_CHANNEL% -Version %KOREBUILD_DOTNET_VERSION%
|
||||
|
||||
ECHO Adding %DOTNET_LOCAL_INSTALL_FOLDER_BIN% to PATH
|
||||
SET PATH=%DOTNET_LOCAL_INSTALL_FOLDER_BIN%;%PATH%
|
||||
|
||||
REM ==== Temporary ====
|
||||
IF "%BUILDCMD_DNX_VERSION%"=="" (
|
||||
SET BUILDCMD_DNX_VERSION=latest
|
||||
)
|
||||
IF "%SKIP_DNX_INSTALL%"=="" (
|
||||
CALL %KOREBUILD_FOLDER%\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default
|
||||
CALL %KOREBUILD_FOLDER%\build\dnvm install default -runtime CLR -arch x86 -alias default
|
||||
) ELSE (
|
||||
CALL %KOREBUILD_FOLDER%\build\dnvm use default -runtime CLR -arch x86
|
||||
)
|
||||
REM ============================
|
||||
|
||||
:SKIP_RUNTIME_INSTALL
|
||||
|
||||
SET MAKEFILE_PATH=makefile.shade
|
||||
IF NOT EXIST %MAKEFILE_PATH% (
|
||||
SET MAKEFILE_PATH=%KOREBUILD_FOLDER%\build\makefile.shade
|
||||
)
|
||||
ECHO Using makefile: %MAKEFILE_PATH%
|
||||
|
||||
|
||||
REM Don't use full paths. Sake doesn't support them!
|
||||
"%~dp0Sake\tools\Sake.exe" -I %KOREBUILD_FOLDER%\build -f %MAKEFILE_PATH% %*
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
[ -z "$KOREBUILD_DOTNET_CHANNEL" ] && KOREBUILD_DOTNET_CHANNEL=beta
|
||||
[ -z "$KOREBUILD_DOTNET_VERSION" ] && KOREBUILD_DOTNET_VERSION=1.0.0.001540
|
||||
|
||||
targets=""
|
||||
filename=$0
|
||||
while [[ $# > 0 ]]; do
|
||||
case $1 in
|
||||
-m)
|
||||
shift
|
||||
makeFilePath=$1
|
||||
;;
|
||||
-n)
|
||||
shift
|
||||
nugetPath=$1
|
||||
;;
|
||||
*)
|
||||
targets+=" $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ ! -e "$nugetPath" ] || [ ! -e "$makeFilePath" ]; then
|
||||
printf "Usage: $filename -m [makefile] -n [nuget] [ [targets] ]\n\n"
|
||||
echo " -m [makefile] The makefile.shade to execute"
|
||||
echo " -n [nuget] nuget.exe"
|
||||
echo " [targets] A space separated list of targets to run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ==== find directory containing this file =====
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
thisDir="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
# ===================
|
||||
|
||||
|
||||
sakeFolder=$thisDir/Sake
|
||||
if [ ! -d $sakeFolder ]; then
|
||||
mono $nugetPath install Sake -ExcludeVersion -o $thisDir -nocache
|
||||
fi
|
||||
if [ ! -d $thisDir/xunit.runner.console ]; then
|
||||
mono $nugetPath install xunit.runner.console -ExcludeVersion -o $thisDir -nocache
|
||||
fi
|
||||
if [ ! -d $thisDir/xunit.core ]; then
|
||||
mono $nugetPath install xunit.core -ExcludeVersion -o $thisDir -nocache
|
||||
fi
|
||||
|
||||
if [ ! -z "$KOREBUILD_SKIP_RUNTIME_INSTALL" ]; then
|
||||
echo "Skipping runtime installation because KOREBUILD_SKIP_RUNTIME_INSTALL is set"
|
||||
else
|
||||
# Need to set this variable because by default the install script
|
||||
# requires sudo
|
||||
export DOTNET_INSTALL_DIR=~/.dotnet
|
||||
export PATH=$DOTNET_INSTALL_DIR/bin:$PATH
|
||||
export KOREBUILD_FOLDER="$(dirname $thisDir)"
|
||||
chmod +x $thisDir/dotnet-install.sh
|
||||
$thisDir/dotnet-install.sh --channel $KOREBUILD_DOTNET_CHANNEL --version $KOREBUILD_DOTNET_VERSION
|
||||
# ==== Temporary ====
|
||||
if ! type dnvm > /dev/null 2>&1; then
|
||||
source $thisDir/dnvm.sh
|
||||
fi
|
||||
if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then
|
||||
dnvm install latest -runtime coreclr -alias default
|
||||
dnvm install default -runtime mono -alias default
|
||||
else
|
||||
dnvm use default -runtime mono
|
||||
fi
|
||||
# ============
|
||||
fi
|
||||
|
||||
# Probe for Mono Reference assemblies
|
||||
if [ -z "$DOTNET_REFERENCE_ASSEMBLIES_PATH" ]; then
|
||||
if [ $(uname) == Darwin ] && [ -d "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks" ]; then
|
||||
export DOTNET_REFERENCE_ASSEMBLIES_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks"
|
||||
elif [ -d "/usr/local/lib/mono/xbuild-frameworks" ]; then
|
||||
export DOTNET_REFERENCE_ASSEMBLIES_PATH="/usr/local/lib/mono/xbuild-frameworks"
|
||||
elif [ -d "/usr/lib/mono/xbuild-frameworks" ]; then
|
||||
export DOTNET_REFERENCE_ASSEMBLIES_PATH="/usr/lib/mono/xbuild-frameworks"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
ulimit -n 2048
|
||||
fi
|
||||
|
||||
echo "Using Reference Assemblies from: $DOTNET_REFERENCE_ASSEMBLIES_PATH"
|
||||
mono $sakeFolder/tools/Sake.exe -I $thisDir -f $makeFilePath $targets
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
default ASM_DIFF='${Environment.GetEnvironmentVariable("ASM_DIFF")}'
|
||||
default outFile = "artifacts\default.html"
|
||||
@{
|
||||
if (String.IsNullOrEmpty(ASM_DIFF))
|
||||
{
|
||||
Log.Warn("ASM_DIFF environment variable not set.");
|
||||
Environment.Exit(-1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
exec program='${ASM_DIFF}' commandline='${oldBinariesDir} ${newBinariesDir} -adm -out:${outFile}'
|
||||
|
||||
@{
|
||||
if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")))
|
||||
{
|
||||
var message = File.ReadAllText(outFile)
|
||||
.Replace("|", "||")
|
||||
.Replace("'", "|'")
|
||||
.Replace("\r", "|r")
|
||||
.Replace("\n", "|n")
|
||||
.Replace("]", "|]");
|
||||
Log.Info("##teamcity[message text='" + message + "' status='WARNING']");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
var bowerLibrary = '${ Path.Combine(nodeDir, "node_modules", "bower", "bin", "bower") }'
|
||||
var bowerInstalled = '${ File.Exists(bowerLibrary) }'
|
||||
|
||||
default bowerGloballyInstalled = '${ !bowerInstalled && TestCommand("bower", "--version --config.interactive=false") }'
|
||||
var bowerCmd = '${ bowerGloballyInstalled ? "bower" : bowerLibrary }'
|
||||
|
||||
- // Turn off Bower's Insight reporting since this usage is scripted.
|
||||
- bowerCommand = bowerCommand + " --config.interactive=false";
|
||||
|
||||
- // Install bower locally if not already installed either globally or locally; creates bowerLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" bower'
|
||||
npm npmCommand='${installCommand}' if='!(bowerGloballyInstalled || bowerInstalled)' once='installBower'
|
||||
|
||||
- // Run bower
|
||||
exec program='cmd' commandline='/C ${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && !IsLinux'
|
||||
exec program='${bowerCmd}' commandline='${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${bowerCmd}" ${bowerCommand}' workingdir='${bowerDir}' if='!bowerGloballyInstalled'
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
use import="Files"
|
||||
|
||||
default include='**/*.*'
|
||||
default exclude=''
|
||||
default overwrite='${ false }'
|
||||
|
||||
@{
|
||||
var copyFiles = Files.BasePath(Path.GetFullPath(sourceDir));
|
||||
if (!string.IsNullOrEmpty(include))
|
||||
{
|
||||
copyFiles = copyFiles.Include(include);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(exclude))
|
||||
{
|
||||
copyFiles = copyFiles.Exclude(exclude);
|
||||
}
|
||||
|
||||
foreach(var copyFile in copyFiles)
|
||||
{
|
||||
if (!Quiet)
|
||||
{
|
||||
Log.Info(string.Format("Copying {0}", copyFile));
|
||||
}
|
||||
|
||||
var sourceFile = Path.Combine(sourceDir, copyFile);
|
||||
var outputFile = Path.Combine(outputDir, copyFile);
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFile)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
|
||||
}
|
||||
|
||||
File.Copy(sourceFile, outputFile, overwrite);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
use import="Json"
|
||||
use import="Environment"
|
||||
|
||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||
|
||||
@{/*
|
||||
|
||||
dnx-test
|
||||
Run unit tests in your project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the test project.json to execute
|
||||
|
||||
framework=''
|
||||
Required. The TFM to run tests for
|
||||
|
||||
*/}
|
||||
|
||||
@{
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var projectName = Path.GetFileName(projectFolder);
|
||||
|
||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||
{
|
||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||
}
|
||||
|
||||
var testArgs = noParallelTestProjects.Contains(projectName) || IsLinux ? " -parallel none" : "";
|
||||
|
||||
if (framework.StartsWith("dnxcore", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Dnx("test" + testArgs, projectFolder, "default -runtime coreclr");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dnx
|
||||
Run dnx commands in your project. Executes `dnx` command.
|
||||
|
||||
command=''
|
||||
The `dnx` subcommand to execute.
|
||||
dnxDir=''
|
||||
Optional. The directory in which to execute the `dnx` command.
|
||||
dnvmUse=''
|
||||
Optional. The DNX framework to use. Suitable for a `dnvm run` or `dnvm use` command.
|
||||
*/}
|
||||
|
||||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default dnxDir = '${ currentDir }'
|
||||
|
||||
default dnvmUse=''
|
||||
var dnvmPath = '${ Path.Combine(Directory.GetCurrentDirectory(), ".build", "KoreBuild-dotnet", "build", "dnvm") }'
|
||||
|
||||
exec program='cmd' commandline='/C dnx ${command}' workingdir='${dnxDir}' if='!IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var cmdCommand = '/S /C ""${dnvmPath}.cmd" use ${dnvmUse} && dnx ${command}"'
|
||||
exec program='cmd' commandline='${ cmdCommand }' workingdir='${dnxDir}' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
exec program='dnx' commandline='${command}' workingdir='${dnxDir}' if='IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var envCommand = 'bash -c "source \"${dnvmPath}.sh\" && dnvm use ${dnvmUse} && dnx ${command}"'
|
||||
exec program='/usr/bin/env' commandline='${ envCommand }' workingdir='${dnxDir}' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dotnet-build
|
||||
Builds a project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
default build_options=' ${E("KOREBUILD_DOTNET_BUILD_OPTIONS")}'
|
||||
|
||||
@{
|
||||
var projectFolder=Path.GetDirectoryName(projectFile);
|
||||
var projectBin=Path.Combine(projectFolder, "bin", configuration);
|
||||
|
||||
DeleteFolder(projectBin);
|
||||
|
||||
var dotnetArgs=string.Format("build{0} {1} --configuration {2}", build_options, projectFolder, configuration);
|
||||
Dotnet(dotnetArgs);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dotnet-pack
|
||||
Builds package from project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
dotnetPackOutputDir=''
|
||||
Required. Base output directory.
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
default pack_options=' ${E("KOREBUILD_DOTNET_PACK_OPTIONS")}'
|
||||
|
||||
@{
|
||||
var projectFolder=Path.GetDirectoryName(projectFile);
|
||||
var projectName=Path.GetFileName(projectFolder);
|
||||
var projectBin=Path.Combine(projectFolder, "bin");
|
||||
|
||||
if (IsLinux)
|
||||
{
|
||||
projectBin = Path.Combine(projectBin, configuration);
|
||||
}
|
||||
|
||||
DeleteFolder(projectBin);
|
||||
|
||||
var dotnetArgs=string.Format("pack{0} {1} --configuration {2}", pack_options, projectFolder, configuration);
|
||||
Dotnet(dotnetArgs);
|
||||
|
||||
CopyFolder(projectBin, Path.Combine(dotnetPackOutputDir, projectName), true);
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dotnet-publish
|
||||
Builds package from project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
outputFolder=''
|
||||
Optional. The output folder.
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
|
||||
framework=''
|
||||
Optional. The framework to publish
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
|
||||
@{
|
||||
var projectFolder=Path.GetDirectoryName(projectFile);
|
||||
var projectName=Path.GetFileName(projectFolder);
|
||||
var projectBin=Path.Combine(projectFolder, "bin", configuration);
|
||||
|
||||
var outputArg = string.IsNullOrEmpty(outputFolder) ? "" : "--output " + outputFolder;
|
||||
var frameworkArg = "";
|
||||
if (!string.IsNullOrEmpty(framework))
|
||||
{
|
||||
frameworkArg = "--framework " + framework;
|
||||
projectBin = Path.Combine(projectBin, framework);
|
||||
}
|
||||
|
||||
DeleteFolder(projectBin);
|
||||
|
||||
var dotnetArgs = string.Format("publish --configuration {0} {1} {2} {3}", configuration, frameworkArg, outputArg, projectFolder);
|
||||
Dotnet(dotnetArgs);
|
||||
}
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dotnet-restore
|
||||
Restores nuget packages required for dotnet projects. Downloads and executes dotnet sdk tools.
|
||||
|
||||
restoreDir=''
|
||||
Optional. The directory in which to execute the dnu restore command.
|
||||
*/}
|
||||
|
||||
default currentDir = '${ Directory.GetCurrentDirectory() }'
|
||||
default restoreDir = '${ currentDir }'
|
||||
|
||||
default restore_options=' ${ E("KOREBUILD_DOTNET_RESTORE_OPTIONS") }'
|
||||
|
||||
dotnet command='restore${ restore_options }' workingDir='${ restoreDir }'
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
use import="Environment"
|
||||
|
||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||
|
||||
@{/*
|
||||
|
||||
dotnet-test
|
||||
Run unit tests in your project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the test project.json to execute
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
|
||||
@{
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var projectName = Path.GetFileName(projectFolder);
|
||||
|
||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||
{
|
||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||
}
|
||||
|
||||
var testArgs = " --configuration " + configuration;
|
||||
testArgs += noParallelTestProjects.Contains(projectName) || IsLinux ? " -parallel none" : "";
|
||||
Dotnet("test" + testArgs, projectFolder);
|
||||
}
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dotnet
|
||||
Run dotnet commands in your project. Executes `dotnet` command.
|
||||
|
||||
command=''
|
||||
The `dotnet` subcommand to execute.
|
||||
dotnetDir=''
|
||||
Optional. The directory in which to execute the `dotnet` command.
|
||||
*/}
|
||||
|
||||
@{
|
||||
//temporary delete cross-gen files
|
||||
var installDir = Environment.GetEnvironmentVariable("DOTNET_INSTALL_DIR");
|
||||
if (string.IsNullOrEmpty(installDir))
|
||||
{
|
||||
installDir = Path.Combine(Environment.GetEnvironmentVariable("LocalAppData"), "Microsoft", "dotnet", "cli");
|
||||
}
|
||||
|
||||
if (IsLinux)
|
||||
{
|
||||
var files = Directory.GetFiles(installDir, "*.ni.*", SearchOption.AllDirectories);
|
||||
foreach (var file in files.Where(f => !f.Contains("mscorlib")))
|
||||
{
|
||||
Console.WriteLine("Deleting {0}", file);
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default dotnetDir = '${ currentDir }'
|
||||
|
||||
exec program='dotnet' commandline='${command}' workingdir='${dotnetDir}'
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
|
||||
|
||||
default gitBranch=''
|
||||
|
||||
var gitCommand='clone --quiet ${gitUri}'
|
||||
set gitCommand='${gitCommand} --branch ${gitBranch}' if='!string.IsNullOrEmpty(gitBranch)'
|
||||
|
||||
git
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
var gitCommand='config ${gitOptionName} ${gitOptionValue}'
|
||||
|
||||
git
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
|
||||
default gitBranch=''
|
||||
|
||||
var gitCommand='pull --quiet --ff-only ${gitUri}'
|
||||
set gitCommand='${gitCommand} ${gitBranch}:${gitBranch}' if='!string.IsNullOrEmpty(gitBranch)'
|
||||
|
||||
git
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
default gitFolder=''
|
||||
|
||||
-// Use cmd to invoke git so that people who have git as a 'cmd'
|
||||
exec program='cmd' commandline='/C git ${gitCommand}' workingdir='${gitFolder}' if='!IsLinux'
|
||||
exec program='git' commandline='${gitCommand}' workingdir='${gitFolder}' if='IsLinux'
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
var gruntCliLibrary = '${ Path.Combine(nodeDir, "node_modules", "grunt-cli", "bin", "grunt") }'
|
||||
var gruntCliInstalled = '${ File.Exists(gruntCliLibrary) }'
|
||||
|
||||
default gruntCliGloballyInstalled = '${ !gruntCliInstalled && TestCommand("grunt", "--version") }'
|
||||
var gruntCmd = '${ gruntCliGloballyInstalled ? "grunt" : gruntCliLibrary }'
|
||||
|
||||
- // Install grunt-cli locally if not already installed either globally or locally; creates gruntCliLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" grunt-cli'
|
||||
npm npmCommand='${installCommand}' if='!(gruntCliGloballyInstalled || gruntCliInstalled)' once='installGruntCli'
|
||||
|
||||
-// Run grunt-cli
|
||||
exec program='cmd' commandline='/C ${gruntCmd}' workingdir='${gruntDir}' if='gruntCliGloballyInstalled && !IsLinux'
|
||||
exec program='${gruntCmd}' workingdir='${gruntDir}' if='gruntCliGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${gruntCmd}"' workingdir='${gruntDir}' if='!gruntCliGloballyInstalled'
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
@{/*
|
||||
|
||||
k-clean
|
||||
Cleans project. Downloads and executes k sdk tools.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
*/}
|
||||
|
||||
var projectFolder='${Path.GetDirectoryName(projectFile)}'
|
||||
|
||||
directory delete='${Path.Combine(projectFolder, "bin")}'
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
use namespace="System"
|
||||
use namespace="System.Collections.Generic"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.Linq"
|
||||
use namespace="System.Text"
|
||||
use namespace="System.Xml.Linq"
|
||||
|
||||
default resxFile=''
|
||||
|
||||
@{
|
||||
var projectDir = Path.GetDirectoryName(resxFile);
|
||||
var outDirectory = Path.Combine(projectDir, "Properties");
|
||||
var projectName = Path.GetFileName(projectDir.TrimEnd((char)'/'));
|
||||
var namedParameterMatcher = new Regex(@"\{([a-z]\w+)\}", RegexOptions.IgnoreCase);
|
||||
var numberParameterMatcher = new Regex(@"\{(\d+)\}");
|
||||
var generatingEnvironment = new StringBuilder();
|
||||
|
||||
var fileName = Path.GetFileNameWithoutExtension(resxFile);
|
||||
var resourceStrings = new List<ResourceData>();
|
||||
var xml = XDocument.Load(resxFile);
|
||||
|
||||
foreach (var entry in xml.Descendants("data"))
|
||||
{
|
||||
var name = entry.Attribute("name").Value;
|
||||
var value = entry.Element("value").Value;
|
||||
|
||||
bool usingNamedArgs = true;
|
||||
var match = namedParameterMatcher.Matches(value);
|
||||
if (match.Count == 0)
|
||||
{
|
||||
usingNamedArgs = false;
|
||||
match = numberParameterMatcher.Matches(value);
|
||||
}
|
||||
|
||||
var arguments = match.Cast<Match>()
|
||||
.Select(m => m.Groups[1].Value)
|
||||
.Distinct();
|
||||
if (!usingNamedArgs)
|
||||
{
|
||||
arguments = arguments.OrderBy(Convert.ToInt32);
|
||||
}
|
||||
|
||||
resourceStrings.Add(
|
||||
new ResourceData
|
||||
{
|
||||
Name = name,
|
||||
Value = value,
|
||||
Arguments = arguments.ToList(),
|
||||
UsingNamedArgs = usingNamedArgs
|
||||
});
|
||||
}
|
||||
|
||||
generatingEnvironment.AppendFormat(
|
||||
@"// <auto-generated />
|
||||
namespace {0}
|
||||
{{
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
internal static class {1}
|
||||
{{
|
||||
private static readonly ResourceManager _resourceManager
|
||||
= new ResourceManager(""{0}.{1}"", typeof({1}).GetTypeInfo().Assembly);
|
||||
", projectName, fileName);
|
||||
|
||||
foreach (var resourceString in resourceStrings)
|
||||
{
|
||||
generatingEnvironment.AppendLine();
|
||||
RenderHeader(generatingEnvironment, resourceString);
|
||||
RenderProperty(generatingEnvironment, resourceString);
|
||||
|
||||
generatingEnvironment.AppendLine();
|
||||
RenderHeader(generatingEnvironment, resourceString);
|
||||
RenderFormatMethod(generatingEnvironment, resourceString);
|
||||
}
|
||||
|
||||
generatingEnvironment.Append(@"
|
||||
private static string GetString(string name, params string[] formatterNames)
|
||||
{
|
||||
var value = _resourceManager.GetString(name);
|
||||
|
||||
System.Diagnostics.Debug.Assert(value != null);
|
||||
|
||||
if (formatterNames != null)
|
||||
{
|
||||
for (var i = 0; i < formatterNames.Length; i++)
|
||||
{
|
||||
value = value.Replace(""{"" + formatterNames[i] + ""}"", ""{"" + i + ""}"");
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
Directory.CreateDirectory(outDirectory);
|
||||
var outputPath = Path.Combine(outDirectory, fileName + ".Designer.cs");
|
||||
|
||||
File.WriteAllText(outputPath, generatingEnvironment.ToString());
|
||||
}
|
||||
|
||||
functions @{
|
||||
private static void RenderHeader(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.Append(" /// <summary>")
|
||||
.AppendLine();
|
||||
foreach (var line in resourceString.Value.Split(new[] { '\n' }, StringSplitOptions.None))
|
||||
{
|
||||
builder.AppendFormat(" /// {0}", new XText(line))
|
||||
.AppendLine();
|
||||
}
|
||||
builder.Append(" /// </summary>")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
private static void RenderProperty(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string {0}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" {")
|
||||
.AppendFormat(@" get {{ return GetString(""{0}""); }}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
private static void RenderFormatMethod(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string Format{0}({1})", resourceString.Name, resourceString.Parameters)
|
||||
.AppendLine()
|
||||
.AppendLine(" {");
|
||||
if(resourceString.Arguments.Count > 0)
|
||||
{
|
||||
builder.AppendFormat(@" return string.Format(CultureInfo.CurrentCulture, GetString(""{0}""{1}), {2});",
|
||||
resourceString.Name,
|
||||
resourceString.UsingNamedArgs ? ", " + resourceString.FormatArguments : null,
|
||||
resourceString.ArgumentNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendFormat(@" return GetString(""{0}"");", resourceString.Name);
|
||||
}
|
||||
builder.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
private class ResourceData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public List<string> Arguments { get; set; }
|
||||
|
||||
public bool UsingNamedArgs { get; set; }
|
||||
|
||||
public string FormatArguments
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "\"" + a + "\"")); }
|
||||
}
|
||||
|
||||
public string ArgumentNames
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(GetArgName)); }
|
||||
}
|
||||
|
||||
public string Parameters
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "object " + GetArgName(a))); }
|
||||
}
|
||||
|
||||
public string GetArgName(string name)
|
||||
{
|
||||
return UsingNamedArgs ? name : 'p' + name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,391 +0,0 @@
|
|||
use assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
use namespace="System"
|
||||
use namespace="System.Globalization"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.Linq"
|
||||
use import="BuildEnv"
|
||||
use import="Environment"
|
||||
use import="Files"
|
||||
use import="Json"
|
||||
use-teamcity
|
||||
|
||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
|
||||
default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
|
||||
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'
|
||||
default Configuration='${E("Configuration")}'
|
||||
default PACKAGELIST_JSON_FILENAME = 'NuGetPackageVerifier.json'
|
||||
default DNX_TOOLS_FEED = 'https://www.myget.org/F/dnxtools/api/v3/index.json'
|
||||
default NUGET_FEED = 'https://api.nuget.org/v3/index.json'
|
||||
|
||||
@{
|
||||
if (string.IsNullOrEmpty(E("DOTNET_BUILD_VERSION")))
|
||||
{
|
||||
E("DOTNET_BUILD_VERSION", BuildNumber);
|
||||
}
|
||||
if (string.IsNullOrEmpty(E("DOTNET_AUTHOR")))
|
||||
{
|
||||
E("DOTNET_AUTHOR", AUTHORS);
|
||||
}
|
||||
if (string.IsNullOrEmpty(E("DOTNET_ASSEMBLY_FILE_VERSION")))
|
||||
{
|
||||
E("DOTNET_ASSEMBLY_FILE_VERSION", CreateDayBasedVersionNumber());
|
||||
}
|
||||
if (string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
Configuration = "Debug";
|
||||
E("Configuration", Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
#restore-npm-modules
|
||||
-// Find all dirs that contain a package.json file
|
||||
var npmDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json")}'
|
||||
npm npmCommand='install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")}' each='var npmDir in npmDirs'
|
||||
|
||||
#restore-bower-components
|
||||
-// Find all dirs that contain a bower.json file
|
||||
var bowerDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "bower.json")}'
|
||||
bower each='var bowerDir in bowerDirs' bowerCommand='install ${E("KOREBUILD_BOWER_INSTALL_OPTIONS")}'
|
||||
|
||||
#run-grunt .restore-npm-modules .restore-bower-components target='initialize'
|
||||
-// Find all dirs that contain a gruntfile.js file
|
||||
var gruntDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "gruntfile.js")}'
|
||||
grunt each='var gruntDir in gruntDirs'
|
||||
|
||||
#clean-bin-folder
|
||||
rimraf rimrafDir='bin' if='Directory.Exists("bin")'
|
||||
|
||||
#clean-npm-modules
|
||||
-// Find all dirs that contain a package.json file
|
||||
var npmDirs = '${
|
||||
GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json")
|
||||
.Select(directory => Path.Combine(directory, "node_modules"))
|
||||
.Where(directory => Directory.Exists(directory))
|
||||
}'
|
||||
rimraf each='var rimrafDir in npmDirs'
|
||||
|
||||
-// Target order is important because clean-npm-modules may (re)create bin folder.
|
||||
#deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.'
|
||||
|
||||
#repo-initialize target='initialize'
|
||||
use-volatile-feed
|
||||
dotnet-restore if='!NoRestore'
|
||||
|
||||
#target-dir-clean target='clean'
|
||||
@{
|
||||
if (Directory.Exists(TARGET_DIR))
|
||||
{
|
||||
var directory = new DirectoryInfo(TARGET_DIR);
|
||||
directory.Attributes &= ~FileAttributes.ReadOnly;
|
||||
|
||||
foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories))
|
||||
{
|
||||
info.Attributes &= ~FileAttributes.ReadOnly;
|
||||
}
|
||||
|
||||
directory.Delete(true);
|
||||
}
|
||||
}
|
||||
|
||||
#build-clean if='Directory.Exists("src")'
|
||||
k-clean each='var projectFile in Files.Include("src/*/project.json")'
|
||||
|
||||
#ci-deep-clean .deep-clean target='clean' if='IsTeamCity'
|
||||
|
||||
#build-compile target='compile' if='Directory.Exists("src")'
|
||||
@{
|
||||
var projectFiles = Files.Include("src/*/project.json").ToList();
|
||||
projectFiles.ForEach(projectFile => DotnetPack(projectFile, BUILD_DIR, Configuration));
|
||||
|
||||
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/" + Configuration + "/*.nupkg")))
|
||||
{
|
||||
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
||||
}
|
||||
}
|
||||
|
||||
#build-test target='compile' if='Directory.Exists("test") && !BuildSrcOnly'
|
||||
@{
|
||||
var projectFiles = Files.Include("test/*/project.json").ToList();
|
||||
projectFiles.ForEach(projectFile => DotnetBuild(projectFile, Configuration));
|
||||
}
|
||||
|
||||
#build-samples target='compile' if='Directory.Exists("samples") && !BuildSrcOnly'
|
||||
@{
|
||||
var projectFiles = Files.Include("samples/*/project.json").ToList();
|
||||
projectFiles.ForEach(projectFile => DotnetBuild(projectFile, Configuration));
|
||||
}
|
||||
|
||||
#native-compile target='compile' if='!IsLinux && Directory.Exists(Path.Combine(BASE_DIR, "src"))'
|
||||
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
||||
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
|
||||
|
||||
@{
|
||||
if (nativeProjects.Any())
|
||||
{
|
||||
var msbuildVersions = new[] { "14.0", "12.0"};
|
||||
|
||||
for (var i = 0; i < msbuildVersions.Length; i++)
|
||||
{
|
||||
var msbuildPath = Path.Combine(programFilesX86, "MSBuild", msbuildVersions[i], "Bin", "MSBuild.exe");
|
||||
if (File.Exists(msbuildPath))
|
||||
{
|
||||
var commonParameters =
|
||||
" /p:Configuration=" + Configuration +
|
||||
" /p:ProductVersion=1.0.0" +
|
||||
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
|
||||
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
|
||||
|
||||
foreach (var project in nativeProjects)
|
||||
{
|
||||
Exec(msbuildPath, project + " /p:Platform=Win32" + commonParameters);
|
||||
Exec(msbuildPath, project + " /p:Platform=x64" + commonParameters);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == msbuildVersions.Length - 1)
|
||||
{
|
||||
Log.Warn("msbuild version 14 or 12 not found. Please ensure you have the VS 2015 or VS 2013 C++ SDK installed.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copy sourceDir='${Path.GetDirectoryName(project)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR, Path.GetFileNameWithoutExtension(project))}' overwrite='${true}' each='var project in nativeProjects'
|
||||
|
||||
#nuget-verify target='package' if='File.Exists(PACKAGELIST_JSON_FILENAME) && ShouldVerifyNupkgs' description='Verify if all the packages are generated properly'
|
||||
var commandsDirectory = '${Path.Combine(BASE_DIR, "commands")}'
|
||||
exec program='.build/NuGet.exe' commandline='install -ExcludeVersion -pre NuGetPackageVerifier -Source ${DNX_TOOLS_FEED} -out ${commandsDirectory}'
|
||||
exec program='${Path.Combine(commandsDirectory, "NuGetPackageVerifier", "NuGetPackageVerifier.exe")}' commandline='"${BUILD_DIR}" "${Path.Combine(BASE_DIR, PACKAGELIST_JSON_FILENAME)}"'
|
||||
@{
|
||||
if (Directory.Exists(commandsDirectory))
|
||||
{
|
||||
Directory.Delete(commandsDirectory, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
#nuget-install target='install' description='Install NuGet packages to local repo'
|
||||
-if (Directory.Exists("src")) {
|
||||
nuget-packages-add sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}'
|
||||
nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))'
|
||||
-}
|
||||
|
||||
#xunit-test target='test' if='Directory.Exists("test")'
|
||||
@{
|
||||
var projectFiles = Files.Include("test/*/project.json");
|
||||
foreach (var projectFile in projectFiles)
|
||||
{
|
||||
var projectText = File.ReadAllText(projectFile);
|
||||
var project = (JsonObject)Json.Deserialize(projectText);
|
||||
var configs = project.ValueAsJsonObject("frameworks");
|
||||
var targetFrameworks = configs == null ? new string[0] : configs.Keys;
|
||||
|
||||
var net45TFM = targetFrameworks.FirstOrDefault(t => t.StartsWith("net45", StringComparison.OrdinalIgnoreCase));
|
||||
var dnx451TFM = targetFrameworks.FirstOrDefault(t => t.Equals("dnx451", StringComparison.OrdinalIgnoreCase));
|
||||
var dnxCore50TFM = targetFrameworks.FirstOrDefault(t => t.Equals("dnxcore50", StringComparison.OrdinalIgnoreCase));
|
||||
if (dnxCore50TFM != null && project.Keys.Contains("testRunner"))
|
||||
{
|
||||
DotnetTest(projectFile, Configuration);
|
||||
}
|
||||
|
||||
if (project.Keys.Contains("testRunner"))
|
||||
{
|
||||
if (net45TFM != null)
|
||||
{
|
||||
XunitTest(projectFile, net45TFM, Configuration);
|
||||
}
|
||||
else if (dnx451TFM != null)
|
||||
{
|
||||
XunitTest(projectFile, dnx451TFM, Configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#make-roslyn-fast
|
||||
ngen-roslyn
|
||||
|
||||
#resx
|
||||
@{
|
||||
var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures | CultureTypes.InstalledWin32Cultures | CultureTypes.SpecificCultures);
|
||||
foreach (var file in Directory.EnumerateFiles(BASE_DIR, "*.resx", SearchOption.AllDirectories))
|
||||
{
|
||||
var splitFileName = Path.GetFileNameWithoutExtension(file).Split(new string[] { "." }, StringSplitOptions.None);
|
||||
|
||||
if (splitFileName.Length > 1)
|
||||
{
|
||||
var localeString = splitFileName.Last();
|
||||
if (!cultures.Any(c => localeString.Equals(c.Name)))
|
||||
{
|
||||
UpdateResx(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateResx(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#--no-restore
|
||||
@{ NoRestore = true; }
|
||||
|
||||
#--quiet
|
||||
@{
|
||||
AddToE("KOREBUILD_DOTNET_RESTORE_OPTIONS", "--verbosity minimal");
|
||||
AddToE("KOREBUILD_BOWER_INSTALL_OPTIONS", "--quiet");
|
||||
AddToE("KOREBUILD_NPM_INSTALL_OPTIONS", "--quiet");
|
||||
Quiet = true;
|
||||
}
|
||||
|
||||
#--parallel
|
||||
@{
|
||||
Log.Warn("The --parallel flag is no longer supported. It will be ignored.");
|
||||
}
|
||||
|
||||
#--test-dnxcore
|
||||
@{
|
||||
Log.Warn("The --test-dnxcore flag is no longer supported. It will be ignored.");
|
||||
}
|
||||
|
||||
functions @{
|
||||
private static bool Quiet { get; set; }
|
||||
private static bool NoRestore { get; set; }
|
||||
|
||||
string E(string key) { return Environment.GetEnvironmentVariable(key); }
|
||||
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
|
||||
void AddToE(string key, string append)
|
||||
{
|
||||
var original = E(key);
|
||||
if (string.IsNullOrEmpty(original))
|
||||
{
|
||||
E(key, append);
|
||||
}
|
||||
else
|
||||
{
|
||||
E(key, original + " " + append);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<string> GetDirectoriesContaining(string path, string searchPattern)
|
||||
{
|
||||
var sep = Path.DirectorySeparatorChar;
|
||||
// Don't include directories that are children of a node_modules or bower_components directory
|
||||
return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories)
|
||||
.Where(p => p.IndexOf(sep + "node_modules" + sep) < 0 &&
|
||||
p.IndexOf(sep + "bower_components" + sep) < 0 &&
|
||||
p.IndexOf(sep + "wwwroot" + sep + "lib" + sep) < 0)
|
||||
.Select(p => Path.GetDirectoryName(p))
|
||||
.Distinct();
|
||||
}
|
||||
|
||||
bool TestCommand(string program, string commandline)
|
||||
{
|
||||
// Tests whether a given command succeeds at the command line.
|
||||
// Useful for testing whether a given command is installed and on the path, e.g. node
|
||||
ProcessStartInfo processStartInfo;
|
||||
|
||||
if(!IsLinux)
|
||||
{
|
||||
processStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
FileName = "cmd",
|
||||
Arguments = "/C " + program + " " + commandline,
|
||||
};
|
||||
} else
|
||||
{
|
||||
processStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
FileName = program,
|
||||
Arguments = commandline,
|
||||
};
|
||||
}
|
||||
try
|
||||
{
|
||||
Log.Info(string.Format("Testing for command: {0} {1}", program, commandline));
|
||||
var process = Process.Start(processStartInfo);
|
||||
process.WaitForExit();
|
||||
if (process.ExitCode == 0)
|
||||
{
|
||||
Log.Info(" command found (0 exit code)");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warn(" command not found (non-0 exit code)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn(" command exception: " + ex.ToString());
|
||||
Log.Warn(" command not found");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ShouldVerifyNupkgs
|
||||
{
|
||||
get { return E("KOREBUILD_VERIFY_NUPKGS") == "1"; }
|
||||
}
|
||||
|
||||
bool BuildSrcOnly
|
||||
{
|
||||
get { return E("KOREBUILD_BUILD_SRC_ONLY") == "1"; }
|
||||
}
|
||||
}
|
||||
|
||||
macro name='Exec' program='string' commandline='string'
|
||||
exec
|
||||
|
||||
macro name='Exec' program='string' commandline='string' workingdir='string'
|
||||
exec
|
||||
|
||||
macro name='ExecClr' program='string' commandline='string'
|
||||
exec-clr
|
||||
|
||||
macro name='ExecClr' program='string' commandline='string' workingdir='string'
|
||||
exec-clr
|
||||
|
||||
macro name="DeleteFolder" delete='string'
|
||||
directory
|
||||
|
||||
macro name="Copy" sourceDir='string' outputDir='string' include='string' overwrite='bool'
|
||||
copy
|
||||
|
||||
macro name="CopyFolder" sourceDir='string' outputDir='string' overwrite='bool'
|
||||
copy
|
||||
|
||||
macro name='Dotnet' command='string'
|
||||
dotnet
|
||||
|
||||
macro name='Dotnet' command='string' dotnetDir='string'
|
||||
dotnet
|
||||
|
||||
macro name="DotnetBuild" projectFile='string' configuration='string'
|
||||
dotnet-build
|
||||
|
||||
macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' configuration='string'
|
||||
dotnet-pack
|
||||
|
||||
macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string' configuration='string'
|
||||
dotnet-publish
|
||||
|
||||
macro name="DotnetTest" projectFile='string' configuration='string'
|
||||
dotnet-test
|
||||
|
||||
macro name="XunitTest" projectFile='string' framework='string' configuration='string'
|
||||
xunit-test
|
||||
|
||||
macro name='Dnx' command='string' dnxDir='string' dnvmUse='string'
|
||||
dnx
|
||||
|
||||
macro name="DnxTest" projectFile='string' framework='string' configuration='string'
|
||||
dnx-test
|
||||
|
||||
macro name="UpdateResx" resxFile='string'
|
||||
k-generate-resx
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
|
||||
use namespace="System"
|
||||
use namespace="System.Collections.Generic"
|
||||
use namespace="System.IO"
|
||||
use import="Files"
|
||||
|
||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
|
||||
@{
|
||||
var srcDir = Path.Combine(BASE_DIR, "src");
|
||||
foreach (var projectFile in Files.Include(Path.Combine(srcDir, "**", "project.json")))
|
||||
{
|
||||
var binDirectory = Path.Combine(Path.GetDirectoryName(projectFile), "bin");
|
||||
if (Directory.Exists(binDirectory))
|
||||
{
|
||||
foreach (var xmlFilePath in Files.Include(Path.Combine(binDirectory, "**", "*.xml")))
|
||||
{
|
||||
var errors = 0;
|
||||
var xmlLines = File.ReadAllLines(xmlFilePath);
|
||||
for (var linesIndex = 0; linesIndex < xmlLines.Length; linesIndex++)
|
||||
{
|
||||
var xmlLine = xmlLines[linesIndex].Trim();
|
||||
if (xmlLine.StartsWith("<!--"))
|
||||
{
|
||||
// Compiler only emits comments for syntax errors.
|
||||
if (errors == 0)
|
||||
{
|
||||
Log.Warn(string.Format("Invalid documentation syntax in {0}:", xmlFilePath));
|
||||
}
|
||||
|
||||
errors++;
|
||||
Log.Warn(string.Format(" {0}: {1}", linesIndex + 1, xmlLine));
|
||||
}
|
||||
else if (xmlLine.Contains("\"!:"))
|
||||
{
|
||||
// '!' is reference string error token.
|
||||
if (errors == 0)
|
||||
{
|
||||
Log.Warn(string.Format("Invalid documentation syntax in {0}:", xmlFilePath));
|
||||
}
|
||||
|
||||
errors++;
|
||||
Log.Warn(string.Format(" {0}: {1}", linesIndex + 1, xmlLine));
|
||||
}
|
||||
}
|
||||
|
||||
if (errors != 0)
|
||||
{
|
||||
Environment.Exit(errors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
var oldRoslynAssemblies='${new[] { "Microsoft.CodeAnalysis.CSharp",
|
||||
"Microsoft.CodeAnalysis",
|
||||
"System.Collections.Immutable",
|
||||
"System.Reflection.Metadata.Ecma335",
|
||||
"System.Reflection.Metadata" }}'
|
||||
|
||||
var roslynAssemblies='${new[] { "Microsoft.CodeAnalysis.CSharp",
|
||||
"Microsoft.CodeAnalysis",
|
||||
"System.Collections.Immutable",
|
||||
"System.Reflection.Metadata" }}'
|
||||
|
||||
var programFilesX86='${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
||||
var gacutil='${Path.Combine(programFilesX86, "Microsoft SDKs", "Windows", "v8.1A", "bin", "NETFX 4.5.1 Tools", "gacutil.exe")}'
|
||||
|
||||
var windir='${Environment.GetFolderPath(Environment.SpecialFolder.Windows)}'
|
||||
var ngen='${Path.Combine(windir, "Microsoft.NET", "Framework", "v4.0.30319", "ngen.exe")}'
|
||||
|
||||
var tempRoslynPackagesDir='bin\_roslyn'
|
||||
var tempRoslynDir='bin\_roslyn\all'
|
||||
|
||||
exec program='${gacutil}' commandline='/u ${p}' each='var p in oldRoslynAssemblies'
|
||||
|
||||
nuget-install package='Microsoft.CodeAnalysis.CSharp' outputDir='${tempRoslynPackagesDir}' extra='-pre -ExcludeVersion -nocache'
|
||||
|
||||
@{
|
||||
var binaries = Files.Include(Path.Combine(tempRoslynPackagesDir, "**", "*net45*", "*.dll"));
|
||||
Directory.CreateDirectory(tempRoslynDir);
|
||||
|
||||
foreach(var file in binaries)
|
||||
{
|
||||
File.Copy(file, Path.Combine(tempRoslynDir, Path.GetFileName(file)), true);
|
||||
}
|
||||
}
|
||||
|
||||
exec program='${ngen}' commandline='install ${tempRoslynDir}\${p}.dll' each='var p in roslynAssemblies'
|
||||
exec program='${gacutil}' commandline='/i ${tempRoslynDir}\${p}.dll' each='var p in roslynAssemblies'
|
||||
|
||||
directory delete='${tempRoslynPackagesDir}'
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.IO.Compression"
|
||||
use namespace="System.Net"
|
||||
|
||||
default binDir = '${Path.Combine(Directory.GetCurrentDirectory(), "bin")}'
|
||||
|
||||
-// When updating the node version you need to update the nodeExeSha to match what 'signtool.exe /pa /v node.exe' emits
|
||||
default nodeVer = '0.10.28'
|
||||
default npmVer = '1.4.9'
|
||||
default nodeExeSha = '628FFD6C3577068C00CEC9F6F897F0EC8F5212D9'
|
||||
default nodeDir = '${Path.Combine(binDir, "nodejs")}'
|
||||
|
||||
var nodeExe = 'node.exe'
|
||||
var npmZip = 'npm-${npmVer}.zip'
|
||||
var nodeDist = 'http://nodejs.org/dist/'
|
||||
var nodeUrl = '${nodeDist}v${nodeVer}/${nodeExe}'
|
||||
var npmUrl = '${nodeDist}npm/${npmZip}'
|
||||
var nodeInstallExePath = '${Path.Combine(nodeDir, nodeExe)}'
|
||||
var npmInstallZipPath = '${Path.Combine(nodeDir, npmZip)}'
|
||||
var nodeInstalled = '${ File.Exists(nodeInstallExePath) }'
|
||||
|
||||
default nodeGloballyInstalled = '${ !nodeInstalled && TestCommand("node", "--version") }'
|
||||
|
||||
-// Command simply fails on Linux if nodejs is not available.
|
||||
var doInstall = '${ !IsLinux && !(nodeGloballyInstalled || nodeInstalled) }'
|
||||
|
||||
@{
|
||||
if (doInstall) {
|
||||
Log.Info("Installing nodejs locally");
|
||||
|
||||
if (Directory.Exists(nodeDir))
|
||||
{
|
||||
Directory.Delete(nodeDir, recursive: true);
|
||||
}
|
||||
Directory.CreateDirectory(nodeDir);
|
||||
|
||||
// Download node
|
||||
var wc = new WebClient();
|
||||
|
||||
Log.Info(string.Format("Downloading {0} to {1}", nodeUrl, nodeInstallExePath));
|
||||
wc.DownloadFile(nodeUrl, nodeInstallExePath);
|
||||
|
||||
Log.Info(string.Format("Downloading {0} to {1}", npmUrl, npmInstallZipPath));
|
||||
wc.DownloadFile(npmUrl, npmInstallZipPath);
|
||||
|
||||
// Unzip npm
|
||||
Log.Info(string.Format("Unzipping npm to {0}", nodeDir));
|
||||
ZipFile.ExtractToDirectory(npmInstallZipPath, nodeDir);
|
||||
}
|
||||
}
|
||||
|
||||
verify-authenticode verifyFilePath='${nodeInstallExePath}' expectedHash='${nodeExeSha}' if='doInstall'
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "node")}'
|
||||
|
||||
node-install once='installNode'
|
||||
|
||||
var nodeExeFile = '${ Path.Combine(nodeDir, "node.exe") }'
|
||||
var nodeExePath = '${ File.Exists(nodeExeFile) ? nodeExeFile : "node" }'
|
||||
|
||||
exec program='${nodeExePath}' commandline='${nodeCommand}'
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
default npmDir = '${currentDir}'
|
||||
|
||||
node-install once='installNode'
|
||||
|
||||
var npmFile = '${ Path.Combine(nodeDir, "npm.cmd") }'
|
||||
var npmCmd = '${ File.Exists(npmFile) ? ("\"" + npmFile + "\"") : "npm" }'
|
||||
|
||||
- // Ensure nodeDir exists. npmCommand is likely a package installation targeting that directory.
|
||||
@{
|
||||
Directory.CreateDirectory(nodeDir);
|
||||
}
|
||||
|
||||
exec program='cmd' commandline='/S /C "${npmCmd} ${npmCommand}"' workingdir='${npmDir}' if='!IsLinux'
|
||||
exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
@{/*
|
||||
|
||||
nuget-local-publish
|
||||
Publishing nuget packages in the source directory to %USERPROFILE%\.nuget
|
||||
|
||||
sourcePackagesDir=''
|
||||
Directory of packages to publish to the local nuget feed
|
||||
|
||||
*/}
|
||||
|
||||
@{
|
||||
var HOME_DIR = Environment.GetEnvironmentVariable("HOME");
|
||||
if (string.IsNullOrEmpty(HOME_DIR))
|
||||
{
|
||||
HOME_DIR = Environment.GetEnvironmentVariable("HOMEDRIVE") +
|
||||
Environment.GetEnvironmentVariable("HOMEPATH");
|
||||
}
|
||||
}
|
||||
|
||||
copy sourceDir='${sourcePackagesDir}' include='*.nupkg' outputDir='${Path.Combine(HOME_DIR, ".nuget")}' overwrite='${true}'
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
@{/*
|
||||
|
||||
nuget-packages-add
|
||||
Installs packages to a NuGet v3 directory structure
|
||||
|
||||
sourcePackagesDir=''
|
||||
Required. Path to packages to install (skips symbol packages)
|
||||
|
||||
targetPackagesDir=''
|
||||
Optional. Path to publish packages.
|
||||
*/}
|
||||
|
||||
default targetPackagesDir=''
|
||||
|
||||
@{
|
||||
var packages = Directory.EnumerateFiles(sourcePackagesDir, "*.nupkg")
|
||||
.Where(p => !p.EndsWith(".symbols.nupkg"));
|
||||
|
||||
var nugetExePath = Environment.GetEnvironmentVariable("PUSH_NUGET_EXE");
|
||||
if (string.IsNullOrEmpty(nugetExePath))
|
||||
{
|
||||
nugetExePath = ".build/NuGet.exe";
|
||||
}
|
||||
|
||||
Parallel.ForEach(packages, package =>
|
||||
{
|
||||
ExecClr(nugetExePath, "add " + package + " -source " + targetPackagesDir + " -expand");
|
||||
});
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
use namespace="System.Threading.Tasks"
|
||||
|
||||
@{/*
|
||||
|
||||
nuget-resilient-publish
|
||||
Publishes NuGet packages with retries
|
||||
|
||||
sourcePackagesDir=''
|
||||
Required. Path to packages to push
|
||||
|
||||
nugetFeed=''
|
||||
Required. Feed to publish to.
|
||||
*/}
|
||||
|
||||
default apiKey='${Environment.GetEnvironmentVariable("APIKEY")}'
|
||||
default extra=''
|
||||
|
||||
var nugetArgs=''
|
||||
set nugetArgs='${nugetArgs} -ApiKey ${apiKey}' if='!string.IsNullOrEmpty(apiKey)'
|
||||
set nugetArgs='${nugetArgs} -Source ${nugetFeed}' if='!string.IsNullOrEmpty(nugetFeed)'
|
||||
set nugetArgs='${nugetArgs} ${extra}' if='!string.IsNullOrEmpty(extra)'
|
||||
|
||||
@{
|
||||
var packages = Directory.EnumerateFiles(sourcePackagesDir, "*.nupkg")
|
||||
.Where(p => !p.EndsWith(".symbols.nupkg"))
|
||||
.ToArray();
|
||||
|
||||
var nugetExePath = Environment.GetEnvironmentVariable("PUSH_NUGET_EXE");
|
||||
if (string.IsNullOrEmpty(nugetExePath))
|
||||
{
|
||||
nugetExePath = ".build/NuGet.exe";
|
||||
}
|
||||
|
||||
Parallel.ForEach(packages, package =>
|
||||
{
|
||||
var retries = 0;
|
||||
var packagePath = Path.Combine(sourcePackagesDir, package);
|
||||
start:
|
||||
try
|
||||
{
|
||||
ExecClr(nugetExePath, "push " + package + " " + nugetArgs);
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (++retries == 3)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
goto start;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default workingDir = '${ currentDir }'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
default rimrafLibrary = '${ Path.Combine(nodeDir, "node_modules", "rimraf", "bin.js") }'
|
||||
var rimrafInstalled = '${ File.Exists(rimrafLibrary) }'
|
||||
|
||||
default rimrafGloballyInstalled = '${ !rimrafInstalled && TestCommand("rimraf", "::") }'
|
||||
var rimrafCmd = '${ rimrafGloballyInstalled ? "rimraf" : rimrafLibrary }'
|
||||
|
||||
- // Install rimraf locally if not already installed either globally or locally; creates rimrafLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" rimraf'
|
||||
npm npmCommand='${installCommand}' if='!(rimrafGloballyInstalled || rimrafInstalled)' once='installRimraf'
|
||||
|
||||
- // Run rimraf
|
||||
exec program='cmd' commandline='/C ${rimrafCmd} "${rimrafDir}"' workingdir='${workingDir}' if='rimrafGloballyInstalled && !IsLinux'
|
||||
exec program='${rimrafCmd}' commandline='"${rimrafDir}"' workingdir='${workingDir}' if='rimrafGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${rimrafCmd}" "${rimrafDir}"' workingdir='${workingDir}' if='!rimrafGloballyInstalled'
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
-// Deletes a directory using robocopy such that long paths aren't an issue
|
||||
default parentDir = '${Directory.GetParent(dir).FullName}'
|
||||
default tempDir = '${Path.Combine(parentDir, "__emp_dir")}'
|
||||
default logFile = '${Path.Combine(parentDir, "robocopy-log.txt")}'
|
||||
|
||||
exec program='cmd' commandline='/C mkdir ${tempDir}'
|
||||
|
||||
@{
|
||||
var robocopyProcessStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = dir,
|
||||
FileName = "cmd",
|
||||
Arguments = "/C robocopy " + tempDir + " " + dir + " /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:" + logFile,
|
||||
};
|
||||
|
||||
var robocopyProcess = Process.Start(robocopyProcessStartInfo);
|
||||
robocopyProcess.WaitForExit();
|
||||
|
||||
// Robocopy encodes results as a bitmap in the return code, see http://ss64.com/nt/robocopy-exit.html
|
||||
if (robocopyProcess.ExitCode >= 16)
|
||||
{
|
||||
throw new Exception(string.Format("Error {0} attempting to delete {1}, see {2} for more details", robocopyProcess.ExitCode, dir, logFile));
|
||||
}
|
||||
}
|
||||
-//exec program='cmd' commandline='/C robocopy ${tempDir} ${dir} /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:${logFile}'
|
||||
|
||||
exec program='cmd' commandline='/C rmdir ${tempDir}'
|
||||
exec program='cmd' commandline='/C rmdir ${dir}'
|
||||
exec program='cmd' commandline='/C del ${logFile}'
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
use namespace="System.Collections"
|
||||
use namespace="System.Xml.Linq"
|
||||
|
||||
@{
|
||||
var prefix = "NUGET_VOLATILE_FEED_";
|
||||
|
||||
var feeds = Environment.GetEnvironmentVariables()
|
||||
.Cast<DictionaryEntry>()
|
||||
.Where(entry => ((string)entry.Key).StartsWith("NUGET_VOLATILE_FEED_"))
|
||||
.Select(entry => new KeyValuePair<string, string>(((string)entry.Key).Substring(prefix.Length), (string)entry.Value))
|
||||
.ToList();
|
||||
|
||||
if (feeds.Any())
|
||||
{
|
||||
var nugetConfig = XDocument.Load("NuGet.config");
|
||||
var packageSources = nugetConfig.Element("configuration").Element("packageSources");
|
||||
var addElements = packageSources.Elements("add").ToList();
|
||||
foreach (var feed in feeds)
|
||||
{
|
||||
var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase));
|
||||
if (valueToUpdate == null)
|
||||
{
|
||||
packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value)));
|
||||
}
|
||||
else
|
||||
{
|
||||
valueToUpdate.Attribute("value").Value = feed.Value;
|
||||
}
|
||||
}
|
||||
|
||||
nugetConfig.Save("NuGet.config");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
use namespace="System.Diagnostics"
|
||||
use namespace="System.IO"
|
||||
|
||||
default workingdir='${Directory.GetCurrentDirectory()}'
|
||||
default expectedHash = ''
|
||||
|
||||
@{
|
||||
Log.Info(string.Format("Verifying Authenticode signature of {0}", verifyFilePath));
|
||||
|
||||
var signToolExePaths = new [] { "C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86\\signtool.exe", "C:\\Program Files\\Windows Kits\\8.1\\bin\\x86\\signtool.exe" };
|
||||
var signToolExe = signToolExePaths.FirstOrDefault(File.Exists);
|
||||
|
||||
if (string.IsNullOrEmpty(signToolExe))
|
||||
{
|
||||
throw new Exception("Could not find signtool.exe on this machine. Ensure Visual Studio is installed.");
|
||||
}
|
||||
|
||||
var processStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = workingdir,
|
||||
FileName = signToolExe,
|
||||
RedirectStandardOutput = true,
|
||||
Arguments = "verify /pa /v \"" + verifyFilePath + "\"",
|
||||
};
|
||||
|
||||
var signTool = Process.Start(processStartInfo);
|
||||
var stdout = signTool.StandardOutput.ReadToEnd();
|
||||
signTool.WaitForExit();
|
||||
|
||||
if (signTool.ExitCode != 0)
|
||||
{
|
||||
File.Delete(verifyFilePath);
|
||||
throw new Exception(string.Format("The signature verification for {0} failed:{1}{2}", verifyFilePath, Environment.NewLine, stdout));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(expectedHash))
|
||||
{
|
||||
// SHA1 of the file is on 4th line and looks like: Hash of file (sha1): 628FFD6C3577068C00CEC9F6F897F0EC8F5212D9
|
||||
var lines = stdout.Split(new [] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var hashLine = lines[3];
|
||||
var actualHash = hashLine.Substring(hashLine.IndexOf(":") + 1).Trim();
|
||||
|
||||
if (!string.Equals(expectedHash, actualHash, StringComparison.Ordinal))
|
||||
{
|
||||
File.Delete(verifyFilePath);
|
||||
throw new Exception(string.Format("The hash comparison for {0} failed: expected hash '{1}', actual hash '{2}'", verifyFilePath, expectedHash, actualHash));
|
||||
}
|
||||
}
|
||||
|
||||
Log.Info("Authenticode signature verified!");
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
use import="Json"
|
||||
use import="Environment"
|
||||
|
||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||
default KOREBUILD_TEST_SKIPMONO='${E("KOREBUILD_TEST_SKIPMONO")}'
|
||||
|
||||
@{/*
|
||||
|
||||
xunit-test
|
||||
Run unit tests in your project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the test project.json to execute
|
||||
|
||||
framework=''
|
||||
Required. The TFM to run tests for
|
||||
|
||||
configuration=''
|
||||
Required. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
@{
|
||||
if (!string.Equals(KOREBUILD_TEST_SKIPMONO, "1") && !string.Equals(KOREBUILD_TEST_SKIPMONO, "true"))
|
||||
{
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var projectName = Path.GetFileName(projectFolder);
|
||||
|
||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||
{
|
||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||
}
|
||||
|
||||
var testArgs = noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
|
||||
var runnerFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.runner.console", "tools"));
|
||||
var xunitCoreFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.core", "build", "_desktop"));
|
||||
|
||||
if (IsLinux)
|
||||
{
|
||||
// Work around issue with testing in parallel on Mono
|
||||
// and issue https://github.com/xunit/xunit/issues/158
|
||||
testArgs = " -parallel none -noappdomain";
|
||||
}
|
||||
|
||||
var publishFolder = Path.Combine(projectFolder, "obj", "testPublish-" + framework);
|
||||
DotnetPublish(projectFile, publishFolder, framework, configuration);
|
||||
|
||||
var runnerExe = "xunit.console.exe";
|
||||
Copy(runnerFolder, publishFolder, "*.*", true);
|
||||
Copy(xunitCoreFolder, publishFolder, "*.*", true);
|
||||
var runnerFullPath = Path.GetFullPath(Path.Combine(publishFolder, runnerExe));
|
||||
|
||||
var targetTestDll = projectName + ".dll";
|
||||
|
||||
ExecClr(runnerFullPath, targetTestDll + " " + testArgs, publishFolder);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
@Echo off
|
||||
|
||||
for /f "delims=" %%i in ('PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.IO.Path]::GetTempFileName()"') do set DNVM_CMD_PATH_FILE=%%i.cmd
|
||||
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%~dp0dnvm.ps1' %*"
|
||||
|
||||
IF EXIST %DNVM_CMD_PATH_FILE% (
|
||||
CALL %DNVM_CMD_PATH_FILE%
|
||||
DEL %DNVM_CMD_PATH_FILE%
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,10 +0,0 @@
|
|||
@Echo off
|
||||
|
||||
for /f "delims=" %%i in ('PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.IO.Path]::GetTempFileName()"') do set INSTALL_CMD_PATH_FILE="%%i.cmd"
|
||||
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%INSTALL_CMD_PATH_FILE%';& '%~dp0dotnet-install.ps1' %*"
|
||||
|
||||
IF EXIST %INSTALL_CMD_PATH_FILE% (
|
||||
CALL %INSTALL_CMD_PATH_FILE%
|
||||
DEL %INSTALL_CMD_PATH_FILE%
|
||||
)
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
param(
|
||||
[string]$Channel="dev",
|
||||
[string]$version="Latest"
|
||||
)
|
||||
|
||||
$ErrorActionPreference="Stop"
|
||||
$ProgressPreference="SilentlyContinue"
|
||||
|
||||
$fileVersion = $Version
|
||||
if ($fileVersion -eq "Latest") {
|
||||
$fileVersion = "latest"
|
||||
}
|
||||
$Feed="https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
$DotNetFileName="dotnet-win-x64.$fileVersion.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/$Version"
|
||||
|
||||
function say($str)
|
||||
{
|
||||
Write-Host "dotnet_install: $str"
|
||||
}
|
||||
|
||||
$InstallDir = $env:DOTNET_INSTALL_DIR
|
||||
if (!$InstallDir) {
|
||||
$InstallDir = "$env:LocalAppData\Microsoft\dotnet"
|
||||
}
|
||||
|
||||
say "Preparing to install .NET Tools to $InstallDir"
|
||||
|
||||
# Check if we need to bother
|
||||
$LocalFile = "$InstallDir\cli\.version"
|
||||
if (Test-Path $LocalFile)
|
||||
{
|
||||
$LocalData = @(cat $LocalFile)
|
||||
$LocalHash = $LocalData[0].Trim()
|
||||
$LocalVersion = $LocalData[1].Trim()
|
||||
if ($LocalVersion -and $LocalHash)
|
||||
{
|
||||
if ($Version -eq "Latest")
|
||||
{
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
{
|
||||
say "You already have the latest version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
elseif ($LocalVersion -eq $Version)
|
||||
{
|
||||
say "$Version is already installed."
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Set up the install location
|
||||
if (!(Test-Path $InstallDir)) {
|
||||
mkdir $InstallDir | Out-Null
|
||||
}
|
||||
|
||||
# De-powershell the path before passing to .NET APIs
|
||||
$InstallDir = Convert-Path $InstallDir
|
||||
|
||||
say "Downloading $DotNetFileName from $DotNetUrl"
|
||||
$resp = Invoke-WebRequest -UseBasicParsing "$DotNetUrl/$DotNetFileName" -OutFile "$InstallDir\$DotNetFileName"
|
||||
|
||||
say "Extracting zip"
|
||||
|
||||
# Create the destination
|
||||
if (Test-Path "$InstallDir\cli_new") {
|
||||
del -rec -for "$InstallDir\cli_new"
|
||||
}
|
||||
mkdir "$InstallDir\cli_new" | Out-Null
|
||||
|
||||
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$InstallDir\$DotNetFileName", "$InstallDir\cli_new")
|
||||
|
||||
# Replace the old installation (if any)
|
||||
if (Test-Path "$InstallDir\cli") {
|
||||
del -rec -for "$InstallDir\cli"
|
||||
}
|
||||
mv "$InstallDir\cli_new" "$InstallDir\cli"
|
||||
|
||||
# Clean the zip
|
||||
if (Test-Path "$InstallDir\$DotNetFileName") {
|
||||
del -for "$InstallDir\$DotNetFileName"
|
||||
}
|
||||
|
||||
say "The .NET Tools have been installed to $InstallDir\cli!"
|
||||
|
||||
# New layout
|
||||
say "Add '$InstallDir\cli\bin' to your PATH to use dotnet"
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
# Note: This script should be compatible with the dash shell used in Ubuntu. So avoid bashisms! See https://wiki.ubuntu.com/DashAsBinSh for more info
|
||||
|
||||
# This is a herestring Everything from the line AFTER the "read" until the line containing ONLY "EOF" is part of the string
|
||||
# The quotes around "EOF" ensure that $ is not interpreted as a variable expansion. The indentation of the herestring must be
|
||||
# kept exactly consistent
|
||||
LINK_SCRIPT_CONTENT=$(cat <<-"EOF"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
if [ -z "$DOTNET_TOOLS" ]; then
|
||||
# We should be in $PREFIX/bin, so just get the directory above us.
|
||||
PREFIX="$( cd -P "$DIR/.." && pwd)"
|
||||
|
||||
# The tools are in $PREFIX/share/dotnet/cli by default
|
||||
DOTNET_TOOLS_DEFAULT=$PREFIX/share/dotnet/cli
|
||||
|
||||
# Check the default location
|
||||
if [ -d "$DOTNET_TOOLS_DEFAULT" ]; then
|
||||
export DOTNET_TOOLS=$DOTNET_TOOLS_DEFAULT
|
||||
else
|
||||
echo "error: the .NET tools installation appears to be corrupt!" 1>&2
|
||||
echo "error: specifically, the tools could not be located in the $DOTNET_TOOLS_DEFAULT directory" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MY_NAME=$(basename ${BASH_SOURCE[0]})
|
||||
MY_TARGET=$DOTNET_TOOLS/bin/$MY_NAME
|
||||
|
||||
if [ ! -e "$MY_TARGET" ]; then
|
||||
echo "error: the tool $MY_TARGET cannot be found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$MY_TARGET" ]; then
|
||||
echo "error: the tool $MY_TARGET is not executable" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$MY_TARGET" "$@"
|
||||
EOF
|
||||
)
|
||||
|
||||
#setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors.
|
||||
#See if stdout is a terminal
|
||||
if [ -t 1 ]; then
|
||||
# see if it supports colors
|
||||
ncolors=$(tput colors)
|
||||
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
|
||||
bold="$(tput bold)"
|
||||
normal="$(tput sgr0)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
fi
|
||||
fi
|
||||
|
||||
#Standardise OS name to what is put into filenames of the tarballs.
|
||||
current_os()
|
||||
{
|
||||
local uname=$(uname)
|
||||
if [ "$uname" = "Darwin" ]; then
|
||||
echo "osx"
|
||||
else
|
||||
# Detect Distro
|
||||
if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
|
||||
echo "ubuntu"
|
||||
elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
|
||||
echo "centos"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
machine_has() {
|
||||
type "$1" > /dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
#Not 100% sure at the moment that these checks are enough. We might need to take version into account or do something
|
||||
#more complicated. This seemed like a good beginning though as it should catch the default "clean" machine case and give
|
||||
#people an appropriate hint.
|
||||
check_pre_reqs() {
|
||||
local os=$(current_os)
|
||||
local _failing=false;
|
||||
|
||||
if [ "$DOTNET_INSTALL_SKIP_PREREQS" = "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
[ -z "$(ldconfig -p | grep libunwind)" ] && say_err "Unable to locate libunwind. Install libunwind to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libssl)" ] && say_err "Unable to locate libssl. Install libssl to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libcurl)" ] && say_err "Unable to locate libcurl. Install libcurl to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libicu)" ] && say_err "Unable to locate libicu. Install libicu to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep gettext)" ] && say_err "Unable to locate gettext. Install gettext to continue" && _failing=true
|
||||
fi
|
||||
|
||||
if [ "$_failing" = true ]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
say_err() {
|
||||
printf "%b\n" "${red}dotnet_install: Error: $1${normal}" >&2
|
||||
}
|
||||
|
||||
say() {
|
||||
printf "%b\n" "dotnet_install: $1"
|
||||
}
|
||||
|
||||
make_link() {
|
||||
local target_name=$1
|
||||
local dest=$PREFIX/bin/$target_name
|
||||
say "Linking $dest -> $PREFIX/share/dotnet/cli/$target_name"
|
||||
if [ -e $dest ]; then
|
||||
rm $dest
|
||||
fi
|
||||
|
||||
[ -d "$PREFIX/bin" ] || mkdir -p $PREFIX/bin
|
||||
|
||||
echo "$LINK_SCRIPT_CONTENT" > $dest
|
||||
|
||||
# Make mode: rwxr-xr-x
|
||||
chmod 755 $dest
|
||||
}
|
||||
|
||||
install_dotnet()
|
||||
{
|
||||
if ! machine_has "curl"; then
|
||||
printf "%b\n" "${red}curl is required to download dotnet. Install curl to proceed. ${normal}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
say "Preparing to install .NET Tools from '$CHANNEL' channel to '$PREFIX'"
|
||||
|
||||
if [ -e "$PREFIX/share/dotnet/cli/dotnet" ] && [ ! -w "$PREFIX/share/dotnet/cli/dotnet" ]; then
|
||||
say_err "dotnet cli is already installed and not writeable. Use 'curl -sSL <url> | sudo sh' to force install."
|
||||
say_err "If you have previously installed the cli using a package manager or installer then that is why it is write protected, and you need to run sudo to install the new version."
|
||||
say_err "Alternatively, removing the '$PREFIX/share/dotnet' directory completely before running the script will also resolve the issue."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! check_pre_reqs; then
|
||||
say_err "Ending install due to missing pre-reqs"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ "$VERSION" == "Latest" ]; then
|
||||
local fileVersion=latest
|
||||
else
|
||||
local fileVersion=$VERSION
|
||||
fi
|
||||
|
||||
local os=$(current_os)
|
||||
local installLocation="$PREFIX/share/dotnet"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/Binaries/$VERSION"
|
||||
local dotnet_filename="dotnet-$os-x64.$fileVersion.tar.gz"
|
||||
|
||||
if [ "$RELINK" = "0" ]; then
|
||||
if [ "$FORCE" = "0" ]; then
|
||||
# Check if we need to bother
|
||||
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/dnvm/latest.$os.version)"
|
||||
[ $? != 0 ] && say_err "Unable to determine latest version." && return 1
|
||||
|
||||
local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
|
||||
local remoteHash=$(IFS="\n" && echo $remoteData | head -n 1)
|
||||
|
||||
local localVersion=$(tail -n 1 "$installLocation/cli/.version" 2>/dev/null)
|
||||
[ -z $localVersion ] && localVersion='<none>'
|
||||
local localHash=$(head -n 1 "$installLocation/cli/.version" 2>/dev/null)
|
||||
|
||||
say "Latest Version: $remoteVersion"
|
||||
say "Local Version: $localVersion"
|
||||
|
||||
[ "$remoteHash" = "$localHash" ] && say "${green}You already have the latest version.${normal}" && return 0
|
||||
fi
|
||||
|
||||
#This should noop if the directory already exists.
|
||||
mkdir -p $installLocation
|
||||
|
||||
say "Downloading $dotnet_filename from $dotnet_url"
|
||||
|
||||
#Download file and check status code, error and return if we cannot download a cli tar.
|
||||
local httpResult=$(curl -L -D - "$dotnet_url/$dotnet_filename" -o "$installLocation/$dotnet_filename" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/")
|
||||
[ $httpResult -ne "302" ] && [ $httpResult -ne "200" ] && echo "${Red}HTTP Error $httpResult fetching the dotnet cli from $dotnet_url ${RCol}" && return 1
|
||||
|
||||
say "Extracting tarball"
|
||||
#Any of these could fail for various reasons so we will check each one and end the script there if it fails.
|
||||
rm -rf "$installLocation/cli_new"
|
||||
mkdir "$installLocation/cli_new"
|
||||
[ $? != 0 ] && say_err "failed to clean and create temporary cli directory to extract into" && return 1
|
||||
|
||||
tar -xzf "$installLocation/$dotnet_filename" -C "$installLocation/cli_new"
|
||||
[ $? != 0 ] && say_err "failed to extract tar" && return 1
|
||||
|
||||
say "Moving new CLI into install location and symlinking"
|
||||
|
||||
rm -rf "$installLocation/cli"
|
||||
[ $? != 0 ] && say_err "Failed to clean current dotnet install" && return 1
|
||||
|
||||
mv "$installLocation/cli_new" "$installLocation/cli"
|
||||
elif [ ! -e "$installLocation/cli" ]; then
|
||||
say_err "${red}cannot relink dotnet, it is not installed in $PREFIX!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for f in $(find "$installLocation/cli" -regex ".*/dotnet[a-z\-]*$")
|
||||
do
|
||||
local baseFile=$(basename $f)
|
||||
make_link $baseFile
|
||||
done
|
||||
|
||||
if [ -e "$installLocation/$dotnet_filename" ]; then
|
||||
say "Cleaning $dotnet_filename"
|
||||
if ! rm "$installLocation/$dotnet_filename"; then
|
||||
say_err "Failed to delete tar after extracting."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
FORCE=0
|
||||
RELINK=0
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
name=$1
|
||||
case $name in
|
||||
-f|--force)
|
||||
FORCE=1
|
||||
;;
|
||||
-r|--relink)
|
||||
RELINK=1
|
||||
;;
|
||||
-c|--channel)
|
||||
shift
|
||||
CHANNEL=$1
|
||||
;;
|
||||
-v|--version)
|
||||
shift
|
||||
VERSION=$1
|
||||
;;
|
||||
-d|--destination)
|
||||
shift
|
||||
DOTNET_INSTALL_DIR=$1
|
||||
;;
|
||||
-?|-h|--help)
|
||||
echo ".NET Tools Installer"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 [-f|--force] [-r|--relink] [-c|--channel <CHANNEL>] [-d|--destination <DESTINATION>]"
|
||||
echo " $0 -h|-?|--help"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -f,--force Force reinstallation even if you have the most recent version installed"
|
||||
echo " -r,--relink Don't re-download, just recreate the links in $PREFIX/bin"
|
||||
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified (default: dev)"
|
||||
echo " -d,--destination <PATH> Install under the specified root (see Install Location below)"
|
||||
echo " -?,-h,--help Show this help message"
|
||||
echo ""
|
||||
echo "Install Location:"
|
||||
echo " By default, this script installs the .NET Tools to /usr/local. However, if the PREFIX environment variable"
|
||||
echo " is specified, that will be used as the installation root. If the DOTNET_INSTALL_DIR environment variable"
|
||||
echo " is specified, it will be used as the installation root (overriding PREFIX). Finally, if the '--destination'"
|
||||
echo " option is specified, it will override all environment variables and be used as the installation location"
|
||||
echo ""
|
||||
echo " After installation, the .NET Tools will be installed to the 'share/dotnet/cli' subdirectory of the "
|
||||
echo " installation location (i.e. /usr/local/share/dotnet/cli). Binaries will be symlinked to the 'bin'"
|
||||
echo " subdirectory of the installation location (i.e. /usr/local/bin/dotnet)"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
#set default prefix (PREFIX is a fairly standard env-var, but we also want to allow the use the specific "DOTNET_INSTALL_DIR" one)
|
||||
if [ ! -z "$DOTNET_INSTALL_DIR" ]; then
|
||||
PREFIX=$DOTNET_INSTALL_DIR
|
||||
elif [ -z "$PREFIX" ]; then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
|
||||
[ -z "$CHANNEL" ] && CHANNEL="dev"
|
||||
[ -z "$VERSION" ] && VERSION="Latest"
|
||||
|
||||
install_dotnet
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
@Echo off
|
||||
|
||||
for /f "delims=" %%i in ('PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.IO.Path]::GetTempFileName()"') do set INSTALL_CMD_PATH_FILE="%%i.cmd"
|
||||
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%INSTALL_CMD_PATH_FILE%';& '%~dp0install.ps1' %*"
|
||||
|
||||
IF EXIST %INSTALL_CMD_PATH_FILE% (
|
||||
CALL %INSTALL_CMD_PATH_FILE%
|
||||
DEL %INSTALL_CMD_PATH_FILE%
|
||||
)
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
$ErrorActionPreference="Stop"
|
||||
$ProgressPreference="SilentlyContinue"
|
||||
|
||||
$Feed="https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
$Channel="dev"
|
||||
$DotNetFileName="dotnet-win-x64.latest.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/Latest"
|
||||
|
||||
function say($str)
|
||||
{
|
||||
Write-Host "dotnet_install: $str"
|
||||
}
|
||||
|
||||
$InstallDir = $env:DOTNET_INSTALL_DIR
|
||||
if (!$InstallDir) {
|
||||
$InstallDir = "$env:LocalAppData\Microsoft\dotnet"
|
||||
}
|
||||
|
||||
say "Preparing to install .NET Tools to $InstallDir"
|
||||
|
||||
# Check if we need to bother
|
||||
$LocalFile = "$InstallDir\cli\.version"
|
||||
if (Test-Path $LocalFile)
|
||||
{
|
||||
$LocalData = @(cat $LocalFile)
|
||||
$LocalHash = $LocalData[0].Trim()
|
||||
$LocalVersion = $LocalData[1].Trim()
|
||||
if ($LocalVersion -and $LocalHash)
|
||||
{
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
{
|
||||
say "You already have the latest version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Set up the install location
|
||||
if (!(Test-Path $InstallDir)) {
|
||||
mkdir $InstallDir | Out-Null
|
||||
}
|
||||
|
||||
# De-powershell the path before passing to .NET APIs
|
||||
$InstallDir = Convert-Path $InstallDir
|
||||
|
||||
say "Downloading $DotNetFileName from $DotNetUrl"
|
||||
$resp = Invoke-WebRequest -UseBasicParsing "$DotNetUrl/$DotNetFileName" -OutFile "$InstallDir\$DotNetFileName"
|
||||
|
||||
say "Extracting zip"
|
||||
|
||||
# Create the destination
|
||||
if (Test-Path "$InstallDir\cli_new") {
|
||||
del -rec -for "$InstallDir\cli_new"
|
||||
}
|
||||
mkdir "$InstallDir\cli_new" | Out-Null
|
||||
|
||||
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$InstallDir\$DotNetFileName", "$InstallDir\cli_new")
|
||||
|
||||
# Replace the old installation (if any)
|
||||
if (Test-Path "$InstallDir\cli") {
|
||||
del -rec -for "$InstallDir\cli"
|
||||
}
|
||||
mv "$InstallDir\cli_new" "$InstallDir\cli"
|
||||
|
||||
# Clean the zip
|
||||
if (Test-Path "$InstallDir\$DotNetFileName") {
|
||||
del -for "$InstallDir\$DotNetFileName"
|
||||
}
|
||||
|
||||
say "The .NET Tools have been installed to $InstallDir\cli!"
|
||||
|
||||
# New layout
|
||||
say "Add '$InstallDir\cli\bin' to your PATH to use dotnet"
|
||||
|
|
@ -1,262 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
# Note: This script should be compatible with the dash shell used in Ubuntu. So avoid bashisms! See https://wiki.ubuntu.com/DashAsBinSh for more info
|
||||
|
||||
# This is a herestring Everything from the line AFTER the "read" until the line containing ONLY "EOF" is part of the string
|
||||
# The quotes around "EOF" ensure that $ is not interpreted as a variable expansion. The indentation of the herestring must be
|
||||
# kept exactly consistent
|
||||
LINK_SCRIPT_CONTENT=$(cat <<-"EOF"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
if [ -z "$DOTNET_TOOLS" ]; then
|
||||
# We should be in $PREFIX/bin, so just get the directory above us.
|
||||
PREFIX="$( cd -P "$DIR/.." && pwd)"
|
||||
|
||||
# The tools are in $PREFIX/share/dotnet/cli by default
|
||||
DOTNET_TOOLS_DEFAULT=$PREFIX/share/dotnet/cli
|
||||
|
||||
# Check the default location
|
||||
if [ -d "$DOTNET_TOOLS_DEFAULT" ]; then
|
||||
export DOTNET_TOOLS=$DOTNET_TOOLS_DEFAULT
|
||||
else
|
||||
echo "error: the .NET tools installation appears to be corrupt!" 1>&2
|
||||
echo "error: specifically, the tools could not be located in the $DOTNET_TOOLS_DEFAULT directory" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MY_NAME=$(basename ${BASH_SOURCE[0]})
|
||||
MY_TARGET=$DOTNET_TOOLS/bin/$MY_NAME
|
||||
|
||||
if [ ! -e "$MY_TARGET" ]; then
|
||||
echo "error: the tool $MY_TARGET cannot be found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$MY_TARGET" ]; then
|
||||
echo "error: the tool $MY_TARGET is not executable" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$MY_TARGET" "$@"
|
||||
EOF
|
||||
)
|
||||
|
||||
#set default prefix (PREFIX is a fairly standard env-var, but we also want to allow the use the specific "DOTNET_INSTALL_DIR" one)
|
||||
if [ ! -z "$DOTNET_INSTALL_DIR" ]; then
|
||||
PREFIX=$DOTNET_INSTALL_DIR
|
||||
elif [ -z "$PREFIX" ]; then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
|
||||
#setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors.
|
||||
#See if stdout is a terminal
|
||||
if [ -t 1 ]; then
|
||||
# see if it supports colors
|
||||
ncolors=$(tput colors)
|
||||
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
|
||||
bold="$(tput bold)"
|
||||
normal="$(tput sgr0)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
fi
|
||||
fi
|
||||
|
||||
#Standardise OS name to what is put into filenames of the tarballs.
|
||||
current_os()
|
||||
{
|
||||
local uname=$(uname)
|
||||
if [ "$uname" = "Darwin" ]; then
|
||||
echo "osx"
|
||||
else
|
||||
echo "linux"
|
||||
fi
|
||||
}
|
||||
|
||||
machine_has() {
|
||||
type "$1" > /dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
#Not 100% sure at the moment that these checks are enough. We might need to take version into account or do something
|
||||
#more complicated. This seemed like a good beginning though as it should catch the default "clean" machine case and give
|
||||
#people an appropriate hint.
|
||||
check_pre_reqs() {
|
||||
local os=$(current_os)
|
||||
local _failing=false;
|
||||
|
||||
if [ "$DOTNET_INSTALL_SKIP_PREREQS" = "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$os" = "linux" ]; then
|
||||
[ -z "$(ldconfig -p | grep libunwind)" ] && say_err "Unable to locate libunwind. Install libunwind to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libssl)" ] && say_err "Unable to locate libssl. Install libssl to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libcurl)" ] && say_err "Unable to locate libcurl. Install libcurl to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep libicu)" ] && say_err "Unable to locate libicu. Install libicu to continue" && _failing=true
|
||||
[ -z "$(ldconfig -p | grep gettext)" ] && say_err "Unable to locate gettext. Install gettext to continue" && _failing=true
|
||||
fi
|
||||
|
||||
if [ "$_failing" = true ]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
say_err() {
|
||||
printf "%b\n" "${red}dotnet_install: Error: $1${normal}" >&2
|
||||
}
|
||||
|
||||
say() {
|
||||
printf "%b\n" "dotnet_install: $1"
|
||||
}
|
||||
|
||||
make_link() {
|
||||
local target_name=$1
|
||||
local dest=$PREFIX/bin/$target_name
|
||||
say "Linking $dest -> $PREFIX/share/dotnet/cli/$target_name"
|
||||
if [ -e $dest ]; then
|
||||
rm $dest
|
||||
fi
|
||||
|
||||
[ -d "$PREFIX/bin" ] || mkdir -p $PREFIX/bin
|
||||
|
||||
echo "$LINK_SCRIPT_CONTENT" > $dest
|
||||
|
||||
# Make mode: rwxr-xr-x
|
||||
chmod 755 $dest
|
||||
}
|
||||
|
||||
install_dotnet()
|
||||
{
|
||||
if ! machine_has "curl"; then
|
||||
printf "%b\n" "${red}curl is required to download dotnet. Install curl to proceed. ${normal}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
say "Preparing to install .NET Tools to $PREFIX"
|
||||
|
||||
if [ -e "$PREFIX/share/dotnet/cli/dotnet" ] && [ ! -w "$PREFIX/share/dotnet/cli/dotnet" ]; then
|
||||
say_err "dotnet cli is already installed and not writeable. Use 'curl -sSL <url> | sudo sh' to force install."
|
||||
say_err "If you have previously installed the cli using a package manager or installer then that is why it is write protected, and you need to run sudo to install the new version."
|
||||
say_err "Alternatively, removing the '$PREFIX/share/dotnet' directory completely before running the script will also resolve the issue."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! check_pre_reqs; then
|
||||
say_err "Ending install due to missing pre-reqs"
|
||||
return 1;
|
||||
fi
|
||||
local os=$(current_os)
|
||||
local installLocation="$PREFIX/share/dotnet"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest"
|
||||
local dotnet_filename="dotnet-$os-x64.latest.tar.gz"
|
||||
|
||||
if [ "$RELINK" = "0" ]; then
|
||||
if [ "$FORCE" = "0" ]; then
|
||||
# Check if we need to bother
|
||||
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/dev/dnvm/latest.$os.version)"
|
||||
[ $? != 0 ] && say_err "Unable to determine latest version." && return 1
|
||||
|
||||
local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
|
||||
local remoteHash=$(IFS="\n" && echo $remoteData | head -n 1)
|
||||
|
||||
local localVersion=$(tail -n 1 "$installLocation/cli/.version" 2>/dev/null)
|
||||
[ -z $localVersion ] && localVersion='<none>'
|
||||
local localHash=$(head -n 1 "$installLocation/cli/.version" 2>/dev/null)
|
||||
|
||||
say "Latest Version: $remoteVersion"
|
||||
say "Local Version: $localVersion"
|
||||
|
||||
[ "$remoteHash" = "$localHash" ] && say "${green}You already have the latest version.${normal}" && return 0
|
||||
fi
|
||||
|
||||
#This should noop if the directory already exists.
|
||||
mkdir -p $installLocation
|
||||
|
||||
say "Downloading $dotnet_filename from $dotnet_url"
|
||||
|
||||
#Download file and check status code, error and return if we cannot download a cli tar.
|
||||
local httpResult=$(curl -L -D - "$dotnet_url/$dotnet_filename" -o "$installLocation/$dotnet_filename" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/")
|
||||
[ $httpResult -ne "302" ] && [ $httpResult -ne "200" ] && echo "${Red}HTTP Error $httpResult fetching the dotnet cli from $dotnet_url ${RCol}" && return 1
|
||||
|
||||
say "Extracting tarball"
|
||||
#Any of these could fail for various reasons so we will check each one and end the script there if it fails.
|
||||
rm -rf "$installLocation/cli_new"
|
||||
mkdir "$installLocation/cli_new"
|
||||
[ $? != 0 ] && say_err "failed to clean and create temporary cli directory to extract into" && return 1
|
||||
|
||||
tar -xzf "$installLocation/$dotnet_filename" -C "$installLocation/cli_new"
|
||||
[ $? != 0 ] && say_err "failed to extract tar" && return 1
|
||||
|
||||
say "Moving new CLI into install location and symlinking"
|
||||
|
||||
rm -rf "$installLocation/cli"
|
||||
[ $? != 0 ] && say_err "Failed to clean current dotnet install" && return 1
|
||||
|
||||
mv "$installLocation/cli_new" "$installLocation/cli"
|
||||
elif [ ! -e "$installLocation/cli" ]; then
|
||||
say_err "${red}cannot relink dotnet, it is not installed in $PREFIX!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for f in $(find "$installLocation/cli" -regex ".*/dotnet[a-z\-]*$")
|
||||
do
|
||||
local baseFile=$(basename $f)
|
||||
make_link $baseFile
|
||||
done
|
||||
|
||||
if [ -e "$installLocation/$dotnet_filename" ]; then
|
||||
say "Cleaning $dotnet_filename"
|
||||
if ! rm "$installLocation/$dotnet_filename"; then
|
||||
say_err "Failed to delete tar after extracting."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
FORCE=0
|
||||
RELINK=0
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
if [ $1 = "-f" ] || [ $1 = "--force" ]; then
|
||||
FORCE=1
|
||||
elif [ $1 = "-r" ] || [ $1 = "--relink" ]; then
|
||||
RELINK=1
|
||||
elif [ $1 = "-?" ] || [ $1 = "-h" ] || [ $1 = "--help" ]; then
|
||||
echo ".NET Tools Installer"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 [-f]"
|
||||
echo " $0 -r"
|
||||
echo " $0 -h"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -f Force reinstallation even if you have the most recent version installed"
|
||||
echo " -r Don't re-download, just recreate the links in $PREFIX/bin"
|
||||
echo " -h Show this help message"
|
||||
echo ""
|
||||
echo "The PREFIX environment variable can be used to affect the root installation directory"
|
||||
exit 0
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
install_dotnet
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
var VERSION='0.1'
|
||||
var FULL_VERSION='0.1'
|
||||
var AUTHORS='Microsoft Open Technologies, Inc.'
|
||||
|
||||
use-standard-lifecycle
|
||||
k-standard-goals
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<metadata>
|
||||
<id>KoreBuild</id>
|
||||
<title>The ProjectK build tools</title>
|
||||
<version>0.0</version>
|
||||
<authors>.NET Foundation</authors>
|
||||
<owners>.NET Foundation</owners>
|
||||
<description>ProjectK build tooling</description>
|
||||
<language>en-US</language>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="build\*.*" target="build" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
|
||||
*.jpg binary
|
||||
*.png binary
|
||||
*.gif binary
|
||||
|
||||
*.cs text=auto diff=csharp
|
||||
*.vb text=auto
|
||||
*.resx text=auto
|
||||
*.c text=auto
|
||||
*.cpp text=auto
|
||||
*.cxx text=auto
|
||||
*.h text=auto
|
||||
*.hxx text=auto
|
||||
*.py text=auto
|
||||
*.rb text=auto
|
||||
*.java text=auto
|
||||
*.html text=auto
|
||||
*.htm text=auto
|
||||
*.css text=auto
|
||||
*.scss text=auto
|
||||
*.sass text=auto
|
||||
*.less text=auto
|
||||
*.js text=auto
|
||||
*.lisp text=auto
|
||||
*.clj text=auto
|
||||
*.sql text=auto
|
||||
*.php text=auto
|
||||
*.lua text=auto
|
||||
*.m text=auto
|
||||
*.asm text=auto
|
||||
*.erl text=auto
|
||||
*.fs text=auto
|
||||
*.fsx text=auto
|
||||
*.hs text=auto
|
||||
|
||||
*.csproj text=auto
|
||||
*.vbproj text=auto
|
||||
*.fsproj text=auto
|
||||
*.dbproj text=auto
|
||||
*.sln text=auto eol=crlf
|
||||
|
||||
*.sh eol=lf
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
[Oo]bj/
|
||||
[Bb]in/
|
||||
TestResults/
|
||||
.nuget/
|
||||
.build/
|
||||
.testPublish/
|
||||
*.sln.ide/
|
||||
_ReSharper.*/
|
||||
packages/
|
||||
artifacts/
|
||||
.build/
|
||||
PublishProfiles/
|
||||
*.user
|
||||
*.suo
|
||||
*.cache
|
||||
*.docstates
|
||||
_ReSharper.*
|
||||
nuget.exe
|
||||
project.lock.json
|
||||
*net45.csproj
|
||||
*net451.csproj
|
||||
*k10.csproj
|
||||
*.psess
|
||||
*.vsp
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*DS_Store
|
||||
*.ncrunchsolution
|
||||
*.*sdf
|
||||
*.ipch
|
||||
.build/
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
language: csharp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gettext
|
||||
- libcurl4-openssl-dev
|
||||
- libicu-dev
|
||||
- libssl-dev
|
||||
- libunwind8
|
||||
- zlib1g
|
||||
mono:
|
||||
- 4.0.5
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode7.1
|
||||
script:
|
||||
- ./build.sh --quiet verify
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v2" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="AspNetVNext" value="https://www.myget.org/f/aspnetmaster/api/v3/index.json" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
init:
|
||||
- git config --global core.autocrlf true
|
||||
build_script:
|
||||
- build.cmd --quiet verify
|
||||
clone_depth: 1
|
||||
test: off
|
||||
deploy: off
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
@ECHO off
|
||||
SETLOCAL
|
||||
|
||||
SET REPO_FOLDER=%~dp0
|
||||
CD "%REPO_FOLDER%"
|
||||
|
||||
SET BUILD_FOLDER=.build
|
||||
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet
|
||||
SET KOREBUILD_VERSION=
|
||||
|
||||
SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe
|
||||
SET NUGET_VERSION=latest
|
||||
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
|
||||
|
||||
IF NOT EXIST %BUILD_FOLDER% (
|
||||
md %BUILD_FOLDER%
|
||||
)
|
||||
|
||||
IF NOT EXIST %NUGET_PATH% (
|
||||
IF NOT EXIST %CACHED_NUGET% (
|
||||
echo Downloading latest version of NuGet.exe...
|
||||
IF NOT EXIST %LocalAppData%\NuGet (
|
||||
md %LocalAppData%\NuGet
|
||||
)
|
||||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
|
||||
)
|
||||
|
||||
copy %CACHED_NUGET% %NUGET_PATH% > nul
|
||||
)
|
||||
|
||||
SET KOREBUILD_DOWNLOAD_ARGS=
|
||||
IF NOT "%KOREBUILD_VERSION%"=="" (
|
||||
SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
|
||||
)
|
||||
IF NOT EXIST %KOREBUILD_FOLDER% (
|
||||
%BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
|
||||
)
|
||||
|
||||
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
buildFolder=.build
|
||||
koreBuildFolder=$buildFolder/KoreBuild-dotnet
|
||||
|
||||
nugetPath=$buildFolder/nuget.exe
|
||||
|
||||
if test `uname` = Darwin; then
|
||||
cachedir=~/Library/Caches/KBuild
|
||||
else
|
||||
if [ -z $XDG_DATA_HOME ]; then
|
||||
cachedir=$HOME/.local/share
|
||||
else
|
||||
cachedir=$XDG_DATA_HOME;
|
||||
fi
|
||||
fi
|
||||
mkdir -p $cachedir
|
||||
nugetVersion=latest
|
||||
cacheNuget=$cachedir/nuget.$nugetVersion.exe
|
||||
|
||||
nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe
|
||||
|
||||
if test ! -d $buildFolder; then
|
||||
mkdir $buildFolder
|
||||
fi
|
||||
|
||||
if test ! -f $nugetPath; then
|
||||
if test ! -f $cacheNuget; then
|
||||
wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null
|
||||
fi
|
||||
|
||||
cp $cacheNuget $nugetPath
|
||||
fi
|
||||
|
||||
if test ! -d $koreBuildFolder; then
|
||||
mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre
|
||||
chmod +x $koreBuildFolder/build/KoreBuild.sh
|
||||
fi
|
||||
|
||||
makeFile=makefile.shade
|
||||
if [ ! -e $makeFile ]; then
|
||||
makeFile=$koreBuildFolder/build/makefile.shade
|
||||
fi
|
||||
|
||||
./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@"
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
|
||||
*.jpg binary
|
||||
*.png binary
|
||||
*.gif binary
|
||||
|
||||
*.cs text=auto diff=csharp
|
||||
*.vb text=auto
|
||||
*.resx text=auto
|
||||
*.c text=auto
|
||||
*.cpp text=auto
|
||||
*.cxx text=auto
|
||||
*.h text=auto
|
||||
*.hxx text=auto
|
||||
*.py text=auto
|
||||
*.rb text=auto
|
||||
*.java text=auto
|
||||
*.html text=auto
|
||||
*.htm text=auto
|
||||
*.css text=auto
|
||||
*.scss text=auto
|
||||
*.sass text=auto
|
||||
*.less text=auto
|
||||
*.js text=auto
|
||||
*.lisp text=auto
|
||||
*.clj text=auto
|
||||
*.sql text=auto
|
||||
*.php text=auto
|
||||
*.lua text=auto
|
||||
*.m text=auto
|
||||
*.asm text=auto
|
||||
*.erl text=auto
|
||||
*.fs text=auto
|
||||
*.fsx text=auto
|
||||
*.hs text=auto
|
||||
|
||||
*.csproj text=auto
|
||||
*.vbproj text=auto
|
||||
*.fsproj text=auto
|
||||
*.dbproj text=auto
|
||||
*.sln text=auto eol=crlf
|
||||
*.sh eol=lf
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
[Oo]bj/
|
||||
[Bb]in/
|
||||
TestResults/
|
||||
.nuget/
|
||||
*.sln.ide/
|
||||
_ReSharper.*/
|
||||
packages/
|
||||
artifacts/
|
||||
PublishProfiles/
|
||||
*.user
|
||||
*.suo
|
||||
*.cache
|
||||
*.docstates
|
||||
_ReSharper.*
|
||||
nuget.exe
|
||||
project.lock.json
|
||||
*net45.csproj
|
||||
*net451.csproj
|
||||
*k10.csproj
|
||||
*.psess
|
||||
*.vsp
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*DS_Store
|
||||
*.ncrunchsolution
|
||||
*.*sdf
|
||||
*.ipch
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
language: csharp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gettext
|
||||
- libcurl4-openssl-dev
|
||||
- libicu-dev
|
||||
- libssl-dev
|
||||
- libunwind8
|
||||
- zlib1g
|
||||
mono:
|
||||
- 4.0.5
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode7.1
|
||||
script:
|
||||
- ./build.sh verify
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v2" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="AspNetVNext" value="https://www.myget.org/f/aspnetmaster/api/v3/index.json" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
init:
|
||||
- git config --global core.autocrlf true
|
||||
build_script:
|
||||
- build.cmd verify
|
||||
clone_depth: 1
|
||||
test: off
|
||||
deploy: off
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
@echo off
|
||||
cd %~dp0
|
||||
|
||||
SETLOCAL
|
||||
SET NUGET_VERSION=latest
|
||||
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
|
||||
SET BUILDCMD_KOREBUILD_VERSION=
|
||||
SET BUILDCMD_DNX_VERSION=
|
||||
|
||||
IF EXIST %CACHED_NUGET% goto copynuget
|
||||
echo Downloading latest version of NuGet.exe...
|
||||
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
|
||||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
|
||||
|
||||
:copynuget
|
||||
IF EXIST .nuget\nuget.exe goto restore
|
||||
md .nuget
|
||||
copy %CACHED_NUGET% .nuget\nuget.exe > nul
|
||||
|
||||
:restore
|
||||
IF EXIST packages\Sake goto getdnx
|
||||
IF "%BUILDCMD_KOREBUILD_VERSION%"=="" (
|
||||
.nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
|
||||
) ELSE (
|
||||
.nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre
|
||||
)
|
||||
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages
|
||||
|
||||
:getdnx
|
||||
IF "%BUILDCMD_DNX_VERSION%"=="" (
|
||||
SET BUILDCMD_DNX_VERSION=latest
|
||||
)
|
||||
IF "%SKIP_DNX_INSTALL%"=="" (
|
||||
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default
|
||||
CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default
|
||||
) ELSE (
|
||||
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
|
||||
)
|
||||
|
||||
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if test `uname` = Darwin; then
|
||||
cachedir=~/Library/Caches/KBuild
|
||||
else
|
||||
if [ -z $XDG_DATA_HOME ]; then
|
||||
cachedir=$HOME/.local/share
|
||||
else
|
||||
cachedir=$XDG_DATA_HOME;
|
||||
fi
|
||||
fi
|
||||
mkdir -p $cachedir
|
||||
nugetVersion=latest
|
||||
cachePath=$cachedir/nuget.$nugetVersion.exe
|
||||
|
||||
url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe
|
||||
|
||||
if test ! -f $cachePath; then
|
||||
wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null
|
||||
fi
|
||||
|
||||
if test ! -e .nuget; then
|
||||
mkdir .nuget
|
||||
cp $cachePath .nuget/nuget.exe
|
||||
fi
|
||||
|
||||
if test ! -d packages/Sake; then
|
||||
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
|
||||
mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages
|
||||
fi
|
||||
|
||||
if ! type dnvm > /dev/null 2>&1; then
|
||||
source packages/KoreBuild/build/dnvm.sh
|
||||
fi
|
||||
|
||||
if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then
|
||||
dnvm install latest -runtime coreclr -alias default
|
||||
dnvm install default -runtime mono -alias default
|
||||
else
|
||||
dnvm use default -runtime mono
|
||||
fi
|
||||
|
||||
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
var VERSION='0.1'
|
||||
var FULL_VERSION='0.1'
|
||||
var AUTHORS='Microsoft Open Technologies, Inc.'
|
||||
|
||||
use-standard-lifecycle
|
||||
k-standard-goals
|
||||
25
build.cmd
25
build.cmd
|
|
@ -1,23 +1,2 @@
|
|||
@echo off
|
||||
cd %~dp0
|
||||
|
||||
SETLOCAL
|
||||
SET NUGET_VERSION=latest
|
||||
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
|
||||
|
||||
IF EXIST %CACHED_NUGET% goto copynuget
|
||||
echo Downloading latest version of NuGet.exe...
|
||||
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
|
||||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
|
||||
|
||||
:copynuget
|
||||
IF EXIST .nuget\nuget.exe goto restore
|
||||
md .nuget
|
||||
copy %CACHED_NUGET% .nuget\nuget.exe > nul
|
||||
|
||||
:restore
|
||||
IF EXIST packages\Sake goto run
|
||||
.nuget\NuGet.exe install Sake -ExcludeVersion -Out packages
|
||||
|
||||
:run
|
||||
packages\Sake\tools\Sake.exe -I KoreBuild-dotnet\build -f makefile.shade %*
|
||||
@ECHO OFF
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
cd $PSScriptRoot
|
||||
|
||||
$repoFolder = $PSScriptRoot
|
||||
$env:REPO_FOLDER = $repoFolder
|
||||
|
||||
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||
if ($env:KOREBUILD_ZIP)
|
||||
{
|
||||
$koreBuildZip=$env:KOREBUILD_ZIP
|
||||
}
|
||||
|
||||
$buildFolder = ".build"
|
||||
$buildFile="$buildFolder\KoreBuild.ps1"
|
||||
|
||||
if (!(Test-Path $buildFolder)) {
|
||||
Write-Host "Downloading KoreBuild from $koreBuildZip"
|
||||
|
||||
$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid()
|
||||
New-Item -Path "$tempFolder" -Type directory | Out-Null
|
||||
|
||||
$localZipFile="$tempFolder\korebuild.zip"
|
||||
|
||||
Invoke-WebRequest $koreBuildZip -OutFile $localZipFile
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
|
||||
|
||||
New-Item -Path "$buildFolder" -Type directory | Out-Null
|
||||
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse
|
||||
|
||||
# Cleanup
|
||||
if (Test-Path $tempFolder) {
|
||||
Remove-Item -Recurse -Force $tempFolder
|
||||
}
|
||||
}
|
||||
|
||||
&"$buildFile" $args
|
||||
54
build.sh
54
build.sh
|
|
@ -1,31 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $repoFolder
|
||||
|
||||
if test `uname` = Darwin; then
|
||||
cachedir=~/Library/Caches/KBuild
|
||||
else
|
||||
if [ -z $XDG_DATA_HOME ]; then
|
||||
cachedir=$HOME/.local/share
|
||||
else
|
||||
cachedir=$XDG_DATA_HOME;
|
||||
fi
|
||||
fi
|
||||
mkdir -p $cachedir
|
||||
nugetVersion=latest
|
||||
cachePath=$cachedir/nuget.$nugetVersion.exe
|
||||
|
||||
url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe
|
||||
|
||||
if test ! -f $cachePath; then
|
||||
wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null
|
||||
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||
if [ ! -z $KOREBUILD_ZIP ]; then
|
||||
koreBuildZip=$KOREBUILD_ZIP
|
||||
fi
|
||||
|
||||
if test ! -e .nuget; then
|
||||
mkdir .nuget
|
||||
cp $cachePath .nuget/nuget.exe
|
||||
buildFolder=".build"
|
||||
buildFile="$buildFolder/KoreBuild.sh"
|
||||
|
||||
if test ! -d $buildFolder; then
|
||||
echo "Downloading KoreBuild from $koreBuildZip"
|
||||
|
||||
tempFolder="/tmp/KoreBuild-$(uuidgen)"
|
||||
mkdir $tempFolder
|
||||
|
||||
localZipFile="$tempFolder/korebuild.zip"
|
||||
|
||||
wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null
|
||||
unzip -q -d $tempFolder $localZipFile
|
||||
|
||||
mkdir $buildFolder
|
||||
cp -r $tempFolder/**/build/** $buildFolder
|
||||
|
||||
chmod +x $buildFile
|
||||
|
||||
# Cleanup
|
||||
if test ! -d $tempFolder; then
|
||||
rm -rf $tempFolder
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ! -d packages/Sake; then
|
||||
mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages
|
||||
fi
|
||||
|
||||
mono packages/Sake/tools/Sake.exe -I build -f makefile.shade "$@"
|
||||
$buildFile -r $repoFolder "$@"
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
use namespace="System"
|
||||
|
||||
functions
|
||||
@{
|
||||
string CreateDayBasedVersionNumber()
|
||||
{
|
||||
var start = new DateTime(2015, 1, 1);
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
string version = "0";
|
||||
// If the computer date is set before the start date, then the version is 0
|
||||
if (now >= start)
|
||||
{
|
||||
var yearsSinceStart = (now.Year - start.Year) + 1;
|
||||
version = yearsSinceStart + now.ToString("MMdd");
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
string BuildNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return "t" + DateTime.UtcNow.ToString("yyMMddHHmmss");
|
||||
}
|
||||
}
|
||||
|
||||
bool IsBuildV2
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("KOREBUILD_BUILD_V2") == "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
883
build/Json.shade
883
build/Json.shade
|
|
@ -1,883 +0,0 @@
|
|||
use namespace='System'
|
||||
use namespace='System.Collections.Generic'
|
||||
use namespace='System.Globalization'
|
||||
use namespace='System.IO'
|
||||
use namespace='System.Text'
|
||||
|
||||
functions @{
|
||||
public class JsonArray : JsonValue
|
||||
{
|
||||
private readonly JsonValue[] _array;
|
||||
|
||||
public JsonArray(JsonValue[] array, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
|
||||
_array = array;
|
||||
}
|
||||
|
||||
public int Length { get { return _array.Length; } }
|
||||
public IEnumerable<JsonValue> Values { get { return _array; }}
|
||||
public JsonValue this[int index] { get { return _array[index]; }}
|
||||
}
|
||||
|
||||
public class JsonBoolean : JsonValue
|
||||
{
|
||||
public JsonBoolean(JsonToken token)
|
||||
: base(token.Line, token.Column)
|
||||
{
|
||||
if (token.Type == JsonTokenType.True)
|
||||
{
|
||||
Value = true;
|
||||
}
|
||||
else if (token.Type == JsonTokenType.False)
|
||||
{
|
||||
Value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Token value should be either True or False.", "token");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Value { get; private set; }
|
||||
|
||||
public static implicit operator bool (JsonBoolean jsonBoolean)
|
||||
{
|
||||
return jsonBoolean.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonString : JsonValue
|
||||
{
|
||||
private readonly string _value;
|
||||
|
||||
public JsonString(string value, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
public static implicit operator string (JsonString instance)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return instance.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonNull : JsonValue
|
||||
{
|
||||
public JsonNull(int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonValue
|
||||
{
|
||||
public JsonValue(int line, int column)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public int Line { get; private set; }
|
||||
|
||||
public int Column { get; private set; }
|
||||
}
|
||||
|
||||
public class JsonObject : JsonValue
|
||||
{
|
||||
private readonly IDictionary<string, JsonValue> _data;
|
||||
|
||||
public JsonObject(IDictionary<string, JsonValue> data, int line, int column)
|
||||
: base(line, column)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public ICollection<string> Keys
|
||||
{
|
||||
get { return _data.Keys; }
|
||||
}
|
||||
|
||||
public JsonValue Value(string key)
|
||||
{
|
||||
JsonValue result;
|
||||
if (!_data.TryGetValue(key, out result))
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public JsonObject ValueAsJsonObject(string key)
|
||||
{
|
||||
return Value(key) as JsonObject;
|
||||
}
|
||||
|
||||
public JsonString ValueAsString(string key)
|
||||
{
|
||||
return Value(key) as JsonString;
|
||||
}
|
||||
|
||||
public int ValueAsInt(string key)
|
||||
{
|
||||
var number = Value(key) as JsonNumber;
|
||||
if (number == null)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
return Convert.ToInt32(number.Raw);
|
||||
}
|
||||
|
||||
public bool ValueAsBoolean(string key, bool defaultValue = false)
|
||||
{
|
||||
var boolVal = Value(key) as JsonBoolean;
|
||||
if (boolVal != null)
|
||||
{
|
||||
return boolVal.Value;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public bool? ValueAsNullableBoolean(string key)
|
||||
{
|
||||
var boolVal = Value(key) as JsonBoolean;
|
||||
if (boolVal != null)
|
||||
{
|
||||
return boolVal.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] ValueAsStringArray(string key)
|
||||
{
|
||||
var list = Value(key) as JsonArray;
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = new string[list.Length];
|
||||
|
||||
for (int i = 0; i < list.Length; ++i)
|
||||
{
|
||||
var jsonString = list[i] as JsonString;
|
||||
if (jsonString != null)
|
||||
{
|
||||
result[i] = jsonString.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal object ValueAsJsonObject(object packIncludePropertyName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonNumber : JsonValue
|
||||
{
|
||||
private readonly string _raw;
|
||||
private readonly double _double;
|
||||
|
||||
public JsonNumber(JsonToken token)
|
||||
: base(token.Line, token.Column)
|
||||
{
|
||||
try
|
||||
{
|
||||
_raw = token.Value;
|
||||
_double = double.Parse(_raw, NumberStyles.Float);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidFloatNumberFormat(_raw),
|
||||
ex,
|
||||
token.Line,
|
||||
token.Column);
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_FloatNumberOverflow(_raw),
|
||||
ex,
|
||||
token.Line,
|
||||
token.Column);
|
||||
}
|
||||
}
|
||||
|
||||
public double Double
|
||||
{
|
||||
get { return _double; }
|
||||
}
|
||||
|
||||
public string Raw
|
||||
{
|
||||
get { return _raw; }
|
||||
}
|
||||
}
|
||||
|
||||
public static class Json
|
||||
{
|
||||
public static JsonValue Deserialize(string content)
|
||||
{
|
||||
using (var reader = new StringReader(content))
|
||||
{
|
||||
return Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonValue Deserialize(TextReader reader)
|
||||
{
|
||||
if (reader == null)
|
||||
{
|
||||
throw new ArgumentNullException("reader");
|
||||
}
|
||||
|
||||
var buffer = new JsonBuffer(reader);
|
||||
|
||||
var result = DeserializeInternal(buffer.Read(), buffer);
|
||||
|
||||
// There are still unprocessed char. The parsing is not finished. Error happened.
|
||||
var nextToken = buffer.Read();
|
||||
if (nextToken.Type != JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_UnfinishedJSON(nextToken.Value),
|
||||
nextToken);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JsonValue DeserializeInternal(JsonToken next, JsonBuffer buffer)
|
||||
{
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.LeftSquareBracket)
|
||||
{
|
||||
return DeserializeArray(next, buffer);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.LeftCurlyBracket)
|
||||
{
|
||||
return DeserializeObject(next, buffer);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.String)
|
||||
{
|
||||
return new JsonString(next.Value, next.Line, next.Column);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.True || next.Type == JsonTokenType.False)
|
||||
{
|
||||
return new JsonBoolean(next);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Null)
|
||||
{
|
||||
return new JsonNull(next.Line, next.Column);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Number)
|
||||
{
|
||||
return new JsonNumber(next);
|
||||
}
|
||||
|
||||
throw new JsonDeserializerException(JsonDeserializerResource.Format_InvalidTokenExpectation(
|
||||
next.Value, "'{', (char)'[', true, false, null, JSON string, JSON number, or the end of the file"),
|
||||
next);
|
||||
}
|
||||
|
||||
private static JsonArray DeserializeArray(JsonToken head, JsonBuffer buffer)
|
||||
{
|
||||
var list = new List<JsonValue>();
|
||||
while (true)
|
||||
{
|
||||
var next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.RightSquareBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
list.Add(DeserializeInternal(next, buffer));
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON array", (char)']', (char)','),
|
||||
next);
|
||||
}
|
||||
else if (next.Type == JsonTokenType.RightSquareBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (next.Type != JsonTokenType.Comma)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON array", (char)','),
|
||||
next);
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonArray(list.ToArray(), head.Line, head.Column);
|
||||
}
|
||||
|
||||
private static JsonObject DeserializeObject(JsonToken head, JsonBuffer buffer)
|
||||
{
|
||||
var dictionary = new Dictionary<string, JsonValue>();
|
||||
|
||||
// Loop through each JSON entry in the input object
|
||||
while (true)
|
||||
{
|
||||
var next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.EOF)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)'}'),
|
||||
next);
|
||||
}
|
||||
|
||||
if (next.Type == JsonTokenType.Colon)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxNotExpected("JSON object", (char)':'),
|
||||
next);
|
||||
}
|
||||
else if (next.Type == JsonTokenType.RightCurlyBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (next.Type != JsonTokenType.String)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object member name", "JSON string"),
|
||||
next);
|
||||
}
|
||||
|
||||
var memberName = next.Value;
|
||||
if (dictionary.ContainsKey(memberName))
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_DuplicateObjectMemberName(memberName),
|
||||
next);
|
||||
}
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type != JsonTokenType.Colon)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)':'),
|
||||
next);
|
||||
}
|
||||
|
||||
dictionary[memberName] = DeserializeInternal(buffer.Read(), buffer);
|
||||
|
||||
next = buffer.Read();
|
||||
if (next.Type == JsonTokenType.RightCurlyBracket)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (next.Type != JsonTokenType.Comma)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxExpectation("JSON object", (char)',', (char)'}'),
|
||||
next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonObject(dictionary, head.Line, head.Column);
|
||||
}
|
||||
}
|
||||
|
||||
internal class JsonBuffer
|
||||
{
|
||||
public const string ValueNull = "null";
|
||||
public const string ValueTrue = "true";
|
||||
public const string ValueFalse = "false";
|
||||
|
||||
private readonly StringBuilder _buffer = new StringBuilder();
|
||||
private readonly StringBuilder _codePointBuffer = new StringBuilder(4);
|
||||
private readonly TextReader _reader;
|
||||
private JsonToken _token;
|
||||
private int _line;
|
||||
private int _column;
|
||||
|
||||
public JsonBuffer(TextReader reader)
|
||||
{
|
||||
_reader = reader;
|
||||
_line = 1;
|
||||
}
|
||||
|
||||
public JsonToken Read()
|
||||
{
|
||||
int first;
|
||||
while (true)
|
||||
{
|
||||
first = ReadNextChar();
|
||||
|
||||
if (first == -1)
|
||||
{
|
||||
_token.Type = JsonTokenType.EOF;
|
||||
return _token;
|
||||
}
|
||||
else if (!IsWhitespace(first))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_token.Value = ((char)first).ToString();
|
||||
_token.Line = _line;
|
||||
_token.Column = _column;
|
||||
|
||||
if (first == (char)'{')
|
||||
{
|
||||
_token.Type = JsonTokenType.LeftCurlyBracket;
|
||||
}
|
||||
else if (first == (char)'}')
|
||||
{
|
||||
_token.Type = JsonTokenType.RightCurlyBracket;
|
||||
}
|
||||
else if (first == (char)'[')
|
||||
{
|
||||
_token.Type = JsonTokenType.LeftSquareBracket;
|
||||
}
|
||||
else if (first == (char)']')
|
||||
{
|
||||
_token.Type = JsonTokenType.RightSquareBracket;
|
||||
}
|
||||
else if (first == (char)':')
|
||||
{
|
||||
_token.Type = JsonTokenType.Colon;
|
||||
}
|
||||
else if (first == (char)',')
|
||||
{
|
||||
_token.Type = JsonTokenType.Comma;
|
||||
}
|
||||
else if (first == (char)'"')
|
||||
{
|
||||
_token.Type = JsonTokenType.String;
|
||||
_token.Value = ReadString();
|
||||
}
|
||||
else if (first == (char)'t')
|
||||
{
|
||||
ReadLiteral(ValueTrue);
|
||||
_token.Type = JsonTokenType.True;
|
||||
}
|
||||
else if (first == (char)'f')
|
||||
{
|
||||
ReadLiteral(ValueFalse);
|
||||
_token.Type = JsonTokenType.False;
|
||||
}
|
||||
else if (first == (char)'n')
|
||||
{
|
||||
ReadLiteral(ValueNull);
|
||||
_token.Type = JsonTokenType.Null;
|
||||
}
|
||||
else if ((first >= (char)'0' && first <= (char)'9') || first == (char)'-')
|
||||
{
|
||||
_token.Type = JsonTokenType.Number;
|
||||
_token.Value = ReadNumber(first);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_IllegalCharacter(first),
|
||||
_token);
|
||||
}
|
||||
|
||||
// JsonToken is a value type
|
||||
return _token;
|
||||
}
|
||||
|
||||
private int ReadNextChar()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var value = _reader.Read();
|
||||
_column++;
|
||||
|
||||
if (value == -1)
|
||||
{
|
||||
// This is the end of file
|
||||
return -1;
|
||||
}
|
||||
else if (value == (char)'\n')
|
||||
{
|
||||
// This is a new line. Let the next loop read the first charactor of the following line.
|
||||
// Set position ahead of next line
|
||||
_column = 0;
|
||||
_line++;
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (value == (char)'\r')
|
||||
{
|
||||
// Skip the carriage return.
|
||||
// Let the next loop read the following char
|
||||
}
|
||||
else
|
||||
{
|
||||
// Returns the normal value
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadNumber(int firstRead)
|
||||
{
|
||||
_buffer.Clear();
|
||||
_buffer.Append((char)firstRead);
|
||||
|
||||
while (true)
|
||||
{
|
||||
var next = _reader.Peek();
|
||||
|
||||
if ((next >= (char)'0' && next <= (char)'9') ||
|
||||
next == (char)'.' ||
|
||||
next == (char)'e' ||
|
||||
next == (char)'E')
|
||||
{
|
||||
_buffer.Append((char)ReadNextChar());
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _buffer.ToString();
|
||||
}
|
||||
|
||||
private void ReadLiteral(string literal)
|
||||
{
|
||||
for (int i = 1; i < literal.Length; ++i)
|
||||
{
|
||||
var next = _reader.Peek();
|
||||
if (next != literal[i])
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_UnrecognizedLiteral(literal),
|
||||
_line, _column);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadNextChar();
|
||||
}
|
||||
}
|
||||
|
||||
var tail = _reader.Peek();
|
||||
if (tail != (char)'}' &&
|
||||
tail != (char)']' &&
|
||||
tail != (char)',' &&
|
||||
tail != (char)'\n' &&
|
||||
tail != -1 &&
|
||||
!IsWhitespace(tail))
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_IllegalTrailingCharacterAfterLiteral(tail, literal),
|
||||
_line, _column);
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadString()
|
||||
{
|
||||
_buffer.Clear();
|
||||
var escaped = false;
|
||||
|
||||
while (true)
|
||||
{
|
||||
var next = ReadNextChar();
|
||||
|
||||
if (next == -1 || next == (char)'\n')
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.JSON_OpenString,
|
||||
_line, _column);
|
||||
}
|
||||
else if (escaped)
|
||||
{
|
||||
if ((next == (char)'"') || (next == (char)'\\') || (next == (char)'/'))
|
||||
{
|
||||
_buffer.Append((char)next);
|
||||
}
|
||||
else if (next == (char)'b')
|
||||
{
|
||||
// (char)'\b' backspace
|
||||
_buffer.Append('\b');
|
||||
}
|
||||
else if (next == (char)'f')
|
||||
{
|
||||
// (char)'\f' form feed
|
||||
_buffer.Append('\f');
|
||||
}
|
||||
else if (next == (char)'n')
|
||||
{
|
||||
// (char)'\n' line feed
|
||||
_buffer.Append('\n');
|
||||
}
|
||||
else if (next == (char)'r')
|
||||
{
|
||||
// (char)'\r' carriage return
|
||||
_buffer.Append('\r');
|
||||
}
|
||||
else if (next == (char)'t')
|
||||
{
|
||||
// (char)'\t' tab
|
||||
_buffer.Append('\t');
|
||||
}
|
||||
else if (next == (char)'u')
|
||||
{
|
||||
// (char)'\uXXXX' unicode
|
||||
var unicodeLine = _line;
|
||||
var unicodeColumn = _column;
|
||||
|
||||
_codePointBuffer.Clear();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
next = ReadNextChar();
|
||||
if (next == -1)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.JSON_InvalidEnd,
|
||||
unicodeLine,
|
||||
unicodeColumn);
|
||||
}
|
||||
else
|
||||
{
|
||||
_codePointBuffer[i] = (char)next;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var unicodeValue = int.Parse(_codePointBuffer.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
_buffer.Append((char)unicodeValue);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidUnicode(_codePointBuffer.ToString()),
|
||||
ex,
|
||||
unicodeLine,
|
||||
unicodeColumn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonDeserializerException(
|
||||
JsonDeserializerResource.Format_InvalidSyntaxNotExpected("charactor escape", "\\" + next),
|
||||
_line,
|
||||
_column);
|
||||
}
|
||||
|
||||
escaped = false;
|
||||
}
|
||||
else if (next == (char)'\\')
|
||||
{
|
||||
escaped = true;
|
||||
}
|
||||
else if (next == (char)'"')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buffer.Append((char)next);
|
||||
}
|
||||
}
|
||||
|
||||
return _buffer.ToString();
|
||||
}
|
||||
|
||||
private static bool IsWhitespace(int value)
|
||||
{
|
||||
return value == (char)' ' || value == (char)'\t' || value == (char)'\r';
|
||||
}
|
||||
}
|
||||
|
||||
public enum JsonTokenType
|
||||
{
|
||||
LeftCurlyBracket, // [
|
||||
LeftSquareBracket, // {
|
||||
RightCurlyBracket, // ]
|
||||
RightSquareBracket, // }
|
||||
Colon, // :
|
||||
Comma, // ,
|
||||
Null,
|
||||
True,
|
||||
False,
|
||||
Number,
|
||||
String,
|
||||
EOF
|
||||
}
|
||||
|
||||
public struct JsonToken
|
||||
{
|
||||
public JsonTokenType Type;
|
||||
public string Value;
|
||||
public int Line;
|
||||
public int Column;
|
||||
}
|
||||
|
||||
public class JsonDeserializerException : Exception
|
||||
{
|
||||
public JsonDeserializerException(string message, Exception innerException, int line, int column)
|
||||
: base(message, innerException)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public JsonDeserializerException(string message, int line, int column)
|
||||
: base(message)
|
||||
{
|
||||
Line = line;
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public JsonDeserializerException(string message, JsonToken nextToken)
|
||||
: base(message)
|
||||
{
|
||||
Line = nextToken.Line;
|
||||
Column = nextToken.Column;
|
||||
}
|
||||
|
||||
public int Line { get; private set; }
|
||||
|
||||
public int Column { get; private set; }
|
||||
}
|
||||
|
||||
internal class JsonDeserializerResource
|
||||
{
|
||||
internal static string Format_IllegalCharacter(int value)
|
||||
{
|
||||
return string.Format("Illegal character (char)'{0}' (Unicode hexadecimal {0:X4}).", value);
|
||||
}
|
||||
|
||||
internal static string Format_IllegalTrailingCharacterAfterLiteral(int value, string literal)
|
||||
{
|
||||
return string.Format("Illegal character(char)'{0}'(Unicode hexadecimal { 0:X4}) after the literal name (char)'{1}'.", value, literal);
|
||||
}
|
||||
|
||||
internal static string Format_UnrecognizedLiteral(string literal)
|
||||
{
|
||||
return string.Format("Invalid JSON literal.Expected literal(char)'{0}'.", literal);
|
||||
}
|
||||
|
||||
internal static string Format_DuplicateObjectMemberName(string memberName)
|
||||
{
|
||||
return Format_InvalidSyntax("JSON object", string.Format("Duplicate member name(char)'{0}'", memberName));
|
||||
}
|
||||
|
||||
internal static string Format_InvalidFloatNumberFormat(string raw)
|
||||
{
|
||||
return string.Format("Invalid float number format: {0}", raw);
|
||||
}
|
||||
|
||||
internal static string Format_FloatNumberOverflow(string raw)
|
||||
{
|
||||
return string.Format("Float number overflow: {0}", raw);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntax(string syntaxName, string issue)
|
||||
{
|
||||
return string.Format("Invalid {0}syntax. {1}.", syntaxName, issue);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxNotExpected(string syntaxName, char unexpected)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Unexpected(char)'{1}'.", syntaxName, unexpected);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxNotExpected(string syntaxName, string unexpected)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Unexpected { 1}.", syntaxName, unexpected);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, char expectation)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected(char)'{1}'.", syntaxName, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, string expectation)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected {1}.", syntaxName, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidSyntaxExpectation(string syntaxName, char expectation1, char expectation2)
|
||||
{
|
||||
return string.Format("Invalid {0} syntax.Expected(char)'{1}' or(char)'{2}'.", syntaxName, expectation1, expectation2);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidTokenExpectation(string tokenValue, string expectation)
|
||||
{
|
||||
return string.Format("Unexpected token(char)'{0}'.Expected {1}.", tokenValue, expectation);
|
||||
}
|
||||
|
||||
internal static string Format_InvalidUnicode(string unicode)
|
||||
{
|
||||
return string.Format("Invalid Unicode[{0}]", unicode);
|
||||
}
|
||||
|
||||
internal static string Format_UnfinishedJSON(string nextTokenValue)
|
||||
{
|
||||
return string.Format("Invalid JSON end.Unprocessed token {0}.", nextTokenValue);
|
||||
}
|
||||
|
||||
internal static string JSON_OpenString
|
||||
{
|
||||
get { return Format_InvalidSyntaxExpectation("JSON string", (char)'\"'); }
|
||||
}
|
||||
|
||||
internal static string JSON_InvalidEnd
|
||||
{
|
||||
get { return "Invalid JSON. Unexpected end of file."; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
<#@ template debug="true" hostspecific="true" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ assembly name="System.Windows.Forms" #>
|
||||
<#@ assembly name="Microsoft.VisualStudio.Shell.Interop.8.0" #>
|
||||
<#@ assembly name="EnvDTE" #>
|
||||
<#@ assembly name="EnvDTE80" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Collections" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Resources" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Text.RegularExpressions" #>
|
||||
<#@ import namespace="Microsoft.VisualStudio.Shell.Interop" #>
|
||||
<#@ import namespace="EnvDTE" #>
|
||||
<#@ import namespace="EnvDTE80" #>
|
||||
<#
|
||||
var hostServiceProvider = (IServiceProvider)Host;
|
||||
var dte = (EnvDTE.DTE)hostServiceProvider.GetService(typeof(EnvDTE.DTE));
|
||||
var templateProjectItem = dte.Solution.FindProjectItem(Host.TemplateFile);
|
||||
var projectDirectory = Path.GetDirectoryName(templateProjectItem.ContainingProject.FullName);
|
||||
var ttDirectory = Path.Combine(projectDirectory, "Properties");
|
||||
var projectNamespace = templateProjectItem.ContainingProject.Properties.Item("DefaultNamespace").Value;
|
||||
var projectName = Path.GetFileName(projectDirectory.TrimEnd('/'));
|
||||
var namedParameterMatcher = new Regex(@"\{([a-z]\w+)\}", RegexOptions.IgnoreCase);
|
||||
var numberParameterMatcher = new Regex(@"\{(\d+)\}");
|
||||
|
||||
foreach (var resxFile in Directory.EnumerateFiles(projectDirectory, "*.resx", SearchOption.AllDirectories))
|
||||
{
|
||||
var fileName = Path.GetFileNameWithoutExtension(resxFile);
|
||||
var resourceStrings = new List<ResourceData>();
|
||||
|
||||
using (var resxReader = new ResXResourceReader(resxFile))
|
||||
{
|
||||
resxReader.UseResXDataNodes = true;
|
||||
|
||||
foreach (DictionaryEntry entry in resxReader)
|
||||
{
|
||||
var node = (ResXDataNode)entry.Value;
|
||||
var value = (string)node.GetValue((System.ComponentModel.Design.ITypeResolutionService)null);
|
||||
|
||||
bool usingNamedArgs = true;
|
||||
var match = namedParameterMatcher.Matches(value);
|
||||
if (match.Count == 0)
|
||||
{
|
||||
usingNamedArgs = false;
|
||||
match = numberParameterMatcher.Matches(value);
|
||||
}
|
||||
|
||||
var arguments = match.Cast<Match>()
|
||||
.Select(m => m.Groups[1].Value)
|
||||
.Distinct();
|
||||
if (!usingNamedArgs)
|
||||
{
|
||||
arguments = arguments.OrderBy(Convert.ToInt32);
|
||||
}
|
||||
|
||||
resourceStrings.Add(
|
||||
new ResourceData
|
||||
{
|
||||
Name = node.Name,
|
||||
Value = value,
|
||||
Arguments = arguments.ToList(),
|
||||
UsingNamedArgs = usingNamedArgs
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
GenerationEnvironment.AppendFormat(
|
||||
@"// <auto-generated />
|
||||
namespace {0}
|
||||
{{
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
internal static class {2}
|
||||
{{
|
||||
private static readonly ResourceManager _resourceManager
|
||||
= new ResourceManager(""{1}.{2}"", typeof({2}).GetTypeInfo().Assembly);
|
||||
", projectNamespace, projectName, fileName);
|
||||
|
||||
foreach (var resourceString in resourceStrings)
|
||||
{
|
||||
GenerationEnvironment.AppendLine();
|
||||
RenderHeader(GenerationEnvironment, resourceString);
|
||||
RenderProperty(GenerationEnvironment, resourceString);
|
||||
|
||||
GenerationEnvironment.AppendLine();
|
||||
RenderHeader(GenerationEnvironment, resourceString);
|
||||
RenderFormatMethod(GenerationEnvironment, resourceString);
|
||||
}
|
||||
|
||||
GenerationEnvironment.Append(@"
|
||||
private static string GetString(string name, params string[] formatterNames)
|
||||
{
|
||||
var value = _resourceManager.GetString(name);
|
||||
|
||||
System.Diagnostics.Debug.Assert(value != null);
|
||||
|
||||
if (formatterNames != null)
|
||||
{
|
||||
for (var i = 0; i < formatterNames.Length; i++)
|
||||
{
|
||||
value = value.Replace(""{"" + formatterNames[i] + ""}"", ""{"" + i + ""}"");
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
var outputPath = Path.Combine(ttDirectory, fileName + ".Designer.cs");
|
||||
|
||||
File.WriteAllText(outputPath, GenerationEnvironment.ToString());
|
||||
GenerationEnvironment.Length = 0;
|
||||
}
|
||||
#>
|
||||
<#+
|
||||
private static void RenderHeader(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.Append(" /// <summary>")
|
||||
.AppendLine();
|
||||
foreach (var line in resourceString.Value.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
|
||||
{
|
||||
builder.AppendFormat(" /// {0}", line.Replace("<", "<").Replace(">", ">"))
|
||||
.AppendLine();
|
||||
}
|
||||
builder.Append(" /// </summary>")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
private static void RenderProperty(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string {0}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" {")
|
||||
.AppendFormat(@" get {{ return GetString(""{0}""); }}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
private static void RenderFormatMethod(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string Format{0}({1})", resourceString.Name, resourceString.Parameters)
|
||||
.AppendLine()
|
||||
.AppendLine(" {");
|
||||
if(resourceString.Arguments.Count > 0)
|
||||
{
|
||||
builder.AppendFormat(@" return string.Format(CultureInfo.CurrentCulture, GetString(""{0}""{1}), {2});",
|
||||
resourceString.Name,
|
||||
resourceString.UsingNamedArgs ? ", " + resourceString.FormatArguments : null,
|
||||
resourceString.ArgumentNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendFormat(@" return GetString(""{0}"");", resourceString.Name);
|
||||
}
|
||||
builder.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
|
||||
private class ResourceData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public List<string> Arguments { get; set; }
|
||||
|
||||
public bool UsingNamedArgs { get; set; }
|
||||
|
||||
public string FormatArguments
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "\"" + a + "\"")); }
|
||||
}
|
||||
|
||||
public string ArgumentNames
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(GetArgName)); }
|
||||
}
|
||||
|
||||
public string Parameters
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "object " + GetArgName(a))); }
|
||||
}
|
||||
|
||||
public string GetArgName(string name)
|
||||
{
|
||||
return UsingNamedArgs ? name : 'p' + name;
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
default ASM_DIFF='${Environment.GetEnvironmentVariable("ASM_DIFF")}'
|
||||
default outFile = "artifacts\default.html"
|
||||
@{
|
||||
if (String.IsNullOrEmpty(ASM_DIFF))
|
||||
{
|
||||
Log.Warn("ASM_DIFF environment variable not set.");
|
||||
Environment.Exit(-1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
exec program='${ASM_DIFF}' commandline='${oldBinariesDir} ${newBinariesDir} -adm -out:${outFile}'
|
||||
|
||||
@{
|
||||
if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")))
|
||||
{
|
||||
var message = File.ReadAllText(outFile)
|
||||
.Replace("|", "||")
|
||||
.Replace("'", "|'")
|
||||
.Replace("\r", "|r")
|
||||
.Replace("\n", "|n")
|
||||
.Replace("]", "|]");
|
||||
Log.Info("##teamcity[message text='" + message + "' status='WARNING']");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
var bowerLibrary = '${ Path.Combine(nodeDir, "node_modules", "bower", "bin", "bower") }'
|
||||
var bowerInstalled = '${ File.Exists(bowerLibrary) }'
|
||||
|
||||
default bowerGloballyInstalled = '${ !bowerInstalled && TestCommand("bower", "--version --config.interactive=false") }'
|
||||
var bowerCmd = '${ bowerGloballyInstalled ? "bower" : bowerLibrary }'
|
||||
|
||||
- // Turn off Bower's Insight reporting since this usage is scripted.
|
||||
- bowerCommand = bowerCommand + " --config.interactive=false";
|
||||
|
||||
- // Install bower locally if not already installed either globally or locally; creates bowerLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" bower'
|
||||
npm npmCommand='${installCommand}' if='!(bowerGloballyInstalled || bowerInstalled)' once='installBower'
|
||||
|
||||
- // Run bower
|
||||
exec program='cmd' commandline='/C ${bowerCmd} ${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && !IsLinux'
|
||||
exec program='${bowerCmd}' commandline='${bowerCommand}' workingdir='${bowerDir}' if='bowerGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${bowerCmd}" ${bowerCommand}' workingdir='${bowerDir}' if='!bowerGloballyInstalled'
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
use import="Files"
|
||||
|
||||
default include='**/*.*'
|
||||
default exclude=''
|
||||
default overwrite='${ false }'
|
||||
|
||||
@{
|
||||
var copyFiles = Files.BasePath(Path.GetFullPath(sourceDir));
|
||||
if (!string.IsNullOrEmpty(include))
|
||||
{
|
||||
copyFiles = copyFiles.Include(include);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(exclude))
|
||||
{
|
||||
copyFiles = copyFiles.Exclude(exclude);
|
||||
}
|
||||
|
||||
foreach(var copyFile in copyFiles)
|
||||
{
|
||||
if (!Quiet)
|
||||
{
|
||||
Log.Info(string.Format("Copying {0}", copyFile));
|
||||
}
|
||||
|
||||
var sourceFile = Path.Combine(sourceDir, copyFile);
|
||||
var outputFile = Path.Combine(outputDir, copyFile);
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFile)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
|
||||
}
|
||||
|
||||
File.Copy(sourceFile, outputFile, overwrite);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
@{/*
|
||||
|
||||
dnu
|
||||
Run dnu commands in your project. Executes `dnu` command.
|
||||
|
||||
command=''
|
||||
The `dnu` subcommand to execute.
|
||||
dnvmUse=''
|
||||
Optional. The DNX framework to use. Suitable for a `dnvm exec` or `dnvm use` command.
|
||||
*/}
|
||||
|
||||
default dnvmUse=''
|
||||
var dnvmPath = '${ Path.Combine(Directory.GetCurrentDirectory(), "packages", "KoreBuild", "build", "dnvm") }'
|
||||
|
||||
exec program='cmd' commandline='/C dnu ${command}' if='!IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var cmdCommand = '/S /C ""${dnvmPath}.cmd" use ${dnvmUse} && dnu ${command}"'
|
||||
exec program='cmd' commandline='${ cmdCommand }' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
exec program='dnu' commandline='${command}' if='IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var envCommand = 'bash -c "source \"${dnvmPath}.sh\" && dnvm use ${dnvmUse} && dnu ${command}"'
|
||||
exec program='/usr/bin/env' commandline='${ envCommand }' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
|
||||
|
||||
default gitBranch=''
|
||||
|
||||
var gitCommand='clone --quiet ${gitUri}'
|
||||
set gitCommand='${gitCommand} --branch ${gitBranch}' if='!string.IsNullOrEmpty(gitBranch)'
|
||||
|
||||
git
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
var gitCommand='config ${gitOptionName} ${gitOptionValue}'
|
||||
|
||||
git
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
|
||||
default gitBranch=''
|
||||
|
||||
var gitCommand='pull --quiet --ff-only ${gitUri}'
|
||||
set gitCommand='${gitCommand} ${gitBranch}:${gitBranch}' if='!string.IsNullOrEmpty(gitBranch)'
|
||||
|
||||
git
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
default gitFolder=''
|
||||
|
||||
-// Use cmd to invoke git so that people who have git as a 'cmd'
|
||||
exec program='cmd' commandline='/C git ${gitCommand}' workingdir='${gitFolder}' if='!IsLinux'
|
||||
exec program='git' commandline='${gitCommand}' workingdir='${gitFolder}' if='IsLinux'
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
var gruntCliLibrary = '${ Path.Combine(nodeDir, "node_modules", "grunt-cli", "bin", "grunt") }'
|
||||
var gruntCliInstalled = '${ File.Exists(gruntCliLibrary) }'
|
||||
|
||||
default gruntCliGloballyInstalled = '${ !gruntCliInstalled && TestCommand("grunt", "--version") }'
|
||||
var gruntCmd = '${ gruntCliGloballyInstalled ? "grunt" : gruntCliLibrary }'
|
||||
|
||||
- // Install grunt-cli locally if not already installed either globally or locally; creates gruntCliLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" grunt-cli'
|
||||
npm npmCommand='${installCommand}' if='!(gruntCliGloballyInstalled || gruntCliInstalled)' once='installGruntCli'
|
||||
|
||||
-// Run grunt-cli
|
||||
exec program='cmd' commandline='/C ${gruntCmd}' workingdir='${gruntDir}' if='gruntCliGloballyInstalled && !IsLinux'
|
||||
exec program='${gruntCmd}' workingdir='${gruntDir}' if='gruntCliGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${gruntCmd}"' workingdir='${gruntDir}' if='!gruntCliGloballyInstalled'
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
@{/*
|
||||
|
||||
k-clean
|
||||
Cleans project. Downloads and executes k sdk tools.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
*/}
|
||||
|
||||
var projectFolder='${Path.GetDirectoryName(projectFile)}'
|
||||
|
||||
directory delete='${Path.Combine(projectFolder, "bin")}'
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
use namespace="System"
|
||||
use namespace="System.Collections.Generic"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.Linq"
|
||||
use namespace="System.Text"
|
||||
use namespace="System.Xml.Linq"
|
||||
|
||||
default resxFile=''
|
||||
|
||||
@{
|
||||
var projectDir = Path.GetDirectoryName(resxFile);
|
||||
var outDirectory = Path.Combine(projectDir, "Properties");
|
||||
var projectName = Path.GetFileName(projectDir.TrimEnd((char)'/'));
|
||||
var namedParameterMatcher = new Regex(@"\{([a-z]\w+)\}", RegexOptions.IgnoreCase);
|
||||
var numberParameterMatcher = new Regex(@"\{(\d+)\}");
|
||||
var generatingEnvironment = new StringBuilder();
|
||||
|
||||
var fileName = Path.GetFileNameWithoutExtension(resxFile);
|
||||
var resourceStrings = new List<ResourceData>();
|
||||
var xml = XDocument.Load(resxFile);
|
||||
|
||||
foreach (var entry in xml.Descendants("data"))
|
||||
{
|
||||
var name = entry.Attribute("name").Value;
|
||||
var value = entry.Element("value").Value;
|
||||
|
||||
bool usingNamedArgs = true;
|
||||
var match = namedParameterMatcher.Matches(value);
|
||||
if (match.Count == 0)
|
||||
{
|
||||
usingNamedArgs = false;
|
||||
match = numberParameterMatcher.Matches(value);
|
||||
}
|
||||
|
||||
var arguments = match.Cast<Match>()
|
||||
.Select(m => m.Groups[1].Value)
|
||||
.Distinct();
|
||||
if (!usingNamedArgs)
|
||||
{
|
||||
arguments = arguments.OrderBy(Convert.ToInt32);
|
||||
}
|
||||
|
||||
resourceStrings.Add(
|
||||
new ResourceData
|
||||
{
|
||||
Name = name,
|
||||
Value = value,
|
||||
Arguments = arguments.ToList(),
|
||||
UsingNamedArgs = usingNamedArgs
|
||||
});
|
||||
}
|
||||
|
||||
generatingEnvironment.AppendFormat(
|
||||
@"// <auto-generated />
|
||||
namespace {0}
|
||||
{{
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
internal static class {1}
|
||||
{{
|
||||
private static readonly ResourceManager _resourceManager
|
||||
= new ResourceManager(""{0}.{1}"", typeof({1}).GetTypeInfo().Assembly);
|
||||
", projectName, fileName);
|
||||
|
||||
foreach (var resourceString in resourceStrings)
|
||||
{
|
||||
generatingEnvironment.AppendLine();
|
||||
RenderHeader(generatingEnvironment, resourceString);
|
||||
RenderProperty(generatingEnvironment, resourceString);
|
||||
|
||||
generatingEnvironment.AppendLine();
|
||||
RenderHeader(generatingEnvironment, resourceString);
|
||||
RenderFormatMethod(generatingEnvironment, resourceString);
|
||||
}
|
||||
|
||||
generatingEnvironment.Append(@"
|
||||
private static string GetString(string name, params string[] formatterNames)
|
||||
{
|
||||
var value = _resourceManager.GetString(name);
|
||||
|
||||
System.Diagnostics.Debug.Assert(value != null);
|
||||
|
||||
if (formatterNames != null)
|
||||
{
|
||||
for (var i = 0; i < formatterNames.Length; i++)
|
||||
{
|
||||
value = value.Replace(""{"" + formatterNames[i] + ""}"", ""{"" + i + ""}"");
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
Directory.CreateDirectory(outDirectory);
|
||||
var outputPath = Path.Combine(outDirectory, fileName + ".Designer.cs");
|
||||
|
||||
File.WriteAllText(outputPath, generatingEnvironment.ToString());
|
||||
}
|
||||
|
||||
functions @{
|
||||
private static void RenderHeader(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.Append(" /// <summary>")
|
||||
.AppendLine();
|
||||
foreach (var line in resourceString.Value.Split(new[] { '\n' }, StringSplitOptions.None))
|
||||
{
|
||||
builder.AppendFormat(" /// {0}", new XText(line))
|
||||
.AppendLine();
|
||||
}
|
||||
builder.Append(" /// </summary>")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
private static void RenderProperty(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string {0}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" {")
|
||||
.AppendFormat(@" get {{ return GetString(""{0}""); }}", resourceString.Name)
|
||||
.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
private static void RenderFormatMethod(StringBuilder builder, ResourceData resourceString)
|
||||
{
|
||||
builder.AppendFormat(" internal static string Format{0}({1})", resourceString.Name, resourceString.Parameters)
|
||||
.AppendLine()
|
||||
.AppendLine(" {");
|
||||
if(resourceString.Arguments.Count > 0)
|
||||
{
|
||||
builder.AppendFormat(@" return string.Format(CultureInfo.CurrentCulture, GetString(""{0}""{1}), {2});",
|
||||
resourceString.Name,
|
||||
resourceString.UsingNamedArgs ? ", " + resourceString.FormatArguments : null,
|
||||
resourceString.ArgumentNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendFormat(@" return GetString(""{0}"");", resourceString.Name);
|
||||
}
|
||||
builder.AppendLine()
|
||||
.AppendLine(" }");
|
||||
}
|
||||
|
||||
private class ResourceData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public List<string> Arguments { get; set; }
|
||||
|
||||
public bool UsingNamedArgs { get; set; }
|
||||
|
||||
public string FormatArguments
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "\"" + a + "\"")); }
|
||||
}
|
||||
|
||||
public string ArgumentNames
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(GetArgName)); }
|
||||
}
|
||||
|
||||
public string Parameters
|
||||
{
|
||||
get { return string.Join(", ", Arguments.Select(a => "object " + GetArgName(a))); }
|
||||
}
|
||||
|
||||
public string GetArgName(string name)
|
||||
{
|
||||
return UsingNamedArgs ? name : 'p' + name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
@{/*
|
||||
|
||||
k-restore
|
||||
Restores nuget packages required for DNX projects. Downloads and executes DNX sdk tools.
|
||||
|
||||
restoreDir=''
|
||||
Optional. The directory in which to execute the dnu restore command.
|
||||
*/}
|
||||
|
||||
default currentDir = '${ Directory.GetCurrentDirectory() }'
|
||||
default restoreDir = '${ currentDir }'
|
||||
|
||||
-// Set KOREBUILD_DNU_RESTORE_CORECLR environment variable to any value and `dnu restore` will use Core CLR.
|
||||
var useCore = '${ E("KOREBUILD_DNU_RESTORE_CORECLR") }'
|
||||
default restoreUse='${ string.IsNullOrEmpty(useCore) ? string.Empty : "default -runtime coreclr" }'
|
||||
|
||||
default restore_options=' ${ E("KOREBUILD_DNU_RESTORE_OPTIONS") } ${ IsLinux ? string.Empty : "--parallel" }'
|
||||
|
||||
dnu command='restore${ restore_options }' workingDir='${ restoreDir }' dnvmUse='${ restoreUse }'
|
||||
|
|
@ -1,401 +0,0 @@
|
|||
use assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
use namespace="System"
|
||||
use namespace="System.Globalization"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.Linq"
|
||||
use import="BuildEnv"
|
||||
use import="Environment"
|
||||
use import="Files"
|
||||
use import="Json"
|
||||
use-teamcity
|
||||
|
||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
|
||||
default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
|
||||
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'
|
||||
default Configuration='${E("Configuration")}'
|
||||
default PACKAGELIST_JSON_FILENAME = 'NuGetPackageVerifier.json'
|
||||
default DNX_TOOLS_FEED = 'https://www.myget.org/F/dnxtools/api/v3/index.json'
|
||||
default NUGET_FEED = 'https://api.nuget.org/v3/index.json'
|
||||
|
||||
@{
|
||||
if (string.IsNullOrEmpty(E("DNX_BUILD_VERSION")))
|
||||
{
|
||||
E("DNX_BUILD_VERSION", BuildNumber);
|
||||
}
|
||||
if (string.IsNullOrEmpty(E("DNX_AUTHOR")))
|
||||
{
|
||||
E("DNX_AUTHOR", AUTHORS);
|
||||
}
|
||||
if (string.IsNullOrEmpty(E("DNX_ASSEMBLY_FILE_VERSION")))
|
||||
{
|
||||
E("DNX_ASSEMBLY_FILE_VERSION", CreateDayBasedVersionNumber());
|
||||
}
|
||||
if (string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
Configuration = "Debug";
|
||||
E("Configuration", Configuration);
|
||||
}
|
||||
|
||||
Log.Info("Build v2: " + IsBuildV2);
|
||||
}
|
||||
|
||||
#restore-npm-modules
|
||||
-// Find all dirs that contain a package.json file
|
||||
var npmDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json")}'
|
||||
npm npmCommand='install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")}' each='var npmDir in npmDirs'
|
||||
|
||||
#restore-bower-components
|
||||
-// Find all dirs that contain a bower.json file
|
||||
var bowerDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "bower.json")}'
|
||||
bower each='var bowerDir in bowerDirs' bowerCommand='install ${E("KOREBUILD_BOWER_INSTALL_OPTIONS")}'
|
||||
|
||||
#run-grunt .restore-npm-modules .restore-bower-components target='initialize'
|
||||
-// Find all dirs that contain a gruntfile.js file
|
||||
var gruntDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "gruntfile.js")}'
|
||||
grunt each='var gruntDir in gruntDirs'
|
||||
|
||||
#clean-bin-folder
|
||||
rimraf rimrafDir='bin' if='Directory.Exists("bin")'
|
||||
|
||||
#clean-npm-modules
|
||||
-// Find all dirs that contain a package.json file
|
||||
var npmDirs = '${
|
||||
GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json")
|
||||
.Select(directory => Path.Combine(directory, "node_modules"))
|
||||
.Where(directory => Directory.Exists(directory))
|
||||
}'
|
||||
rimraf each='var rimrafDir in npmDirs'
|
||||
|
||||
-// Target order is important because clean-npm-modules may (re)create bin folder.
|
||||
#deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.'
|
||||
|
||||
#repo-initialize target='initialize'
|
||||
use-volatile-feed
|
||||
k-restore
|
||||
|
||||
#target-dir-clean target='clean'
|
||||
@{
|
||||
if (Directory.Exists(TARGET_DIR))
|
||||
{
|
||||
var directory = new DirectoryInfo(TARGET_DIR);
|
||||
directory.Attributes &= ~FileAttributes.ReadOnly;
|
||||
|
||||
foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories))
|
||||
{
|
||||
info.Attributes &= ~FileAttributes.ReadOnly;
|
||||
}
|
||||
|
||||
directory.Delete(true);
|
||||
}
|
||||
}
|
||||
|
||||
#build-clean target='clean' if='Directory.Exists("src")'
|
||||
k-clean each='var projectFile in Files.Include("src/**/project.json")'
|
||||
|
||||
#ci-deep-clean .deep-clean target='clean' if='IsTeamCity'
|
||||
|
||||
#build-compile target='compile' if='!IsBuildV2 && Directory.Exists("src")'
|
||||
@{
|
||||
var projectFiles = Files.Include("src/**/project.json").ToList();
|
||||
if (ShouldRunInParallel)
|
||||
{
|
||||
Parallel.ForEach(projectFiles, projectFile => DnuPack(projectFile, BUILD_DIR, Configuration));
|
||||
}
|
||||
else
|
||||
{
|
||||
projectFiles.ForEach(projectFile => DnuPack(projectFile, BUILD_DIR, Configuration));
|
||||
}
|
||||
|
||||
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
|
||||
{
|
||||
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
||||
}
|
||||
}
|
||||
|
||||
#build-compile target='compile' if='IsBuildV2'
|
||||
@{
|
||||
// If the src folder, build and create the packages
|
||||
if (Directory.Exists("src"))
|
||||
{
|
||||
// Handle projects 1 to 3 levels down from src/, avoiding path too long errors.
|
||||
DnuPack("src/*;src/*/*;src/*/*/*", BUILD_DIR, Configuration);
|
||||
|
||||
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
|
||||
{
|
||||
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
||||
}
|
||||
}
|
||||
|
||||
// For test and samples only check if they compile
|
||||
var projectsToBuild = new List<string>();
|
||||
if (Directory.Exists("test"))
|
||||
{
|
||||
// Handle projects 1 to 3 levels down from test/, avoiding path too long errors.
|
||||
projectsToBuild.Add("test/*");
|
||||
projectsToBuild.Add("test/*/*");
|
||||
projectsToBuild.Add("test/*/*/*");
|
||||
}
|
||||
if (Directory.Exists("samples"))
|
||||
{
|
||||
// Handle projects 1 to 3 levels down from samples/, avoiding path too long errors.
|
||||
projectsToBuild.Add("samples/*");
|
||||
projectsToBuild.Add("samples/*/*");
|
||||
projectsToBuild.Add("samples/*/*/*");
|
||||
}
|
||||
|
||||
if (projectsToBuild.Any())
|
||||
{
|
||||
DnuBuild(
|
||||
string.Join(";", projectsToBuild),
|
||||
Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
#native-compile target='compile' if='!IsLinux && Directory.Exists(Path.Combine(BASE_DIR, "src"))'
|
||||
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
||||
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
|
||||
|
||||
@{
|
||||
if (nativeProjects.Any())
|
||||
{
|
||||
var msbuildVersions = new[] { "14.0", "12.0"};
|
||||
|
||||
for (var i = 0; i < msbuildVersions.Length; i++)
|
||||
{
|
||||
var msbuildPath = Path.Combine(programFilesX86, "MSBuild", msbuildVersions[i], "Bin", "MSBuild.exe");
|
||||
if (File.Exists(msbuildPath))
|
||||
{
|
||||
var commonParameters =
|
||||
" /p:Configuration=" + Configuration +
|
||||
" /p:ProductVersion=1.0.0" +
|
||||
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
|
||||
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
|
||||
|
||||
foreach (var project in nativeProjects)
|
||||
{
|
||||
Exec(msbuildPath, project + " /p:Platform=Win32" + commonParameters);
|
||||
Exec(msbuildPath, project + " /p:Platform=x64" + commonParameters);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == msbuildVersions.Length - 1)
|
||||
{
|
||||
Log.Warn("msbuild version 14 or 12 not found. Please ensure you have the VS 2015 or VS 2013 C++ SDK installed.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copy sourceDir='${Path.GetDirectoryName(project)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR, Path.GetFileNameWithoutExtension(project))}' overwrite='${true}' each='var project in nativeProjects'
|
||||
|
||||
#nuget-verify target='package' if='File.Exists(PACKAGELIST_JSON_FILENAME) && ShouldVerifyNupkgs' description='Verify if all the packages are generated properly'
|
||||
var commandsDirectory = '${Path.Combine(BASE_DIR, "commands")}'
|
||||
exec program='.build/NuGet.exe' commandline='install -ExcludeVersion -pre NuGetPackageVerifier -Source ${DNX_TOOLS_FEED} -out ${commandsDirectory}'
|
||||
exec program='${Path.Combine(commandsDirectory, "NuGetPackageVerifier", "NuGetPackageVerifier.exe")}' commandline='"${BUILD_DIR}" "${Path.Combine(BASE_DIR, PACKAGELIST_JSON_FILENAME)}"'
|
||||
@{
|
||||
if (Directory.Exists(commandsDirectory))
|
||||
{
|
||||
Directory.Delete(commandsDirectory, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
#nuget-install target='install' description='Install NuGet packages to local repo'
|
||||
-if (Directory.Exists("src")) {
|
||||
kpm-publish sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}'
|
||||
nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))'
|
||||
- }
|
||||
|
||||
#xunit-test target='test' if='Directory.Exists("test")'
|
||||
@{
|
||||
var projectFiles = Files.Include("test/**/project.json").Exclude("**/bin/*/app/project.json").ToList();
|
||||
if (ShouldRunInParallel)
|
||||
{
|
||||
Parallel.ForEach(projectFiles, projectFile => DnxTest(projectFile, testParallel: true));
|
||||
}
|
||||
else
|
||||
{
|
||||
projectFiles.ForEach(projectFile => DnxTest(projectFile, testParallel: false));
|
||||
}
|
||||
}
|
||||
|
||||
#build-samples target='test' if='!IsBuildV2 && Directory.Exists("samples")'
|
||||
@{
|
||||
var projectFiles = Files.Include("samples/**/project.json").ToList();
|
||||
if (ShouldRunInParallel)
|
||||
{
|
||||
Parallel.ForEach(projectFiles, projectFile => DnuBuild(projectFile, Configuration));
|
||||
}
|
||||
else
|
||||
{
|
||||
projectFiles.ForEach(projectFile => DnuBuild(projectFile, Configuration));
|
||||
}
|
||||
}
|
||||
|
||||
#make-roslyn-fast
|
||||
ngen-roslyn
|
||||
|
||||
#resx
|
||||
@{
|
||||
var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures | CultureTypes.InstalledWin32Cultures | CultureTypes.SpecificCultures);
|
||||
foreach (var file in Directory.EnumerateFiles(BASE_DIR, "*.resx", SearchOption.AllDirectories))
|
||||
{
|
||||
var splitFileName = Path.GetFileNameWithoutExtension(file).Split(new string[] { "." }, StringSplitOptions.None);
|
||||
|
||||
if (splitFileName.Length > 1)
|
||||
{
|
||||
var localeString = splitFileName.Last();
|
||||
if (!cultures.Any(c => localeString.Equals(c.Name)))
|
||||
{
|
||||
UpdateResx(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateResx(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#--quiet
|
||||
@{
|
||||
AddToE("KOREBUILD_BOWER_INSTALL_OPTIONS", "--quiet");
|
||||
AddToE("KOREBUILD_DNU_BUILD_OPTIONS", "--quiet");
|
||||
AddToE("KOREBUILD_DNU_PACK_OPTIONS", "--quiet");
|
||||
AddToE("KOREBUILD_DNU_RESTORE_OPTIONS", "--quiet");
|
||||
AddToE("KOREBUILD_NPM_INSTALL_OPTIONS", "--quiet");
|
||||
Quiet = true;
|
||||
}
|
||||
|
||||
#--parallel
|
||||
@{
|
||||
E("KOREBUILD_PARALLEL", "1");
|
||||
}
|
||||
|
||||
#--test-dnxcore
|
||||
@{
|
||||
E("KOREBUILD_TEST_DNXCORE", "1");
|
||||
}
|
||||
|
||||
#stylecop if='Directory.Exists("src")'
|
||||
stylecop-setup
|
||||
stylecop-run each='var projectFile in Files.Include("src/**/project.json")'
|
||||
|
||||
functions @{
|
||||
private static bool Quiet { get; set; }
|
||||
|
||||
string E(string key) { return Environment.GetEnvironmentVariable(key); }
|
||||
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
|
||||
void AddToE(string key, string append)
|
||||
{
|
||||
var original = E(key);
|
||||
if (string.IsNullOrEmpty(original))
|
||||
{
|
||||
E(key, append);
|
||||
}
|
||||
else
|
||||
{
|
||||
E(key, original + " " + append);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<string> GetDirectoriesContaining(string path, string searchPattern)
|
||||
{
|
||||
var sep = Path.DirectorySeparatorChar;
|
||||
// Don't include directories that are children of a node_modules or bower_components directory
|
||||
return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories)
|
||||
.Where(p => p.IndexOf(sep + "node_modules" + sep) < 0 &&
|
||||
p.IndexOf(sep + "bower_components" + sep) < 0 &&
|
||||
p.IndexOf(sep + "wwwroot" + sep + "lib" + sep) < 0)
|
||||
.Select(p => Path.GetDirectoryName(p))
|
||||
.Distinct();
|
||||
}
|
||||
|
||||
bool TestCommand(string program, string commandline)
|
||||
{
|
||||
// Tests whether a given command succeeds at the command line.
|
||||
// Useful for testing whether a given command is installed and on the path, e.g. node
|
||||
ProcessStartInfo processStartInfo;
|
||||
|
||||
if(!IsLinux)
|
||||
{
|
||||
processStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
FileName = "cmd",
|
||||
Arguments = "/C " + program + " " + commandline,
|
||||
};
|
||||
} else
|
||||
{
|
||||
processStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
FileName = program,
|
||||
Arguments = commandline,
|
||||
};
|
||||
}
|
||||
try
|
||||
{
|
||||
Log.Info(string.Format("Testing for command: {0} {1}", program, commandline));
|
||||
var process = Process.Start(processStartInfo);
|
||||
process.WaitForExit();
|
||||
if (process.ExitCode == 0)
|
||||
{
|
||||
Log.Info(" command found (0 exit code)");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warn(" command not found (non-0 exit code)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn(" command exception: " + ex.ToString());
|
||||
Log.Warn(" command not found");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ShouldRunInParallel
|
||||
{
|
||||
get { return !string.IsNullOrEmpty(E("KOREBUILD_PARALLEL")); }
|
||||
}
|
||||
|
||||
bool ShouldVerifyNupkgs
|
||||
{
|
||||
get { return E("KOREBUILD_VERIFY_NUPKGS") == "1"; }
|
||||
}
|
||||
}
|
||||
|
||||
macro name='Exec' program='string' commandline='string'
|
||||
exec
|
||||
|
||||
macro name='Dnu' command='string'
|
||||
dnu
|
||||
|
||||
macro name='Dnx' command='string' dnxDir='string'
|
||||
k
|
||||
|
||||
macro name='Dnx' command='string' dnxDir='string' dnvmUse='string'
|
||||
k
|
||||
|
||||
macro name="UpdateResx" resxFile='string'
|
||||
k-generate-resx
|
||||
|
||||
macro name="DnxTest" projectFile='string' testParallel='bool'
|
||||
k-test
|
||||
|
||||
macro name="DnuBuild" projectFile='string' configuration='string'
|
||||
kpm-build
|
||||
|
||||
macro name="DnuPack" projectFile='string' kpmPackOutputDir='string' configuration='string'
|
||||
kpm-pack
|
||||
|
||||
macro name="DeleteFolder" delete='string'
|
||||
directory
|
||||
|
||||
macro name="CopyFolder" sourceDir='string' outputDir='string' overwrite='bool'
|
||||
copy
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
use import="Json"
|
||||
use import="Environment"
|
||||
|
||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||
default KOREBUILD_TEST_DNXCORE='${E("KOREBUILD_TEST_DNXCORE")}'
|
||||
default KOREBUILD_TEST_SKIPMONO='${E("KOREBUILD_TEST_SKIPMONO")}'
|
||||
|
||||
@{/*
|
||||
|
||||
k-test
|
||||
Run unit tests in your project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the test project.json to execute
|
||||
|
||||
*/}
|
||||
|
||||
@{
|
||||
var projectText = File.ReadAllText(projectFile);
|
||||
var project = (JsonObject)Json.Deserialize(projectText);
|
||||
|
||||
var commands = project.ValueAsJsonObject("commands");
|
||||
|
||||
if (commands != null && commands.Keys.Contains("test"))
|
||||
{
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var projectName = Path.GetFileName(projectFolder);
|
||||
|
||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||
{
|
||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||
}
|
||||
|
||||
var configs = project.ValueAsJsonObject("frameworks");
|
||||
IEnumerable<string> targetFrameworks;
|
||||
if (configs == null)
|
||||
{
|
||||
// Assume dnx451 only if none specified
|
||||
targetFrameworks = new[] { "dnx451" };
|
||||
}
|
||||
else
|
||||
{
|
||||
targetFrameworks = configs.Keys;
|
||||
}
|
||||
|
||||
// Currently only dnx* targets are supported. See aspnet/Universe#53
|
||||
targetFrameworks = targetFrameworks.Where(k => k.StartsWith("dnx", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
foreach (var framework in targetFrameworks)
|
||||
{
|
||||
var testArgs = noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
|
||||
|
||||
if (!framework.StartsWith("dnxcore", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (IsLinux)
|
||||
{
|
||||
// Work around issue with testing in parallel on Mono.
|
||||
testArgs = " -parallel none";
|
||||
}
|
||||
|
||||
if (!IsLinux ||
|
||||
(!string.Equals(KOREBUILD_TEST_SKIPMONO, "1") &&
|
||||
!string.Equals(KOREBUILD_TEST_SKIPMONO, "true")))
|
||||
{
|
||||
Dnx("test" + testArgs, projectFolder);
|
||||
}
|
||||
}
|
||||
else if (!IsLinux ||
|
||||
string.Equals(KOREBUILD_TEST_DNXCORE, "1") ||
|
||||
string.Equals(KOREBUILD_TEST_DNXCORE, "true"))
|
||||
{
|
||||
Dnx("test" + testArgs, projectFolder, "default -runtime coreclr");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
|
||||
use namespace="System"
|
||||
use namespace="System.Collections.Generic"
|
||||
use namespace="System.IO"
|
||||
use import="Files"
|
||||
|
||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
|
||||
@{
|
||||
var srcDir = Path.Combine(BASE_DIR, "src");
|
||||
foreach (var projectFile in Files.Include(Path.Combine(srcDir, "**", "project.json")))
|
||||
{
|
||||
var binDirectory = Path.Combine(Path.GetDirectoryName(projectFile), "bin");
|
||||
if (Directory.Exists(binDirectory))
|
||||
{
|
||||
foreach (var xmlFilePath in Files.Include(Path.Combine(binDirectory, "**", "*.xml")))
|
||||
{
|
||||
var errors = 0;
|
||||
var xmlLines = File.ReadAllLines(xmlFilePath);
|
||||
for (var linesIndex = 0; linesIndex < xmlLines.Length; linesIndex++)
|
||||
{
|
||||
var xmlLine = xmlLines[linesIndex].Trim();
|
||||
if (xmlLine.StartsWith("<!--"))
|
||||
{
|
||||
// Compiler only emits comments for syntax errors.
|
||||
if (errors == 0)
|
||||
{
|
||||
Log.Warn(string.Format("Invalid documentation syntax in {0}:", xmlFilePath));
|
||||
}
|
||||
|
||||
errors++;
|
||||
Log.Warn(string.Format(" {0}: {1}", linesIndex + 1, xmlLine));
|
||||
}
|
||||
else if (xmlLine.Contains("\"!:"))
|
||||
{
|
||||
// '!' is reference string error token.
|
||||
if (errors == 0)
|
||||
{
|
||||
Log.Warn(string.Format("Invalid documentation syntax in {0}:", xmlFilePath));
|
||||
}
|
||||
|
||||
errors++;
|
||||
Log.Warn(string.Format(" {0}: {1}", linesIndex + 1, xmlLine));
|
||||
}
|
||||
}
|
||||
|
||||
if (errors != 0)
|
||||
{
|
||||
Environment.Exit(errors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
@{/*
|
||||
|
||||
k
|
||||
Run dnx commands in your project. Executes `dnx` command.
|
||||
|
||||
command=''
|
||||
The `dnx` subcommand to execute.
|
||||
dnxDir=''
|
||||
Optional. The directory in which to execute the `dnx` command.
|
||||
dnvmUse=''
|
||||
Optional. The DNX framework to use. Suitable for a `dnvm run` or `dnvm use` command.
|
||||
*/}
|
||||
|
||||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default dnxDir = '${ currentDir }'
|
||||
|
||||
default dnvmUse=''
|
||||
var dnvmPath = '${ Path.Combine(Directory.GetCurrentDirectory(), "packages", "KoreBuild", "build", "dnvm") }'
|
||||
|
||||
exec program='cmd' commandline='/C dnx ${command}' workingdir='${dnxDir}' if='!IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var cmdCommand = '/S /C ""${dnvmPath}.cmd" use ${dnvmUse} && dnx ${command}"'
|
||||
exec program='cmd' commandline='${ cmdCommand }' workingdir='${dnxDir}' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
exec program='dnx' commandline='${command}' workingdir='${dnxDir}' if='IsLinux && string.IsNullOrEmpty(dnvmUse)'
|
||||
|
||||
var envCommand = 'bash -c "source \"${dnvmPath}.sh\" && dnvm use ${dnvmUse} && dnx ${command}"'
|
||||
exec program='/usr/bin/env' commandline='${ envCommand }' workingdir='${dnxDir}' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)'
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
@{/*
|
||||
|
||||
kpm-build
|
||||
Builds a project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
default build_options=' ${E("KOREBUILD_DNU_BUILD_OPTIONS")}'
|
||||
|
||||
@{
|
||||
if (IsBuildV2)
|
||||
{
|
||||
var projectsToPack = new List<string>();
|
||||
foreach(var arg in projectFile.Split((char)';'))
|
||||
{
|
||||
if (!arg.Contains("*"))
|
||||
{
|
||||
projectsToPack.Add(Path.GetDirectoryName(arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
var projectFolders = Files.Include(arg + "/project.json").Select(proj => Path.GetDirectoryName(proj));
|
||||
projectsToPack.AddRange(projectFolders);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var projFolder in projectsToPack)
|
||||
{
|
||||
DeleteFolder(Path.Combine(projFolder, "bin", configuration));
|
||||
}
|
||||
|
||||
var projectsArg=projectFile.Replace(";", " ");
|
||||
var dnuArgs=string.Format("build{0} {1} --configuration {2}", build_options, projectsArg, configuration);
|
||||
Dnu(dnuArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
var projectFolder=Path.GetDirectoryName(projectFile);
|
||||
var projectBin=Path.Combine(projectFolder, "bin", configuration);
|
||||
|
||||
DeleteFolder(projectBin);
|
||||
|
||||
var dnuArgs=string.Format("build{0} {1} --configuration {2}", build_options, projectFolder, configuration);
|
||||
Dnu(dnuArgs);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
@{/*
|
||||
|
||||
kpm-pack
|
||||
Builds package from project.
|
||||
|
||||
projectFile=''
|
||||
Required. Path to the project.json to build.
|
||||
|
||||
kpmPackOutputDir=''
|
||||
Required. Base output directory.
|
||||
|
||||
configuration=''
|
||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
default pack_options=' ${E("KOREBUILD_DNU_PACK_OPTIONS")}'
|
||||
|
||||
@{
|
||||
if (IsBuildV2)
|
||||
{
|
||||
var projectsToPack = new List<string>();
|
||||
foreach(var arg in projectFile.Split((char)';'))
|
||||
{
|
||||
if (!arg.Contains("*"))
|
||||
{
|
||||
projectsToPack.Add(Path.GetDirectoryName(arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
var projectFolders = Files.Include(arg + "/project.json").Select(proj => Path.GetDirectoryName(proj));
|
||||
projectsToPack.AddRange(projectFolders);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var projFolder in projectsToPack)
|
||||
{
|
||||
DeleteFolder(Path.Combine(projFolder, "bin", configuration));
|
||||
}
|
||||
|
||||
var projectsArg=projectFile.Replace(";", " ");
|
||||
var dnuArgs=string.Format("pack{0} {1} --configuration {2}", pack_options, projectsArg, configuration);
|
||||
Dnu(dnuArgs);
|
||||
|
||||
foreach(var projFolder in projectsToPack)
|
||||
{
|
||||
CopyFolder(
|
||||
Path.Combine(projFolder, "bin", configuration),
|
||||
Path.Combine(kpmPackOutputDir, Path.GetFileName(projFolder)),
|
||||
true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var projectFolder=Path.GetDirectoryName(projectFile);
|
||||
var projectName=Path.GetFileName(projectFolder);
|
||||
var projectBin=Path.Combine(projectFolder, "bin", configuration);
|
||||
|
||||
DeleteFolder(projectBin);
|
||||
|
||||
var dnuArgs=string.Format("pack{0} {1} --configuration {2}", pack_options, projectFolder, configuration);
|
||||
Dnu(dnuArgs);
|
||||
|
||||
CopyFolder(projectBin, Path.Combine(kpmPackOutputDir, projectName), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
@{/*
|
||||
|
||||
kpm-publish
|
||||
Builds project. Downloads and executes k sdk tools.
|
||||
|
||||
sourcePackagesDir=''
|
||||
Required. Path to packages to install (skips symbol packages)
|
||||
|
||||
targetPackagesDir=''
|
||||
Optional. Path to publish packages.
|
||||
*/}
|
||||
|
||||
default targetPackagesDir=''
|
||||
|
||||
@{
|
||||
var packages = Directory.EnumerateFiles(sourcePackagesDir, "*.nupkg")
|
||||
.Where(p => !p.EndsWith(".symbols.nupkg"));
|
||||
}
|
||||
|
||||
dnu command='packages add ${package} ${targetPackagesDir}' each='var package in packages'
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
var oldRoslynAssemblies='${new[] { "Microsoft.CodeAnalysis.CSharp",
|
||||
"Microsoft.CodeAnalysis",
|
||||
"System.Collections.Immutable",
|
||||
"System.Reflection.Metadata.Ecma335",
|
||||
"System.Reflection.Metadata" }}'
|
||||
|
||||
var roslynAssemblies='${new[] { "Microsoft.CodeAnalysis.CSharp",
|
||||
"Microsoft.CodeAnalysis",
|
||||
"System.Collections.Immutable",
|
||||
"System.Reflection.Metadata" }}'
|
||||
|
||||
var programFilesX86='${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
||||
var gacutil='${Path.Combine(programFilesX86, "Microsoft SDKs", "Windows", "v8.1A", "bin", "NETFX 4.5.1 Tools", "gacutil.exe")}'
|
||||
|
||||
var windir='${Environment.GetFolderPath(Environment.SpecialFolder.Windows)}'
|
||||
var ngen='${Path.Combine(windir, "Microsoft.NET", "Framework", "v4.0.30319", "ngen.exe")}'
|
||||
|
||||
var tempRoslynPackagesDir='bin\_roslyn'
|
||||
var tempRoslynDir='bin\_roslyn\all'
|
||||
|
||||
exec program='${gacutil}' commandline='/u ${p}' each='var p in oldRoslynAssemblies'
|
||||
|
||||
nuget-install package='Microsoft.CodeAnalysis.CSharp' outputDir='${tempRoslynPackagesDir}' extra='-pre -ExcludeVersion -nocache'
|
||||
|
||||
@{
|
||||
var binaries = Files.Include(Path.Combine(tempRoslynPackagesDir, "**", "*net45*", "*.dll"));
|
||||
Directory.CreateDirectory(tempRoslynDir);
|
||||
|
||||
foreach(var file in binaries)
|
||||
{
|
||||
File.Copy(file, Path.Combine(tempRoslynDir, Path.GetFileName(file)), true);
|
||||
}
|
||||
}
|
||||
|
||||
exec program='${ngen}' commandline='install ${tempRoslynDir}\${p}.dll' each='var p in roslynAssemblies'
|
||||
exec program='${gacutil}' commandline='/i ${tempRoslynDir}\${p}.dll' each='var p in roslynAssemblies'
|
||||
|
||||
directory delete='${tempRoslynPackagesDir}'
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
use namespace="System.IO"
|
||||
use namespace="System.IO.Compression"
|
||||
use namespace="System.Net"
|
||||
|
||||
default binDir = '${Path.Combine(Directory.GetCurrentDirectory(), "bin")}'
|
||||
|
||||
-// When updating the node version you need to update the nodeExeSha to match what 'signtool.exe /pa /v node.exe' emits
|
||||
default nodeVer = '0.10.28'
|
||||
default npmVer = '1.4.9'
|
||||
default nodeExeSha = '628FFD6C3577068C00CEC9F6F897F0EC8F5212D9'
|
||||
default nodeDir = '${Path.Combine(binDir, "nodejs")}'
|
||||
|
||||
var nodeExe = 'node.exe'
|
||||
var npmZip = 'npm-${npmVer}.zip'
|
||||
var nodeDist = 'http://nodejs.org/dist/'
|
||||
var nodeUrl = '${nodeDist}v${nodeVer}/${nodeExe}'
|
||||
var npmUrl = '${nodeDist}npm/${npmZip}'
|
||||
var nodeInstallExePath = '${Path.Combine(nodeDir, nodeExe)}'
|
||||
var npmInstallZipPath = '${Path.Combine(nodeDir, npmZip)}'
|
||||
var nodeInstalled = '${ File.Exists(nodeInstallExePath) }'
|
||||
|
||||
default nodeGloballyInstalled = '${ !nodeInstalled && TestCommand("node", "--version") }'
|
||||
|
||||
-// Command simply fails on Linux if nodejs is not available.
|
||||
var doInstall = '${ !IsLinux && !(nodeGloballyInstalled || nodeInstalled) }'
|
||||
|
||||
@{
|
||||
if (doInstall) {
|
||||
Log.Info("Installing nodejs locally");
|
||||
|
||||
if (Directory.Exists(nodeDir))
|
||||
{
|
||||
Directory.Delete(nodeDir, recursive: true);
|
||||
}
|
||||
Directory.CreateDirectory(nodeDir);
|
||||
|
||||
// Download node
|
||||
var wc = new WebClient();
|
||||
|
||||
Log.Info(string.Format("Downloading {0} to {1}", nodeUrl, nodeInstallExePath));
|
||||
wc.DownloadFile(nodeUrl, nodeInstallExePath);
|
||||
|
||||
Log.Info(string.Format("Downloading {0} to {1}", npmUrl, npmInstallZipPath));
|
||||
wc.DownloadFile(npmUrl, npmInstallZipPath);
|
||||
|
||||
// Unzip npm
|
||||
Log.Info(string.Format("Unzipping npm to {0}", nodeDir));
|
||||
ZipFile.ExtractToDirectory(npmInstallZipPath, nodeDir);
|
||||
}
|
||||
}
|
||||
|
||||
verify-authenticode verifyFilePath='${nodeInstallExePath}' expectedHash='${nodeExeSha}' if='doInstall'
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "node")}'
|
||||
|
||||
node-install once='installNode'
|
||||
|
||||
var nodeExeFile = '${ Path.Combine(nodeDir, "node.exe") }'
|
||||
var nodeExePath = '${ File.Exists(nodeExeFile) ? nodeExeFile : "node" }'
|
||||
|
||||
exec program='${nodeExePath}' commandline='${nodeCommand}'
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
default npmDir = '${currentDir}'
|
||||
|
||||
node-install once='installNode'
|
||||
|
||||
var npmFile = '${ Path.Combine(nodeDir, "npm.cmd") }'
|
||||
var npmCmd = '${ File.Exists(npmFile) ? ("\"" + npmFile + "\"") : "npm" }'
|
||||
|
||||
- // Ensure nodeDir exists. npmCommand is likely a package installation targeting that directory.
|
||||
@{
|
||||
Directory.CreateDirectory(nodeDir);
|
||||
}
|
||||
|
||||
exec program='cmd' commandline='/S /C "${npmCmd} ${npmCommand}"' workingdir='${npmDir}' if='!IsLinux'
|
||||
exec program='${npmCmd}' commandline='${npmCommand}' workingdir='${npmDir}' if='IsLinux'
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
@{/*
|
||||
|
||||
nuget-local-publish
|
||||
Publishing nuget packages in the source directory to %USERPROFILE%\.nuget
|
||||
|
||||
sourcePackagesDir=''
|
||||
Directory of packages to publish to the local nuget feed
|
||||
|
||||
*/}
|
||||
|
||||
@{
|
||||
var HOME_DIR = Environment.GetEnvironmentVariable("HOME");
|
||||
if (string.IsNullOrEmpty(HOME_DIR))
|
||||
{
|
||||
HOME_DIR = Environment.GetEnvironmentVariable("HOMEDRIVE") +
|
||||
Environment.GetEnvironmentVariable("HOMEPATH");
|
||||
}
|
||||
}
|
||||
|
||||
copy sourceDir='${sourcePackagesDir}' include='*.nupkg' outputDir='${Path.Combine(HOME_DIR, ".nuget")}' overwrite='${true}'
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
use namespace="System.Threading.Tasks"
|
||||
|
||||
@{/*
|
||||
|
||||
nuget-resilient-publish
|
||||
Publishes NuGet packages with retries
|
||||
|
||||
sourcePackagesDir=''
|
||||
Required. Path to packages to push
|
||||
|
||||
nugetFeed=''
|
||||
Required. Feed to publish to.
|
||||
*/}
|
||||
|
||||
default apiKey='${Environment.GetEnvironmentVariable("APIKEY")}'
|
||||
default extra=''
|
||||
|
||||
var nugetArgs=''
|
||||
set nugetArgs='${nugetArgs} -ApiKey ${apiKey}' if='!string.IsNullOrEmpty(apiKey)'
|
||||
set nugetArgs='${nugetArgs} -Source ${nugetFeed}' if='!string.IsNullOrEmpty(nugetFeed)'
|
||||
set nugetArgs='${nugetArgs} ${extra}' if='!string.IsNullOrEmpty(extra)'
|
||||
|
||||
@{
|
||||
var packages = Directory.EnumerateFiles(sourcePackagesDir, "*.nupkg")
|
||||
.Where(p => !p.EndsWith(".symbols.nupkg"))
|
||||
.ToArray();
|
||||
|
||||
var nugetExePath = Environment.GetEnvironmentVariable("PUSH_NUGET_EXE");
|
||||
if (string.IsNullOrEmpty(nugetExePath))
|
||||
{
|
||||
nugetExePath = ".nuget/NuGet.exe";
|
||||
}
|
||||
|
||||
Parallel.ForEach(packages, package =>
|
||||
{
|
||||
var retries = 0;
|
||||
var packagePath = Path.Combine(sourcePackagesDir, package);
|
||||
start:
|
||||
try
|
||||
{
|
||||
ExecClr(nugetExePath, "push " + package + " " + nugetArgs);
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (++retries == 3)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
goto start;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
macro name='ExecClr' program='string' commandline='string'
|
||||
exec-clr
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
default currentDir = '${Directory.GetCurrentDirectory()}'
|
||||
default workingDir = '${ currentDir }'
|
||||
default nodeDir = '${Path.Combine(currentDir, "bin", "nodejs")}'
|
||||
default rimrafLibrary = '${ Path.Combine(nodeDir, "node_modules", "rimraf", "bin.js") }'
|
||||
var rimrafInstalled = '${ File.Exists(rimrafLibrary) }'
|
||||
|
||||
default rimrafGloballyInstalled = '${ !rimrafInstalled && TestCommand("rimraf", "::") }'
|
||||
var rimrafCmd = '${ rimrafGloballyInstalled ? "rimraf" : rimrafLibrary }'
|
||||
|
||||
- // Install rimraf locally if not already installed either globally or locally; creates rimrafLibrary file if run
|
||||
var installCommand = 'install ${E("KOREBUILD_NPM_INSTALL_OPTIONS")} --prefix "${nodeDir}" rimraf'
|
||||
npm npmCommand='${installCommand}' if='!(rimrafGloballyInstalled || rimrafInstalled)' once='installRimraf'
|
||||
|
||||
- // Run rimraf
|
||||
exec program='cmd' commandline='/C ${rimrafCmd} "${rimrafDir}"' workingdir='${workingDir}' if='rimrafGloballyInstalled && !IsLinux'
|
||||
exec program='${rimrafCmd}' commandline='"${rimrafDir}"' workingdir='${workingDir}' if='rimrafGloballyInstalled && IsLinux'
|
||||
node nodeCommand='"${rimrafCmd}" "${rimrafDir}"' workingdir='${workingDir}' if='!rimrafGloballyInstalled'
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
-// Deletes a directory using robocopy such that long paths aren't an issue
|
||||
default parentDir = '${Directory.GetParent(dir).FullName}'
|
||||
default tempDir = '${Path.Combine(parentDir, "__emp_dir")}'
|
||||
default logFile = '${Path.Combine(parentDir, "robocopy-log.txt")}'
|
||||
|
||||
exec program='cmd' commandline='/C mkdir ${tempDir}'
|
||||
|
||||
@{
|
||||
var robocopyProcessStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = dir,
|
||||
FileName = "cmd",
|
||||
Arguments = "/C robocopy " + tempDir + " " + dir + " /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:" + logFile,
|
||||
};
|
||||
|
||||
var robocopyProcess = Process.Start(robocopyProcessStartInfo);
|
||||
robocopyProcess.WaitForExit();
|
||||
|
||||
// Robocopy encodes results as a bitmap in the return code, see http://ss64.com/nt/robocopy-exit.html
|
||||
if (robocopyProcess.ExitCode >= 16)
|
||||
{
|
||||
throw new Exception(string.Format("Error {0} attempting to delete {1}, see {2} for more details", robocopyProcess.ExitCode, dir, logFile));
|
||||
}
|
||||
}
|
||||
-//exec program='cmd' commandline='/C robocopy ${tempDir} ${dir} /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:${logFile}'
|
||||
|
||||
exec program='cmd' commandline='/C rmdir ${tempDir}'
|
||||
exec program='cmd' commandline='/C rmdir ${dir}'
|
||||
exec program='cmd' commandline='/C del ${logFile}'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue