Skip to content

Commit 191a4e5

Browse files
committed
Merge pull request scriptcs#983 from scriptcs/dev
merge dev to master for 0.14
2 parents 81aa4d7 + a421db9 commit 191a4e5

88 files changed

Lines changed: 1958 additions & 462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
language: c
2-
3-
before_install:
4-
- sudo bash -c "echo deb http://badgerports.org precise main >> /etc/apt/sources.list"
5-
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E1FAD0C
6-
- sudo apt-get update -qq
7-
- sudo apt-get install -qq mono-devel
1+
sudo: false
2+
language: csharp
83

94
install:
10-
- mozroots --import --sync --quiet
11-
- mono ./.nuget/NuGet.exe restore ./ScriptCs.sln
5+
- nuget restore ./ScriptCs.sln
126

137
script:
148
- mkdir artifacts --parents
159
- xbuild ./ScriptCs.sln /property:Configuration=Release /nologo /verbosity:normal
1610
- mono ./packages/xunit.runners.1.9.2/tools/xunit.console.clr4.exe test/ScriptCs.Tests.Acceptance/bin/Release/ScriptCs.Tests.Acceptance.dll /xml artifacts/ScriptCs.Tests.Acceptance.dll.TestResult.xml /html artifacts/ScriptCs.Tests.Acceptance.dll.TestResult.html
17-
18-
notifications:
19-
email:
20-
- adam@adamralph.com
21-

ScriptCs.sln

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30501.0
4+
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCs", "src\ScriptCs\ScriptCs.csproj", "{25080671-1A80-4041-B9C7-260578FF4849}"
77
EndProject
@@ -37,6 +37,9 @@ EndProject
3737
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCs.Engine.Mono.Tests", "test\ScriptCs.Engine.Mono.Tests\ScriptCs.Engine.Mono.Tests.csproj", "{D0723C2D-D3B4-40B7-8E5A-84FB3A6E5092}"
3838
EndProject
3939
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCs.Tests.Acceptance", "test\ScriptCs.Tests.Acceptance\ScriptCs.Tests.Acceptance.csproj", "{10684649-2922-41F5-AB9B-20B127CBF92C}"
40+
ProjectSection(ProjectDependencies) = postProject
41+
{25080671-1A80-4041-B9C7-260578FF4849} = {25080671-1A80-4041-B9C7-260578FF4849}
42+
EndProjectSection
4043
EndProject
4144
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B138045D-DC04-4A04-A2BA-F771173BCC32}"
4245
ProjectSection(SolutionItems) = preProject

ScriptCs.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String></wpf:ResourceDictionary>

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ mozroots --import --sync --quiet
88
mono ./.nuget/NuGet.exe restore ./ScriptCs.sln
99

