@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<startup> | |||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | |||
</startup> | |||
</configuration> |
@ -0,0 +1,66 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProjectGuid>{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}</ProjectGuid> | |||
<OutputType>Exe</OutputType> | |||
<RootNamespace>CollectDependencies</RootNamespace> | |||
<AssemblyName>CollectDependencies</AssemblyName> | |||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | |||
<FileAlignment>512</FileAlignment> | |||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | |||
<Deterministic>true</Deterministic> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>bin\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Mono.Cecil, Version=0.10.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.10.1\lib\net40\Mono.Cecil.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Mdb, Version=0.10.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.10.1\lib\net40\Mono.Cecil.Mdb.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Pdb, Version=0.10.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.10.1\lib\net40\Mono.Cecil.Pdb.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Rocks, Version=0.10.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.10.1\lib\net40\Mono.Cecil.Rocks.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Net.Http" /> | |||
<Reference Include="System.Xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Program.cs" /> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="App.config" /> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
</Project> |
@ -0,0 +1,82 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace CollectDependencies | |||
{ | |||
class Program | |||
{ | |||
static void Main(string[] args) | |||
{ | |||
string depsfile = File.ReadAllText(args[0]); | |||
string fdir = Path.GetDirectoryName(args[0]); | |||
List<string> files = new List<string>(); | |||
{ // Create files from stuff in depsfile | |||
Stack<string> fstack = new Stack<string>(); | |||
void Push(string val) | |||
{ | |||
string pre = ""; | |||
if (fstack.Count > 0) | |||
pre = fstack.First(); | |||
fstack.Push(pre + val); | |||
} | |||
string Pop() => fstack.Pop(); | |||
string Replace(string val) | |||
{ | |||
var v2 = Pop(); | |||
Push(val); | |||
return v2; | |||
} | |||
foreach (var line in depsfile.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | |||
{ | |||
var parts = line.Split('"'); | |||
var path = parts.Last(); | |||
var level = parts.Length - 1; | |||
if (path.StartsWith("::")) | |||
{ // pseudo-command | |||
parts = path.Split(' '); | |||
var command = parts[0].Substring(2); | |||
parts = parts.Skip(1).ToArray(); | |||
var arglist = string.Join(" ", parts); | |||
if (command == "from") | |||
{ // an "import" type command | |||
path = File.ReadAllText(Path.Combine(fdir, arglist)); | |||
} | |||
else if (command == "prompt") | |||
{ | |||
Console.Write(arglist); | |||
path = Console.ReadLine(); | |||
} | |||
else | |||
{ | |||
path = ""; | |||
Console.Error.WriteLine($"Invalid command {command}"); | |||
} | |||
} | |||
if (level > fstack.Count - 1) | |||
Push(path); | |||
else if (level == fstack.Count - 1) | |||
files.Add(Replace(path)); | |||
else if (level < fstack.Count - 1) | |||
{ | |||
files.Add(Pop()); | |||
while (level < fstack.Count) | |||
Pop(); | |||
Push(path); | |||
} | |||
} | |||
files.Add(Pop()); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,36 @@ | |||
using System.Reflection; | |||
using System.Runtime.CompilerServices; | |||
using System.Runtime.InteropServices; | |||
// General Information about an assembly is controlled through the following | |||
// set of attributes. Change these attribute values to modify the information | |||
// associated with an assembly. | |||
[assembly: AssemblyTitle("CollectDependencies")] | |||
[assembly: AssemblyDescription("")] | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("")] | |||
[assembly: AssemblyProduct("CollectDependencies")] | |||
[assembly: AssemblyCopyright("Copyright © 2018")] | |||
[assembly: AssemblyTrademark("")] | |||
[assembly: AssemblyCulture("")] | |||
// Setting ComVisible to false makes the types in this assembly not visible | |||
// to COM components. If you need to access a type in this assembly from | |||
// COM, set the ComVisible attribute to true on that type. | |||
[assembly: ComVisible(false)] | |||
// The following GUID is for the ID of the typelib if this project is exposed to COM | |||
[assembly: Guid("5f33b310-dc8d-4c0d-877e-bac3908de10f")] | |||
// Version information for an assembly consists of the following four values: | |||
// | |||
// Major Version | |||
// Minor Version | |||
// Build Number | |||
// Revision | |||
// | |||
// You can specify all the values or you can default the Build and Revision Numbers | |||
// by using the '*' as shown below: | |||
// [assembly: AssemblyVersion("1.0.*")] | |||
[assembly: AssemblyVersion("1.0.0.0")] | |||
[assembly: AssemblyFileVersion("1.0.0.0")] |
@ -0,0 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<packages> | |||
<package id="Mono.Cecil" version="0.10.1" targetFramework="net472" /> | |||
</packages> |
@ -1 +1 @@ | |||
1d38dd5b9139545c6bc300c735ca121563a74d20 | |||
de1a0105accb49be9027a1a26ea711a5ac5f69fd |
@ -1,66 +0,0 @@ | |||
import os | |||
import shutil | |||
def toFileList(text): | |||
lines = text.splitlines() | |||
files = [] | |||
stack = [] | |||
def push(val): | |||
pre = '' | |||
if len(stack) > 0: | |||
pre = stack[-1] | |||
stack.append(pre + val) | |||
def pop(): | |||
return stack.pop() | |||
def replace(val): | |||
val2 = pop() | |||
push(val) | |||
return val2 | |||
for line in lines: | |||
spl = line.split('"'); | |||
spath = spl[-1] | |||
semis = len(spl[:-1]) | |||
if spath.startswith('::'): | |||
spl = spath.split(' ') | |||
cmd = spl[0][2:] | |||
if cmd == 'from': # basically just import | |||
content = '' | |||
with open(' '.join(spl[1:]),'r') as f: | |||
content = f.read() | |||
spath = content | |||
elif cmd == 'prompt': | |||
spath = input(' '.join(spl[1:])) | |||
else: | |||
spath = '' | |||
print("No such command", cmd) | |||
if semis > (len(stack)-1): | |||
push(spath) | |||
elif semis == (len(stack)-1): | |||
files.append(replace(spath)) | |||
elif semis < (len(stack)-1): | |||
files.append(pop()) | |||
while semis < (len(stack)): | |||
pop() | |||
push(spath) | |||
files.append(pop()) | |||
return files | |||
if __name__ == '__main__': | |||
file = '' | |||
with open("refs.txt","r") as f: | |||
file = f.read() | |||
refs = toFileList(file) | |||
tgtDir = "target/" | |||
shutil.rmtree(tgtDir, ignore_errors=True) | |||
if not os.path.exists(tgtDir): | |||
os.makedirs(tgtDir) | |||
for filename in refs: | |||
if (os.path.isfile(filename)): | |||
print("Copying",filename) | |||
shutil.copy(filename, tgtDir) |