Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

MyGet package publishing #1013

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Implemented setting to copy Libraries content.
  • Loading branch information
iskiselev committed Jul 21, 2016
commit 0473c5fbda9436c124717198a68d0cb33394dedb
4 changes: 4 additions & 0 deletions Compiler/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void MergeInto (SolutionBuildConfiguration result) {
public bool? ReuseTypeInfoAcrossAssemblies;
public bool? ProxyWarnings;
public string OutputDirectory;
public string JsLibrariesOutputDirectory;
public string FileOutputDirectory;
public string Profile;
public Dictionary<string, object> ProfileSettings = new Dictionary<string, object>();
Expand All @@ -66,6 +67,8 @@ public override void MergeInto (JSIL.Translator.Configuration result) {
cc.ReuseTypeInfoAcrossAssemblies = ReuseTypeInfoAcrossAssemblies;
if (OutputDirectory != null)
cc.OutputDirectory = OutputDirectory;
if (JsLibrariesOutputDirectory != null)
cc.JsLibrariesOutputDirectory = JsLibrariesOutputDirectory;
if (FileOutputDirectory != null)
cc.FileOutputDirectory = FileOutputDirectory;
if (Profile != null)
Expand Down Expand Up @@ -108,6 +111,7 @@ public VariableSet ApplyTo (VariableSet variables) {
result["CurrentDirectory"] = () => Environment.CurrentDirectory;
result["ConfigDirectory"] = () => Path;
result["OutputDirectory"] = () => OutputDirectory;
result["JsLibrariesOutputDirectory"] = () => JsLibrariesOutputDirectory;
result["FileOutputDirectory"] = () => FileOutputDirectory;
result["Profile"] = () => Profile;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Extensibility/IProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TranslationResultCollection Translate (
Configuration configuration, string assemblyPath, bool scanForProxies
);
void WriteOutputs (
VariableSet variables, TranslationResultCollection result, string path, bool quiet
VariableSet variables, TranslationResultCollection result, Configuration path, bool quiet
);

void RegisterPostprocessors (IEnumerable<IEmitterGroupFactory> emitters, Configuration configuration, string assemblyPath, string[] skippedAssemblies);
Expand Down
25 changes: 23 additions & 2 deletions Compiler/Profiles/Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using JSIL.Compiler.Extensibility;
using JSIL.Utilities;

Expand All @@ -24,15 +25,35 @@ public virtual TranslationResultCollection Translate (
public virtual void RegisterPostprocessors (IEnumerable<IEmitterGroupFactory> emitters, Configuration configuration, string assemblyPath, string[] skippedAssemblies) {
}

public virtual void WriteOutputs (VariableSet variables, TranslationResultCollection result, string path,bool quiet) {
public virtual void WriteOutputs (VariableSet variables, TranslationResultCollection result, Configuration configuration, bool quiet) {
foreach (var translationResult in result.TranslationResults) {
if (!quiet)
{
foreach (var fe in translationResult.OrderedFiles)
Console.WriteLine(fe.Filename);
}

translationResult.WriteToDirectory(path);
translationResult.WriteToDirectory(configuration.OutputDirectory);
}

var jsilPath = Path.GetDirectoryName(JSIL.Internal.Util.GetPathOfAssembly(Assembly.GetExecutingAssembly()));
var searchPath = Path.Combine(jsilPath, "JS Libraries\\JsLibraries\\");
if (!string.IsNullOrEmpty(configuration.JsLibrariesOutputDirectory) && Directory.Exists(searchPath))
{
foreach (var file in Directory.GetFiles(searchPath, "*", SearchOption.AllDirectories)) {
var target = Uri.UnescapeDataString(Path.Combine(configuration.JsLibrariesOutputDirectory, new Uri(searchPath).MakeRelativeUri(new Uri(file)).ToString()))
.Replace('/', Path.DirectorySeparatorChar);
var directory = Path.GetDirectoryName(target);
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);

File.Copy(file, target, true);

if (!quiet)
{
Console.WriteLine(target);
}
}
}
}

Expand Down
19 changes: 14 additions & 5 deletions Compiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ AssemblyCache assemblyCache
{"o=|out=",
"Specifies the output directory for generated javascript and manifests.",
(path) => commandLineConfig.OutputDirectory = Path.GetFullPath(path) },
{"outLibraries=",
"Specifies the output directory for JSIL Libraries.",
(path) => commandLineConfig.JsLibrariesOutputDirectory = Path.GetFullPath(path) },
{"q|quiet",
"Suppresses non-error/non-warning stderr messages.",
(_) => commandLineConfig.Quiet = Quiet = true },
Expand Down Expand Up @@ -822,20 +825,26 @@ static void InternalMain (string[] arguments) {
if (localConfig.OutputDirectory == null)
throw new Exception("No output directory was specified!");

var outputDir = MapPath(localConfig.OutputDirectory, localVariables, false);
CopiedOutputGatherer.EnsureDirectoryExists(outputDir);
localConfig.OutputDirectory = MapPath(localConfig.OutputDirectory, localVariables, false);
CopiedOutputGatherer.EnsureDirectoryExists(localConfig.OutputDirectory);

InformationWriteLine("// Saving output to '{0}'.", ShortenPath(outputDir) + Path.DirectorySeparatorChar);
InformationWriteLine("// Saving output to '{0}'.", ShortenPath(localConfig.OutputDirectory) + Path.DirectorySeparatorChar);

if (!string.IsNullOrEmpty(localConfig.JsLibrariesOutputDirectory))
{
localConfig.JsLibrariesOutputDirectory = MapPath(localConfig.JsLibrariesOutputDirectory, localVariables, false);
CopiedOutputGatherer.EnsureDirectoryExists(localConfig.JsLibrariesOutputDirectory);
}

// Ensures that the log file contains the name of the profile that was actually used.
localConfig.Profile = localProfile.GetType().Name;

if (ignoredMethods.Count > 0)
Console.Error.WriteLine("// {0} method(s) were ignored during translation. See the log for a list.", ignoredMethods.Count);

EmitLog(outputDir, localConfig, filename, outputs, ignoredMethods);
EmitLog(localConfig.OutputDirectory, localConfig, filename, outputs, ignoredMethods);

buildGroup.Profile.WriteOutputs(localVariables, outputs, outputDir, Quiet);
buildGroup.Profile.WriteOutputs(localVariables, outputs, localConfig, Quiet);

totalFailureCount += translator.Failures.Count;
}
Expand Down
2 changes: 2 additions & 0 deletions JSIL.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
<file src="bin\Mono.Cecil.Pdb.dll" target="tools" />
<file src="bin\JSIL.ExpressionInterpreter.dll" target="tools" />
<file src="bin\JSIL.ExpressionInterpreter.pdb" target="tools" />
<file src="bin\JS Libraries\**" target="tools\JS Libraries" />
<file src="Libraries\" target="tools\JS Libraries\JsLibraries" />
</files>
</package>