Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stability inference flags for non-jvm #1006

Open
wants to merge 18 commits into
base: release/compiler-integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ __pycache__

# Don't ignore src files under build package
!**/src/**/build
/jbdeps/android-sdk/linux/*
26 changes: 26 additions & 0 deletions .run/All tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All tests" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":compose:runtime:runtime:cleanTestDebugUnitTest" />
<option value=":compose:runtime:runtime:testDebugUnitTest" />
<option value=":compose:runtime:runtime:integration-tests:connectedAndroidTest" />
<option value=":compose:compiler:compiler-hosted:integration-tests:testDebugUnitTest" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
23 changes: 23 additions & 0 deletions .run/Compiler (Unit tests).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Compiler (Unit tests)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":compose:compiler:compiler-hosted:integration-tests:testDebugUnitTest" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
55 changes: 55 additions & 0 deletions .run/Runtime (Android integration tests).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Runtime (Android integration tests)" type="AndroidTestRunConfigurationType" factoryName="Android Instrumented Tests">
<module name="androidx.compose.runtime.runtime.integration-tests.androidTest" />
<option name="TESTING_TYPE" value="0" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="TEST_NAME_REGEX" value="" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="RETENTION_ENABLED" value="No" />
<option name="RETENTION_MAX_SNAPSHOTS" value="2" />
<option name="RETENTION_COMPRESS_SNAPSHOTS" value="false" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
24 changes: 24 additions & 0 deletions .run/Runtime (Unit tests).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Runtime (Unit tests)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":compose:runtime:runtime:cleanTestDebugUnitTest" />
<option value=":compose:runtime:runtime:testDebugUnitTest" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
82 changes: 24 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,35 @@
# Android Jetpack
# Fork of https://github.com/androidx/androidx (androidx-main branch) to test Compose Compiler

[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.androidx.dev)
TODO([email protected]): we need to test Compose Compiler for JS and Native too

Jetpack is a suite of libraries, tools, and guidance to help developers write high-quality apps easier. These components help you follow best practices, free you from writing boilerplate code, and simplify complex tasks, so you can focus on the code you care about.
## Developing in IDE

Jetpack comprises the `androidx.*` package libraries, unbundled from the platform APIs. This means that it offers backward compatibility and is updated more frequently than the Android platform, making sure you always have access to the latest and greatest versions of the Jetpack components.
1. Download Android Studio version that is specified in [libs.versions.toml](gradle/libs.versions.toml#L11)

Our official AARs and JARs binaries are distributed through [Google Maven](https://maven.google.com).
2. Open the project in Android Studio

You can learn more about using it from [Android Jetpack landing page](https://developer.android.com/jetpack).
3. Make sure that you use OpenJDK 11 in `Project settings -> Project`, and have `Gradle JVM = Project SDK` in `Settings -> Build, Executions, Deployment -> Build Tools -> Gradle`

# Contribution Guide
4. Change Kotlin version in `gradle/libs.versions.toml` if needed (search for `kotlin = `)

For contributions via GitHub, see the [GitHub Contribution Guide](CONTRIBUTING.md).
5. Run `All tests`, `Compiler (Unit tests)`, `Runtime (Unit tests)` or `Runtime (Android integration tests)` to run tests.
If you don't see them, restart Android Studio (it seems a bug).

Note: The contributions workflow via GitHub is currently experimental - only contributions to the following projects are being accepted at this time:
* [Activity](activity)
* [AppCompat](appcompat)
* [Biometric](biometric)
* [Collection](collection)
* [Compose Compiler](compose/compiler)
* [Compose Runtime](compose/runtime)
* [Core](core)
* [DataStore](datastore)
* [Fragment](fragment)
* [Lifecycle](lifecycle)
* [Navigation](navigation)
* [Paging](paging)
* [Room](room)
* [WorkManager](work)
Notes:
- To run All tests you need a connected Android device or emulator (Android studio don't run it automatically)
- Compiler tests seems don't work on Windows

## Code Review Etiquette
When contributing to Jetpack, follow the [code review etiquette](code-review.md).
## Gradle commands

## Accepted Types of Contributions
* Bug fixes - needs a corresponding bug report in the [Android Issue Tracker](https://issuetracker.google.com/issues/new?component=192731&template=842428)
* Each bug fix is expected to come with tests
* Fixing spelling errors
* Updating documentation
* Adding new tests to the area that is not currently covered by tests
* New features to existing libraries if the feature request bug has been approved by an AndroidX team member.
1. Gradle command to build Compose Compiler:
```
export COMPOSE_CUSTOM_VERSION=0.0.0-custom2
./gradlew compose:compiler:compiler:publishMavenPublicationToLocalRepository
```
The artifact `androidx.compose.compiler:compiler:0.0.0-custom2` will be in `~/.m2/repository/androidx/compose/compiler/compiler/0.0.0-custom2`

We **are not** currently accepting new modules.

## Checking Out the Code

Head over to the [onboarding docs](docs/onboarding.md) to learn more about getting set up and the
development workflow!

### Continuous integration
[Our continuous integration system](https://ci.android.com/builds/branches/aosp-androidx-main/grid?) builds all in progress (and potentially unstable) libraries as new changes are merged. You can manually download these AARs and JARs for your experimentation.

## Password and Contributor Agreement before making a change
Before uploading your first contribution, you will need setup a password and agree to the contribution agreement:

Generate a HTTPS password:
https://android-review.googlesource.com/new-password

Agree to the Google Contributor Licenses Agreement:
https://android-review.googlesource.com/settings/new-agreement

## Getting reviewed
* After you run repo upload, open [r.android.com](http://r.android.com)
* Sign in into your account (or create one if you do not have one yet)
* Add an appropriate reviewer (use git log to find who did most modifications on the file you are fixing or check the OWNERS file in the project's directory)

## Handling binary dependencies
AndroidX uses git to store all the binary Gradle dependencies. They are stored in `prebuilts/androidx/internal` and `prebuilts/androidx/external` directories in your checkout. All the dependencies in these directories are also available from `google()`, or `mavenCentral()`. We store copies of these dependencies to have hermetic builds. You can pull in [a new dependency using our importMaven tool](development/importMaven/README.md).
2. Gradle command to test Compose Runtime:
```
./gradlew :compose:runtime:runtime:testDebugUnitTest :compose:runtime:runtime:integration-tests:connectedAndroidTest :compose:compiler:compiler-hosted:integration-tests:testDebugUnitTest
```
It runs unit tests and Android tests (there should be a connected Android device or emulator)
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ abstract class AndroidXExtension(val project: Project) : ExtensionAware, Android

val listProjectsService: Provider<ListProjectsService>

private val composeCustomVersion = project.providers.environmentVariable("COMPOSE_CUSTOM_VERSION")
private val composeCustomGroup = project.providers.environmentVariable("COMPOSE_CUSTOM_GROUP")

private val versionService: LibraryVersionsService

val deviceTests = DeviceTests.register(project.extensions)
Expand Down Expand Up @@ -186,12 +189,17 @@ abstract class AndroidXExtension(val project: Project) : ExtensionAware, Android
return null
}
// convert parent project path to groupId
val groupIdText =
if (projectPath.startsWith(":external")) {
projectPath.replace(":external:", "")
val groupIdText = if (projectPath.startsWith(":external")) {
projectPath.replace(":external:", "")
} else {
"androidx.${parentPath.substring(1).replace(':', '.')}"
}.let {
if (it.contains("compose") && composeCustomGroup.isPresent) {
it.replace("androidx.compose", composeCustomGroup.get())
} else {
"androidx.${parentPath.substring(1).replace(':', '.')}"
it
}
}

// get the library group having that text
val result = libraryGroupsByGroupId[groupIdText]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ constructor(private val componentFactory: SoftwareComponentFactory) : Plugin<Pro
it.configureWithAndroidXExtension(extension)
}
project.configureConstraintsWithinGroup(extension)
project.validateProjectParser(extension)
project.validateAllArchiveInputsRecognized()
// project.validateProjectParser(extension)
// project.validateAllArchiveInputsRecognized()
project.afterEvaluate {
if (extension.shouldPublishSbom()) {
project.configureSbomPublishing()
Expand Down Expand Up @@ -243,7 +243,7 @@ constructor(private val componentFactory: SoftwareComponentFactory) : Plugin<Pro
task.maxHeapSize = "3g"

// For non-playground setup use robolectric offline
if (!ProjectLayoutType.isPlayground(project)) {
if (false) {
task.systemProperty("robolectric.offline", "true")
val robolectricDependencies =
File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ abstract class AndroidXRootImplPlugin : Plugin<Project> {

maybeRegisterFilterableTask()

val isJBFork = true
// If we're running inside Studio, validate the Android Gradle Plugin version.
val expectedAgpVersion = System.getenv("EXPECTED_AGP_VERSION")
if (properties.containsKey("android.injected.invoked.from.ide")) {
if (!isJBFork && properties.containsKey("android.injected.invoked.from.ide")) {
if (expectedAgpVersion != ANDROID_GRADLE_PLUGIN_VERSION) {
throw GradleException(
"""
Expand Down
6 changes: 2 additions & 4 deletions buildSrc/public/src/main/kotlin/androidx/build/SdkHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ fun Project.getSdkDependency(): FileTree =

/** Returns the root project's platform-specific SDK path as a file. */
fun Project.getSdkPath(): File {
if (
rootProject.plugins.hasPlugin("AndroidXPlaygroundRootPlugin") ||
System.getenv("COMPOSE_DESKTOP_GITHUB_BUILD") != null
) {
val isJBFork = true
if (isJBFork) {
// This is not full checkout, use local settings instead.
// https://developer.android.com/studio/command-line/variables
// check for local.properties first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ abstract class SdkResourceGenerator : DefaultTask() {

@JvmStatic
fun generateForHostTest(project: Project) {
// We have this error on Windows:
// Could not create task ':compose:compiler:compiler:integration-tests:generateSdkResource'.
// > this and base files have different roots: ~\.m2\repository and ...\compose-jb\compose\frameworks\support\compose\compiler\compiler\integration-tests.
val os = System.getProperty("os.name").lowercase()
if (os.startsWith("win")) return

val provider = registerSdkResourceGeneratorTask(project)
val extension = project.extensions.getByType<JavaPluginExtension>()
val testSources = extension.sourceSets.getByName("test")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/public/src/main/kotlin/androidx/build/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ data class Version(val major: Int, val minor: Int, val patch: Int, val extra: St
private const val serialVersionUID = 345435634563L

private val VERSION_FILE_REGEX = Pattern.compile("^(res-)?(.*).txt$")
private val VERSION_REGEX = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)(-.+)?$")
private val VERSION_REGEX = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)((?:\\.\\d+)?(?:-.+)?)?$")

private fun checkedMatcher(versionString: String): Matcher {
val matcher = VERSION_REGEX.matcher(versionString)
Expand Down
18 changes: 16 additions & 2 deletions buildSrc/repos.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,28 @@ def addMavenRepositories(RepositoryHandler handler) {
}
}
}
if (System.getenv("ALLOW_PUBLIC_REPOS") != null || System.getProperty("ALLOW_PUBLIC_REPOS") != null) {
def isJBFork = true
if (isJBFork) {
handler.maven {
url("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
}
handler.mavenLocal()
handler.mavenCentral()
handler.google()
handler.gradlePluginPortal()
handler.maven {
url("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
handler.mavenLocal()
handler.maven {
url("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
// TODO(b/280646217): Remove after official release to gmaven.
handler.maven {
url("https://storage.googleapis.com/r8-releases/raw")
content {
includeModule("com.android.tools", "r8")
}
}
}
// Ordering appears to be important: b/229733266
def androidPluginRepoOverride = System.getenv("GRADLE_PLUGIN_REPO")
Expand Down
1 change: 1 addition & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include ":imports:stableaidl-gradle-plugin"
dependencyResolutionManagement {
versionCatalogs {
libs {
//from(files("../gradle/libs.versions.toml"))
def agpOverride = System.getenv("GRADLE_PLUGIN_VERSION")
if (agpOverride != null) {
logger.warn("Using custom version ${agpOverride} of AGP due to GRADLE_PLUGIN_VERSION being set.")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/settingsScripts/project-dependency-graph.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class ProjectDependencyGraph {
// fixed.
// This option is supported so that development/simplify_build_failure.sh can try
// deleting entire projects at once to identify the cause of a build failure
if (System.getenv("ALLOW_MISSING_PROJECTS") == null) {
if (System.getenv("ALLOW_MISSING_PROJECTS") == null && false) {
throw new Exception("Path " + buildGradle + " does not exist;" +
"cannot include project " + projectPath + " ($projectDir)")
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/shared.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += [
"-Werror",
//"-Werror",
"-Xskip-metadata-version-check"
]
languageVersion = "1.8"
Expand Down
Loading