Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request: {}
push:
branches:
- '*'
- 'trunk'
tags:
- '*'

Expand All @@ -19,7 +19,7 @@ jobs:
distribution: 'zulu'
java-version-file: .github/workflows/.java-version

- uses: gradle/actions/wrapper-validation@v4
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew build
- run: build/dependency-tree-diff.jar --help

Expand Down
35 changes: 15 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath libs.kotlin.gradle.plugin
}
Expand All @@ -20,35 +23,37 @@ dependencies {
r8 libs.r8
}

def targetJavaVersion = 11

tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
options.release = targetJavaVersion
}

tasks.withType(KotlinJvmCompile).configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
jvmTarget = JvmTarget.fromTarget(targetJavaVersion.toString())
freeCompilerArgs.addAll(
'-Xno-call-assertions',
'-Xno-param-assertions',
'-Xno-receiver-assertions',
"-Xjdk-release=$targetJavaVersion",
)
}
}

def fatJarProvider = tasks.register('fatJar', Jar) { task ->
task.dependsOn(configurations.named('runtimeClasspath'))
task.dependsOn(tasks.named('jar'))
Comment on lines -39 to -41
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need explicit inputs, from outputs is enough.

tasks.named('jar', Jar) {
// We don't need the thin jar, use the fatJar instead.
enabled = false
}

def fatJarProvider = tasks.register('fatJar', Jar) { task ->
task.archiveClassifier = 'fat'

task.manifest {
attributes 'Main-Class': 'com.jakewharton.gradle.dependencies.DependencyTreeDiff'
}

def sourceClasses = sourceSets.main.output.classesDirs
task.inputs.files(sourceClasses)
task.from files(sourceClasses)
task.from sourceSets.named('main').map { it.output }
task.from configurations.named('runtimeClasspath').map {
it.asFileTree.files.collect { it.isDirectory() ? it : zipTree(it) }
}
Expand Down Expand Up @@ -111,13 +116,3 @@ tasks.named('assemble').configure { task ->
artifacts {
archives file: binaryFile, name: 'binary', type: 'jar', builtBy: binaryJar, classifier: 'binary'
}

buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
google()
}
13 changes: 13 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}

dependencyResolutionManagement {
repositories {
mavenCentral()
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
}
}

rootProject.name = 'dependency-tree-diff'