[core] [app] Use commit count as version code (#195)
This commit is contained in:
parent
cc0afb03e8
commit
a7500c73f3
|
|
@ -20,17 +20,12 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
|
fetch-depth: 0
|
||||||
- name: set up JDK 1.8
|
- name: set up JDK 1.8
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Get version code
|
|
||||||
run: echo APPVEYOR_BUILD_NUMBER=$(expr $GITHUB_RUN_NUMBER + 4999) >> $GITHUB_ENV
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
env:
|
|
||||||
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
|
|
||||||
ALIAS_NAME: ${{ secrets.ALIAS_NAME }}
|
|
||||||
ALIAS_PASS: ${{ secrets.ALIAS_PASS }}
|
|
||||||
run: bash ./gradlew zipRelease zipDebug
|
run: bash ./gradlew zipRelease zipDebug
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
if: success()
|
if: success()
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,11 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
|
fetch-depth: 0
|
||||||
- name: set up JDK 1.8
|
- name: set up JDK 1.8
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Get version code
|
|
||||||
run: echo APPVEYOR_BUILD_NUMBER=$(expr $GITHUB_RUN_NUMBER + 4999) >> $GITHUB_ENV
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: bash ./gradlew :app:assembleRelease
|
run: bash ./gradlew :app:assembleRelease
|
||||||
- name: Sign Manager Release
|
- name: Sign Manager Release
|
||||||
|
|
|
||||||
37
build.gradle
37
build.gradle
|
|
@ -1,44 +1,25 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
import org.eclipse.jgit.internal.storage.file.FileRepository
|
||||||
|
import org.eclipse.jgit.api.Git
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||||
|
classpath 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def repo = new FileRepository(rootProject.file(".git"))
|
||||||
|
def refId = repo.refDatabase.exactRef("refs/remotes/origin/master").objectId
|
||||||
|
def commitCount = new Git(repo).log().add(refId).call().size()
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
def buildVersionName = versionName
|
|
||||||
// Values set here will be overriden by AppVeyor, feel free to modify during development.
|
|
||||||
def buildVersionCode = 233
|
|
||||||
|
|
||||||
if (System.env.APPVEYOR_BUILD_VERSION != null) {
|
|
||||||
buildVersionName = "v${System.getenv('appveyor_build_version')}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.env.APPVEYOR_BUILD_NUMBER != null) {
|
|
||||||
// Split is necessary because PRs set the build number to "1234-something".
|
|
||||||
def parts = System.env.APPVEYOR_BUILD_NUMBER.split('-')
|
|
||||||
buildVersionCode = Integer.valueOf(parts[0])
|
|
||||||
}
|
|
||||||
ext {
|
ext {
|
||||||
versionCode = buildVersionCode
|
versionCode = commitCount + 4200
|
||||||
versionName = buildVersionName
|
versionName = versionName
|
||||||
templateRootPath = project(":core").projectDir.path + "/template_override/"
|
|
||||||
templateSystemPath = templateRootPath + "/system/"
|
|
||||||
templateSystemx86Path = templateRootPath + "/system_x86/"
|
|
||||||
templateFrameworkPath = templateRootPath + "/system/framework/"
|
|
||||||
templateLibPath = templateRootPath + "/system/lib/"
|
|
||||||
templateLib64Path = templateRootPath + "/system/lib64/"
|
|
||||||
templateEtcPath = templateRootPath + "/system/etc/"
|
|
||||||
hiddenApiStubJarFilePath = project(":hiddenapi-stubs").buildDir.absolutePath + "/libs/framework-stub.jar"
|
|
||||||
zipPathMagiskReleasePath = project(":core").projectDir.path + "/build/tmp/release/magisk/"
|
zipPathMagiskReleasePath = project(":core").projectDir.path + "/build/tmp/release/magisk/"
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ afterEvaluate {
|
||||||
doFirst {
|
doFirst {
|
||||||
copy {
|
copy {
|
||||||
from "${projectDir}/tpl/module.prop.tpl"
|
from "${projectDir}/tpl/module.prop.tpl"
|
||||||
into templateRootPath
|
into "${projectDir}/template_override"
|
||||||
rename "module.prop.tpl", "module.prop"
|
rename "module.prop.tpl", "module.prop"
|
||||||
expand(moduleId: "$module_id",
|
expand(moduleId: "$module_id",
|
||||||
versionName: "$rootProject.ext.versionName",
|
versionName: "$rootProject.ext.versionName",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue