Repository navigation
148 lines (131 loc) · 5.01 KB
/
Copy pathmain.yml
File metadata and controls
148 lines (131 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build VMecha AAR
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Prepare Workspace Structure
run: |
if [ -d "VirtualApp" ]; then
cp -r VirtualApp/* .
cp -r VirtualApp/.[!.]* . 2>/dev/null || true
rm -rf VirtualApp
fi
rm -f build.gradle settings.gradle lib/build.gradle
- name: Create gradle.properties
run: |
cat > gradle.properties << 'EOF'
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx2048m
EOF
- name: Create settings.gradle
run: |
cat > settings.gradle << 'EOF'
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
// Tambahkan JitPack dan mirror JCenter yang lebih spesifik
maven { url "https://jitpack.io" }
maven { url "https://jcenter.bintray.com/" }
maven { url "https://plugins.gradle.org/m2/" }
}
}
rootProject.name = "VMechaVM"
include ':lib'
EOF
- name: Create root build.gradle
run: |
cat > build.gradle << 'EOF'
plugins {
id 'com.android.library' version '8.1.0' apply false
}
EOF
- name: Setup Gradle Wrapper
run: gradle wrapper --gradle-version 8.9
- name: Patch lib module
run: |
cd lib
# Rename package folder
for base in src/main/java src/main/aidl; do
if [ -d "$base/com/lody/virtual" ]; then
mkdir -p "$base/com/vmecha"
mv "$base/com/lody/virtual" "$base/com/vmecha/vcore"
fi
done
# Patch source files
find src -type f \( -name "*.java" -o -name "*.kt" -o -name "*.xml" -o -name "*.aidl" \) -exec sed -i 's/com\.lody\.virtual/com.vmecha.vcore/g' {} +
# Remove package attribute from Manifest
sed -i 's/package="[^"]*"//g' src/main/AndroidManifest.xml
cat > build.gradle << 'EOF'
plugins { id 'com.android.library' }
android {
namespace 'com.vmecha.vcore'
compileSdk 34
buildFeatures { aidl true }
defaultConfig {
minSdk 21
targetSdk 34
multiDexEnabled true
ndk { abiFilters 'arm64-v8a', 'armeabi-v7a' }
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/aidl', 'src/main/java']
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
lint { abortOnError false }
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.cardview:cardview:1.0.0'
// Library yang bermasalah (Sekarang seharusnya ter-resolve lewat mirror JCenter)
implementation 'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation 'com.melnykov:floatingactionbutton:1.3.0'
implementation 'com.jonathanfinerty.once:once:1.0.3'
implementation 'com.kyleduo.switchbutton:library:1.4.6'
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
EOF
- name: Global String Replacement
run: |
find . -maxdepth 4 -type f -not -path '*/.*' -exec sed -i 's/com\.lody\.virtual/com.vmecha.vcore/g' {} +
- name: Build AAR
run: |
chmod +x gradlew
# Gunakan --info jika ingin melihat proses download library
./gradlew :lib:assembleRelease --stacktrace --no-daemon --info
- name: Upload AAR
uses: actions/upload-artifact@v4
with:
name: vmecha-vcore-release
path: lib/build/outputs/aar/lib-release.aar