Skip to content

Commit

Permalink
build(Gradle): Apply a work-around for precompiled plugin scripts
Browse files Browse the repository at this point in the history
Allow precompiled plugin scripts to access the version catalog, see [1].

[1]: gradle/gradle#15383

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jun 20, 2023
1 parent 8a749bd commit 3fe4c5b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
* License-Filename: LICENSE
*/

import org.gradle.accessors.dm.LibrariesForLibs

private val Project.libs: LibrariesForLibs
get() = extensions.getByType()

plugins {
// Use Kotlin DSL to write precompiled script plugins.
`kotlin-dsl`
Expand All @@ -26,3 +31,7 @@ repositories {
// Allow to resolve external plugins from precompiled script plugins.
gradlePluginPortal()
}

dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
26 changes: 26 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

0 comments on commit 3fe4c5b

Please sign in to comment.