Compare commits
2 commits
e7ab539994
...
91094491f1
Author | SHA1 | Date | |
---|---|---|---|
|
91094491f1 | ||
|
05a610d1cb |
|
@ -13,7 +13,7 @@ Use whichever you prefer.
|
||||||
|
|
||||||
1. Copy `zipalign` or `zipalign.exe` from your android build tools (ver. 35) into `tools`
|
1. Copy `zipalign` or `zipalign.exe` from your android build tools (ver. 35) into `tools`
|
||||||
2. If you want a release build, generate a keystore and name it `release.keystore` in `keystores` using `keytool`
|
2. If you want a release build, generate a keystore and name it `release.keystore` in `keystores` using `keytool`
|
||||||
3. Get a copy of the tumblr apk version <TODO> and place it inside `source-apk` (Naming doesn't matter)
|
3. Get a copy of the tumblr apk version `34.3.0.110` and place it inside `source-apk` (Naming doesn't matter)
|
||||||
4. Run the build script using `python build.py build r`
|
4. Run the build script using `python build.py build r`
|
||||||
5. Copy the output apk (in `build/apk/tumblr-ykit.apk`) wherever you need it.
|
5. Copy the output apk (in `build/apk/tumblr-ykit.apk`) wherever you need it.
|
||||||
|
|
||||||
|
|
6
TODO.txt
Normal file
6
TODO.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
1. Add android.jar from android sdk 35 to classpath
|
||||||
|
2. Identify tumblr apk version
|
||||||
|
3. Fix enhanced block n shit
|
||||||
|
4. ???
|
||||||
|
5. Profit
|
||||||
|
6. Fix that bug that prevents you from opening your account settings
|
47
build.py
47
build.py
|
@ -99,8 +99,52 @@ class Task:
|
||||||
print(f"Compiling {file}...")
|
print(f"Compiling {file}...")
|
||||||
subprocess.run(['java', '-jar', 'tools/smali-2.5.2.jar', 'a', f'build/smali/{file}', '-o', f'build/dex/{dex}'])
|
subprocess.run(['java', '-jar', 'tools/smali-2.5.2.jar', 'a', f'build/smali/{file}', '-o', f'build/dex/{dex}'])
|
||||||
|
|
||||||
|
def genClassPath():
|
||||||
|
print("Generating java classpath from dex files...")
|
||||||
|
for file in os.listdir('build/dex'):
|
||||||
|
src = f'build/dex/{file}'
|
||||||
|
dst = f'build/jar/{file[:-4]}.jar'
|
||||||
|
srctime = os.path.getmtime(src)
|
||||||
|
dsttime = 0 if not Path(dst).exists() else os.path.getmtime(dst)
|
||||||
|
|
||||||
|
if srctime < dsttime:
|
||||||
|
print(f"Skipping {file}...")
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(f"Dex2jar {file}...")
|
||||||
|
subprocess.run(['java', '-cp', 'tools/d2j/*', 'com.googlecode.dex2jar.tools.Dex2jarCmd', '-f', src, '-o', dst])
|
||||||
|
|
||||||
|
def compileJava():
|
||||||
|
Task.genClassPath()
|
||||||
|
|
||||||
|
sep = ';' if os.name == 'nt' else ':'
|
||||||
|
javaFiles = [str(x) for x in Path('src/java').rglob('*.java')]
|
||||||
|
classPath = sep.join([str(x) for x in Path('build/jar').rglob('*.jar')])
|
||||||
|
|
||||||
|
# Get latest java file timestamp
|
||||||
|
files = list(Path('src/java').rglob('*.java'))
|
||||||
|
files = [os.path.getmtime(x) for x in files]
|
||||||
|
latest = max(files)
|
||||||
|
|
||||||
|
# Get latest dex time or 0
|
||||||
|
latest2 = 0 if not Path('build/java_dex/classes.dex').exists() else os.path.getmtime('build/java_dex/classes.dex')
|
||||||
|
|
||||||
|
# If dex file is newer than source, no need to do anything
|
||||||
|
if latest2 > latest:
|
||||||
|
print("Skipping java...")
|
||||||
|
return
|
||||||
|
|
||||||
|
print("Compiling java...")
|
||||||
|
subprocess.run(['javac', '-cp', classPath, '-d', 'build/java_class', *javaFiles])
|
||||||
|
|
||||||
|
classFiles = [str(x) for x in Path('build/java_class').rglob('*.class')]
|
||||||
|
|
||||||
|
Path('build/java_dex').mkdir(parents=True, exist_ok=True)
|
||||||
|
subprocess.run(['java', '-cp', 'tools/d8.jar', 'com.android.tools.r8.D8', *classFiles, '--output', 'build/java_dex'])
|
||||||
|
|
||||||
def mergeResources():
|
def mergeResources():
|
||||||
Task.compileSmali()
|
Task.compileSmali()
|
||||||
|
Task.compileJava()
|
||||||
|
|
||||||
# Copy original resources
|
# Copy original resources
|
||||||
# on first run only
|
# on first run only
|
||||||
|
@ -113,6 +157,7 @@ class Task:
|
||||||
|
|
||||||
print("Copying compiled dex files...")
|
print("Copying compiled dex files...")
|
||||||
shutil.copytree('build/dex', 'build/merged', dirs_exist_ok=True)
|
shutil.copytree('build/dex', 'build/merged', dirs_exist_ok=True)
|
||||||
|
shutil.copy('build/java_dex/classes.dex', 'build/merged/classes7.dex') # TODO: Unhardcode this
|
||||||
|
|
||||||
def buildApk():
|
def buildApk():
|
||||||
Task.mergeResources()
|
Task.mergeResources()
|
||||||
|
@ -182,6 +227,8 @@ def main():
|
||||||
|
|
||||||
if ('a' in ''.join(sys.argv[2:])):
|
if ('a' in ''.join(sys.argv[2:])):
|
||||||
Task.deployToAndroidStudio()
|
Task.deployToAndroidStudio()
|
||||||
|
case 'genclasspath':
|
||||||
|
Task.genClassPath()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
10
src/java/dev/maelstrom/ykit/java/Test.java
Normal file
10
src/java/dev/maelstrom/ykit/java/Test.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package dev.maelstrom.ykit.java;
|
||||||
|
|
||||||
|
import dev.maelstrom.ykit.settings.YkitCurrentSettings;
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
public static void test() {
|
||||||
|
System.out.println("Hello, world!");
|
||||||
|
System.out.println(YkitCurrentSettings.class.getName());
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,8 @@
|
||||||
.method static constructor <clinit>()V
|
.method static constructor <clinit>()V
|
||||||
.locals 0
|
.locals 0
|
||||||
|
|
||||||
|
invoke-static {}, Ldev/maelstrom/ykit/java/Test;->test()V
|
||||||
|
|
||||||
return-void
|
return-void
|
||||||
.end method
|
.end method
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue