(fix) try to address build perf issue

Signed-off-by: androidacy-user <opensource@androidacy.com>
master
androidacy-user 1 year ago
parent aaed979932
commit 6a76a6403f

@ -39,6 +39,11 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-includes: |
caches
notifications
jdks
- name: Change wrapper permissions
run: chmod +x ./gradlew

@ -1,12 +1,9 @@
@file:Suppress("UnstableApiUsage", "SpellCheckingInspection")
import com.android.build.api.dsl.Packaging
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel
import com.android.build.api.variant.FilterConfiguration.FilterType.*
import java.util.Properties
import java.io.File
import java.io.ByteArrayOutputStream
plugins {
// Gradle doesn't allow conditionally enabling/disabling plugins
@ -22,30 +19,16 @@ apply(plugin = "realm-android")
val hasSentryConfig = File(rootProject.projectDir, "sentry.properties").exists()
android {
// functions to get git info: gitCommitHash, gitBranch, gitRemote
val gitCommitHash by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
stdout.toString().trim()
}
val gitBranch by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
standardOutput = stdout
}
stdout.toString().trim()
}
val gitRemote by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "config", "--get", "remote.origin.url")
standardOutput = stdout
}
stdout.toString().trim()
}
val gitCommitHash = providers.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asText.get().toString().trim()
val gitBranch = providers.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
}.standardOutput.asText.get().toString().trim()
val gitRemote = providers.exec {
commandLine("git", "config", "--get", "remote.origin.url")
}.standardOutput.asText.get().toString().trim()
namespace = "com.fox2code.mmm"
compileSdk = 33
ndkVersion = "25.2.9519653"
@ -88,7 +71,9 @@ android {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
getByName("debug") {
applicationIdSuffix = ".debug"
@ -120,9 +105,15 @@ android {
val properties = Properties()
if (project.rootProject.file("local.properties").exists()) {
// grab matomo.url
buildConfigField("String", "ANALYTICS_ENDPOINT", "\"" + properties.getProperty("matomo.url", "https://s-api.androidacy.com/matomo.php" + "\""))
buildConfigField(
"String", "ANALYTICS_ENDPOINT", "\"" + properties.getProperty(
"matomo.url", "https://s-api.androidacy.com/matomo.php" + "\""
)
)
} else {
buildConfigField("String", "ANALYTICS_ENDPOINT", "\"https://s-api.androidacy.com/matomo.php\"")
buildConfigField(
"String", "ANALYTICS_ENDPOINT", "\"https://s-api.androidacy.com/matomo.php\""
)
}
buildConfigField("boolean", "ENABLE_PROTECTION", "true")
// Get the androidacy client ID from the androidacy.properties
@ -132,15 +123,26 @@ android {
// rate limited to 30 requests per minute
if (project.rootProject.file("androidacy.properties").exists()) {
propertiesA.load(project.rootProject.file("androidacy.properties").inputStream())
properties.setProperty("client_id", "\"" + propertiesA.getProperty("client_id", "5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ") + "\"")
properties.setProperty(
"client_id", "\"" + propertiesA.getProperty(
"client_id",
"5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ"
) + "\""
)
} else {
properties.setProperty("client_id", "5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ")
properties.setProperty(
"client_id", "5KYccdYxWB2RxMq5FTbkWisXi2dS6yFN9R7RVlFCG98FRdz6Mf5ojY2fyJCUlXJZ"
)
}
buildConfigField("String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty("client_id") + "\"")
buildConfigField(
"String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty("client_id") + "\""
)
// If client ID is empty, disable androidacy
buildConfigField("java.util.List<String>",
buildConfigField(
"java.util.List<String>",
"ENABLED_REPOS",
"java.util.Arrays.asList(\"androidacy_repo\")",)
"java.util.Arrays.asList(\"androidacy_repo\")",
)
}
@ -169,17 +171,25 @@ android {
val properties = Properties()
if (project.rootProject.file("local.properties").exists()) {
// grab matomo.url
buildConfigField("String", "ANALYTICS_ENDPOINT", "\"" + properties.getProperty("matomo.url", "https://s-api.androidacy.com/matomo.php") + "\"")
buildConfigField(
"String", "ANALYTICS_ENDPOINT", "\"" + properties.getProperty(
"matomo.url", "https://s-api.androidacy.com/matomo.php"
) + "\""
)
} else {
buildConfigField("String", "ANALYTICS_ENDPOINT", "\"https://s-api.androidacy.com/matomo.php\"")
buildConfigField(
"String", "ANALYTICS_ENDPOINT", "\"https://s-api.androidacy.com/matomo.php\""
)
}
buildConfigField("boolean", "ENABLE_PROTECTION", "true")
// Repo with ads or tracking feature are disabled by default for the
// F-Droid flavor. at the same time, the alt repo isn"t particularly trustworthy
buildConfigField("java.util.List<String>",
"ENABLED_REPOS",
"java.util.Arrays.asList(\"\")",)
buildConfigField(
"java.util.List<String>",
"ENABLED_REPOS",
"java.util.Arrays.asList(\"\")",
)
// Get the androidacy client ID from the androidacy.properties
val propertiesA = Properties()
@ -188,9 +198,15 @@ android {
if (project.rootProject.file("androidacy.properties").exists()) {
propertiesA.load(project.rootProject.file("androidacy.properties").inputStream())
} else {
propertiesA.setProperty("client_id", "dQ1p7X8bF14PVJ7wAU6ORVjPB2IeTinsuAZ8Uos6tQiyUdUyIjSyZSmN54QBbaTy")
propertiesA.setProperty(
"client_id", "dQ1p7X8bF14PVJ7wAU6ORVjPB2IeTinsuAZ8Uos6tQiyUdUyIjSyZSmN54QBbaTy"
)
}
buildConfigField("String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty("client_id", "dQ1p7X8bF14PVJ7wAU6ORVjPB2IeTinsuAZ8Uos6tQiyUdUyIjSyZSmN54QBbaTy") + "\"")
buildConfigField(
"String", "ANDROIDACY_CLIENT_ID", "\"" + propertiesA.getProperty(
"client_id", "dQ1p7X8bF14PVJ7wAU6ORVjPB2IeTinsuAZ8Uos6tQiyUdUyIjSyZSmN54QBbaTy"
) + "\""
)
versionNameSuffix = "-froid"
}
}
@ -203,13 +219,6 @@ android {
lint {
disable.add("MissingTranslation")
}
@Suppress("UNUSED_EXPRESSION")
fun Packaging.() {
jniLibs {
useLegacyPackaging = true
}
}
}
sentry {
@ -227,7 +236,14 @@ sentry {
tracingInstrumentation {
enabled.set(true)
features.set(setOf(InstrumentationFeature.DATABASE, InstrumentationFeature.FILE_IO, InstrumentationFeature.OKHTTP, InstrumentationFeature.COMPOSE))
features.set(
setOf(
InstrumentationFeature.DATABASE,
InstrumentationFeature.FILE_IO,
InstrumentationFeature.OKHTTP,
InstrumentationFeature.COMPOSE
)
)
logcat {
enabled.set(true)
@ -254,30 +270,29 @@ val abiCodes = mapOf("armeabi-v7a" to 1, "x86" to 2, "x86_64" to 3)
// abiCodes * 1000 + variant.versionCode. In this example, variant.versionCode
// is equal to defaultConfig.versionCode. If you configure product flavors that
// define their own versionCode, variant.versionCode uses that value instead.
androidComponents {
onVariants { variant ->
// Assigns a different version code for each output APK
// other than the universal APK.
variant.outputs.forEach { output ->
val name = output.filters.find { it.filterType == ABI }?.identifier
// Stores the value of abiCodes that is associated with the ABI for this variant.
val baseAbiCode = abiCodes[name]
// Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
// the following code doesn't override the version code for universal APKs.
// However, because you want universal APKs to have the lowest version code,
// this outcome is desirable.
if (baseAbiCode != null) {
// Assigns the new version code to output.versionCode, which changes the version code
// for only the output APK, not for the variant itself.
@Suppress("USELESS_CAST")
val versioCode = output.versionCode.get() as Int
output.versionCode.set(baseAbiCode * 1000 + versioCode)
}
}
androidComponents {
onVariants { variant ->
// Assigns a different version code for each output APK
// other than the universal APK.
variant.outputs.forEach { output ->
val name = output.filters.find { it.filterType == ABI }?.identifier
// Stores the value of abiCodes that is associated with the ABI for this variant.
val baseAbiCode = abiCodes[name]
// Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
// the following code doesn't override the version code for universal APKs.
// However, because you want universal APKs to have the lowest version code,
// this outcome is desirable.
if (baseAbiCode != null) {
// Assigns the new version code to output.versionCode, which changes the version code
// for only the output APK, not for the variant itself.
val versioCode = output.versionCode.get() as Int
output.versionCode.set(baseAbiCode * 1000 + versioCode)
}
}
}
}
aboutLibraries {
// Specify the additional licenses
@ -383,6 +398,12 @@ android {
}
//noinspection GrDeprecatedAPIUsage
buildToolsVersion = "34.0.0 rc3"
@Suppress("DEPRECATION")
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}

@ -65,7 +65,6 @@
android:theme="@style/Theme.MagiskModuleManager"
android:usesCleartextTraffic="false"
android:forceDarkAllowed="false"
android:extractNativeLibs="true"
tools:ignore="ManifestResource"
tools:replace="android:supportsRtl"
tools:targetApi="tiramisu">

@ -21,7 +21,7 @@ android.enableJetifier=false
# Fox builds props mods
org.gradle.parallel=true
android.enableR8.fullMode=true
org.gradle.unsafe.configuration-cache=true
org.gradle.configuration-cache=true
android.defaults.buildfeatures.buildconfig=true
#kotlin.jvm.target.validation.mode=IGNORE
org.gradle.caching=true

Binary file not shown.

@ -1,6 +1,7 @@
#Sat Apr 22 15:39:14 EDT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

30
gradlew vendored

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# 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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,22 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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=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=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
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 $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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.

15
gradlew.bat vendored

@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
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

Loading…
Cancel
Save