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 wired build error #4158

Merged
merged 1 commit into from
Apr 21, 2024
Merged

Conversation

Bambooin
Copy link
Contributor

Description

Error:

$ ./gradlew assembleFdroidRelease

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'amaze'.
> Could not create an instance of type org.gradle.accessors.dm.LibrariesForLibs.
   > Could not generate a decorated class for type LibrariesForLibs.
      > org/gradle/accessors/dm/LibrariesForLibs$AndroidxLibraryAccessors (wrong name: org/gradle/accessors/dm/LibrariesForLibs$AndroidXLibraryAccessors)

Analysis:
Find all string AndroidxLibraryAccessors

grep -r AndroidXLibraryAccessors .

Before:

/**
 * A catalog of dependencies accessible via the `libs` extension.
*/
@NonNullApi
public class LibrariesForLibs extends AbstractExternalDependencyFactory {

    private final AbstractExternalDependencyFactory owner = this;
    private final AcraLibraryAccessors laccForAcraLibraryAccessors = new AcraLibraryAccessors(owner);
    private final AmazeLibraryAccessors laccForAmazeLibraryAccessors = new AmazeLibraryAccessors(owner);

    private final AndroidXLibraryAccessors laccForAndroidXLibraryAccessors = new AndroidXLibraryAccessors(owner);
    private final AndroidxLibraryAccessors laccForAndroidxLibraryAccessors = new AndroidxLibraryAccessors(owner);

After:

/**
 * A catalog of dependencies accessible via the `libs` extension.
*/
@NonNullApi
public class LibrariesForLibs extends AbstractExternalDependencyFactory {

    private final AbstractExternalDependencyFactory owner = this;
    private final AcraLibraryAccessors laccForAcraLibraryAccessors = new AcraLibraryAccessors(owner);
    private final AmazeLibraryAccessors laccForAmazeLibraryAccessors = new AmazeLibraryAccessors(owner);
    private final AndroidXLibraryAccessors laccForAndroidXLibraryAccessors = new AndroidXLibraryAccessors(owner);
    private final ApacheLibraryAccessors laccForApacheLibraryAccessors = new ApacheLibraryAccessors(owner);

No class conflict(AndroidXLibraryAccessors vs AndroidxLibraryAccessors) anymore.

Root cause:
Seems this bug only show up on gradle 7.x(7.5 and 7.6.4) not gradle 8.7.

macOS is not a case sensitive file system by default, so the CI passed in Linux and failed in macOS.

Issue tracker

Fixes #4157

Automatic tests

  • Added test cases

Manual tests

  • Done

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@Bambooin
Copy link
Contributor Author

Seems this issue also in branch https://github.com/TeamAmaze/AmazeFileManager/tree/release/3.10

This regression is on #4092

Fix TeamAmaze#4157

Error:
```
$ ./gradlew assembleFdroidRelease

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'amaze'.
> Could not create an instance of type org.gradle.accessors.dm.LibrariesForLibs.
   > Could not generate a decorated class for type LibrariesForLibs.
      > org/gradle/accessors/dm/LibrariesForLibs$AndroidxLibraryAccessors (wrong name: org/gradle/accessors/dm/LibrariesForLibs$AndroidXLibraryAccessors)
```

Analysis:
Find all string `AndroidxLibraryAccessors`

```
grep -r AndroidXLibraryAccessors .
```

Before:
```
/**
 * A catalog of dependencies accessible via the `libs` extension.
*/
@NonNullApi
public class LibrariesForLibs extends AbstractExternalDependencyFactory {

    private final AbstractExternalDependencyFactory owner = this;
    private final AcraLibraryAccessors laccForAcraLibraryAccessors = new AcraLibraryAccessors(owner);
    private final AmazeLibraryAccessors laccForAmazeLibraryAccessors = new AmazeLibraryAccessors(owner);

    private final AndroidXLibraryAccessors laccForAndroidXLibraryAccessors = new AndroidXLibraryAccessors(owner);
    private final AndroidxLibraryAccessors laccForAndroidxLibraryAccessors = new AndroidxLibraryAccessors(owner);
```

After:
```
/**
 * A catalog of dependencies accessible via the `libs` extension.
*/
@NonNullApi
public class LibrariesForLibs extends AbstractExternalDependencyFactory {

    private final AbstractExternalDependencyFactory owner = this;
    private final AcraLibraryAccessors laccForAcraLibraryAccessors = new AcraLibraryAccessors(owner);
    private final AmazeLibraryAccessors laccForAmazeLibraryAccessors = new AmazeLibraryAccessors(owner);
    private final AndroidXLibraryAccessors laccForAndroidXLibraryAccessors = new AndroidXLibraryAccessors(owner);
    private final ApacheLibraryAccessors laccForApacheLibraryAccessors = new ApacheLibraryAccessors(owner);
```

No class conflict(AndroidXLibraryAccessors vs AndroidxLibraryAccessors) anymore.

Root cause:
Seems this bug only show up on gradle 7.x(7.5 and 7.6.4) not gradle 8.7.

macOS is not a case sensitive file system by default, so the CI passed in Linux and failed in macOS.
@Bambooin Bambooin force-pushed the wired-build-error branch from cb58017 to fcd5b81 Compare April 21, 2024 03:02
@VishalNehra VishalNehra merged commit 1435fc1 into TeamAmaze:release/4.0 Apr 21, 2024
3 checks passed
@VishalNehra
Copy link
Member

Was wondering why it was failing on my mac. Thanks for this :)

@VishalNehra VishalNehra added this to the v4.0 milestone Apr 21, 2024
@Bambooin Bambooin deleted the wired-build-error branch April 21, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to build Amaze
2 participants