Sencha-命令-CMD(Ant集成)(官网文档翻译34)

除了 ​​“ 入门 指南“ 中描述的命令行界面,煎茶CMD还提供了直接在Ant中使用的接口。

蚂蚁已久的Java开发社区的支柱,但其核心,Ant是一个基于XML的跨平台的脚本平台。我们把它叫做一个“平台”,而不是一种“语言”,因为Ant可以轻松地将JAR形式的代码库,或者您可以使用您的Ant脚本的一部分的许多支持的脚本语言之一。

当然,Ant可以调用其它程序(如煎茶Cmd的),传递参数和处理的退出代码,但Ant是什么特别善于操纵文件。这是因为Ant是专为使用构建脚本。

触及的高级煎茶CMD指南,煎茶Cmd的交付为一个JAR文件,它暴露了其为的Ant库(或antlib)的核心功能 。煎茶CMD,以及SDK的特殊处理,在命令行级别的这层上实现的。所以你可以在一个,你可以在其他。

 

 

如果您是使用Ant,它是更好的接口,在这个级别的煎茶Cmd的重复调用,而不是通过命令行界面。

<taskdefresource="com/sencha/ant/antlib.xml"classpath="${cmd.dir}/sencha.jar"/>

当一个Ant脚本执行煎茶蚂蚁...中cmd.dir属性定义的输入。否则,则该Ant脚本或执行方必须确定cmd.dir以适当的方式为本地计算机。

X-煎茶-init方法

这个任务加载的配置属性从“sencha.cfg”的文件在当前目录的基础上。这通常是由Ant脚本,需要煎茶Cmd和煎茶应用程序的构建。

<x-sencha-init/>

X-煎茶命令

此命令是等价的命令行界面。参数均放置在这个标签的正文文本,每行一个参数。空格两端修剪,所以缩进级别是不显着。缩进一个很好用的是澄清的命令结构,这样的:

<x-sencha-command>
    compile
        --classpath=app,sdk/src
        page
            --in=app/index.html
            --out=build/index.html
</x-sencha-command>

因为每一行是一个参数,空间不是特别的,不应该被转义或引用。

Ant属性扩展,所以下面的相当传统的风格也可以:

<x-sencha-command>
    compile
        --classpath=${app.dir},${sdk.dir}/src
        page
            --in=${app.dir}/index.html
            --out=${build.dir}/index.html
</x-sencha-command>

最后,注释支持使您可以记录命令或暂时禁用部分而不删除它们。此外,跳过空白行:

<x-sencha-command>
    compile
        # Include the app folder and the sdk/src folder
        --classpath=${app.dir},${sdk.dir}/src

        # Turn off debugging (comment next line to leave debug enabled):
        # --debug=false

        page
            # The application main page:
            --in=${app.dir}/index.html

            # The compiled page goes in build folder along with "all-classes.js":
            --out=${build.dir}/index.html
</x-sencha-command>

X-扩展类路径

此任务扩展当前的类加载器的类路径中。到中包括“sencha.jar”在classpath中,这有时是必要的,但在其他情况下,一个Ant脚本启动和类路径,必须动态扩展可能是有用的。

<x-extend-classpath><jarpath="${cmd.dir}/sencha.jar/></x-extend-classpath>

由于许多JAR的需要可以上市。

X-产生

该任务会产生两种基本模式:文件目录中的模板输出。也就是说,模板生成器可以给单个源文件或源文件夹。

模板引擎

模板文件的名称确定所使用的模板引擎。目前支持的模板引擎有两个:

例如,“foo.js.tpl”将用于生成使用XTemplate引擎的“是foo.js” ,而使用Velocity的“foo.js.vm” 

神圣的文件

在生成代码时,文件分为两个基本类别:机械维护和用户维护。它是优选的,然而,在初始生成即使文件,将最终用户维护提供一种起动器或骨架文件。

这就是所谓的“神圣”的文件被识别的源文件扩展名“默认”。也就是说,源文件仅仅是一个默认情况下并不会取代现有的文件。

例如,我们可能需要,生成启动“README.TXT”文件,但保存任何用户可能已经改变了在以后的再生。要做到这一点,源文件将被命名readme.txt.default的

