Skip to content

Commit ca7b114

Browse files
committed
First version.
1 parent a3cc4c4 commit ca7b114

30 files changed

+1374
-0
lines changed

.gitignore

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
/bin/
15+
/gen/
16+
/out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# Gradle files
19+
.gradle/
20+
/build/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
25+
# Proguard folder generated by Eclipse
26+
proguard/
27+
28+
# Log Files
29+
*.log
30+
31+
# Android Studio Navigation editor temp files
32+
.navigation/
33+
34+
# Android Studio captures folder
35+
captures/
36+
37+
# IntelliJ
38+
*.iml
39+
.idea/workspace.xml
40+
.idea/tasks.xml
41+
.idea/gradle.xml
42+
.idea/assetWizardSettings.xml
43+
.idea/dictionaries
44+
.idea/libraries
45+
# Android Studio 3 in .gitignore file.
46+
.idea/caches
47+
.idea/modules.xml
48+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
49+
.idea/navEditor.xml
50+
51+
# Keystore files
52+
# Uncomment the following lines if you do not want to check your keystore files in.
53+
#*.jks
54+
#*.keystore
55+
56+
# External native build folder generated in Android Studio 2.2 and later
57+
.externalNativeBuild
58+
.cxx/
59+
60+
# Google Services (e.g. APIs or Firebase)
61+
# google-services.json
62+
63+
# Freeline
64+
freeline.py
65+
freeline/
66+
freeline_project_description.json
67+
68+
# fastlane
69+
fastlane/report.xml
70+
fastlane/Preview.html
71+
fastlane/screenshots
72+
fastlane/test_output
73+
fastlane/readme.md
74+
75+
# Version control
76+
vcs.xml
77+
78+
# lint
79+
lint/intermediates/
80+
lint/generated/
81+
lint/outputs/
82+
lint/tmp/
83+
# lint/reports/

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# DroidScript Java Compiler
2+
3+
Runtime Java compiler plugin for DroidScript.
4+
5+
> [!NOTE]
6+
> Minimum required Android version: 8 (SDK 26).
7+
8+
## How to use
9+
10+
After installing the plugin, you can use the example in the documentation to get started.
11+
12+
## Build it
13+
14+
This library is mandatory: [nb-javac-android](https://github.com/cemalgnlts/nb-javac-android).
15+
16+
17+
18+
Open and compile the project with [AndroidIDE](https://github.com/AndroidIDEOfficial) or Android Studio.
19+
20+
### Install with shell commands
21+
22+
It can be imported into DroidScript with this example:
23+
24+
```sh
25+
cd app/build/outputs/apk/debug
26+
rm -r temp
27+
unzip app-debug.apk -d temp
28+
cd temp
29+
zip JavaCompiler.jar classes*.dex
30+
rm classes.dex
31+
cp -r assets/* .
32+
cp -r lib/* .
33+
rm -r lib
34+
rm -r assets
35+
rm -r res
36+
rm AndroidManifest.xml
37+
rm resources.arsc
38+
rm -r META-INF
39+
zip -r ../JavaCompiler.ppk *.
40+
41+
cd ..
42+
export PATH=$PATH:~/Library/Android/sdk/platform-tools/
43+
adb push JavaCompiler.ppk /sdcard/Android/data/com.smartphoneremote.androidscriptfree/files/DroidScript/Plugins/JavaCompiler.ppk
44+
```
45+
46+
### Install manually
47+
48+
* Unzip the APK.
49+
* Add the `classes.dex` files to a zip file named `JavaCompiler.jar`.
50+
* Then add the `JavaCompiler.jar` file and the contents of the `assets` folder to a zip file named `JavaCompiler.ppk`.
51+
* Open `JavaCompiler.ppk` with DroidScript.
52+
53+
The `JavaCompiler.ppk` file should look like this
54+
```
55+
JavaCompiler.ppk/
56+
- JavaCompiler.jar
57+
- JavaCompiler.html
58+
- JavaCompiler.inc
59+
- android.jar
60+
```
61+
62+
## Documentation
63+
64+
You can check this repo to create the document: [DroidScript/Docs](https://github.com/DroidScript/Docs). The code for the current document is in [document.js](document.js). After building the document you can drop it into the [assets](./app/src/main/assets) folder.

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
plugins {
3+
id 'com.android.application'
4+
5+
}
6+
7+
android {
8+
namespace 'com.candlelight.javacompiler.plugins'
9+
compileSdk 33
10+
11+
defaultConfig {
12+
applicationId "com.candlelight.javacompiler.plugins"
13+
minSdk 21
14+
targetSdk 33
15+
versionCode 1
16+
versionName "1.0"
17+
multiDexEnabled true
18+
19+
vectorDrawables {
20+
useSupportLibrary true
21+
}
22+
}
23+
24+
buildTypes {
25+
release {
26+
minifyEnabled false
27+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28+
}
29+
}
30+
31+
compileOptions {
32+
coreLibraryDesugaringEnabled true
33+
34+
sourceCompatibility JavaVersion.VERSION_1_8
35+
targetCompatibility JavaVersion.VERSION_1_8
36+
}
37+
}
38+
39+
dependencies {
40+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
41+
42+
implementation fileTree(dir: 'libs', include: ['*.jar'])
43+
}
4.01 MB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<manifest
4+
xmlns:android="http://schemas.android.com/apk/res/android">
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:roundIcon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity
13+
android:name="MainActivity"
14+
android:exported="true">
15+
<intent-filter>
16+
<action
17+
android:name="android.intent.action.MAIN" />
18+
<category
19+
android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
</manifest>

0 commit comments

Comments
 (0)