# ScopedArtifact.CLASSES

[View Source](https://cs.android.com/search?q=file:com/android/build/api/artifact/ScopedArtifact.kt+class:com.android.build.api.artifact.ScopedArtifact.CLASSES)  
Added in 7.4.0  

<br />

```
object ScopedArtifact.CLASSES : ScopedArtifact, Artifact.Appendable, Artifact.Transformable, Artifact.Replaceable
```

<br />

|---|---|---|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                       |||||
| ↳ | [com.android.build.api.artifact.Artifact](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact)                                      ||||
|   | ↳ | [com.android.build.api.artifact.Artifact.Single](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact.Single)                     |||
|   |   | ↳ | [com.android.build.api.artifact.ScopedArtifact](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact)                    ||
|   |   |   | ↳ | [com.android.build.api.artifact.ScopedArtifact.CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.CLASSES) |

*** ** * ** ***

.class files, result of sources compilation and/or external dependencies depending on the scope; includes users' transformation, but does not include Jacoco instrumentation

content of[POST_COMPILATION_CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.POST_COMPILATION_CLASSES)plus anything added to[CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.CLASSES)after compilation.

You should use this if you just need to consume all the classes that will be packaged in the project.

If you need to generate bytecodes post compilation and also need to have access to the compiled classes, you cannot directly consume[CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.CLASSES)and append to it as it would create a circular dependency.

Instead, consume[POST_COMPILATION_CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.POST_COMPILATION_CLASSES)and use[CLASSES](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ScopedArtifact.CLASSES)to append your bytecodes to.  

```dart
extension.onVariants(extension.selector().withBuildType("debug")) { variant ->
    val generatorTask = project.tasks.register(
         "postCompilation${variant.name.capitalizeFirstChar()}Task",
         AddPostCompilationCodeGeneratorTask::class.java) { task ->
             // configure your task
         }

    // consume the result of compilation
    variant.artifacts.forScope(Scope.PROJECT)
         .use(generatorTask)
         .toGet(
             ScopedArtifact.POST_COMPILATION_CLASSES,
             AddPostCompilationCodeGeneratorTask::jars,
             AddPostCompilationCodeGeneratorTask::dirs
    )

    // and produce the new bytecodes.
    variant.artifacts.forScope(Scope.PROJECT)
        .use(generatorTask)
        .toAppend(ScopedArtifact.CLASSES, AddPostCompilationCodeGeneratorTask::outputDir)
}
```

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.android.build.api.artifact.Artifact](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact) |-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `open `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getFileSystemLocationName](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact#getFileSystemLocationName())`()`    | | `open `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getFolderName](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact#getFolderName())`()`                            | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)        | [name](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact#name())`()` Provide a unique name for the artifact type. | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.android.build.api.artifact.Artifact](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact) |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| | [Artifact.Category](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact.Category)                                                                                    | [category](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact#category()) | | [ArtifactKind](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/ArtifactKind)`<`[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)`>` | [kind](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/artifact/Artifact#kind())         | |