All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.grab.grazel.migrate.android.AndroidData.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2023 Grabtaxi Holdings PTE LTD (GRAB)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.grab.grazel.migrate.android

import com.grab.grazel.bazel.rules.Multidex
import com.grab.grazel.bazel.starlark.BazelDependency

internal data class BazelSourceSet(
    val name: String,
    val res: String?,
    val assets: String?,
    val manifest: String?,
) {
    val isEmpty: Boolean = res == null && assets == null && manifest == null
    val hasResources: Boolean = res != null || assets != null
}

internal interface AndroidData {
    val name: String
    val srcs: List
    val resourceSets: Set
    val resValuesData: ResValuesData
    val manifestFile: String?

    // Custom package used for detecting Java/Kotlin sources root
    val customPackage: String

    // Actual application package name of the library
    val packageName: String
    val buildConfigData: BuildConfigData
    val deps: List
    val plugins: List
    val compose: Boolean
    val databinding: Boolean
    val tags: List
    val lintConfigData: LintConfigData
}

internal data class AndroidLibraryData(
    override val name: String,
    override val srcs: List = emptyList(),
    override val resourceSets: Set = emptySet(),
    override val resValuesData: ResValuesData = ResValuesData(),
    override val manifestFile: String? = null,
    override val customPackage: String,
    override val packageName: String,
    override val buildConfigData: BuildConfigData = BuildConfigData(),
    override val deps: List = emptyList(),
    override val plugins: List = emptyList(),
    override val databinding: Boolean = false,
    override val compose: Boolean = false,
    override val tags: List = emptyList(),
    override val lintConfigData: LintConfigData,
) : AndroidData

internal data class AndroidBinaryData(
    override val name: String,
    override val srcs: List = emptyList(),
    override val resourceSets: Set = emptySet(),
    override val resValuesData: ResValuesData = ResValuesData(),
    override val manifestFile: String? = null,
    override val customPackage: String,
    override val packageName: String,
    override val buildConfigData: BuildConfigData = BuildConfigData(),
    override val deps: List = emptyList(),
    override val plugins: List = emptyList(),
    override val databinding: Boolean = false,
    override val compose: Boolean = false,
    override val tags: List = emptyList(),
    override val lintConfigData: LintConfigData,
    val manifestValues: Map = emptyMap(),
    val resConfigs: Set = emptySet(),
    val multidex: Multidex = Multidex.Native,
    val dexShards: Int? = null,
    val incrementalDexing: Boolean = true,
    val debugKey: String? = null,
    val hasCrashlytics: Boolean = false,
) : AndroidData




© 2015 - 2024 Weber Informatics LLC | Privacy Policy