我试图用gradle exec任务连接一个bat和sh文件(取决于正在运行的操作系统)。但是我无法弄清楚如何从exec任务向bat / sh发送参数。
task testing(type:Exec) {
workingDir '.'
if (System.properties['os.name'].toLowerCase().contains('windows')) {
if ( project.hasProperty("arg1") ) {
println arg1
args arg1
commandLine 'cmd', '/c', 'run.bat'
}else{
commandLine 'cmd', '/c', 'run.bat'
}
}else {
if ( project.hasProperty("arg1") ) {
args arg1
commandLine './run.sh'
}else{
commandLine './run.sh'
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我以:运行该任务gradle testing -Parg1=test,在中println arg1,它将打印测试
但是如何将这个测试作为bat / sh文件的参数传递。
我一直致力于开发移动应用程序来排版数学应用程序,但我遇到了一个问题.根据规则,代码是可以的,但表达式不会改变.没有进行排版.
这是我的MainActivity代码,请告诉我哪里有漏洞:
public class MainActivity extends Activity implements View.OnClickListener
{
private String doubleEscapeTeX(String s) {
String t="";
for (int i=0; i < s.length(); i++) {
if (s.charAt(i) == '\'') t += '\\';
if (s.charAt(i) != '\n') t += s.charAt(i);
if (s.charAt(i) == '\\') t += "\\";
}
return t;
}
public void onClick(View v) {
if (v == findViewById(R.id.button2)) {
WebView w = (WebView) findViewById(R.id.webview);
EditText e = (EditText) findViewById(R.id.edit);
w.loadUrl("javascript:document.getElementById('math').innerHTML='\\\\["
+doubleEscapeTeX(e.getText().toString())+"\\\\]';");
w.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
}
else if (v == findViewById(R.id.button3)) { …Run Code Online (Sandbox Code Playgroud)