-
Notifications
You must be signed in to change notification settings - Fork 395
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
Fixing #529 #565
Fixing #529 #565
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,8 +265,15 @@ private void addClassesToClasspath( UnpackedLibHelper helper, MavenProject proje | |
throw new MavenExecutionException( "Could not add " + classesJar.getName() + " as dependency", e ); | ||
} | ||
|
||
// Add the classes to the classpath | ||
final Dependency dependency = createSystemScopeDependency( artifact, classesJar, "extracted" ); | ||
|
||
// Modify the classpath to use an extracted dex file. This will overwrite | ||
// any exisiting dependencies with the same information. | ||
final Dependency dependency = createSystemScopeDependency( artifact, classesJar, null ); | ||
final Dependency providedJar = findProvidedDependencies( dependency, project ); | ||
if ( providedJar != null ) | ||
{ | ||
project.getModel().removeDependency( providedJar ); | ||
} | ||
project.getModel().addDependency( dependency ); | ||
} | ||
|
||
|
@@ -285,5 +292,25 @@ private Dependency createSystemScopeDependency( Artifact artifact, File location | |
dependency.setSystemPath( location.getAbsolutePath() ); | ||
return dependency; | ||
} | ||
|
||
private Dependency findProvidedDependencies( Dependency dexDependency, MavenProject project ) | ||
{ | ||
for ( Dependency dependency : project.getDependencies() ) | ||
{ | ||
if ( dependency.getScope().equals( Artifact.SCOPE_PROVIDED ) ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are they always going to be SCOPE_PROVIDED? What dependency are you looking for the AAR or it's contained JAR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'll update to explicitly look for jar types. |
||
{ | ||
if ( dependency.getArtifactId().equals( dexDependency.getArtifactId() ) | ||
&& dependency.getGroupId().equals( dexDependency.getGroupId() ) | ||
&& dependency.getType().equals( dexDependency.getType() ) | ||
&& dependency.getVersion().equals( dexDependency.getVersion() ) ) | ||
{ | ||
return dependency; | ||
} | ||
} | ||
} | ||
return null; | ||
|
||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not using an extracted dex file though is it?
It's using the classes.jar from an unpacked aar lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'm used to the classes.dex in an apk. I'll fix the doc.