Add AppFunctionInventory
Bug: 374924489
Test: ./gradlew appfunctions:appfunctions-runtime:assemble
Change-Id: Ib7580ae1d5e01d0db7d65f53a42162128611df04
diff --git a/appfunctions/appfunctions-runtime/build.gradle b/appfunctions/appfunctions-runtime/build.gradle
index d682879..3b37e08 100644
--- a/appfunctions/appfunctions-runtime/build.gradle
+++ b/appfunctions/appfunctions-runtime/build.gradle
@@ -31,10 +31,14 @@
dependencies {
api(libs.kotlinStdlib)
- // Add dependencies here
+
+ // Internal dependencies
+ implementation("androidx.annotation:annotation:1.9.0-rc01")
+ implementation project(":appfunctions:appfunctions-common")
}
android {
+ compileSdk = 35
namespace = "androidx.appfunctions.runtime"
}
diff --git a/appfunctions/appfunctions-runtime/src/main/java/androidx/appfunctions/internal/AppFunctionInventory.kt b/appfunctions/appfunctions-runtime/src/main/java/androidx/appfunctions/internal/AppFunctionInventory.kt
new file mode 100644
index 0000000..63cab1f
--- /dev/null
+++ b/appfunctions/appfunctions-runtime/src/main/java/androidx/appfunctions/internal/AppFunctionInventory.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.appfunctions.internal
+
+import androidx.annotation.RestrictTo
+import androidx.appfunctions.metadata.AppFunctionMetadata
+
+/**
+ * An interface providing access to metadata for a set of registered AppFunctions.
+ *
+ * This interface defines a contract for accessing metadata associated with AppFunctions. Each
+ * AppFunction implementation class has a corresponding generated inventory class that implements
+ * this interface. This inventory class provides a mapping between AppFunction IDs and their
+ * respective [AppFunctionMetadata].
+ *
+ * For example, consider the following AppFunction implementation:
+ * ```kotlin
+ * package com.example.imageeditor
+ *
+ * class ImageFunctions : RotateImage, BlurImage {
+ * @AppFunction
+ * override suspend fun rotateImage(...): Image { ... }
+ *
+ * @AppFunction
+ * override suspend fun blurImage(...): Image? { ... }
+ * }
+ * ```
+ *
+ * The generated inventory class for `ImageFunctions` would implement this interface and provide a
+ * map containing metadata for both `rotateImage` and `blurImage`.
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public interface AppFunctionInventory {
+ /** A map of function IDs to their corresponding [AppFunctionMetadata]. */
+ public val functionIdToMetadataMap: Map<String, AppFunctionMetadata>
+}