[ https://issues.apache.org/jira/browse/CB-9149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14582872#comment-14582872 ]
ASF GitHub Bot commented on CB-9149: ------------------------------------ Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-android/pull/182#discussion_r32287653 --- Diff: bin/templates/cordova/lib/build.js --- @@ -245,18 +258,29 @@ var builders = { } } + var name=extractRealProjectNameFromManifest(ROOT); var subProjectsAsGradlePaths = subProjects.map(function(p) { return ':' + p.replace(/[/\\]/g, ':'); }); + //Remove the proj.id/name- prefix from projects + var settingsGradlePaths = subProjects.map(function(p){ + var realDir=p.replace(/[/\\]/g, ':'); + var libName=realDir.replace(name+'-',''); + var str='include ":'+libName+'"\n'; + if(realDir.indexOf(name+'-')!==-1) + str+='project(":'+libName+'").projectDir = new File("'+p+'")\n'; + return str; + }); + // Write the settings.gradle file. fs.writeFileSync(path.join(projectPath, 'settings.gradle'), '// GENERATED FILE - DO NOT EDIT\n' + - 'include ":"\n' + - 'include "' + subProjectsAsGradlePaths.join('"\ninclude "') + '"\n'); + 'include ":"\n' + settingsGradlePaths.join('')); // Update dependencies within build.gradle. var buildGradle = fs.readFileSync(path.join(projectPath, 'build.gradle'), 'utf8'); var depsList = ''; subProjectsAsGradlePaths.forEach(function(p) { --- End diff -- nit: delete subProjectsAsGradlePaths, and just loop on subProjects here. > Make gradle alias subprojects in order to handle libs that depend on libs > ------------------------------------------------------------------------- > > Key: CB-9149 > URL: https://issues.apache.org/jira/browse/CB-9149 > Project: Apache Cordova > Issue Type: Improvement > Components: Android > Affects Versions: Master > Reporter: Tony Homer > Assignee: Tony Homer > > Currently there is an issue with how references for libraries are created in > gradle. > 1. project A includes a plugin that includes 2 frameworks: B and C > 2. framework C depends on framework B > 3. C will not be able to resolve B because the reference will be prefixed > with the project name (e.g., com.plugin.id/C wants com.plugin.id/B, but only > com.plugin.id/A-B exists) > For a concrete example, see: > https://github.com/01org/APKexpansion > The relevant frameworks are: > {code} > <framework src="AndroidLibrary/GoogleExtras/play_licensing/library" > custom="true" /> > <framework > src="AndroidLibrary/GoogleExtras/play_apk_expansion/downloader_library" > custom="true"/> > {code} > The downloader library (downloader_library) depends on the licensing library > (library). However, the references in the project will be created with > prefixes that will prevent the downloader library from resolving licensing > library: > {code} > org.apache.cordova.xapkreader/projectName-library > org.apache.cordova.xapkreader/projectName-downloader_library > {code} > In order to fix this, settings.gradle should prefix the framework directory, > but omit the prefix in the framework references: > {code} > include ":org.apache.cordova.xapkreader:library" > project(":org.apache.cordova.xapkreader:library").projectDir = new > File("org.apache.cordova.xapkreader/projectName-library") > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org