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

com.grab.grazel.migrate.kotlin.KotlinLibraryTarget.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2022 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.kotlin

import com.grab.grazel.bazel.rules.Visibility
import com.grab.grazel.bazel.rules.ktLibrary
import com.grab.grazel.bazel.starlark.BazelDependency
import com.grab.grazel.migrate.android.LintConfigData
import com.grab.grazel.bazel.starlark.StatementsBuilder
import com.grab.grazel.migrate.BazelBuildTarget
import com.grab.grazel.migrate.android.ResValuesData
import com.grab.grazel.migrate.android.buildResFiles

internal data class KotlinLibraryTarget(
    override val name: String,
    override val srcs: List,
    override val deps: List,
    override val visibility: Visibility = Visibility.Public,
    override val tags: List = emptyList(),
    override val sortKey: String = "0$name",
    val projectName: String = name,
    val packageName: String? = null,
    val res: List,
    val resValuesData: ResValuesData = ResValuesData(),
    val manifest: String? = null,
    val plugins: List = emptyList(),
    val assetsGlob: List = emptyList(),
    val assetsDir: String? = null,
    val lintConfigData: LintConfigData? = null
) : BazelBuildTarget {

    override fun statements(builder: StatementsBuilder) = builder {
        val resourceFiles = buildResFiles(res)
        ktLibrary(
            name = name,
            packageName = packageName,
            srcsGlob = srcs,
            visibility = visibility,
            deps = deps,
            resourceFiles = resourceFiles,
            manifest = manifest,
            plugins = plugins,
            assetsGlob = assetsGlob,
            assetsDir = assetsDir,
            tags = tags,
            lintConfigData = lintConfigData
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy