gluonhq / AttachExtended

An extension of Gluon Attach, showing how to create custom Attach services
GNU General Public License v3.0
3 stars 6 forks source link

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

Open ctoabidmaqbool opened 1 month ago

ctoabidmaqbool commented 1 month ago
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 commented 1 month ago

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 commented 1 month ago

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