Skip to content

Commit

Permalink
Merge pull request #2 from s1204IT/gradle
Browse files Browse the repository at this point in the history
Improve project
  • Loading branch information
reveny authored Oct 31, 2024
2 parents dec3939 + 81e8423 commit 8bdbc08
Show file tree
Hide file tree
Showing 19 changed files with 313 additions and 179 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bat eol=crlf
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build

on:
push:
paths:
- '.github/workflows/build.yml'
- 'service/**'
workflow_dispatch:
inputs:
module:
description: 'Make module'
type: boolean
required: true
default: false

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Set environments
run: |
{
echo "apk_version=v$(grep -oP 'versionName \"\K[^\"]+' service/app/build.gradle)"
echo "mod_version=v$(awk -F= '/^version=/ {print $2}' module/module.prop)"
} >> $GITHUB_ENV
- name: Build with Gradle
working-directory: service
run: |
./gradlew assembleDebug
cp -f app/build/outputs/apk/debug/app-debug.apk ../module/service/service.apk
- name: Upload APK
if: github.event.inputs.module != 'true'
uses: actions/upload-artifact@v4
with:
name: VBMetaFixerService-${{ env.apk_version }}
path: module/service/service.apk

- name: Make module
if: github.event.inputs.module == 'true'
working-directory: module
run: |
rm -f service/.gitkeep
zip vbmeta-fixer-${{ env.mod_version }}.zip -r *
# - name: Upload module
# if: github.event.inputs.module == 'true'
# uses: actions/upload-artifact@v4
# with:
# name: vbmeta-fixer-${{ env.mod_version }}
# path: module/vbmeta-fixer-${{ env.mod_version }}.zip

- name: Release module
uses: softprops/action-gh-release@v2
if: github.event.inputs.module == 'true'
with:
tag_name: ${{ env.mod_version }}
draft: false
prerelease: false
fail_on_unmatched_files: true
make_latest: true
files: module/vbmeta-fixer-${{ env.mod_version }}.zip
7 changes: 4 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,9 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Android-VBMeta-Fixer
A Magisk/KernelSU/Apatch module to fix VBMeta detections on Android
Copyright (C) 2024 reveny

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +653,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

<program> Copyright (C) <year> <name of author>
Android-VBMeta-Fixer Copyright (C) 2024 reveny
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
Empty file added module/service/.gitkeep
Empty file.
15 changes: 0 additions & 15 deletions service/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion service/app/.gitignore

This file was deleted.

14 changes: 8 additions & 6 deletions service/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ android {
compileSdk 34

defaultConfig {
applicationId "com.reveny.vbmetafix.service"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
proguardFiles += 'proguard-rules.pro'
multiDexEnabled false
}

buildTypes {
release {
debug {
signingConfig signingConfigs.debug
}
configureEach {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
Expand All @@ -30,4 +32,4 @@ android {

dependencies {
implementation libs.bcprov.jdk18on
}
}
4 changes: 2 additions & 2 deletions service/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-renamesourcefileattribute SourceFile
15 changes: 9 additions & 6 deletions service/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<application
android:allowBackup="true"
tools:targetApi="31">
android:label="VBMetaFixerService">

<service
android:name=".FixerService"
android:enabled="true"
android:exported="true" />

<service android:name="com.reveny.vbmetafix.service.FixerService" android:enabled="true" android:exported="true"/>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {

writeBootHashToFile(bootHash);

stopForeground(true);
stopForeground(Service.STOP_FOREGROUND_DETACH);
stopSelf();

return START_STICKY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ private static List<X509Certificate> sortCerts(List<X509Certificate> certs) {
return newList;
}

@SuppressWarnings("unchecked")
public static AttestationResult parseCertificateChain(CertPath certPath) throws Exception {
// noinspection unchecked
//noinspection unchecked
var certs = (List<X509Certificate>) certPath.getCertificates();
if (certs.isEmpty()) {
throw new CertificateParsingException("No certificate found");
Expand Down
5 changes: 2 additions & 3 deletions service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
}
alias(libs.plugins.android.application) apply false
}
4 changes: 2 additions & 2 deletions service/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
#android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
5 changes: 2 additions & 3 deletions service/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[versions]
agp = "8.7.0"
bcprovJdk18on = "1.77"
agp = "8.7.1"
bcprovJdk18on = "1.79"

[libraries]
bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprovJdk18on" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

Binary file modified service/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions service/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Tue Oct 29 15:35:53 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 8bdbc08

Please sign in to comment.