mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-12 13:11:09 -06:00
franek
0823e72328
* Material 3 theme and color support, filled cards
* Change drawer header, dark bottombar color
* Replace MaterialComponents with Material3
* wielki powrót pr m3 do szkolnego (nie czytajcie tego kodu)
* fix M3 UI code & upgrade kotlin
* update dependencies
* fix missing Intent receiver flags for Tiramisu+
* fix kapt errors related to SelectiveDAO + migrate BuildConfig
* adapt code to updated dependencies + align lessons (based by szkolny-eu/szkolny-android#196)
* fix: no query filtering
* fix: duplicated items in about card
* fix: "Back button opens drawer" (redundant super call)
* fix: too small heading in agenda dialog
* adapt notes fragment to MD3
* add lock layout function (szkolny-eu/szkolny-android#199)
* hide classroom heading when no classroom is specified
* add support for grade column codes
* grades: join code and category together
* add cosmetic ui changes + fix build issues
* fix proguard rules (attempt 1)
* add new Retrofit2 rules
* add new ProGuard rules + fix QR scanning
* fix agenda view crash when building release variant
* improve LessonDetailsDialog
* remove duplicated string extension
* set separate app ID & icon for debug version
* remove unneeded import statement
* fix collapsing toolbar title when doing back gesture
* remove useless dependencies
* fix UI issues on old Android versions
* fix missing color resources + cleanup dependencies
* fix release building issue
* fix release building issue & remove ripple from NavView
* move version badge to the top bar
* Revert changes introduced by rebase
* Update NavLib from sadorowo/NavLib
* Revert "add lock layout function (szkolny-eu/szkolny-android#199)"
This reverts commit 2fd7038d0c
.
* Revert "add support for grade column codes"
* Revert unnecessary code changes, part 1
* Lower minSdk to 19
* Revert unnecessary code changes, part 2
* Add new application logo
* Restore bottom bar support in NavLib, revert unnecessary changes
* Use new IconicsMaterialButton in MessageFragment
* Migrate NavView to view binding
* Support IconButton in IconicsMaterialButton
* Cleanup NavLib w600dp styles
* Remove NavLib text styles
* Refactor all application themes, update styles in layouts
* Move enums and config entry to .data, fix app crashing
* Rename non-theme styles to AppStyle
* Restructure app config classes, move config to .data
* Add Theme enum and UiManager, support basic theme changing
* Actually support basic theme changing
* Serialize enum as string, fix config migration, bring back DebugDb
* Fix changing themes, apply night mode in App
* Fix resolving ColorStateList attributes, add LabPlaygroundFragment
* add Iconics methods into ProGuard rules
* Replace home card icon buttons, remove unused icons
* Update gradle properties
* Update build.gradle
* Remove unnecessary dependencies
* Remove playstore icon
* Apply fixes after review
---------
Co-authored-by: Adam Kasprzycki <66315787+santoni0@users.noreply.github.com>
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
125 lines
3.6 KiB
Groovy
125 lines
3.6 KiB
Groovy
/*
|
|
* Copyright (c) Kuba Szczodrzyński 2021-3-27.
|
|
*/
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath "org.eclipse.jgit:org.eclipse.jgit:5.5.+"
|
|
}
|
|
}
|
|
|
|
import org.eclipse.jgit.api.Git
|
|
import org.eclipse.jgit.errors.RepositoryNotFoundException
|
|
import org.eclipse.jgit.lib.Constants
|
|
import org.eclipse.jgit.lib.Ref
|
|
import org.eclipse.jgit.lib.Repository
|
|
import org.eclipse.jgit.revwalk.RevCommit
|
|
import org.eclipse.jgit.revwalk.RevTag
|
|
import org.eclipse.jgit.revwalk.RevWalk
|
|
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
|
|
|
|
private def getGit() {
|
|
Repository repo
|
|
try {
|
|
repo = new FileRepositoryBuilder()
|
|
.readEnvironment()
|
|
.findGitDir(project.projectDir)
|
|
.build()
|
|
} catch (IllegalArgumentException | RepositoryNotFoundException ignore) {
|
|
def logger = LoggerFactory.getLogger("androidGitVersion")
|
|
logger.error("No git repository reachable from ${project.projectDir}")
|
|
return results
|
|
}
|
|
return Git.wrap(repo)
|
|
}
|
|
|
|
private static def getTags(Repository repo, Git git) {
|
|
RevWalk walk = new RevWalk(repo)
|
|
def tags = git.tagList().call().findResults { ref ->
|
|
def obj = walk.parseAny(ref.getObjectId())
|
|
def name = null
|
|
if (obj instanceof RevTag) {
|
|
name = obj.getTagName()
|
|
} else if (obj instanceof RevCommit) {
|
|
name = Repository.shortenRefName(ref.name)
|
|
}
|
|
[obj.id, name]
|
|
}
|
|
walk.close()
|
|
return tags
|
|
}
|
|
|
|
private static def getLastTag(Repository repo, Git git, Ref head) {
|
|
def tags = getTags(repo, git)
|
|
|
|
RevWalk revs = new RevWalk(repo)
|
|
revs.markStart(revs.parseCommit(head.getObjectId()))
|
|
def revCount = 0
|
|
Collection<List> commitTags = null
|
|
for (RevCommit commit : revs) {
|
|
def tagsHere = tags.findAll { (it[0] == commit.id) }
|
|
if (tagsHere) {
|
|
commitTags = tagsHere.stream().map {
|
|
[it[0].name, it[1], revCount]
|
|
}.toArray()
|
|
break
|
|
}
|
|
revCount++
|
|
}
|
|
|
|
return commitTags.last()
|
|
}
|
|
|
|
private def buildGitInfo() {
|
|
Git git = getGit()
|
|
Repository repo = git.repository
|
|
|
|
def head = repo.findRef(Constants.HEAD).target
|
|
|
|
def remotes = git.remoteList().call()
|
|
.stream()
|
|
.map {
|
|
it.name + "(" + it.URIs.stream()
|
|
.map { it.rawPath.stripMargin('/').replace(".git", "") }
|
|
.toArray()
|
|
.join(", ") + ")"
|
|
}
|
|
.toArray()
|
|
.join("; ")
|
|
|
|
def status = git.status().call()
|
|
def dirty = status.hasUncommittedChanges()
|
|
|
|
def tag = getLastTag(repo, git, head)
|
|
def tagName = tag[1]
|
|
def tagRevCount = tag[2]
|
|
|
|
def result = [
|
|
hash : head.objectId.name,
|
|
branch : repo.branch,
|
|
dirty : dirty,
|
|
remotes : remotes,
|
|
unstaged : status.uncommittedChanges.join("; "),
|
|
tag : tagName,
|
|
revCount : tagRevCount,
|
|
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
|
|
versionSuffix : """${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
|
|
]
|
|
return result
|
|
}
|
|
|
|
private static def getMapString(map) {
|
|
def hashMap = "new java.util.HashMap<String, String>() { {\n"
|
|
map.each { k, v -> hashMap += """\tput("${k}", "${v}");\n""" }
|
|
return hashMap + "} }"
|
|
}
|
|
|
|
ext {
|
|
gitInfo = buildGitInfo()
|
|
gitInfoMap = getMapString(gitInfo)
|
|
}
|