Skip to content

Commit 89494cd

Browse files
committed
Rename api to tree
1 parent 23b5747 commit 89494cd

File tree

24 files changed

+42
-23
lines changed

24 files changed

+42
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Check local deployment
2020
run: ./gradlew build deployLocal
2121
- name: Check sample app
22-
run: cd tests && ../gradlew sample:assembleDebug
22+
run: cd tests && ../gradlew sample-library:assembleDebug

grease/src/main/kotlin/io/deepmedia/tools/grease/configurations.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ private class ArtifactsFileCollection(private val fileCollections: List<FileColl
4040
}
4141
}
4242

43-
44-
internal fun Project.grease(isTransitive: Boolean) = greaseOf(if (isTransitive) "api" else "")
45-
46-
internal fun Project.greaseOf(buildType: com.android.builder.model.BuildType, isTransitive: Boolean = false) =
47-
greaseOf(buildType.name.configurationName(isTransitive))
43+
internal fun Project.grease(isTransitive: Boolean) = greaseOf("".configurationName(isTransitive))
4844

4945
internal fun Project.greaseOf(variant: Variant, isTransitive: Boolean = false) =
5046
greaseOf(variant.name.configurationName(isTransitive))
@@ -91,7 +87,7 @@ private fun Project.createGrease(name: String, isTransitive: Boolean): Configura
9187
return configuration
9288
}
9389

94-
private fun String.configurationName(isTransitive: Boolean) = if (isTransitive) nameOf(this, "api") else this
90+
private fun String.configurationName(isTransitive: Boolean) = if (isTransitive) nameOf(this, "tree") else this
9591

9692
// Create the root configuration. Make compileOnly extend from it so that grease
9793
// artifacts are in the classpath and we don't have compile issues.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins {
2+
alias(libs.plugins.android.library)
3+
}
4+
5+
android {
6+
namespace = "io.deepmedia.tools.grease.sample.dependency.pure"
7+
compileSdk = 34
8+
defaultConfig {
9+
minSdk = 21
10+
}
11+
}
12+
13+
dependencies {
14+
// Empty
15+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
</manifest>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.deepmedia.tools.grease.sample.dependency.pure
2+
3+
object PureDependencyClass {
4+
fun foo() = "bar"
5+
}

tests/sample-library/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ grease {
88
}
99

1010
android {
11-
namespace = "io.deepmedia.tools.grease.sample"
11+
namespace = "io.deepmedia.tools.grease.sample.library"
1212
ndkVersion = "23.1.7779620"
1313
compileSdk = 34
1414

@@ -56,15 +56,19 @@ android {
5656
}
5757

5858
dependencies {
59-
greaseApi("androidx.core:core:1.0.0")
59+
grease("androidx.core:core:1.0.0")
6060

6161
// include deps to pom when publishing
6262
api("com.google.android.material:material:1.0.0")
6363
// Includes resource and some manifest changes
6464
implementation("androidx.lifecycle:lifecycle-runtime:2.8.4")
6565

6666
// Includes native libraries
67-
greaseApi("org.tensorflow:tensorflow-lite:2.3.0")
67+
grease("org.tensorflow:tensorflow-lite:2.3.0")
6868
// Manifest changes, layout resources
6969
grease("com.otaliastudios:cameraview:2.7.2")
70+
71+
// Doesn't work. TODO: we need to configure grease configurations so that in case of multiple matching
72+
// variants, they prefer one where com.android.build.api.attributes.BuildTypeAttr is set to release
73+
// grease(project(":sample-dependency-pure"))
7074
}
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
-keepattributes SourceFile,LineNumberTable

0 commit comments

Comments
 (0)