有次当一个神圣的文件也是一个模板。这样做是由同时添加扩展名,例如,“readme.txt.tpl.default” “README.TXT”文件是一个神圣的文件,该文件最初是从模板生成。

参数

模板生成需要的数据或参数。最简单的形式参数使用的 参数属性:

<x-generate ...><paramname="bar"value="42"/></x-generate>

参数也可以从文件加载的,像这样:

<x-generate ...><loadfile="data.properties"/></x-generate>

以下类型的文件会自动被理解:

    • ".cfg" or ".properties" = A standard Java Properties file.
    • ".json" = A JSON data file.

如果该文件不具有这些扩展功能之一,但是是一个属性文件或JSON,你可以指定为JSON属性类型属性,像这样:

<x-generate ...><loadfile="data.props"type="properties"/><loadfile="data"type="json"/></x-generate>

注:参数中指定的顺序应用。被替换,如果遇到重复的名称。

X-生成的文件TOFILE

X-生成最简单的形式是使用一个单独的模板文件转换到指定的输出文件的文件属性:

<x-generatefile="foo.js.tpl"tofile="build/foo.js"><paramname="bar"value="42"/></x-generate>

的源文件名决定的过程将继续进行(使用的模板引擎,如果它是神圣的),但仅此而已。

X-生成的文件todir

在许多情况下,你可以把目标文件名,只需指定的文件夹,如:

<x-generatefile="foo.js.tpl"todir="build"><paramname="bar"value="42"/></x-generate>

这将,产生“foo.js” (使用XTemplate),在“构建”文件夹。

除了避免冗余,这种形式也可以是一个模板源文件名,例如:

<x-generatefile="{name}.js.tpl"todir="build"><paramname="name"value="foobar"/><paramname="bar"value="42"/></x-generate>

源文件是否存在具有指定名称(即“{name}的。js.tpl” ),但该名称使用的的XTemplate发动机和提供的参数,以确定目标文件名 ​​转换。

在上述情况下,“foobar.js”构建目录中生成。

X-生成目录todir

X-生成的最终形式的源文件夹,并生成目标文件夹中的内容,例如:

<x-generatedir="templates/foo"todir="build/foo"><paramname="bar"value="42"/><loadfile="data.json"/></x-generate>

在这种形式下,发电机递归读取文件和子文件夹中的“模板/ foo”的,并适用相应的模板引擎。它也保留了神圣的文件。XTemplate模板处理所有的文件和文 ​​件夹的名称。

X-压缩JS

压缩JavaScript源代码根据以下选​​项(属性):

  • SRCFILE:源文件进行压缩。
  • OUTFILE:输出的文件产生(默认为SRCFILE)。
  • 字符集的输入/输出文件的字符集。
  • 标题:可选的文本,包括在注释块的文件开始。
  • 断行:在换行(默认值是-1,不换行)的列数。
  • 混淆:为False,则不混淆局部符号(默认为true)。
  • disableoptimizations:真正的禁用所有内置的优化。
  • preservesemi:真保留所有分号。
  • 详细:True以启用额外的诊断信息。

X-压缩CSS

根据下列选项(属性)压缩CSS源:

  • SRCFILE:源文件进行压缩。
  • OUTFILE:输出的文件产生(默认为SRCFILE)。
  • 字符集的输入/输出文件的字符集。
  • 标题:可选的文本,包括在注释块的文件开始。
  • 断行:在打破行的列数。
  • 详细:True以启用额外的诊断信息。

X-带状JS

这个任务从一个JS文件删除注释(行和/或块)。支持以下选项:

  • SRCFILE:源文件中去除
  • OUTFILE:输出的文件产生(默认为SRCFILE)。
  • 标题:可选的文本,包括在注释块的文件开始。
  • blockcomments:True(默认),带块注释(“/ /“)。
  • linecomments:True(默认)去掉行注释(“/ /”)。
  • keepfirstcomment:True(默认)保持的JS文件中的第一个评论。
    这是通常的版权。
  • 的空白:真正也剥离的空白。

X--ENV

一个环境变量的值存储在指定的属性。环境变量的名称是第一个匹配的确切情况,但如果没有确切的情况下,找到匹配忽略​​大小写的情况下,如果存在的话,它会选择一个匹配。

