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

[Xamarin.Android.Build.Tasks] use --input-list for CompileToDalvik. #2187

Merged
merged 2 commits into from
Sep 21, 2018

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Sep 16, 2018

The dx tool has an additional argument --input-list which
can be used to provide a list of .jar, .class or .zip
files to the tool.

This will help with reducing the length of the command line
on larger apps with allot of java references.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is good if the Windows build is green.

}
sw.WriteLine (zip);
foreach (var jar in JavaLibrariesToCompile)
sw.WriteLine (jar.ItemSpec);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here: do we need to quote the paths?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird this is what happens on Mac if I quote the files in the input list

/usr/bin/java -Xmx1G -jar /Users/dean/android-toolchain/sdk/build-tools/28.0.0/lib/dx.jar --dex --no-strict --input-list=/var/folders/n_/vt_nzq1n04schx5yy2jgcgcw0000gn/T/tmp799bbfa5.tmp --output obj/Debug/android/bin 
  
  UNEXPECTED TOP-LEVEL EXCEPTION:
  java.lang.RuntimeException: "/Users/dean/Documents/Sandbox/Xamarin/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v9.0/mono.android.jar": file not found
  	at com.android.dex.util.FileUtils.readFile(FileUtils.java:51)
  	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:168)
  	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:143)
  	at com.android.dx.command.dexer.Main.processOne(Main.java:678)
  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:575)
  	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:310)
  	at com.android.dx.command.dexer.Main.runDx(Main.java:288)
  	at com.android.dx.command.dexer.Main.main(Main.java:244)
  	at com.android.dx.command.Main.main(Main.java:95)

This is the file

"/Users/dean/Documents/Sandbox/Xamarin/xamarin-android/bin/TestDebug/temp/BuildReleaseAppWithA InIt(FalseFalseFalse)/obj/Debug/android/bin/classes.zip"
"/Users/dean/Documents/Sandbox/Xamarin/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v9.0/mono.android.jar"
"/Users/dean/Documents/Sandbox/Xamarin/xamarin-android/bin/TestDebug/temp/BuildReleaseAppWithA InIt(FalseFalseFalse)/Hello (World).jar"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Mac does not like quotes... I will test on windows.

throw new FileNotFoundException ($"'{zip}' does not exist. Please rebuild the project.");
}
sw.WriteLine (zip);
foreach (var jar in JavaLibrariesToCompile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation/scope implies that you can't have both JavaLibrariesToCompile and AlternativeJarFiles at the same time. Is this intentional? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, this is just a rework of the existing code. Will need to look at when AlternativeJarFiles were added.

}
sw.WriteLine (zip);
foreach (var jar in JavaLibrariesToCompile)
sw.WriteLine (jar.ItemSpec);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Path.GetFullPath (jar.ItemSpec)?

@dellis1972
Copy link
Contributor Author

@jonpryor OK so I tested the Input list on Windows. If you include Quotes you get the same error as you do on Mac

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\mono.android.jar": file not found
        at com.android.dex.util.FileUtils.readFile(FileUtils.java:51)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:169)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:679)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:576)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:313)
        at com.android.dx.command.dexer.Main.runDx(Main.java:291)
        at com.android.dx.command.dexer.Main.main(Main.java:247)
        at com.android.dx.command.Main.main(Main.java:94)

Without Quotes, paths with spaces work fine. Here is a sample of the test one I used on Windows

c:\Sandbox\Some Folder\AppWithSpaces\AppWithSpaces\obj\Debug\81\android\bin\classes.zip
C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\mono.android.jar
obj\Debug\81\lp\1\jl\arch-core-common.jar
obj\Debug\81\lp\10\jl\bin\classes.jar
obj\Debug\81\lp\11\jl\bin\classes.jar
obj\Debug\81\lp\12\jl\bin\classes.jar
obj\Debug\81\lp\13\jl\bin\classes.jar
obj\Debug\81\lp\14\jl\bin\classes.jar
obj\Debug\81\lp\15\jl\bin\classes.jar
obj\Debug\81\lp\2\jl\arch-lifecycle-common.jar
obj\Debug\81\lp\3\jl\bin\classes.jar
obj\Debug\81\lp\4\jl\bin\classes.jar
obj\Debug\81\lp\6\jl\bin\classes.jar
obj\Debug\81\lp\7\jl\bin\classes.jar
obj\Debug\81\lp\8\jl\bin\classes.jar
obj\Debug\81\lp\9\jl\bin\classes.jar

@dellis1972
Copy link
Contributor Author

build

1 similar comment
@dellis1972
Copy link
Contributor Author

build

The `dx` tool has an additional argument `--input-list` which
can be used to provide a list of `.jar`, `.class` or `.zip`
files to the tool.

This will help with reducing the length of the command line
on larger apps with allot of jav references.
@@ -47,6 +47,7 @@
+ [XA1000](xa1000.md): There was an problem parsing {file}. This is likely due to incomplete or invalid xml.
+ [XA1001](xa1001.md): AndroidResgen: Warning while updating Resource XML '{filename}': {Message}
+ [XA1002](xa1002.md): We found a matching key '{Key}' for '{Item}'. But the casing was incorrect. Please correct the casing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After upgrading a visual studio i am getting this error in all of the xml for namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prash6001 can you open an issue and provide Diagnostic build logs so someone can give you a had to narrow down the cause.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants