parent
85129e4660
commit
f8197db250
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 The Android Open Source Project
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.google.samples.apps.nowinandroid
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
|
||||
val Project.libs
|
||||
get(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.google.samples.apps.nowinandroid.extension
|
||||
|
||||
import org.gradle.kotlin.dsl.DependencyHandlerScope
|
||||
|
||||
internal fun DependencyHandlerScope.implementation(dependency: Any) =
|
||||
dependencies.add("implementation", dependency)
|
||||
|
||||
internal fun DependencyHandlerScope.testImplementation(dependency: Any) =
|
||||
dependencies.add("testImplementation", dependency)
|
||||
|
||||
internal fun DependencyHandlerScope.androidTestImplementation(dependency: Any) =
|
||||
dependencies.add("androidTestImplementation", dependency)
|
||||
|
||||
internal fun DependencyHandlerScope.debugImplementation(dependency: Any) =
|
||||
dependencies.add("debugImplementation", dependency)
|
||||
|
||||
internal fun DependencyHandlerScope.ksp(dependency: Any) =
|
||||
dependencies.add("ksp", dependency)
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.google.samples.apps.nowinandroid.extension
|
||||
|
||||
import org.gradle.api.plugins.PluginManager
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.provider.ProviderConvertible
|
||||
import org.gradle.plugin.use.PluginDependency
|
||||
|
||||
internal fun PluginManager.apply(pluginProvider: Provider<PluginDependency>) {
|
||||
apply(pluginProvider.get().pluginId)
|
||||
}
|
||||
|
||||
internal fun PluginManager.apply(pluginProvider: ProviderConvertible<PluginDependency>) {
|
||||
apply(pluginProvider.asProvider())
|
||||
}
|
||||
|
||||
internal fun PluginManager.hasPlugin(pluginProvider: Provider<PluginDependency>): Boolean {
|
||||
return hasPlugin(pluginProvider.get().pluginId)
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.google.samples.apps.nowinandroid.extension
|
||||
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
|
||||
val Project.libs
|
||||
get(): LibrariesForLibs = extensions.getByType()
|
Loading…
Reference in new issue