[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
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 0
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Get version code
|
||||
run: echo APPVEYOR_BUILD_NUMBER=$(expr $GITHUB_RUN_NUMBER + 4999) >> $GITHUB_ENV
|
||||
- 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
|
||||
- name: Prepare artifact
|
||||
if: success()
|
||||
|
|
|
|||
|
|
@ -19,12 +19,11 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 0
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Get version code
|
||||
run: echo APPVEYOR_BUILD_NUMBER=$(expr $GITHUB_RUN_NUMBER + 4999) >> $GITHUB_ENV
|
||||
- name: Build with Gradle
|
||||
run: bash ./gradlew :app:assembleRelease
|
||||
- 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 {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
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 {
|
||||
versionCode = buildVersionCode
|
||||
versionName = buildVersionName
|
||||
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"
|
||||
versionCode = commitCount + 4200
|
||||
versionName = versionName
|
||||
zipPathMagiskReleasePath = project(":core").projectDir.path + "/build/tmp/release/magisk/"
|
||||
}
|
||||
repositories {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ afterEvaluate {
|
|||
doFirst {
|
||||
copy {
|
||||
from "${projectDir}/tpl/module.prop.tpl"
|
||||
into templateRootPath
|
||||
into "${projectDir}/template_override"
|
||||
rename "module.prop.tpl", "module.prop"
|
||||
expand(moduleId: "$module_id",
|
||||
versionName: "$rootProject.ext.versionName",
|
||||
|
|
@ -261,4 +261,4 @@ afterEvaluate {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue