maipulse: 脱敏存档

- Python 后端 + 单页前端 + Android(Chaquopy) 壳
- 曲库 1343 首 / 称号 2800 个
- 机台身份与店铺信息已抹除,字段留空
- 打包脚本含 16KB 页对齐与自动脱敏
This commit is contained in:
shouko committed 2026-10-28 22:27:46 +08:00
commit 8421898626
161 files changed
+50297

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
plugins {
id 'com.android.application'
id 'com.chaquo.python'
}
android {
namespace 'com.maipulse.app'
compileSdk 34
defaultConfig {
applicationId "com.maipulse.app"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
ndk {
abiFilters "arm64-v8a"
}
// Chaquopy 16 的 DSL 挂在 android.defaultConfig 下面
python {
buildPython "C:/Users/20558/AppData/Local/Programs/Python/Python38/python.exe"
pip {
install "flask"
install "requests"
install "pycryptodome"
}
}
}
// 固定 keystore:AGP 默认会在 $HOME/.android 下自动生成一个,
// 而 zipalign 之后我们要用 apksigner 重签。两边不是同一个 key 的话,
// 出来的包签名不一样,用户必须卸载才能覆盖安装。
signingConfigs {
debug {
storeFile file("../maipulse-debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
androidResources {
noCompress 'json', 'png'
}
}
dependencies {
implementation 'androidx.core:core:1.12.0'
}
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:allowBackup="true"
android:label="maipulse"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:hardwareAccelerated="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="orientation|screenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
@@ -0,0 +1,397 @@
package com.maipulse.app;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebChromeClient;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import com.chaquo.python.Python;
import com.chaquo.python.android.AndroidPlatform;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
/**
* maipulse 的 Android 外壳。
*
* 流程:复制 assets/app -> filesDir/app(assets 只读,Flask 要写 logs 与缓存),
* 起 Chaquopy 跑 Flask 绑 127.0.0.1:8787,端口通了再把 WebView 指过去。
*
* 额外给了网页一个 Maipulse.installApk(url):走系统 DownloadManager 下 APK,
* 下完弹安装器,这样更新不用让用户自己去找文件。
*/
public class MainActivity extends Activity {
private static final String TAG = "maipulse";
private static final int PORT = 8787;
private WebView web;
private TextView tip;
private static final int REQ_PICK_FILE = 1001;
private ValueCallback<Uri[]> filePathCallback;
private long pendingDownloadId = -1;
private BroadcastReceiver downloadReceiver;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout root = new FrameLayout(this);
root.setBackgroundColor(Color.parseColor("#EEF2F9"));
web = new WebView(this);
web.setBackgroundColor(Color.parseColor("#EEF2F9"));
WebSettings s = web.getSettings();
s.setJavaScriptEnabled(true);
s.setDomStorageEnabled(true);
s.setAllowFileAccess(true);
s.setDatabaseEnabled(true);
s.setMediaPlaybackRequiresUserGesture(false);
s.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
s.setCacheMode(WebSettings.LOAD_DEFAULT);
// 禁掉双指缩放与双击放大(网页里能放大就是这里没设)
s.setSupportZoom(false);
s.setBuiltInZoomControls(false);
s.setDisplayZoomControls(false);
s.setTextZoom(100);
// 长按不再弹出「复制/分享」这类浏览器菜单
web.setLongClickable(false);
web.setHapticFeedbackEnabled(false);
web.setWebViewClient(new WebViewClient());
// 网页里的 <input type=file> 走 WebChromeClient.onShowFileChooser,挂在
// WebViewClient 上编译不过,必须单独设一个 chrome client。
web.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onShowFileChooser(WebView view, ValueCallback<Uri[]> callback,
FileChooserParams params) {
if (filePathCallback != null) filePathCallback.onReceiveValue(null);
filePathCallback = callback;
try {
Intent i = params.createIntent();
i.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(i, REQ_PICK_FILE);
return true;
} catch (Exception e) {
filePathCallback = null;
return false;
}
}
});
web.addJavascriptInterface(new Bridge(), "Maipulse");
tip = new TextView(this);
tip.setText("正在启动服务…");
tip.setTextColor(Color.parseColor("#5A6A82"));
tip.setTextSize(15);
tip.setPadding(48, 48, 48, 48);
root.addView(web, new FrameLayout.LayoutParams(-1, -1));
root.addView(tip, new FrameLayout.LayoutParams(-1, -1));
setContentView(root);
registerDownloadReceiver();
new Thread(this::bootPython, "maipulse-boot").start();
new Thread(this::waitAndLoad, "maipulse-wait").start();
}
/* ---------------- 网页可调的接口 ---------------- */
public class Bridge {
/** 下载并安装新版本。url 由网页的更新源给。 */
@JavascriptInterface
public void installApk(String url) {
runOnUiThread(() -> startDownload(url));
}
/** 当前 App 版本号,网页可以拿来显示。 */
@JavascriptInterface
public String appVersion() {
try {
return getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (Exception e) {
return "1.0";
}
}
}
private void startDownload(String url) {
if (url == null || !url.startsWith("http")) {
Toast.makeText(this, "更新地址不对", Toast.LENGTH_SHORT).show();
return;
}
try {
File dir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
if (dir != null) {
for (File f : dir.listFiles()) {
if (f.getName().endsWith(".apk")) f.delete();
}
}
DownloadManager.Request req = new DownloadManager.Request(Uri.parse(url));
req.setTitle("maipulse 新版本");
req.setDescription("下载完成后会弹安装");
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
req.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, "maipulse-update.apk");
req.setMimeType("application/vnd.android.package-archive");
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
pendingDownloadId = dm.enqueue(req);
Toast.makeText(this, "开始下载,完成后会弹安装", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Log.e(TAG, "download failed", e);
Toast.makeText(this, "下载失败:" + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
private void registerDownloadReceiver() {
downloadReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) {
if (!DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) return;
long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if (id != pendingDownloadId) return;
File dir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
if (dir == null) return;
File apk = new File(dir, "maipulse-update.apk");
if (apk.exists()) installApkFile(apk);
}
};
IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(downloadReceiver, filter, Context.RECEIVER_EXPORTED);
} else {
registerReceiver(downloadReceiver, filter);
}
}
private void installApkFile(File apk) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !getPackageManager().canRequestPackageInstalls()) {
// 没有「安装未知应用」权限,跳设置页让用户开
Intent s = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES,
Uri.parse("package:" + getPackageName()));
startActivity(s);
Toast.makeText(this, "允许安装后回到 App 再点一次更新", Toast.LENGTH_LONG).show();
return;
}
Uri uri = FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", apk);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(uri, "application/vnd.android.package-archive");
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} catch (Exception e) {
Log.e(TAG, "install failed", e);
Toast.makeText(this, "拉起安装器失败:" + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
/* ---------------- Python 启动 ---------------- */
private void bootPython() {
try {
File files = getFilesDir();
File appDir = new File(files, "app");
File stamp = new File(files, "asset.rev");
// 内置资源版本号:打包时由 build_apk.ps1 写进 assets/app/asset.rev,
// 每次打包都会变,所以数据更新后一定能触发重建(手写常量太容易忘)。
String want = "";
try (InputStream in = getAssets().open("app/asset.rev")) {
byte[] b = new byte[128];
int n = in.read(b);
if (n > 0) want = new String(b, 0, n, "UTF-8").trim();
} catch (Exception ignored) {
}
String have = "";
try {
if (stamp.exists()) {
byte[] b = new byte[(int) stamp.length()];
try (InputStream in = new FileInputStream(stamp)) {
int n = in.read(b);
if (n > 0) have = new String(b, 0, n, "UTF-8").trim();
}
}
} catch (Exception ignored) {
}
boolean broken = !appDir.exists()
|| !new File(appDir, "app.py").exists()
|| !new File(appDir, "data/master.json").exists();
if (broken || want.isEmpty() || !want.equals(have)) {
tip("正在释放内置资源");
// 用户导入的机台配置要保住,其余整目录重建(否则旧资源永远不更新)
byte[] conf = null;
File confFile = new File(new File(appDir, "astral"), "config.py");
if (confFile.exists() && confFile.length() > 0) {
conf = new byte[(int) confFile.length()];
try (InputStream in = new FileInputStream(confFile)) {
int n = in.read(conf);
if (n <= 0) conf = null;
}
}
deleteTree(appDir);
copyAssetDir("app", appDir);
if (conf != null) {
File cf = new File(new File(appDir, "astral"), "config.py");
File parent = cf.getParentFile();
if (parent != null && !parent.exists()) parent.mkdirs();
try (OutputStream out = new FileOutputStream(cf)) {
out.write(conf);
}
}
try (OutputStream out = new FileOutputStream(stamp)) {
out.write(want.getBytes("UTF-8"));
}
}
tip("正在加载 Python 运行时…");
if (!Python.isStarted()) {
Python.start(new AndroidPlatform(this));
}
tip("正在启动本地服务…");
Python.getInstance().getModule("android_boot").callAttr("boot", files.getAbsolutePath());
} catch (Throwable t) {
Log.e(TAG, "boot failed", t);
tip("启动失败:" + t);
}
}
private void tip(final String text) {
runOnUiThread(() -> tip.setText(text));
}
private void deleteTree(File f) {
if (f == null || !f.exists()) return;
if (f.isDirectory()) {
File[] kids = f.listFiles();
if (kids != null) {
for (File k : kids) deleteTree(k);
}
}
f.delete();
}
private void copyAssetDir(String src, File dst) throws IOException {
AssetManager am = getAssets();
String[] list = am.list(src);
if (list == null || list.length == 0) {
copyAssetFile(src, dst);
return;
}
if (!dst.exists() && !dst.mkdirs()) {
throw new IOException("mkdirs failed: " + dst);
}
for (String name : list) {
copyAssetDir(src + "/" + name, new File(dst, name));
}
}
private void copyAssetFile(String src, File dst) throws IOException {
// 不跳过已存在文件:整目录重建后旧的残留必须被覆盖
File parent = dst.getParentFile();
if (parent != null && !parent.exists() && !parent.mkdirs()) {
throw new IOException("mkdirs failed: " + parent);
}
try (InputStream in = getAssets().open(src);
OutputStream out = new FileOutputStream(dst)) {
byte[] buf = new byte[64 * 1024];
int n;
while ((n = in.read(buf)) > 0) out.write(buf, 0, n);
}
}
private void waitAndLoad() {
for (int i = 0; i < 200; i++) {
try (Socket sock = new Socket()) {
sock.connect(new InetSocketAddress("127.0.0.1", PORT), 300);
runOnUiThread(() -> {
tip.setVisibility(View.GONE);
web.loadUrl("http://127.0.0.1:" + PORT + "/");
});
return;
} catch (IOException ignored) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
return;
}
}
}
tip("服务没有起来,看看日志");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQ_PICK_FILE) {
Uri[] result = null;
if (resultCode == RESULT_OK && data != null) {
if (data.getDataString() != null) {
result = new Uri[]{Uri.parse(data.getDataString())};
} else if (data.getClipData() != null) {
int n = data.getClipData().getItemCount();
result = new Uri[n];
for (int i = 0; i < n; i++) {
result[i] = data.getClipData().getItemAt(i).getUri();
}
}
}
if (filePathCallback != null) {
filePathCallback.onReceiveValue(result);
filePathCallback = null;
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && web != null && web.canGoBack()) {
web.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() {
try {
if (downloadReceiver != null) unregisterReceiver(downloadReceiver);
} catch (Exception ignored) {
}
if (web != null) {
web.destroy();
web = null;
}
super.onDestroy();
}
}
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""Android 启动器:把 filesDir/app 挂进 sys.path,然后跑 Flask。
为什么不在 assets 里直接 import:app.py 顶层会 os.makedirs(logs),
assets 是只读的,必须用 Java 侧复制出来的可写副本。
"""
import os
import sys
PORT = 8787
def boot(files_dir):
base = os.path.join(files_dir, "app")
if base not in sys.path:
sys.path.insert(0, base)
astral = os.path.join(base, "astral")
if astral not in sys.path:
sys.path.insert(0, astral)
os.environ["ASTRAL_DIR"] = astral
os.environ.setdefault("MAIPULSE_PORT", str(PORT))
os.chdir(base)
import app as maipulse_app # noqa: E402
# 绑定 127.0.0.1:只有本机 WebView 能访问
maipulse_app.app.run(host="127.0.0.1", port=PORT, debug=False,
threaded=True, use_reloader=False)
return "exited"
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/iconBg" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/iconBg" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="iconBg">#FFE9A8</color>
</resources>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">maipulse</string>
</resources>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">#EEF2F9</item>
<item name="android:navigationBarColor">#FFFFFF</item>
<item name="android:windowBackground">#EEF2F9</item>
</style>
</resources>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="downloaded" path="Download/" />
<external-cache-path name="cache" path="." />
</paths>
+4
View File
@@ -0,0 +1,4 @@
plugins {
id 'com.android.application' version '8.2.2' apply false
id 'com.chaquo.python' version '16.1.0' apply false
}
+3
View File
@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip
networkTimeout=60000
validateDistributionUrl=false
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+248
View File
@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
+93
View File
@@ -0,0 +1,93 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+16
View File
@@ -0,0 +1,16 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = 'maipulse'
include ':app'