Skip to content

Commit

Permalink
git subrepo clone --force https://github.com/line/gradle-scripts grad…
Browse files Browse the repository at this point in the history
…le/scripts

subrepo:
  subdir:   "gradle/scripts"
  merged:   "597bb9e29"
upstream:
  origin:   "https://github.com/line/gradle-scripts"
  branch:   "main"
  commit:   "597bb9e29"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"
  • Loading branch information
jrhee17 committed Nov 21, 2024
1 parent 7da4565 commit 3121a66
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
6 changes: 3 additions & 3 deletions gradle/scripts/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/line/gradle-scripts
branch = main
commit = 1f94acd56f170782ad291e4603384ad59cca4e9e
parent = d18437e44118f1367ce3cf2d7e5008552ebd7513
commit = 597bb9e29378d56051db3ace62d5cbd81f3b1272
parent = 7da456555cd58b9fe3cd387a7fe1003be7504411
method = merge
cmdver = 0.4.5
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion gradle/scripts/lib/common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ final class GentlePlainTextReporter implements Reporter {

/**
* A custom version of failOnVersionConflict which can limit which dependencies should be checked for conflict.
* Heavily inspired https://github.com/gradle/gradle/issues/8813.
* Heavily inspired by https://github.com/gradle/gradle/issues/8813.
*/
static def failOnVersionConflict(Project project, ProviderConvertible<MinimalExternalModuleDependency> providerConvertible) {
return failOnVersionConflict(project, providerConvertible.asProvider())
Expand Down
31 changes: 24 additions & 7 deletions gradle/scripts/lib/java-shade.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicInteger
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
dependencies {
classpath "gradle.plugin.com.github.johnrengelman:shadow:${managedVersions['gradle.plugin.com.github.johnrengelman:shadow']}"
Expand Down Expand Up @@ -88,7 +88,6 @@ configure(relocatedProjects) {
group: 'Build',
description: 'Extracts the shaded test JAR.',
dependsOn: tasks.shadedTestJar) {

from(zipTree(tasks.shadedTestJar.archiveFile.get().asFile))
from(sourceSets.test.output.classesDirs) {
// Add the JAR resources excluded in the 'shadedTestJar' task.
Expand Down Expand Up @@ -335,7 +334,8 @@ private void configureShadowTask(Project project, ShadowJar task, boolean isMain
private Configuration configureShadedTestImplementConfiguration(
Project project, Project recursedProject = project,
Set<ExcludeRule> excludeRules = new HashSet<>(),
Set<Project> visitedProjects = new HashSet<>()) {
Set<Project> visitedProjects = new HashSet<>(),
boolean recursedProjectRelocated = true) {

def shadedJarTestImplementation = project.configurations.getByName('shadedJarTestImplementation')

Expand Down Expand Up @@ -364,14 +364,24 @@ private Configuration configureShadedTestImplementConfiguration(
}.each { cfg ->
cfg.allDependencies.each { dep ->
if (dep instanceof ProjectDependency) {
if (!dep.dependencyProject.hasFlag('java')) {
// Do not add the dependencies of non-Java projects.
return
}
// Project dependency - recurse later.
// Note that we recurse later to have immediate module dependencies higher precedence.
projectDependencies.add(dep)
} else {
// Module dependency - add.
if (shadedDependencyNames.contains("${dep.group}:${dep.name}")) {
// Skip the shaded dependencies.
return
if (recursedProjectRelocated) {
// Skip the shaded dependencies.
return
}
throw new IllegalStateException(
"${recursedProject} has a shaded dependency: ${dep.group}:${dep.name} " +
"but it is not relocated. Please add a 'relocate' flag to " +
"${recursedProject} in settings.gradle.")
}

if (excludeRules.find { rule ->
Expand All @@ -382,16 +392,23 @@ private Configuration configureShadedTestImplementConfiguration(
}
// Do not use `project.dependencies.add(name, dep)` that discards the classifier of
// a dependency. See https://github.com/gradle/gradle/issues/23096
project.configurations.getByName(shadedJarTestImplementation.name).dependencies.add(dep)
shadedJarTestImplementation.dependencies.add(dep)
}
}
}

// Recurse into the project dependencies.
projectDependencies.each { ProjectDependency dep ->
if (!dep.dependencyProject.hasFlag('relocate')) {
shadedJarTestImplementation.dependencies.add(
project.dependencies.project(path: dep.dependencyProject.path))
recursedProjectRelocated = false
} else {
recursedProjectRelocated = true
}
configureShadedTestImplementConfiguration(
project, dep.dependencyProject,
excludeRules + dep.excludeRules, visitedProjects)
excludeRules + dep.excludeRules, visitedProjects, recursedProjectRelocated)
}

return shadedJarTestImplementation
Expand Down

0 comments on commit 3121a66

Please sign in to comment.