1010
# script
11-
mkdir -p artifacts
11+
mkdir -p artifacts/Release/bin
1212
xbuild ./ScriptCs.sln /property:Configuration=Release /nologo /verbosity:normal
13+
cp src/*/bin/Release/* artifacts/Release/bin/
1314
mono ./packages/xunit.runners.1.9.2/tools/xunit.console.clr4.exe test/ScriptCs.Tests.Acceptance/bin/Release/ScriptCs.Tests.Acceptance.dll /xml artifacts/ScriptCs.Tests.Acceptance.dll.TestResult.xml /html artifacts/ScriptCs.Tests.Acceptance.dll.TestResult.html
1415

build/ScriptCs.Version.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<!-- Use the properties below to control the version of the assemblies created. -->
55
<PropertyGroup>
66
<MajorVersion>0</MajorVersion>
7-
<MinorVersion>13</MinorVersion>
8-
<PatchVersion>3</PatchVersion>
7+
<MinorVersion>14</MinorVersion>
8+
<PatchVersion>0</PatchVersion>
99

1010
<!-- Change this to set the build quality of the project. Use values like "alpha", "beta", "rc1", "rtm", etc. -->
1111
<!-- These values are used in SemVer, so make sure to always increase these alphabetically. -->
@@ -17,9 +17,9 @@
1717
<AssemblyVersion>$(MajorVersion).$(MinorVersion).0</AssemblyVersion>
1818
<AssemblyInformationalVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</AssemblyInformationalVersion>
1919
<AssemblyInformationalVersion Condition=" '$(BuildQuality)' != '' ">$(AssemblyInformationalVersion)-$(BuildQuality)</AssemblyInformationalVersion>
20+
<AssemblyInformationalVersion Condition=" '$(IsNightlyBuild)' != '' ">$(AssemblyInformationalVersion)-nightly-$([System.DateTime]::UtcNow.ToString("yyMMdd"))</AssemblyInformationalVersion>
2021

2122
<PackageVersion>$(AssemblyInformationalVersion)</PackageVersion>
22-
<PackageVersion Condition=" '$(IsNightlyBuild)' != '' ">$(PackageVersion)-nightly-$([System.DateTime]::UtcNow.ToString("yyMMdd"))</PackageVersion>
2323
</PropertyGroup>
2424

2525
<ItemGroup>
Lines changed: 94 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,116 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using System.Reflection;
4-
5-
namespace ScriptCs.Contracts
1+
namespace ScriptCs.Contracts
62
{
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System;
7+
using System.IO;
8+
79
public class AssemblyReferences
810
{
11+
private readonly Dictionary<string, Assembly> _assemblies = new Dictionary<string, Assembly>();
12+
private readonly Dictionary<string, string> _paths = new Dictionary<string, string>();
13+
914
public AssemblyReferences()
10-
: this(Enumerable.Empty<string>(), Enumerable.Empty<Assembly>())
15+
: this(Enumerable.Empty<string>())
16+
{
17+
}
18+
19+
public AssemblyReferences(IEnumerable<Assembly> assemblies)
20+
: this(assemblies, Enumerable.Empty<string>())
21+
{
22+
}
23+
24+
public AssemblyReferences(IEnumerable<string> paths)
25+
: this(Enumerable.Empty<Assembly>(), paths)
1126
{
1227
}
1328

14-
public AssemblyReferences(IEnumerable<string> pathReferences, IEnumerable<Assembly> assemblies)
29+
public AssemblyReferences(IEnumerable<Assembly> assemblies, IEnumerable<string> paths)
1530
{
16-
Guard.AgainstNullArgument("pathReferences", pathReferences);
31+
Guard.AgainstNullArgument("paths", paths);
1732
Guard.AgainstNullArgument("assemblies", assemblies);
1833

19-
PathReferences = new HashSet<string>(pathReferences);
20-
Assemblies = new HashSet<Assembly>(assemblies);
34+
foreach (var assembly in assemblies.Where(assembly => assembly != null))
35+
{
36+
var name = assembly.GetName().Name;
37+
if (!_assemblies.ContainsKey(name))
38+
{
39+
_assemblies.Add(name, assembly);
40+
}
41+
}
42+
43+
foreach (var path in paths)
44+
{
45+
var name = Path.GetFileName(path);
46+
if (name == null)
47+
{
48+
continue;
49+
}
50+
51+
if (name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) ||
52+
name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
53+
{
54+
name = Path.GetFileNameWithoutExtension(name);
55+
}
56+
57+
if (!_paths.ContainsKey(name) && !_assemblies.ContainsKey(name))
58+
{
59+
_paths.Add(name, path);
60+
}
61+
}
2162
}
2263

23-
public HashSet<string> PathReferences { get; private set; }
24-
public HashSet<Assembly> Assemblies { get; private set; }
64+
public IEnumerable<Assembly> Assemblies
65+
{
66+
get { return _assemblies.Values.ToArray(); }
67+
}
2568

26-
public AssemblyReferences Except(AssemblyReferences obj)
69+
public IEnumerable<string> Paths
2770
{
28-
Guard.AgainstNullArgument("obj", obj);
71+
get { return _paths.Values.ToArray(); }
72+
}
73+
74+
public AssemblyReferences Union(AssemblyReferences references)
75+
{
76+
Guard.AgainstNullArgument("references", references);
77+
78+
return new AssemblyReferences(Assemblies.Union(references.Assemblies), Paths.Union(references.Paths));
79+
}
80+
81+
public AssemblyReferences Union(IEnumerable<Assembly> assemblies)
82+
{
83+
Guard.AgainstNullArgument("assemblies", assemblies);
84+
85+
return new AssemblyReferences(Assemblies.Union(assemblies), Paths);
86+
}
87+
88+
public AssemblyReferences Union(IEnumerable<string> paths)
89+
{
90+
Guard.AgainstNullArgument("paths", paths);
91+
92+
return new AssemblyReferences(Assemblies, Paths.Union(paths));
93+
}
94+
95+
public AssemblyReferences Except(AssemblyReferences references)
96+
{
97+
Guard.AgainstNullArgument("references", references);
98+
99+
return new AssemblyReferences(Assemblies.Except(references.Assemblies), Paths.Except(references.Paths));
100+
}
101+
102+
public AssemblyReferences Except(IEnumerable<Assembly> assemblies)
103+
{
104+
Guard.AgainstNullArgument("assemblies", assemblies);
29105

30-
return new AssemblyReferences(PathReferences.Except(obj.PathReferences), Assemblies.Except(obj.Assemblies));
106+
return new AssemblyReferences(Assemblies.Except(assemblies), Paths);
31107
}
32108

33-
public void Union(AssemblyReferences obj)
109+
public AssemblyReferences Except(IEnumerable<string> paths)
34110
{
35-
Guard.AgainstNullArgument("obj", obj);
111+
Guard.AgainstNullArgument("paths", paths);
36112

37-
PathReferences.UnionWith(obj.PathReferences);
38-
Assemblies.UnionWith(obj.Assemblies);
113+
return new AssemblyReferences(Assemblies, Paths.Except(paths));
39114
}
40115
}
41116
}

src/ScriptCs.Contracts/IAppDomainAssemblyResolver.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace ScriptCs.Contracts
44
{
55
public interface IAppDomainAssemblyResolver
66
{
7-
void AddAssemblyPaths(IEnumerable<string> assemblyPaths);
87
void Initialize();
98
}
109
}

src/ScriptCs.Contracts/IPackageObject.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public interface IPackageObject
2020

2121
IEnumerable<IPackageObject> Dependencies { get; }
2222

23-
IEnumerable<string> FrameworkAssemblies { get; }
23+
IEnumerable<string> FrameworkAssemblies { get; }
24+
25+
IEnumerable<string> GetContentFiles();
2426
}
2527
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace ScriptCs.Contracts
8+
{
9+
public interface IScriptEnvironment
10+
{
11+
IReadOnlyList<string> ScriptArgs { get; }
12+
}
13+
}

src/ScriptCs.Contracts/IScriptHost.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ namespace ScriptCs.Contracts
55
public interface IScriptHost
66
{
77
T Require<T>() where T : IScriptPackContext;
8+
IScriptEnvironment Env { get; }
89
}
910
}

0 commit comments

Comments
 (0)