Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Yauheni Khnykin <[email protected]>
  • Loading branch information
Hsilgos committed Jan 1, 2024
1 parent b447e55 commit 27d4651
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 34 deletions.
19 changes: 19 additions & 0 deletions functional-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ public class BuildCMakeNativeHost extends DefaultTask {

ext.BuildCMakeNativeHost = BuildCMakeNativeHost

static def dependJavaTasksOnNativeBuild(tasks, isHostOnly) {
tasks.configureEach { task ->
['Debug', 'Release'].each { buildType ->
if (task.name == "javaPreCompile${buildType}" ||
task.name == "javaPreCompile${buildType}UnitTest" ||
task.name == "compile${buildType}UnitTestJavaWithJavac" ||
task.name == "package${buildType}Resources" ||
task.name == "generate${buildType}ResValues" ||
task.name == "process${buildType}Manifest") {
if (isHostOnly) {
task.dependsOn "build${buildType}NativeHost"
} else {
task.dependsOn "externalNativeBuild${buildType}"
}
}
}
}
}

buildscript {
repositories {
google()
Expand Down
33 changes: 19 additions & 14 deletions functional-tests/functional/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ android {
def typeName = variant.name
def typeCapitalised = typeName.capitalize()

def buildNativeProject = task("build${typeCapitalised}NativeHost", type: BuildCMakeNativeHost) {
tasks.register("build${typeCapitalised}NativeHost", BuildCMakeNativeHost) {
projectDir = rootProject.projectDir
buildDir = file(buildNativeHostDir('functional', typeName))
cmakeParameters = getCMakeCommonParameters()
target = 'functional'
buildType = variant.buildType.name
dependsOn("generate${typeCapitalised}BuildConfig")
}

buildConfigField "String", "NATIVE_LIB_HOST_DIR", "\"${buildNativeHostDir('functional', typeName)}/functional\""
Expand All @@ -114,20 +115,24 @@ task generateJavadoc(type: Javadoc) {
}
}

dependJavaTasksOnNativeBuild(tasks, rootProject.isHostOnly())

tasks.configureEach { task ->
// Java compilation depends on .java/.jar files created by CMake
if (task.name == 'javaPreCompileDebug' || task.name == 'compileDebugUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildDebug'
}
task.dependsOn 'buildDebugNativeHost'
}
if (task.name == 'javaPreCompileRelease' || task.name == 'compileReleaseUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildRelease'
}
task.dependsOn 'buildReleaseNativeHost'
}
// ['Debug', 'Release'].each { buildType ->
// if (task.name == "javaPreCompile${buildType}" ||
// task.name == "javaPreCompile${buildType}UnitTest" ||
// task.name == "compile${buildType}UnitTestJavaWithJavac" ||
// task.name == "package${buildType}Resources" ||
// task.name == "generate${buildType}ResValues" ||
// task.name == "process${buildType}Manifest") {
// if (rootProject.isHostOnly()) {
// task.dependsOn "build${buildType}NativeHost"
// } else {
// task.dependsOn "externalNativeBuild${buildType}"
// }
// }
// }

if (task.name == 'generateJavadoc') {
task.mustRunAfter 'buildDebugNativeHost', 'buildReleaseNativeHost', 'externalNativeBuildDebug', 'externalNativeBuildRelease'
Expand All @@ -139,7 +144,7 @@ dependencies {

testImplementation 'junit:junit:4.13.2'
testImplementation "org.powermock:powermock-reflect:2.0.9"
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
}
Expand Down
3 changes: 2 additions & 1 deletion functional-tests/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
minifyDebugBuilds=false
org.gradle.jvmargs=-Xmx4096m
android.useAndroidX=true
android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
45 changes: 26 additions & 19 deletions functional-tests/namerules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

project.buildDir = "${rootProject.buildDir}"

def getCMakeCommonParameters() {
Expand Down Expand Up @@ -79,37 +77,46 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

libraryVariants.all { variant ->
def typeName = variant.name
def typeCapitalised = typeName.capitalize()

def buildNativeProject = task("build${typeCapitalised}NativeHost", type: BuildCMakeNativeHost) {
tasks.register("build${typeCapitalised}NativeHost", BuildCMakeNativeHost) {
projectDir = project.projectDir
buildDir = file(buildNativeHostDir('namerules', typeName))
cmakeParameters = getCMakeCommonParameters()
target = 'namerules'
buildType = variant.buildType.name
dependsOn("generateGluecodiumSources")
}

buildConfigField "String", "NATIVE_LIB_HOST_DIR", "\"${buildNativeHostDir('namerules', typeName)}\""
}
}

tasks.configureEach { task ->
// Java compilation depends on .java/.jar files created by CMake
if (task.name == 'javaPreCompileDebug' || task.name == 'compileDebugUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildDebug'
}
task.dependsOn 'buildDebugNativeHost'
}
if (task.name == 'javaPreCompileRelease' || task.name == 'compileReleaseUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildRelease'
}
task.dependsOn 'buildReleaseNativeHost'
}
}
dependJavaTasksOnNativeBuild(tasks, rootProject.isHostOnly())

// tasks.configureEach { task ->
// // Java compilation depends on .java/.jar files created by CMake
// ['Debug', 'Release'].each { buildType ->
// if (task.name == "javaPreCompile${buildType}" ||
// task.name == "javaPreCompile${buildType}UnitTest" ||
// task.name == "compile${buildType}UnitTestJavaWithJavac" ||
// task.name == "package${buildType}Resources" ||
// task.name == "generate${buildType}ResValues" ||
// task.name == "process${buildType}Manifest") {
// if (rootProject.isHostOnly()) {
// task.dependsOn "build${buildType}NativeHost"
// } else {
// task.dependsOn "externalNativeBuild${buildType}"
// }
// }
// }
// }

dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
Expand All @@ -119,7 +126,7 @@ dependencies {

testImplementation 'junit:junit:4.13.2'
testImplementation "org.powermock:powermock-reflect:2.0.9"
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
}
Expand Down
5 changes: 5 additions & 0 deletions lime-loader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
dependsOn(tasks.withType(AntlrTask))
}

tasks.withType(Jar).configureEach {
dependsOn(tasks.withType(AntlrTask))
}


// tasks.configureEach { task ->
// if (task.name == 'generateAntlrGeneratedGrammarSource') {
// task.dependsOn('compileAntlrGeneratedKotlin')
Expand Down

0 comments on commit 27d4651

Please sign in to comment.