2.1 KiB · text History 0fc5cce
plugins {
    alias(libs.plugins.android.application)
}

// Bumped by hand; everything after it is generated.
val baseVersion = "0.1.0"

// Seconds, from the environment when it's there. CI sets it once per run
// so every artifact from that run agrees; a local build computes it,
// which is fine because local builds are never published.
val buildTimestamp: Long =
    (System.getenv("SOURCE_DATE_EPOCH") ?: System.getenv("BUILD_TIMESTAMP"))
        ?.toLongOrNull()
        ?: (System.currentTimeMillis() / 1000)

val appVersionName: String =
    System.getenv("RELEASE_VERSION")?.takeIf { it.isNotBlank() }
        ?: "$baseVersion-dev-$buildTimestamp"

android {
    namespace = "io.neiam.moire"
    compileSdk {
        version = release(36) {
            minorApiLevel = 1
        }
    }

    defaultConfig {
        applicationId = "io.neiam.moire"
        // Adaptive icons, and OpenGL ES 3.0 on every device.
        minSdk = 26
        targetSdk = 36
        // Android refuses an update whose versionCode isn't higher than
        // what's installed, and F-Droid orders versions by it. The CI run
        // number is monotonic and needs no state; local builds stay at 1.
        versionCode = (System.getenv("GITHUB_RUN_NUMBER") ?: "").toIntOrNull() ?: 1
        versionName = appVersionName
    }

    // The shader is the desktop wallpaper's, read as it is: one source
    // for both, so they can't drift apart. Shader.kt adapts its Qt
    // header to OpenGL ES at load time.
    sourceSets["main"].assets.srcDir("../../moire/shaders")

    buildTypes {
        release {
            optimization {
                enable = false
            }
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    lint {
        // `assembleRelease` is a packaging step, not a review gate; lint
        // still runs on demand with ./gradlew :app:lint.
        checkReleaseBuilds = false
    }
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.androidx.preference)
    testImplementation(libs.junit)
}