<的X-ENV = “PATH” 属性= “env.path”的/ a>

这应该是更好的选择“属性”任务来读取环境变量,因为这反映了确切的情况下,作为Ant属性的变量是区分大小写,但不区分大小写至少在Windows的环境变量(如“路径”)。

X-逃脱

这个任务转义字符串的转义字符串并存储在一个指定的属性。

<x-escapestring="${some.text}"property="some.text.js"type="json"/><x-escapestring="${some.text}"property="some.text.xml"type="xml"/>

x-generate dir todir

The final form of x-generate operates on a source folder, and generates content in the target folder, for example:

<x-generatedir="templates/foo"todir="build/foo"><paramname="bar"value="42"/><loadfile="data.json"/></x-generate>

In this form, the generator recursively reads files and sub-folders in "templates/foo" and applies the appropriate template engine. It also preserves sacred files. All file and folder names are processed as XTemplate templates.

x-compress-js

Compresses JavaScript source according to the following options (attributes):

  • srcfile: The source file to compress.
  • outfile: The output file to generate (defaults to srcfile).
  • charset: The charset of the input/output files.
  • header: Optional text to include in a comment block at the start of the file.
  • linebreak: The column number at which to break lines (default is -1, to not break lines).
  • obfuscate: False to not obfuscate local symbols (default is true).
  • disableoptimizations: True to disable all built-in optimizations.
  • preservesemi: True to preserve all semicolons.
  • verbose: True to enable extra diagnostic messages.

x-compress-css

Compresses CSS source according to the following options (attributes):

  • srcfile: The source file to compress.
  • outfile: The output file to generate (defaults to srcfile).
  • charset: The charset of the input/output files.
  • header: Optional text to include in a comment block at the start of the file.
  • linebreak: The column number at which to break lines.
  • verbose: True to enable extra diagnostic messages.

x-strip-js

This task removes comments (line and/or block) from a JS file. The following options are supported:

  • srcfile: The source file to strip
  • outfile: The output file to generate (defaults to srcfile).
  • header: Optional text to include in a comment block at the start of the file.
  • blockcomments: True (the default) to strip block comments ("/ ... /").
  • linecomments: True (the default) to strip line comments ("//").
  • keepfirstcomment: True (the default) to keep the first comment in the JS file.
    Thisis typically a copyright.
  • whitespace: True to also strip whitespace.

x-get-env

Stores an environment variable value in the specified property. The name of the environment variable is first matched for exact case, but if no exact case match is found, it will pick a match ignoring case if one exists.

<x-get-envname="PATH"property="env.path"/>

This should be preferred over the "properties" task to read environment variables because that reflects the exact case of the variables as Ant properties which are case sensitive but environment variables (like "Path") are case insensitive at least on Windows.

x-escape

This task escapes a string and stores the escaped string in a specified property.

<x-escapestring="${some.text}"property="some.text.js"type="json"/><x-escapestring="${some.text}"property="some.text.xml"type="xml"/>
 
posted on 2012-12-27 10:49 CW.Liu 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/cheman/archive/2012/12/27/2835292.html

出现这个错误的原因是在导入seaborn包时,无法从typing模块中导入名为'Protocol'的对象。 解决这个问题的方法有以下几种: 1. 检查你的Python版本是否符合seaborn包的要求,如果不符合,尝试更新Python版本。 2. 检查你的环境中是否安装了typing_extensions包,如果没有安装,可以使用以下命令安装:pip install typing_extensions。 3. 如果你使用的是Python 3.8版本以下的版本,你可以尝试使用typing_extensions包来代替typing模块来解决该问题。 4. 检查你的代码是否正确导入了seaborn包,并且没有其他导入错误。 5. 如果以上方法都无法解决问题,可以尝试在你的代码中使用其他的可替代包或者更新seaborn包的版本来解决该问题。 总结: 出现ImportError: cannot import name 'Protocol' from 'typing'错误的原因可能是由于Python版本不兼容、缺少typing_extensions包或者导入错误等原因造成的。可以根据具体情况尝试上述方法来解决该问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [ImportError: cannot import name ‘Literal‘ from ‘typing‘ (D:\Anaconda\envs\tensorflow\lib\typing....](https://blog.youkuaiyun.com/yuhaix/article/details/124528628)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值