Permalink
Browse files

Add build project for IronRuby

  • Loading branch information...
1 parent 52cbfff commit e841952633b07e65891e2a16563de98e1329f8fb @tmat tmat committed May 13, 2012
View
@@ -8,6 +8,7 @@
<ItemGroup>
<BuildProject Include="Solutions\Build.IronPython.proj"/>
+ <!--<BuildProject Include="Solutions\Build.IronRuby.proj"/>-->
</ItemGroup>
<Target Name="Build">
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <id>IronRuby</id>
+ <title>IronRuby</title>
+ <version>1.1.4</version>
+ <authors>IronRuby Contributors, Microsoft</authors>
+ <owners>IronRuby Community</owners>
+ <projectUrl>http://ironruby.net</projectUrl>
+ <licenseUrl>http://ironruby.codeplex.com/license</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>IronRuby is an open-source implementation of the Ruby programming language which is tightly integrated with the .NET Framework. IronRuby can use the .NET Framework and Ruby libraries, and other .NET languages can use Ruby code just as easily.</description>
+ <summary>IronRuby is an open-source implementation of the Ruby programming language which is tightly integrated with the .NET Framework.</summary>
+ <language>en-US</language>
+ <tags>IronRuby Ruby dynamic dlr</tags>
+ </metadata>
+ <files>
+ <!-- TODO -->
+ <file src="**\*.*" target="tools" />
+ </files>
+</package>
@@ -69,7 +69,7 @@ public RubyObject(RubyClass/*!*/ cls, params object[] args)
#region ToString, Equals, GetHashCode
public override string/*!*/ ToString() {
-#if DEBUG && !SILVERLIGHT && CLR2
+#if DEBUG && FEATURE_FULL_CONSOLE
if (RubyBinder._DumpingExpression) {
return RubyUtils.ObjectBaseToMutableString(this).ToString();
}
@@ -80,7 +80,7 @@ public sealed class RubyBinder : DefaultBinder {
return result;
}
-#if DEBUG && !CLR2 && !SILVERLIGHT && !WIN8 && !ANDROID && !WP75
+#if DEBUG && FEATURE_FULL_CONSOLE
// ExpressionWriter might call ToString on a live object that might dynamically invoke a method.
// We need to prevent recursion in such case.
[ThreadStatic]
@@ -107,7 +107,7 @@ public sealed class RubyBinder : DefaultBinder {
[Conditional("DEBUG")]
internal static void DumpRule(CallSiteBinder/*!*/ binder, BindingRestrictions/*!*/ restrictions, Expression/*!*/ expr) {
-#if DEBUG && FEATURE_FULL_CONSOLE && !CLR2
+#if DEBUG && FEATURE_FULL_CONSOLE
if (RubyOptions.ShowRules) {
var oldColor = Console.ForegroundColor;
try {
View
@@ -3,7 +3,7 @@
<?define ProductShortName = "IronRuby" ?>
<?define ProductVersion = "1.1.4.0" ?>
<?define ProductVersionText = "1.1" ?>
- <?define Manufacturer = "Microsoft Corporation" ?>
+ <?define Manufacturer = "IronRuby Team" ?>
<?define EnvVariableName = "IRONRUBY_11" ?>
<?define RegKey = "SOFTWARE\Microsoft\$(var.ProductShortName)\$(var.ProductVersionText)"?>
</Include>
@@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Reflection;
using System.Runtime.CompilerServices;
namespace Microsoft.Scripting.Utils {
@@ -36,15 +37,25 @@ namespace Microsoft.Scripting.Utils {
public class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue> {
// The one and only comparer instance.
static readonly IEqualityComparer<object> comparer = new WeakComparer<object>();
+ static readonly ConstructorInfo valueConstructor;
- IDictionary<object, TValue> dict = new Dictionary<object, TValue>(comparer);
- int version, cleanupVersion;
+ private IDictionary<object, TValue> dict = new Dictionary<object, TValue>(comparer);
+ private int version, cleanupVersion;
#if SILVERLIGHT || WIN8 || WP75 // GC
WeakReference cleanupGC = new WeakReference(new object());
#else
int cleanupGC = 0;
#endif
+ static WeakDictionary()
+ {
+ var ctor = typeof(TValue).GetConstructor(new Type[] { });
+ if (ctor == null) {
+ throw new InvalidOperationException(string.Format("{0} does not have a default constructor.", typeof(TValue).Name));
@jdhardy

jdhardy May 20, 2012

Owner

I don't think we can fail early here. It breaks DelegateInfo, which has a WeakDictionary<object, WeakReference> (and WeakReference has no default constructor).

Maybe GetOrCreateValue should just take a Func<TValue>?

@gglresearchanddevelopment

gglresearchanddevelopment May 23, 2012

Contributor

I'm just looking at this as well as it's causing me issues. My thoughts are:

Get the ctor in the static constructor for performance, but leave it as null, and throw within TryCreateValue if it is null

@tmat

tmat May 23, 2012

Owner

Yeah, that's how I'm fixing it... coming soon.

@tmat

tmat May 23, 2012

Owner

Fixed. Sorry about the break.

+ }
+
+ valueConstructor = ctor;
+ }
public WeakDictionary() {
}
@@ -86,12 +97,7 @@ public class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue> {
public TValue GetOrCreateValue(TKey key) {
TValue value;
if (!TryGetValue(key, out value)) {
- var ctor = typeof(TValue).GetConstructor(new Type[] { });
- if (ctor == null) {
- throw new MissingMethodException(string.Format("{0} does not have a default constructor.", typeof(TValue).Name));
- }
-
- value = (TValue)ctor.Invoke(new object[] { });
+ value = (TValue)valueConstructor.Invoke(new object[] { });
Add(key, value);
}
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <!--<Import Project="CustomBuild.proj" Condition="Exist('CustomBuild.proj')" />-->
+ <!--<Import Project="Versioning.targets" />-->
+ <PropertyGroup>
+ <DisplayVersion>1.1.4</DisplayVersion>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <BaseConfiguration Condition=" '$(BaseConfiguration)' == '' ">Debug</BaseConfiguration>
+ <Mono Condition="'$(OS)' != 'Windows_NT'">true</Mono>
+
+ <Solution>Ruby.sln</Solution>
+
+ <BaseDir>$(MSBuildProjectDirectory)\..</BaseDir>
+ <StageDir>$(BaseDir)\Stage\$(BaseConfiguration)\IronRuby-$(DisplayVersion)</StageDir>
+ <PackageDir>$(BaseDir)\Packages\$(BaseConfiguration)\IronRuby-$(DisplayVersion)</PackageDir>
+ <UtilDir>$(BaseDir)\Util</UtilDir>
+ <BinDir>$(BaseDir)\bin</BinDir>
+
+ <BuildDir>$(BinDir)\$(BaseConfiguration)</BuildDir>
+ <v2BuildDir>$(BinDir)\v2$(BaseConfiguration)</v2BuildDir>
+ <AndroidBuildDir>$(BinDir)\Android$(BaseConfiguration)</AndroidBuildDir>
+ <WP7BuildDir>$(BinDir)\WP7$(BaseConfiguration)</WP7BuildDir>
+ <Silverlight4BuildDir>$(BinDir)\Silverlight4$(BaseConfiguration)</Silverlight4BuildDir>
+ <Silverlight5BuildDir>$(BinDir)\Silverlight5$(BaseConfiguration)</Silverlight5BuildDir>
+ <Win8BuildDir>$(BinDir)\Win8$(BaseConfiguration)</Win8BuildDir>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=v2$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=WP7$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=Silverlight4$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=Silverlight5$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=Android$(BaseConfiguration)</Properties>
+ </BuildProject>
+ <!--
+ <BuildProject Include="$(Solution)">
+ <Properties>Configuration=Win8$(BaseConfiguration)</Properties>
+ </BuildProject>
+ -->
+ <!--
+ <InstallerProject Include="$(BaseDir)\Msi\Ruby\IronRuby.Installer.wixproj">
+ <Properties>Configuration=$(BaseConfiguration);BaseInputPaths=$(StageDir);WixToolPath=$(UtilDir)\Wix35\;OutputPath=$(PackageDir)</Properties>
+ </InstallerProject>
+ -->
+ </ItemGroup>
+
+ <ItemGroup>
+ <DlrLibs Include="Microsoft.Dynamic.dll" />
+ <DlrLibs Include="Microsoft.Dynamic.xml" />
+ <DlrLibs Include="Microsoft.Scripting.dll" />
+ <DlrLibs Include="Microsoft.Scripting.xml" />
+ <ClrDlrLibs Include="Microsoft.Scripting.Metadata.dll" />
+ <ClrDlrLibs Include="Microsoft.Scripting.Metadata.xml" />
+ <ClrDlrLibs Include="Microsoft.Scripting.AspNet.dll" />
+ <ClrDlrLibs Include="Microsoft.Scripting.AspNet.xml" />
+ <v2DlrLibs Include="Microsoft.Scripting.Core.dll" />
+ <v2DlrLibs Include="Microsoft.Scripting.Core.xml" />
+ <SilverlightDlrLibs Include="Microsoft.Scripting.Silverlight.dll" />
+
+ <IronRubyLibs Include="IronRuby.dll" />
+ <IronRubyLibs Include="IronRuby.xml" />
+ <IronRubyLibs Include="IronRuby.Libraries.dll" />
+ <IronRubyLibs Include="IronRuby.Libraries.xml" />
+ <IronRubyLibs Include="IronRuby.Libraries.Yaml.dll" />
+ <IronRubyLibs Include="IronRuby.Libraries.Yaml.xml" />
+
+ <IronRubyBins Include="ir.exe" />
+ <IronRubyBins Include="ir64.exe" />
+ <IronRubyBins Include="irw.exe" />
+ <IronRubyBins Include="irw64.exe" />
+
+ <ChironBins Include="Chiron.exe" />
+ <ChironBins Include="Chiron.exe.config" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <SilverlightScriptFiles Include="$(BaseDir)\Hosts\Silverlight\Public\script\*.*" />
+ <SilverlightScriptTemplates Include="$(BaseDir)\Hosts\Silverlight\Public\script\templates\ruby\**\*.*" />
+
+ <MiscFiles Include="$(BaseDir)\Languages\Ruby\Public\License.Rtf" />
+ <MiscFiles Include="$(BaseDir)\Languages\Ruby\Public\License.Ruby.txt" />
+ <MiscFiles Include="$(BaseDir)\Languages\Ruby\Public\License.CPL.txt" />
+ <MiscFiles Include="$(BaseDir)\Languages\Ruby\Public\LICENSE.APACHE.html" />
+ <MiscFiles Include="$(BaseDir)\Languages\Ruby\Public\Readme.txt" />
+ <Samples Include="$(BaseDir)\Languages\Ruby\Samples\**\*.*" />
+ <StdLib Include="$(BaseDir)\Languages\Ruby\StdLib\**\*.*" />
+ </ItemGroup>
+
+ <Target Name="Build">
+ <MSBuild Projects="@(BuildProject)" Targets="Build" Properties="%(BuildProject.Properties)" />
+ </Target>
+
+ <Target Name="Rebuild">
+ <MSBuild Projects="@(BuildProject)" Targets="Rebuild" Properties="%(BuildProject.Properties)" />
+ </Target>
+
+ <Target Name="Clean">
+ <MSBuild Projects="@(BuildProject)" Targets="Clean" Properties="%(BuildProject.Properties)" />
+ <MSBuild Projects="@(InstallerProject)" Targets="Clean" Condition=" '$(OS)' == 'Windows_NT'" />
+ </Target>
+
+ <Target Name="StageClean">
+ <RemoveDir Directories="$(StageDir)" />
+ </Target>
+
+ <Target Name="Stage" DependsOnTargets="StageClean;Build">
+ <Copy SourceFiles="@(DlrLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\bin" />
+ <Copy SourceFiles="@(ClrDlrLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\bin" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\bin" />
+ <Copy SourceFiles="@(IronRubyBins->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\bin" />
+ <Copy SourceFiles="@(MiscFiles)" DestinationFolder="$(StageDir)" />
+ <Copy SourceFiles="@(Samples)" DestinationFolder="$(StageDir)\Samples\%(RecursiveDir)" />
+ <Copy SourceFiles="@(StdLib)" DestinationFolder="$(StageDir)\Lib\%(RecursiveDir)" />
+
+ <!-- Continue to copy the Silverlight files here for compatibility with previous releases. -->
+ <Copy SourceFiles="@(DlrLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Silverlight\bin" />
+ <Copy SourceFiles="@(SilverlightDlrLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Silverlight\bin" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Silverlight\bin" />
+ <Copy SourceFiles="@(ChironBins->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Silverlight\bin" />
+
+ <Copy SourceFiles="@(SilverlightScriptFiles)" DestinationFiles="@(SilverlightScriptFiles->'$(StageDir)\Silverlight\script\%(RecursiveDir)%(Filename)%(Extension)')" />
+ <Copy SourceFiles="@(SilverlightScriptTemplates)" DestinationFiles="@(SilverlightScriptTemplates->'$(StageDir)\Silverlight\script\templates\Ruby\%(RecursiveDir)%(Filename)%(Extension)')" />
+
+ <!-- .NET 4 -->
+ <Copy SourceFiles="@(DlrLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net40" />
+ <Copy SourceFiles="@(ClrDlrLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net40" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net40" />
+ <Copy SourceFiles="@(v4IronRubyModules->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net40" />
+ <Copy SourceFiles="@(IronRubyModules->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net40" />
+
+ <!-- .NET 3.5 -->
+ <Copy SourceFiles="@(DlrLibs->'$(v2BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net35" />
+ <Copy SourceFiles="@(ClrDlrLibs->'$(v2BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net35" />
+ <Copy SourceFiles="@(v2DlrLibs->'$(v2BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net35" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(v2BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net35" />
+ <Copy SourceFiles="@(IronRubyModules->'$(v2BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Net35" />
+
+ <!-- Windows Phone 7.5 -->
+ <Copy SourceFiles="@(DlrLibs->'$(WP7BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4-WP71" />
+ <Copy SourceFiles="@(v2DlrLibs->'$(WP7BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4-WP71" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(WP7BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4-WP71" />
+ <Copy SourceFiles="@(IronRubyModules->'$(WP7BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4-WP71" />
+
+ <!-- Mono for Android -->
+ <Copy SourceFiles="@(DlrLibs->'$(AndroidBuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Android" />
+ <Copy SourceFiles="@(v2DlrLibs->'$(AndroidBuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Android" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(AndroidBuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Android" />
+ <Copy SourceFiles="@(IronRubyModules->'$(AndroidBuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Android" />
+
+ <!-- Silverlight 4 -->
+ <Copy SourceFiles="@(DlrLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4" />
+ <Copy SourceFiles="@(SilverlightDlrLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4" />
+ <Copy SourceFiles="@(IronRubyModules->'$(Silverlight4BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl4" />
+
+ <!-- Silverlight 5 -->
+ <Copy SourceFiles="@(DlrLibs->'$(Silverlight5BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl5" />
+ <Copy SourceFiles="@(SilverlightDlrLibs->'$(Silverlight5BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl5" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(Silverlight5BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl5" />
+ <Copy SourceFiles="@(IronRubyModules->'$(Silverlight5BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Sl5" />
+
+ <!-- Windows 8 "Metro" -->
+ <Copy SourceFiles="@(DlrLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Win8" />
+ <Copy SourceFiles="@(IronRubyLibs->'$(BuildDir)\%(Identity)')" DestinationFolder="$(StageDir)\Platforms\Win8" />
+ </Target>
+
+ <Target Name="NuGetPackage" DependsOnTargets="Stage" Condition="'$(OS)' == 'Windows_NT'">
+ <MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')" />
+ <Exec Command="$(UtilDir)\Misc\NuGet.exe pack &quot;$(BaseDir)\Languages\Ruby\IronRuby.nuspec&quot; -BasePath &quot;$(StageDir)&quot; -OutputDirectory &quot;$(PackageDir)&quot;" />
+ </Target>
+
+ <Target Name="ZipPackage" DependsOnTargets="Stage" Condition="'$(OS)' == 'Windows_NT'">
+ <MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')" />
+ <Exec Command="$(UtilDir)\Misc\zip.exe -9 -r &quot;$(PackageDir)\IronRuby-$(DisplayVersion).zip&quot; &quot;IronRuby-$(DisplayVersion)&quot;" WorkingDirectory="$(StageDir)\.." />
+ </Target>
+
+ <!--
+ <Target Name="Installer" DependsOnTargets="Stage" Condition="'$(OS)' == 'Windows_NT'">
+ <MSBuild Projects="@(InstallerProject)" Targets="Build" />
+ </Target>
+ -->
+</Project>
Oops, something went wrong.

0 comments on commit e841952

Please sign in to comment.