Modified the build.
- Added BuildEnv with BuildNumber property - Fixed generate projects
This commit is contained in:
parent
921a848cce
commit
a738b84deb
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
use namespace="System"
|
||||
|
||||
functions
|
||||
@{
|
||||
string BuildNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BUILD_NUMBER") ??
|
||||
"t" + DateTime.UtcNow.ToString("yyMMddHHmmss");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -185,6 +185,7 @@ functions
|
|||
var d = serializer.DeserializeObject(jsonText) as IDictionary<string, object>;
|
||||
var configs = GetObject(d, "configurations") ?? new Dictionary<string, object>();
|
||||
var dependencies = GetObject(d, "dependencies") ?? new Dictionary<string, object>();
|
||||
var compilationOptions = GetObject(d, "compilationOptions") ?? new Dictionary<string, object>();
|
||||
|
||||
if(configs.Count == 0)
|
||||
{
|
||||
|
|
@ -208,6 +209,10 @@ functions
|
|||
.Select(r => r.Key)
|
||||
.ToList();
|
||||
|
||||
var sharedDefines = Get<IEnumerable<object>>(compilationOptions, "define") ?? new object[0];
|
||||
object unsafeValue = Get<object>(compilationOptions, "allowUnsafe");
|
||||
bool sharedAllowUnsafeCode = unsafeValue == null ? false : (bool)unsafeValue;
|
||||
|
||||
// HACK: Assume the packages folder is 2 up from the projectDir
|
||||
string packagesDir = Path.GetFullPath(Path.Combine(projectDir, "..", "..", "packages"));
|
||||
|
||||
|
|
@ -218,16 +223,22 @@ functions
|
|||
var targetFramework = pair.Key;
|
||||
var props = (IDictionary<string, object>)pair.Value;
|
||||
|
||||
var compilationOptions = GetObject(props, "compilationOptions") ?? new Dictionary<string, object>();
|
||||
var specificCompilationOptions = GetObject(props, "compilationOptions") ?? compilationOptions ?? new Dictionary<string, object>();
|
||||
|
||||
var defines = Get<IEnumerable<object>>(compilationOptions, "define") ?? new object[0];
|
||||
object unsafeValue = Get<object>(compilationOptions, "allowUnsafe");
|
||||
bool allowUnsafeCode = unsafeValue == null ? false : (bool)unsafeValue;
|
||||
var specificDefines = Get<IEnumerable<object>>(specificCompilationOptions, "define") ?? new object[0];
|
||||
object specificUnsafeValue = Get<object>(specificCompilationOptions, "allowUnsafe");
|
||||
bool allowUnsafeCode = unsafeValue == null ? sharedAllowUnsafeCode : (bool)specificUnsafeValue;
|
||||
|
||||
string extraProperties = allowUnsafeCode ? "\n<AllowUnsafeBlocks>true</AllowUnsafeBlocks>" : "";
|
||||
|
||||
string id = (string)GetObject(projectMapping, projectName)[targetFramework];
|
||||
|
||||
var defines = new HashSet<string>(specificDefines.Select(sd => sd.ToString()));
|
||||
foreach(var def in sharedDefines)
|
||||
{
|
||||
defines.Add(def.ToString());
|
||||
}
|
||||
|
||||
var specificDependencies = GetObject(props, "dependencies") ?? new Dictionary<string, object>();
|
||||
var gacReferences = new List<string>();
|
||||
|
||||
|
|
@ -255,7 +266,7 @@ functions
|
|||
var template = templates[targetFramework]
|
||||
.Replace("{ProjectGuid}", id)
|
||||
.Replace("{Name}", projectName)
|
||||
.Replace("{Defines}", String.Join(";", defines.Select(def => def.ToString())))
|
||||
.Replace("{Defines}", String.Join(";", defines))
|
||||
.Replace("{ExtraProperties}", extraProperties)
|
||||
.Replace("{Files}", filesString)
|
||||
.Replace("{ProjectReferences}", BuildProjectReferences(projectReferences, targetFramework, projectMapping))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use namespace="System"
|
||||
use namespace="System.IO"
|
||||
use import="Files"
|
||||
use import="BuildEnv"
|
||||
|
||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
|
||||
|
|
@ -8,7 +9,7 @@ default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
|
|||
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'
|
||||
|
||||
@{
|
||||
E("K_BUILD_VERSION", "t" + DateTime.UtcNow.ToString("yyMMddHHmmss"));
|
||||
E("K_BUILD_VERSION", BuildNumber);
|
||||
}
|
||||
|
||||
#target-default target='default'
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
var PROJECT='AspNet'
|
||||
var VERSION='0.1.${Environment.GetEnvironmentVariable("BUILD_NUMBER") ?? "0"}'
|
||||
var VERSION='0.2.0-dev'
|
||||
|
||||
use namespace='System'
|
||||
use namespace='System.IO'
|
||||
use namespace='System.Collections.Generic'
|
||||
use import="BuildEnv"
|
||||
|
||||
var repos='${new Dictionary<string,string> {
|
||||
{"HttpAbstractions", "git@github.com:aspnet/HttpAbstractions.git"},
|
||||
|
|
@ -19,6 +20,10 @@ var repos='${new Dictionary<string,string> {
|
|||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
||||
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts", "build")}'
|
||||
|
||||
@{
|
||||
VERSION += "-" + BuildNumber;
|
||||
}
|
||||
|
||||
#default .compile
|
||||
|
||||
#pull
|
||||
|
|
|
|||
Loading…
Reference in New Issue