diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index a96fd1f7..9950ab3a 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -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() diff --git a/.github/workflows/manager.yml b/.github/workflows/manager.yml index c03e2947..1e315e34 100644 --- a/.github/workflows/manager.yml +++ b/.github/workflows/manager.yml @@ -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 diff --git a/build.gradle b/build.gradle index c3805c90..9990c597 100644 --- a/build.gradle +++ b/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 { diff --git a/core/build.gradle b/core/build.gradle index 0daea3b3..4005a671 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -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 { } } -} \ No newline at end of file +}