Skip to content

Fix Gradle warnings #1053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
29 changes: 18 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
* limitations under the License.
*/

import com.android.build.gradle.tasks.JavaDocGenerationTask
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin

def latestSdkVersion = 34

buildscript {
Expand Down Expand Up @@ -44,14 +50,14 @@ allprojects {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

tasks.withType(Javadoc).all {
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
// Disabled until there's a workaround/fix for https://github.com/Kotlin/dokka/issues/2472
tasks.withType(com.android.build.gradle.tasks.JavaDocGenerationTask).all {
tasks.withType(JavaDocGenerationTask).configureEach {
enabled = false
}
configurations.all {
configurations.configureEach {
// Temporarily exclude sample-barebones project from substitution in order to fix the gradle
// build.
if (project.name != "sample-barebones") {
Expand All @@ -66,11 +72,11 @@ allprojects {
}

subprojects {
tasks.withType(Javadoc).all {
tasks.withType(Javadoc).configureEach {
enabled = false
}

tasks.withType(org.jetbrains.dokka.gradle.DokkaTaskPartial).configureEach {
tasks.withType(DokkaTaskPartial).configureEach {
dokkaSourceSets {
configureEach {
def module_docs_file = 'module-docs.md'
Expand All @@ -79,10 +85,10 @@ subprojects {
}
}
}
dependsOn(tasks.withType(org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask))
dependsOn(tasks.withType(KaptWithoutKotlincTask))
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
systemProperty "robolectric.looperMode", "LEGACY"

testLogging {
Expand All @@ -91,14 +97,14 @@ subprojects {
}
}

plugins.withType(org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin) {
plugins.withType(KotlinBasePlugin).configureEach {
kotlin {
jvmToolchain(17)
}
}

afterEvaluate {
tasks.withType(Test) {
tasks.withType(Test).configureEach {
it.dependsOn copyYogaLibs
systemProperty 'java.library.path', "${rootDir}/build/jniLibs"
environment 'LD_LIBRARY_PATH', "${rootDir}/build/jniLibs"
Expand All @@ -114,7 +120,7 @@ subprojects {

apply plugin: 'org.jetbrains.dokka'

tasks.withType(org.jetbrains.dokka.gradle.DokkaMultiModuleTask).configureEach {
tasks.withType(DokkaMultiModuleTask).configureEach {
outputDirectory = file("${rootDir}/website/static/reference")
moduleName = "Litho"
}
Expand Down Expand Up @@ -207,7 +213,8 @@ ext.deps.yoga =

// This should hopefully only serve as a temporary measure until
// we have a proper Gradle setup for Yoga and JNI.
task copyYogaLibs(type: Copy, dependsOn: ':yoga:buckBuild') {
tasks.register('copyYogaLibs', Copy) {
dependsOn ':yoga:buckBuild'
from 'buck-out/gen/lib/yogajni/jni#default,shared/'
include '*.so'
include '*.dylib'
Expand Down
2 changes: 1 addition & 1 deletion lib/yoga/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
// Our current NDK setup only gets us half-way there to a way to run Yoga
// locally for unit tests. We're reusing the buck builds for now and hopefully
// someone (maybe you!) will fix this and get CMake to help us out.
task buckBuild(type: Exec) {
tasks.register('buckBuild', Exec) {
workingDir rootDir
environment BUCKVERSION: System.getenv('BUCKVERSION') ?: 'last'
def buckPath = System.getenv('BUCK_PATH')
Expand Down
10 changes: 5 additions & 5 deletions lib/yogajni/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ android {
version '3.18.1'
}
}
}

dependencies {
// We want to export the Java APIs
api project(':yoga')
compileOnly deps.inferAnnotations
}
dependencies {
// We want to export the Java APIs
api project(':yoga')
compileOnly deps.inferAnnotations
}
3 changes: 1 addition & 2 deletions litho-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ android {
buildConfig true
}
namespace 'com.facebook.litho'
// TODO(#62): Re-enable abort on error.
lint {
abortOnError false
}

// TODO(#62): Re-enable abort on error.
}

dependencies {
Expand Down
32 changes: 16 additions & 16 deletions litho-coroutines-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka'
Expand All @@ -28,23 +30,21 @@ android {
}

testOptions {
unitTests {
includeAndroidResources = true
unitTests.includeAndroidResources = true

all {
// Because of native libraries loading (Yoga), we can never reuse a class loader and
// need to fork a new process per class.
forkEvery = 1
maxParallelForks = 2
unitTests.all {
// Because of native libraries loading (Yoga), we can never reuse a class loader and
// need to fork a new process per class.
forkEvery = 1
maxParallelForks = 2

testLogging {
events 'skipped', 'failed', 'standardOut', 'standardError'
showCauses = true
showExceptions = true
showStackTraces = true
exceptionFormat = 'full'
stackTraceFilters = []
}
testLogging {
events 'skipped', 'failed', 'standardOut', 'standardError'
showCauses = true
showExceptions = true
showStackTraces = true
exceptionFormat = 'full'
stackTraceFilters = []
}
}
}
Expand All @@ -56,7 +56,7 @@ android {
namespace 'com.facebook.litho.coroutines'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:+InlineClasses"]
}
Expand Down
19 changes: 10 additions & 9 deletions litho-editor-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ android {
targetSdkVersion rootProject.targetSdkVersion
}

// TODO(#62): Re-enable abort on error.

dependencies {
api project(':litho-core')
compileOnly deps.jsr305
compileOnly deps.proguardAnnotations
compileOnly deps.supportAnnotations
compileOnly deps.inferAnnotations
}
namespace 'com.facebook.litho.editor'

// TODO(#62): Re-enable abort on error.
lint {
abortOnError false
}
}

dependencies {
api project(':litho-core')
compileOnly deps.jsr305
compileOnly deps.proguardAnnotations
compileOnly deps.supportAnnotations
compileOnly deps.inferAnnotations
}

apply plugin: "com.vanniktech.maven.publish"
68 changes: 34 additions & 34 deletions litho-editor-flipper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,8 @@ android {
targetSdkVersion rootProject.targetSdkVersion
}

// TODO(#62): Re-enable abort on error.

dependencies {
kapt project(':litho-processor')
kapt project(':litho-sections-processor')

implementation deps.kotlinStandardLib
implementation project(':litho-core')
implementation project(':litho-widget')
implementation project(':litho-editor-core')
implementation project(':litho-sections-core')
implementation project(':litho-sections-debug')
implementation deps.flipper
implementation deps.supportAppCompat
implementation deps.guava
compileOnly deps.jsr305
compileOnly deps.proguardAnnotations
compileOnly project(':litho-annotations')
compileOnly deps.inferAnnotations

testImplementation deps.junit
testImplementation deps.robolectric
testImplementation project(':litho-rendercore-testing')
testImplementation project(':litho-testing')
testImplementation project(':litho-widget-kotlin')
testAnnotationProcessor project(':litho-processor')
testImplementation deps.assertjCore
testImplementation deps.supportRecyclerView
testImplementation deps.supportTestJunit
testImplementation deps.mockitokotlin
testImplementation deps.supportTestCore

kaptTest project(':litho-processor')
}
namespace 'com.facebook.litho.editor.flipper'
// TODO(#62): Re-enable abort on error.
lint {
abortOnError false
}
Expand All @@ -72,4 +39,37 @@ kotlin {
jvmToolchain(17)
}

dependencies {
kapt project(':litho-processor')
kapt project(':litho-sections-processor')

implementation deps.kotlinStandardLib
implementation project(':litho-core')
implementation project(':litho-widget')
implementation project(':litho-editor-core')
implementation project(':litho-sections-core')
implementation project(':litho-sections-debug')
implementation deps.flipper
implementation deps.supportAppCompat
implementation deps.guava
compileOnly deps.jsr305
compileOnly deps.proguardAnnotations
compileOnly project(':litho-annotations')
compileOnly deps.inferAnnotations

testImplementation deps.junit
testImplementation deps.robolectric
testImplementation project(':litho-rendercore-testing')
testImplementation project(':litho-testing')
testImplementation project(':litho-widget-kotlin')
testAnnotationProcessor project(':litho-processor')
testImplementation deps.assertjCore
testImplementation deps.supportRecyclerView
testImplementation deps.supportTestJunit
testImplementation deps.mockitokotlin
testImplementation deps.supportTestCore

kaptTest project(':litho-processor')
}

apply plugin: "com.vanniktech.maven.publish"
4 changes: 3 additions & 1 deletion litho-fresco-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.facebook.kotlin.compilerplugins.dataclassgenerate'
Expand All @@ -33,7 +35,7 @@ android {
namespace 'com.facebook.litho.fresco.kotlin'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:+InlineClasses"]
}
Expand Down
3 changes: 1 addition & 2 deletions litho-fresco/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ android {
minSdkVersion rootProject.minSdkVersion
}
namespace 'com.facebook.litho.fresco'
// TODO(#62): Re-enable abort on error.
lint {
abortOnError false
}

// TODO(#62): Re-enable abort on error.
}

dependencies {
Expand Down
3 changes: 2 additions & 1 deletion litho-intellij-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ apply plugin: "org.jetbrains.intellij"
group 'com.facebook.litho.intellij'

sourceCompatibility = rootProject.sourceCompatibilityVersion
targetCompatibility = rootProject.targetCompatibilityVersion

compileKotlin {
kotlinOptions.jvmTarget = rootProject.targetCompatibilityVersion
Expand Down Expand Up @@ -67,7 +68,7 @@ intellij {
plugins = ['java', 'org.jetbrains.kotlin',]
}

task merge {
tasks.register('merge') {
doLast {
def output = new File(project.buildDir, "patchedPluginXmlFiles/plugin.xml")

Expand Down
2 changes: 1 addition & 1 deletion litho-it/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ gradle.projectsEvaluated {
def variationName = variant.name.capitalize()
def variationPath = variant.buildType.name

task "copyTest${variationName}Resources"(type: Copy) {
tasks.register("copyTest${variationName}Resources", Copy) {
from "${projectDir}/src/test/resources"
into "${testClassesPath}/${variationPath}"
}
Expand Down
Loading