# 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


```
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.6/com/android/build/api/artifact/Artifact) ||||
|   | ↳ | [com.android.build.api.artifact.Artifact.Single](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact.Single) |||
|   |   | ↳ | [com.android.build.api.artifact.ScopedArtifact](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/ScopedArtifact) ||
|   |   |   | ↳ | [com.android.build.api.artifact.ScopedArtifact.CLASSES](https://developer.android.com/reference/tools/gradle-api/9.6/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 `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/ScopedArtifact.POST_COMPILATION_CLASSES` plus anything added to `https://developer.android.com/reference/tools/gradle-api/9.6/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 `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/ScopedArtifact.CLASSES` and append to it as it would create a circular dependency.

Instead, consume `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/ScopedArtifact.POST_COMPILATION_CLASSES` and use `https://developer.android.com/reference/tools/gradle-api/9.6/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.6/com/android/build/api/artifact/Artifact) `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact#getFileSystemLocationName()()` `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact#getFolderName()()` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/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.6/com/android/build/api/artifact/Artifact) `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact.Category` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact#category()` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/ArtifactKind<https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html>` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/artifact/Artifact#kind()`