mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-11-07 22:18:29 +01:00
minor update on libantosdk
This commit is contained in:
parent
6e020484a8
commit
ad40892a5c
@ -2,6 +2,7 @@
|
||||
AntOSDK: development API for AntOS based applications/projects
|
||||
|
||||
## Change logs
|
||||
- 0.0.15: App name differ from libname, update AntOS API
|
||||
- 0.0.14: vfs-rm can be configured to be silent when the target does not exist
|
||||
- 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description
|
||||
- 0.0.12: TS worker now allows user specific compile options (defined un build file)
|
||||
|
@ -2,6 +2,7 @@
|
||||
AntOSDK: development API for AntOS based applications/projects
|
||||
|
||||
## Change logs
|
||||
- 0.0.15: App name differ from libname, update AntOS API
|
||||
- 0.0.14: vfs-rm can be configured to be silent when the target does not exist
|
||||
- 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description
|
||||
- 0.0.12: TS worker now allows user specific compile options (defined un build file)
|
||||
|
30
libantosdk/build/debug/core/ts/antos.d.ts
vendored
30
libantosdk/build/debug/core/ts/antos.d.ts
vendored
@ -1140,7 +1140,7 @@ declare namespace OS {
|
||||
* @export
|
||||
* @param {string} app
|
||||
*/
|
||||
function unloadApp(app: string): void;
|
||||
function unloadApp(app: string, save?: boolean): void;
|
||||
/**
|
||||
* Create a service process.
|
||||
*
|
||||
@ -1559,13 +1559,14 @@ declare namespace OS {
|
||||
* AntOS version number is in the following format:
|
||||
*
|
||||
* ```
|
||||
* [major_number].[minor_number].[patch]-[branch]
|
||||
* [major_number].[minor_number].[patch]-[branch]-[build ID])
|
||||
*
|
||||
* e.g.: 1.2.3-r means that:
|
||||
* e.g.: 1.2.3-r-b means that:
|
||||
* - version major number is 1
|
||||
* - version minor number is 2
|
||||
* - patch version is 3
|
||||
* - the current branch is release `r`
|
||||
* - build ID (optional)
|
||||
* ```
|
||||
*
|
||||
* @export
|
||||
@ -1575,10 +1576,11 @@ declare namespace OS {
|
||||
/**
|
||||
* The version string
|
||||
*
|
||||
* @private
|
||||
* @type {string}
|
||||
* @memberof Version
|
||||
*/
|
||||
string: string;
|
||||
private string;
|
||||
/**
|
||||
* The current branch
|
||||
* - 1: `a` - alpha branch
|
||||
@ -1611,12 +1613,27 @@ declare namespace OS {
|
||||
* @memberof Version
|
||||
*/
|
||||
patch: number;
|
||||
/**
|
||||
* Version build ID (optional): usually the current git commit hash
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Version
|
||||
*/
|
||||
build_id: string;
|
||||
/**
|
||||
*Creates an instance of Version.
|
||||
*
|
||||
* @param {string} string string represents the version
|
||||
* @memberof Version
|
||||
*/
|
||||
constructor(string: string);
|
||||
/**
|
||||
* Setter/getter to set the version string to the object
|
||||
*
|
||||
* @memberof Version
|
||||
*/
|
||||
set version_string(v: string);
|
||||
get version_string(): string;
|
||||
/**
|
||||
* Compare the current version with another version.
|
||||
*
|
||||
@ -1670,6 +1687,11 @@ declare namespace OS {
|
||||
* is an instance of [[Version]]
|
||||
*/
|
||||
const VERSION: Version;
|
||||
/**
|
||||
* Variable represents the current AntOS source code repository
|
||||
* is an instance of [[string]]
|
||||
*/
|
||||
const REPOSITORY: string;
|
||||
/**
|
||||
* Register a model prototype to the system namespace.
|
||||
* There are two types of model to be registered, if the model
|
||||
|
4
libantosdk/build/debug/core/ts/jquery.d.ts
vendored
4
libantosdk/build/debug/core/ts/jquery.d.ts
vendored
@ -1,4 +1,7 @@
|
||||
export as namespace Sizzle;
|
||||
|
||||
declare const Sizzle: SizzleStatic;
|
||||
export = Sizzle;
|
||||
|
||||
interface SizzleStatic {
|
||||
selectors: Sizzle.Selectors;
|
||||
@ -81,7 +84,6 @@ declare namespace Sizzle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
@ -1 +1 @@
|
||||
var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const s=t.setting.system.packages[e];i[e]={path:s.path,name:s.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,s,r){const o=this.newJobID(),n={id:o,cmd:t,data:e,root:i};this.jobs[o]={callback:s,logger:r},this.worker.postMessage(n)}submit(t,e,i,s){return new Promise((r,o)=>{this.exectue_job(t,e,i,t=>{if(t.error)return o(t.error);r(t.result)},s)})}terminate(){this.worker.terminate()}}class s{constructor(t,e){this.root=e,this.logger=t,s.worker||(s.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,s)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){s(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,s)=>{try{let s=i;1==s.split("://").length&&(s=`${this.root}/${i}`);const r=await(s+"/package.json").asFileHandle().read("json");return r.text=r.name,r.path=s,r.filename=r.pkgname,r.type="app",r.mime="antos/app",r.icon&&(r.icon=`${r.path}/${r.icon}`),r.iconclass||r.icon||(r.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[r.pkgname]=r,r.app?(this.logger.info(__("Running {0}...",r.app)),t.GUI.forceLaunch(r.app,[])):this.logger.error(__("{0} is not an application",r.pkgname)),e(void 0)}catch(t){s(t)}}):s.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,s)=>{try{e.targets||s("No target found");for(const i of t){const t=e.targets[i];if(!t)return s(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){s(t)}})}}let r;e.AntOSDKBuilder=s,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(r=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let s=$("<pre></pre>").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();s.text(`[${i}]: ${e.__()}`)}else s.text(e.__());$(this.target).append(s),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class s extends e.BaseApplication{constructor(t){super("libantosdk",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text]))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.libantosdk=s}(e=t.application||(t.application={}))}(OS||(OS={}));
|
||||
var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const s=t.setting.system.packages[e];i[e]={path:s.path,name:s.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,s,r){const o=this.newJobID(),n={id:o,cmd:t,data:e,root:i};this.jobs[o]={callback:s,logger:r},this.worker.postMessage(n)}submit(t,e,i,s){return new Promise((r,o)=>{this.exectue_job(t,e,i,t=>{if(t.error)return o(t.error);r(t.result)},s)})}terminate(){this.worker.terminate()}}class s{constructor(t,e){this.root=e,this.logger=t,s.worker||(s.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,s)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){s(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,s)=>{try{let s=i;1==s.split("://").length&&(s=`${this.root}/${i}`);const r=await(s+"/package.json").asFileHandle().read("json");return r.text=r.name,r.path=s,r.filename=r.pkgname,r.type="app",r.mime="antos/app",r.icon&&(r.icon=`${r.path}/${r.icon}`),r.iconclass||r.icon||(r.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[r.pkgname]=r,r.app?(this.logger.info(__("Running {0}...",r.app)),t.GUI.forceLaunch(r.app,[])):this.logger.error(__("{0} is not an application",r.pkgname)),e(void 0)}catch(t){s(t)}}):s.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,s)=>{try{e.targets||s("No target found");for(const i of t){const t=e.targets[i];if(!t)return s(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){s(t)}})}}let r;e.AntOSDKBuilder=s,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(r=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let s=$("<pre></pre>").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();s.text(`[${i}]: ${e.__()}`)}else s.text(e.__());$(this.target).append(s),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class s extends e.BaseApplication{constructor(t){super("SDKBuilder",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text]))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.SDKBuilder=s}(e=t.application||(t.application={}))}(OS||(OS={}));
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"pkgname": "libantosdk",
|
||||
"name": "AntOS SDK builder",
|
||||
"app": "libantosdk",
|
||||
"app": "SDKBuilder",
|
||||
"description": "AntOS Software Development Kit",
|
||||
"info": {
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version": "0.0.14-a",
|
||||
"version": "0.0.15-a",
|
||||
"category": "Development",
|
||||
"iconclass": "fa fa-cog",
|
||||
"mimes": [
|
||||
|
Binary file not shown.
30
libantosdk/core/ts/antos.d.ts
vendored
30
libantosdk/core/ts/antos.d.ts
vendored
@ -1140,7 +1140,7 @@ declare namespace OS {
|
||||
* @export
|
||||
* @param {string} app
|
||||
*/
|
||||
function unloadApp(app: string): void;
|
||||
function unloadApp(app: string, save?: boolean): void;
|
||||
/**
|
||||
* Create a service process.
|
||||
*
|
||||
@ -1559,13 +1559,14 @@ declare namespace OS {
|
||||
* AntOS version number is in the following format:
|
||||
*
|
||||
* ```
|
||||
* [major_number].[minor_number].[patch]-[branch]
|
||||
* [major_number].[minor_number].[patch]-[branch]-[build ID])
|
||||
*
|
||||
* e.g.: 1.2.3-r means that:
|
||||
* e.g.: 1.2.3-r-b means that:
|
||||
* - version major number is 1
|
||||
* - version minor number is 2
|
||||
* - patch version is 3
|
||||
* - the current branch is release `r`
|
||||
* - build ID (optional)
|
||||
* ```
|
||||
*
|
||||
* @export
|
||||
@ -1575,10 +1576,11 @@ declare namespace OS {
|
||||
/**
|
||||
* The version string
|
||||
*
|
||||
* @private
|
||||
* @type {string}
|
||||
* @memberof Version
|
||||
*/
|
||||
string: string;
|
||||
private string;
|
||||
/**
|
||||
* The current branch
|
||||
* - 1: `a` - alpha branch
|
||||
@ -1611,12 +1613,27 @@ declare namespace OS {
|
||||
* @memberof Version
|
||||
*/
|
||||
patch: number;
|
||||
/**
|
||||
* Version build ID (optional): usually the current git commit hash
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Version
|
||||
*/
|
||||
build_id: string;
|
||||
/**
|
||||
*Creates an instance of Version.
|
||||
*
|
||||
* @param {string} string string represents the version
|
||||
* @memberof Version
|
||||
*/
|
||||
constructor(string: string);
|
||||
/**
|
||||
* Setter/getter to set the version string to the object
|
||||
*
|
||||
* @memberof Version
|
||||
*/
|
||||
set version_string(v: string);
|
||||
get version_string(): string;
|
||||
/**
|
||||
* Compare the current version with another version.
|
||||
*
|
||||
@ -1670,6 +1687,11 @@ declare namespace OS {
|
||||
* is an instance of [[Version]]
|
||||
*/
|
||||
const VERSION: Version;
|
||||
/**
|
||||
* Variable represents the current AntOS source code repository
|
||||
* is an instance of [[string]]
|
||||
*/
|
||||
const REPOSITORY: string;
|
||||
/**
|
||||
* Register a model prototype to the system namespace.
|
||||
* There are two types of model to be registered, if the model
|
||||
|
4
libantosdk/core/ts/jquery.d.ts
vendored
4
libantosdk/core/ts/jquery.d.ts
vendored
@ -1,4 +1,7 @@
|
||||
export as namespace Sizzle;
|
||||
|
||||
declare const Sizzle: SizzleStatic;
|
||||
export = Sizzle;
|
||||
|
||||
interface SizzleStatic {
|
||||
selectors: Sizzle.Selectors;
|
||||
@ -81,7 +84,6 @@ declare namespace Sizzle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"pkgname": "libantosdk",
|
||||
"name": "AntOS SDK builder",
|
||||
"app": "libantosdk",
|
||||
"app": "SDKBuilder",
|
||||
"description": "AntOS Software Development Kit",
|
||||
"info": {
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version": "0.0.14-a",
|
||||
"version": "0.0.15-a",
|
||||
"category": "Development",
|
||||
"iconclass": "fa fa-cog",
|
||||
"mimes": [
|
||||
|
@ -114,17 +114,17 @@ namespace OS {
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @class libantosdk
|
||||
* @class SDKBuilder
|
||||
* @extends {BaseApplication}
|
||||
*/
|
||||
export class libantosdk extends BaseApplication {
|
||||
export class SDKBuilder extends BaseApplication {
|
||||
private sdk: API.AntOSDKBuilder;
|
||||
private logger: Logger;
|
||||
private filehandle: OS.API.VFS.BaseFileHandle;
|
||||
private options: GenericObject<any>;
|
||||
private targets: OS.GUI.tag.ListViewTag;
|
||||
constructor(args: AppArgumentsType[]) {
|
||||
super("libantosdk", args);
|
||||
super("SDKBuilder", args);
|
||||
}
|
||||
main(): void {
|
||||
this.logger = new Logger(this.find("container"));
|
||||
|
@ -69,6 +69,16 @@
|
||||
"dependencies": ["Antunnel@0.2.0-b"],
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelPlugins/build/release/AntunnelPlugins.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "AntunnelTestClient",
|
||||
"name": "AntunnelTestClient",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelTestClient/README.md",
|
||||
"category": "Development",
|
||||
"author": "Dany LE",
|
||||
"version": "0.1.0-a",
|
||||
"dependencies": ["Antunnel@0.2.1-b"],
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/AntunnelTestClient/build/release/AntunnelTestClient.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "Archive",
|
||||
"name": "Archive",
|
||||
@ -215,7 +225,7 @@
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libantosdk/README.md",
|
||||
"category": "Development",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.14-a",
|
||||
"version": "0.0.15-a",
|
||||
"dependencies": [],
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/libantosdk/build/release/libantosdk.zip"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user