mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-08 09:05:46 +00:00
Add docs, turn args and buildessentials non classes into classes
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
func Tesses.CrossLang.Args(args)
|
||||
/^ The CrossLang Arguments Parser ^/
|
||||
class Tesses.CrossLang.Args
|
||||
{
|
||||
var filename = args[0];
|
||||
|
||||
if(args.Count < 1) return null;
|
||||
var flags = [];
|
||||
var options = [];
|
||||
var pos = [];
|
||||
|
||||
var onlyPos=false;
|
||||
|
||||
for(var i = 1; i < args.Count; i++)
|
||||
/^ Constructor ^/
|
||||
public Args(args)
|
||||
{
|
||||
var filename = args[0];
|
||||
|
||||
if(args.Count < 1) return null;
|
||||
var flags = [];
|
||||
var options = [];
|
||||
var pos = [];
|
||||
|
||||
var onlyPos=false;
|
||||
|
||||
for(var i = 1; i < args.Count; i++)
|
||||
{
|
||||
if(args[i] == "--") {
|
||||
onlyPos=true;
|
||||
continue;
|
||||
@@ -26,14 +30,20 @@ func Tesses.CrossLang.Args(args)
|
||||
else {
|
||||
pos.Add(args[i]);
|
||||
}
|
||||
}
|
||||
this.Options = options;
|
||||
this.FileName = filename;
|
||||
this.Flags = flags;
|
||||
this.Arguments = pos;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
Options = options,
|
||||
FileName = filename,
|
||||
Flags = flags,
|
||||
Arguments = pos,
|
||||
};
|
||||
|
||||
/^ Key value pairs --NAME=VALUE ^/
|
||||
public Options;
|
||||
/^ Flags --NAME ^/
|
||||
public Flags;
|
||||
/^ Executable name ^/
|
||||
public FileName;
|
||||
/^ Positional Arguments ^/
|
||||
public Arguments;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/^ Entrypoint used only when building the shell ^/
|
||||
func main(args)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
//pm.Offline=true;
|
||||
//Console.WriteLine(pm.GetLatest("MyPackage"));
|
||||
//Console.WriteLine(Json.Encode(pm.ParseFileName("BeautifulApp-John-1.0.0.0-prod.crvm")));
|
||||
|
||||
var tool = Tesses.CrossLang.BuildTool(pm);
|
||||
tool.BuildProject(args[1]);
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
|
||||
var tool = new Tesses.CrossLang.BuildTool(pm);
|
||||
tool.BuildProject(args[1]);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,21 @@
|
||||
func Tesses.CrossLang.PackageManager()
|
||||
/^ The CrossLang Package Manager Client ^/
|
||||
class Tesses.CrossLang.PackageManager
|
||||
{
|
||||
func ParseFileName(name)
|
||||
private configRoot;
|
||||
private packageCache;
|
||||
/^ Work offline (defaults to false) ^/
|
||||
public Offline = false;
|
||||
|
||||
/^ Construct the Package Manager ^/
|
||||
public PackageManager()
|
||||
{
|
||||
this.configRoot = Env.CrossLangConfig;
|
||||
this.packageCache = configRoot / "PackageCache";
|
||||
|
||||
FS.Local.CreateDirectory(packageCache);
|
||||
}
|
||||
/^ Parse package filename ^/
|
||||
public ParseFileName(name)
|
||||
{
|
||||
|
||||
var index = name.LastIndexOf('.');
|
||||
@@ -28,26 +43,21 @@ func Tesses.CrossLang.PackageManager()
|
||||
};
|
||||
}
|
||||
}
|
||||
var configRoot = Env.CrossLangConfig;
|
||||
var packageCache = configRoot / "PackageCache";
|
||||
FS.Local.CreateDirectory(packageCache);
|
||||
|
||||
return {
|
||||
Offline = false,
|
||||
ParseFileName,
|
||||
GetPackageServers = ()=>{
|
||||
var packageConfigFile = configRoot / "package_servers.json";
|
||||
/^ Get package servers list ^/
|
||||
public GetPackageServers()
|
||||
{
|
||||
var packageConfigFile = configRoot / "package_servers.json";
|
||||
|
||||
if(FS.Local.RegularFileExists(packageConfigFile))
|
||||
{
|
||||
return Json.Decode(FS.ReadAllText(FS.Local, packageConfigFile));
|
||||
}
|
||||
return ["https://cpkg.tesseslanguage.com/"];
|
||||
},
|
||||
GetPackage = (this,name, version) =>
|
||||
if(FS.Local.RegularFileExists(packageConfigFile))
|
||||
{
|
||||
|
||||
var v = Version.Parse(version);
|
||||
return Json.Decode(FS.ReadAllText(FS.Local, packageConfigFile));
|
||||
}
|
||||
return ["https://cpkg.tesseslanguage.com/"];
|
||||
}
|
||||
/^ Get a package (returns bytearray of package data or null if not found), use GetLatest to get the latest version ^/
|
||||
public GetPackage(name, version)
|
||||
{
|
||||
var v = Version.Parse(version);
|
||||
var useCache = v.Stage != "dev";
|
||||
var pkgFile = packageCache / name / v.ToString();
|
||||
if(useCache && FS.Local.RegularFileExists(pkgFile))
|
||||
@@ -81,9 +91,11 @@ func Tesses.CrossLang.PackageManager()
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
GetLatest = (this,name) => {
|
||||
var pkgServers = this.GetPackageServers();
|
||||
}
|
||||
/^ Get the latest version of a package ^/
|
||||
public GetLatest(name)
|
||||
{
|
||||
var pkgServers = this.GetPackageServers();
|
||||
if(this.Offline || pkgServers.Count == 0)
|
||||
{
|
||||
//user has declared they are offline or don't have packageServers look through packages locally
|
||||
@@ -121,6 +133,6 @@ func Tesses.CrossLang.PackageManager()
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,13 @@
|
||||
func Tesses.CrossLang.BuildTool(pm)
|
||||
/^ The CrossLang BuildTool (use the function BuildProject) ^/
|
||||
class Tesses.CrossLang.BuildTool
|
||||
{
|
||||
func copyFile(src,dest)
|
||||
/^ Construct the build tool with Package Manager ^/
|
||||
public BuildTool(pm)
|
||||
{
|
||||
this.PacakgeManager = pm;
|
||||
}
|
||||
|
||||
private copyFile(src,dest)
|
||||
{
|
||||
var src = FS.Local.OpenFile(src,"rb");
|
||||
var dest = FS.Local.OpenFile(dest, "wb");
|
||||
@@ -8,11 +15,14 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
src.Close();
|
||||
dest.Close();
|
||||
}
|
||||
|
||||
return {
|
||||
DirectoriesCompiled = [],
|
||||
GetPackageDependencies = (this,name,version,dir)=>{
|
||||
var dep = pm.GetPackage(name,version);
|
||||
/^ Package Manager Object ^/
|
||||
public PackageManager;
|
||||
/^ Directories compiled ^/
|
||||
public DirectoriesCompiled = [];
|
||||
/^ Get the dependencies (don't use this directly unless you know what you are doing) ^/
|
||||
public GetPackageDependencies(name, version, dir)
|
||||
{
|
||||
var dep = PackageManager.GetPackage(name,version);
|
||||
if(TypeOf(dep) == "Null") throw $"Package {name} with version {version} does not exist";
|
||||
|
||||
var pkgPath = dir / $"{name}-{version}.crvm";
|
||||
@@ -45,9 +55,11 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
Dependencies = deps,
|
||||
Output = pkgPath
|
||||
};
|
||||
},
|
||||
BuildProject = (this,projectDirectory)=>{
|
||||
var dir = FS.MakeFull(projectDirectory);
|
||||
}
|
||||
/^ Build the project in the directory projectDirectory ^/
|
||||
public BuildProject(projectDirectory)
|
||||
{
|
||||
var dir = FS.MakeFull(projectDirectory);
|
||||
var dirStr = dir.ToString();
|
||||
|
||||
|
||||
@@ -366,6 +378,7 @@ func Tesses.CrossLang.BuildTool(pm)
|
||||
return myData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/^ Get the name and description from executable ^/
|
||||
func Tesses.CrossLang.GetNameAndDescription(name)
|
||||
{
|
||||
var strm = FS.Local.OpenFile(name,"rb");
|
||||
@@ -15,6 +16,7 @@ func Tesses.CrossLang.GetNameAndDescription(name)
|
||||
|
||||
return $"{name}: {description}";
|
||||
}
|
||||
/^ Get the name and description from executable (as json object) ^/
|
||||
func Tesses.CrossLang.GetNameAndDescriptionJson(name)
|
||||
{
|
||||
var strm = FS.Local.OpenFile(name,"rb");
|
||||
|
||||
@@ -22,7 +22,6 @@ func Pages.PackageDocs(ctx)
|
||||
var classes = res.Classes;
|
||||
var functions = res.Functions;
|
||||
var chunks = res.Chunks;
|
||||
Console.WriteLine(classes);
|
||||
each(var item : functions)
|
||||
{
|
||||
item.Arguments = chunks[item.ChunkId].Arguments;
|
||||
|
||||
@@ -3,10 +3,177 @@ func Net.getIPAddresses($ipv6)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Start server with specified port (and block) server is described by Net.Http.Server ^/
|
||||
func Net.Http.ListenSimpleWithLoop(server, port)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/^ schema from list entries from return value of Net.getIPAddresses ^/
|
||||
class Net.IPAddress {
|
||||
/^ The network interface ^/
|
||||
public Interface;
|
||||
/^ The ip address string ^/
|
||||
public Address;
|
||||
}
|
||||
|
||||
/^ schema for server ^/
|
||||
class Net.Http.Server {
|
||||
/^ Handle the request (ctx schema is Net.Http.ServerContext) returns true (handled request) or false (didn't handle request) (any function that accepts a server can also be passed with this directly) ^/
|
||||
|
||||
public Handle(ctx)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/^ schema for HTTP ServerContext ^/
|
||||
class Net.Http.ServerContext {
|
||||
/^ Is using https (within tessesframework) ^/
|
||||
public Encrypted;
|
||||
/^ Http Method ^/
|
||||
public Method;
|
||||
/^ The client's IP ^/
|
||||
public IP;
|
||||
/^ The client's Port ^/
|
||||
public Port;
|
||||
/^ The original path of the server (if using mountable server) ^/
|
||||
public OriginalPath;
|
||||
/^ The query parameters of url (including post fields) schema is Net.Http.HttpDictionary ^/
|
||||
public QueryParams;
|
||||
/^ The request headers, schema is Net.Http.HttpDictionary ^/
|
||||
public RequestHeaders;
|
||||
|
||||
/^ The response headers, schema is Net.Http.HttpDictionary ^/
|
||||
public ResponseHeaders;
|
||||
/^ Get the path ^/
|
||||
public getPath()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Set the path ^/
|
||||
public setPath(path)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Get the HTTP version ^/
|
||||
public getVersion()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Set the HTTP version ^/
|
||||
public setVersion(version)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Get the status code ^/
|
||||
public getStatusCode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^ Set the status code ^/
|
||||
public setStatusCode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^ Get raw stream ^/
|
||||
public GetStream()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Open a stream for request ^/
|
||||
public OpenRequestStream()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Open a stream for response ^/
|
||||
public OpenResponseStream()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^
|
||||
Parse multipart/form-data
|
||||
pass closure that (mime,filename,name)=>{ return SomeStream; }
|
||||
note: you need to close the streams manually due to how crosslang works
|
||||
^/
|
||||
|
||||
public ParseFormData(cb)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Is the method post and using multipart/form-data ^/
|
||||
public getNeedToParseFormData()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Read request as string ^/
|
||||
public ReadString()
|
||||
{
|
||||
|
||||
}
|
||||
/^ Read request to stream ^/
|
||||
public ReadStream(strm)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Read request and convert to json ^/
|
||||
public ReadJson()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^ Send response from object and serialize to json ^/
|
||||
public SendJson(object)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Send response from text ^/
|
||||
public SendText(text)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Send response from stream ^/
|
||||
|
||||
public SendStream(strm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^ Send response from bytearray ^/
|
||||
|
||||
public SendBytes(strm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/^ With mime type (returns the ctx) ^/
|
||||
|
||||
public WithMimeType(mime)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Set the last modified date (returns the ctx) ^/
|
||||
public WithLastModified(date)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Set the content disposition header (returns the ctx) ^/
|
||||
public WithContentDisposition(filename, inline)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Add response header (add it if it already exists) (returns the ctx) ^/
|
||||
public WithHeader(key,value) {
|
||||
|
||||
}
|
||||
/^ Replace response header (adds it if it does not exist) (returns the ctx) ^/
|
||||
public WithSingleHeader(key,value)
|
||||
{
|
||||
|
||||
}
|
||||
/^ Start a websocket session ^/
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ func Tesses.CrossLang.Shell.AddDependency(dd)
|
||||
|
||||
if(version == null)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
version = pm.GetLatest(name);
|
||||
}
|
||||
if(version == null)
|
||||
|
||||
@@ -38,9 +38,9 @@ func Tesses.CrossLang.Shell.Build(dd)
|
||||
conf = option.Value;
|
||||
}
|
||||
}
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
bt.AllowFullCompTime = allowFullCompTime;
|
||||
bt.BuildProject(buildPath);
|
||||
|
||||
@@ -38,9 +38,9 @@ func Tesses.CrossLang.Shell.Debug(dd)
|
||||
}
|
||||
if(nobuild)
|
||||
{
|
||||
if(FS.Local.FileExists("config.json"))
|
||||
if(FS.Local.FileExists("cross.json"))
|
||||
{
|
||||
var proj = Json.Decode(FS.ReadAllText(FS.Local, "config.json"));
|
||||
var proj = Json.Decode(FS.ReadAllText(FS.Local, "cross.json"));
|
||||
var nameVer = $"{proj.name}-{proj.version}.crvm";
|
||||
var buildDir = TypeOf(proj.bin_directory) == "String" ? proj.bin_directory : "bin";
|
||||
|
||||
@@ -58,9 +58,9 @@ func Tesses.CrossLang.Shell.Debug(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
}
|
||||
|
||||
@@ -34,5 +34,6 @@ func Tesses.CrossLang.Shell.Default(dd)
|
||||
Console.WriteLine("logout: logout from cpkg");
|
||||
Console.WriteLine("configdir: print the config directory");
|
||||
Console.WriteLine("update-shell: update the shell"); //this command is handled by runtime so we don't have to implement it here
|
||||
Console.WriteLine("docs: view docs for project, crvm or reference");
|
||||
return 0;
|
||||
}
|
||||
256
Tesses.CrossLang.Shell/src/docs.tcross
Normal file
256
Tesses.CrossLang.Shell/src/docs.tcross
Normal file
@@ -0,0 +1,256 @@
|
||||
|
||||
|
||||
|
||||
func Tesses.CrossLang.Shell.Docs(dd)
|
||||
{
|
||||
func download_reference()
|
||||
{
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
var latest = pm.GetLatest("Tesses.CrossLang.Reference");
|
||||
if(latest != null)
|
||||
{
|
||||
var pkg = pm.GetPackage("Tesses.CrossLang.Reference", latest);
|
||||
if(TypeOf(pkg) == "ByteArray")
|
||||
{
|
||||
FS.WriteAllBytes(FS.Local,referencePath, pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Console.WriteLine(dd);
|
||||
var override_default=false;
|
||||
|
||||
var funcs=false;
|
||||
var classes=false;
|
||||
|
||||
var funcs_list=[];
|
||||
var classes_list=[];
|
||||
|
||||
var referencePath = Env.CrossLangConfig / "Reference.crvm";
|
||||
|
||||
func printClasses()
|
||||
{
|
||||
Console.WriteLine("Classes:");
|
||||
each(var cls : classes_list)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"\e[38;5;34m/^{cls.Docs}^/");
|
||||
Console.Write($"\e[38;5;39mclass \e[38;5;42m{cls.Name} ");
|
||||
if(cls.Inherits == "ClassObject")
|
||||
{
|
||||
Console.WriteLine("\e[38;5;15m{");
|
||||
}
|
||||
else {
|
||||
Console.WriteLine($"\e[38;5;15m: \e[38;5;42m{cls.Inherits} \e[38;5;15m{{");
|
||||
}
|
||||
each(var ent : cls.Entries)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"\t\e[38;5;34m/^{ent.Docs}^/");
|
||||
Console.Write($"\t\e[38;5;39m{ent.Modifiers} ");
|
||||
if(ent.IsFunction)
|
||||
{
|
||||
Console.WriteLine($"\e[38;5;229m{ent.Name}\e[38;5;63m(\e[38;5;15m{ent.Args}\e[38;5;63m)\e[0m");
|
||||
}
|
||||
else {
|
||||
Console.WriteLine($"\e[38;5;159m{ent.Name}\e[0m;");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("\e[38;5;15m}\e[0m");
|
||||
}
|
||||
}
|
||||
func printFunctions()
|
||||
{
|
||||
Console.WriteLine("Functions:");
|
||||
each(var fn : funcs_list)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"\e[38;5;34m/^{fn.Docs}^/");
|
||||
Console.WriteLine($"\e[38;5;39mfunc \e[38;5;229m{fn.Name}\e[38;5;63m(\e[38;5;15m{fn.Args}\e[38;5;63m)\e[0m");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func load_crvm(crvm_path)
|
||||
{
|
||||
if(!FS.Local.RegularFileExists(crvm_path)) return;
|
||||
var strm = FS.Local.OpenFile(crvm_path,"rb");
|
||||
var res = VM.LoadExecutable(strm);
|
||||
strm.Close();
|
||||
var classes = res.Classes;
|
||||
var functions = res.Functions;
|
||||
var chunks = res.Chunks;
|
||||
each(var item : functions)
|
||||
{
|
||||
item.Arguments = chunks[item.ChunkId].Arguments;
|
||||
|
||||
var name = "";
|
||||
for(var i = 0; i < item.NameParts.Length; i++)
|
||||
{
|
||||
if(i > 0) name += ".";
|
||||
name += item.NameParts[i];
|
||||
}
|
||||
|
||||
var args = "";
|
||||
for(var i = 0; i < item.Arguments.Length; i++)
|
||||
{
|
||||
if(i > 0) args += ", ";
|
||||
args += item.Arguments[i];
|
||||
}
|
||||
|
||||
funcs_list.Add({
|
||||
Name = name,
|
||||
Args = args,
|
||||
Docs = item.Documentation
|
||||
});
|
||||
}
|
||||
each(var item : classes)
|
||||
{
|
||||
var co = {
|
||||
Name = item.Name,
|
||||
Inherits = item.Inherits,
|
||||
Entries = [],
|
||||
Docs = item.Documentation
|
||||
};
|
||||
each(var ent : item.Entries)
|
||||
{
|
||||
if(ent.Modifier != "private")
|
||||
{
|
||||
var modifiers = $"{ent.Modifier}";
|
||||
if(ent.IsAbstract && ent.IsFunction)
|
||||
{
|
||||
modifiers += " abstract";
|
||||
}
|
||||
var args = "";
|
||||
for(var i = 0; i < ent.Arguments.Length; i++)
|
||||
{
|
||||
if(i > 0) args += ", ";
|
||||
args += ent.Arguments[i];
|
||||
}
|
||||
|
||||
|
||||
co.Entries.Add({
|
||||
Modifiers = modifiers,
|
||||
Docs = ent.Documentation,
|
||||
Name = ent.Name,
|
||||
IsFunction = ent.IsFunction,
|
||||
Args = args
|
||||
});
|
||||
}
|
||||
}
|
||||
classes_list.Add(co);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
each(var item : dd.Flags)
|
||||
{
|
||||
switch(item)
|
||||
{
|
||||
case "help":
|
||||
Console.WriteLine("USAGE: crosslang docs [flags]");
|
||||
Console.WriteLine("USAGE: crosslang docs [flags] CRVM1 CRVM2 ...");
|
||||
Console.WriteLine("If no CRVM files are provided it defaults to current directory's project");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("FLAGS:");
|
||||
Console.WriteLine("help: print this help");
|
||||
Console.WriteLine("functions: only list functions");
|
||||
Console.WriteLine("classes: only list classes");
|
||||
Console.WriteLine("reference: print runtime reference");
|
||||
Console.WriteLine("reference-path: print runtime reference file path");
|
||||
Console.WriteLine("update-reference: update runtime reference");
|
||||
Console.WriteLine("example: print an example");
|
||||
return 0;
|
||||
case "functions":
|
||||
funcs=true;
|
||||
break;
|
||||
case "classes":
|
||||
classes=true;
|
||||
break;
|
||||
case "reference":
|
||||
override_default=true;
|
||||
if(!FS.Local.RegularFileExists(referencePath))
|
||||
{
|
||||
download_reference();
|
||||
}
|
||||
if(FS.Local.RegularFileExists(referencePath))
|
||||
{
|
||||
load_crvm(referencePath);
|
||||
}
|
||||
break;
|
||||
case "reference-path":
|
||||
Console.WriteLine(referencePath);
|
||||
return 0;
|
||||
case "update-reference":
|
||||
download_reference();
|
||||
return 0;
|
||||
case "example":
|
||||
override_default=true;
|
||||
funcs_list.Add({
|
||||
Docs="\nAdds two numbers\n",
|
||||
Name="Add",
|
||||
Args="addend1, addend2"
|
||||
});
|
||||
classes_list.Add({
|
||||
Docs = "\nMy Sample Class\n",
|
||||
Name = "Class1",
|
||||
Inherits = "ClassObject",
|
||||
Entries = [
|
||||
{
|
||||
Docs = "My field",
|
||||
Modifiers = "protected",
|
||||
IsFunction = false,
|
||||
Name = "MyField"
|
||||
},
|
||||
{
|
||||
Docs = "Abstract method",
|
||||
IsFunction =true,
|
||||
Modifiers = "protected abstract",
|
||||
Name = "MyAbstractMethod",
|
||||
Args = "a, b"
|
||||
}
|
||||
]
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!override_default)
|
||||
{
|
||||
if(dd.Arguments.Length == 1)
|
||||
{
|
||||
if(FS.Local.FileExists("cross.json"))
|
||||
{
|
||||
var proj = Json.Decode(FS.ReadAllText(FS.Local, "cross.json"));
|
||||
var buildDir = TypeOf(proj.bin_directory) == "String" ? proj.bin_directory : "bin";
|
||||
|
||||
each(var file : FS.Local.EnumeratePaths(FS.MakeFull(buildDir)))
|
||||
{
|
||||
if(file.GetExtension()==".crvm")
|
||||
{
|
||||
load_crvm(file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("ERROR: could not find project.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(var i = 1; i < dd.Arguments.Length; i++)
|
||||
{
|
||||
load_crvm(dd.Arguments[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if((!classes && !funcs) || funcs)
|
||||
printFunctions();
|
||||
if((!classes && !funcs) || classes)
|
||||
printClasses();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ func Tesses.CrossLang.Shell.InstallConsole(dd)
|
||||
}
|
||||
if(dd.Arguments.Length == 2)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var name = dd.Arguments[1];
|
||||
var version = null;
|
||||
@@ -48,7 +48,7 @@ func Tesses.CrossLang.Shell.InstallConsole(dd)
|
||||
}
|
||||
if(version == null)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
version = pm.GetLatest(name);
|
||||
}
|
||||
if(version == null)
|
||||
@@ -158,9 +158,9 @@ func Tesses.CrossLang.Shell.InstallConsole(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func Tesses.CrossLang.Shell.InstallTemplate(dd)
|
||||
}
|
||||
if(dd.Arguments.Length == 2)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var name = dd.Arguments[1];
|
||||
var version = null;
|
||||
@@ -48,7 +48,7 @@ func Tesses.CrossLang.Shell.InstallTemplate(dd)
|
||||
}
|
||||
if(version == null)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
version = pm.GetLatest(name);
|
||||
}
|
||||
if(version == null)
|
||||
@@ -126,9 +126,9 @@ func Tesses.CrossLang.Shell.InstallTemplate(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func Tesses.CrossLang.Shell.InstallTool(dd)
|
||||
}
|
||||
if(dd.Arguments.Length == 2)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var name = dd.Arguments[1];
|
||||
var version = null;
|
||||
@@ -48,7 +48,7 @@ func Tesses.CrossLang.Shell.InstallTool(dd)
|
||||
}
|
||||
if(version == null)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
version = pm.GetLatest(name);
|
||||
}
|
||||
if(version == null)
|
||||
@@ -158,9 +158,9 @@ func Tesses.CrossLang.Shell.InstallTool(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func Tesses.CrossLang.Shell.InstallWebApp(dd)
|
||||
}
|
||||
if(dd.Arguments.Length == 2)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var name = dd.Arguments[1];
|
||||
var version = null;
|
||||
@@ -48,7 +48,7 @@ func Tesses.CrossLang.Shell.InstallWebApp(dd)
|
||||
}
|
||||
if(version == null)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
version = pm.GetLatest(name);
|
||||
}
|
||||
if(version == null)
|
||||
@@ -158,9 +158,9 @@ func Tesses.CrossLang.Shell.InstallWebApp(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
func main(args)
|
||||
{
|
||||
var dd = Tesses.CrossLang.Args(args);
|
||||
var dd = new Tesses.CrossLang.Args(args);
|
||||
if(dd.Arguments.Count > 0)
|
||||
{
|
||||
|
||||
@@ -74,6 +74,9 @@ func main(args)
|
||||
case "configdir":
|
||||
return Tesses.CrossLang.Shell.ConfigDir(dd);
|
||||
break;
|
||||
case "docs":
|
||||
return Tesses.CrossLang.Shell.Docs(dd);
|
||||
break;
|
||||
default:
|
||||
return Tesses.CrossLang.Shell.Default(dd);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ func Tesses.CrossLang.Shell.Run(dd)
|
||||
}
|
||||
if(nobuild)
|
||||
{
|
||||
if(FS.Local.FileExists("config.json"))
|
||||
if(FS.Local.FileExists("cross.json"))
|
||||
{
|
||||
var proj = Json.Decode(FS.ReadAllText(FS.Local, "config.json"));
|
||||
var proj = Json.Decode(FS.ReadAllText(FS.Local, "cross.json"));
|
||||
var nameVer = $"{proj.name}-{proj.version}.crvm";
|
||||
var buildDir = TypeOf(proj.bin_directory) == "String" ? proj.bin_directory : "bin";
|
||||
|
||||
@@ -64,9 +64,9 @@ func Tesses.CrossLang.Shell.Run(dd)
|
||||
}
|
||||
else
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = offline;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = conf;
|
||||
bt.AllowFullCompTime = allowFullCompTime;
|
||||
output = bt.BuildProject(buildPath).Output;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
func Tesses.CrossLang.Shell.ToolTest(dd)
|
||||
{
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = false;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
|
||||
var proj=bt.BuildProject(".");
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ func Tesses.CrossLang.Shell.UploadPackage(dd)
|
||||
}
|
||||
else {
|
||||
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = false;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
bt.Config = "";
|
||||
bt.AllowFullCompTime = false;
|
||||
package = bt.BuildProject(".").Output;
|
||||
|
||||
@@ -12,9 +12,9 @@ func Tesses.CrossLang.Shell.WebAppTest(dd)
|
||||
}
|
||||
|
||||
|
||||
var pm = Tesses.CrossLang.PackageManager();
|
||||
var pm = new Tesses.CrossLang.PackageManager();
|
||||
pm.Offline = false;
|
||||
var bt = Tesses.CrossLang.BuildTool(pm);
|
||||
var bt = new Tesses.CrossLang.BuildTool(pm);
|
||||
|
||||
|
||||
var proj=bt.BuildProject(".");
|
||||
|
||||
@@ -44,6 +44,8 @@ func create_archive()
|
||||
copyFile("Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Args-1.0.0.0-prod.crvm", shell / "Tesses.CrossLang.Args-1.0.0.0-prod.crvm");
|
||||
copyFile("Tesses.CrossLang.Shell/bin/Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm", shell / "Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm");
|
||||
copyFile("Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm", shell / "Shell.crvm");
|
||||
copyFile("Tesses.CrossLang.Reference/bin/Tesses.CrossLang.Reference-1.0.0.0-dev.crvm", "Reference.crvm");
|
||||
|
||||
|
||||
var templates = r / "Templates";
|
||||
tmpFS.CreateDirectory(templates);
|
||||
@@ -65,7 +67,7 @@ func create_archive()
|
||||
tmpFS.CreateDirectory(packageCache / "Tesses.CrossLang.Std");
|
||||
copyFile("Tesses.CrossLang.Args/bin/Tesses.CrossLang.Args-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.Args" / "1.0.0.0-prod");
|
||||
copyFile("Tesses.CrossLang.BuildEssentials/bin/Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.BuildEssentials" / "1.0.0.0-prod");
|
||||
copyFile("Tesses.CrossLang.Markup/bin/Tesses.CrossLang.Markup-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.Markup" / "1.0.0.0-prod");
|
||||
//copyFile("Tesses.CrossLang.Markup/bin/Tesses.CrossLang.Markup-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.Markup" / "1.0.0.0-prod");
|
||||
copyFile("Tesses.CrossLang.Args/bin/Tesses.CrossLang.Args-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.Args" / "1.0.0.0-prod");
|
||||
copyFile("Tesses.CrossLang.Std/bin/Tesses.CrossLang.Std-1.0.0.0-prod.crvm", packageCache / "Tesses.CrossLang.Std" / "1.0.0.0-prod");
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ namespace Tesses.CrossLang
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var project = JsonConvert.DeserializeObject<ProjectFile>(File.ReadAllText("config.json"));
|
||||
var project = JsonConvert.DeserializeObject<ProjectFile>(File.ReadAllText("cross.json"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user