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

How to publishToMavenLocal AttachExtended on Linux (Windows 10's WSL 2.0 -> Ubuntu) OS? #10

Open
ctoabidmaqbool opened this issue Aug 6, 2024 · 2 comments

Comments

@ctoabidmaqbool
Copy link

11:10:17 AM: Executing 'publishToMavenLocal'...

Starting Gradle Daemon...
Gradle Daemon started in 24 s 530 ms
> Task :log:compileJava
> Task :log:processResources
> Task :log:classes
> Task :log:jar
> Task :log:assemble

> Task :log:javadoc
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/com/gluonhq/attachextended/log/impl/AndroidLogService.java:32: warning: no comment
public class AndroidLogService implements LogService {
       ^
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/com/gluonhq/attachextended/log/impl/DesktopLogService.java:35: warning: no comment
public class DesktopLogService implements LogService {
       ^
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/com/gluonhq/attachextended/log/impl/DummyLogService.java:32: warning: no comment
public abstract class DummyLogService implements LogService {
                ^
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/com/gluonhq/attachextended/log/impl/IOSLogService.java:32: warning: no comment
public class IOSLogService implements LogService {
       ^
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/com/gluonhq/attachextended/log/LogService.java:33: warning: no comment
public interface LogService {
       ^
/mnt/d/JavaFx-Android/AttachExtended/modules/log/src/main/java/module-info.java:28: warning: no comment
module com.gluonhq.attachextended.log {
^
6 warnings

> Task :log:javadocJar
> Task :log:sourcesJar
> Task :log:compileTestJava NO-SOURCE
> Task :log:processTestResources NO-SOURCE
> Task :log:testClasses UP-TO-DATE
> Task :log:test NO-SOURCE
> Task :log:check UP-TO-DATE
> Task :log:build
Download https://repo.maven.apache.org/maven2/com/gluonhq/attach/util/4.0.20/util-4.0.20-android.jar, took 5 s 575 ms

> Task :log:androidBuild FAILED
/usr/bin/env: ‘bash\r’: No such file or directory

FAILURE: Build failed with an exception.

* Where:
Script '/mnt/d/JavaFx-Android/AttachExtended/gradle/native-build.gradle' line: 220

* What went wrong:
Execution failed for task ':log:androidBuild'.
> Process 'command '/mnt/d/JavaFx-Android/AttachExtended/modules/log/build/aar/gradlew'' finished with non-zero exit value 127

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 5m 20s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
7 actionable tasks: 7 executed
11:16:11 AM: Execution finished 'publishToMavenLocal'.

Steps to Reproduce the issue,

  1. Checkout AttachExtended repo using TortiseGit on Windows 10 on specific directory.
  2. Open Project in intelliJ IDEA Community Edition (Ubuntu-20.04) / WSL terminal (Ubuntu terminal using wsl command)
  3. Run ./gradlew publishToMavenLocal
@ctoabidmaqbool
Copy link
Author

Resolution:

Modify gradle/native-build.gradle line no 217 - 225:

import org.apache.tools.ant.taskdefs.condition.Os // line no. 1

// build aar
def gradlewFile = file("$tempDir/gradlew")

if (Os.isFamily(Os.FAMILY_UNIX)) {
    exec {
        commandLine 'dos2unix', gradlewFile.getAbsolutePath()
    }
}

def aarArgs = ["-p", file("$tempDir/library").getAbsolutePath(), "assembleDebug"].flatten()
exec {
    environment ANDROID_HOME: sdk, JAVA_HOME: JAVAHOME
    executable gradlewFile.getAbsolutePath()
    args aarArgs
}

@ctoabidmaqbool
Copy link
Author

Moreover if you want to run gradlew using linux, which was checkout using window style e.g. TortiseGit:

sudo apt-get install dos2unix
dos2unix gradlew

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

No branches or pull requests

1 participant