-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JavaDocs and Refactoring between AndroidUtils and SourceSetsModelBuilder
Changes: - Added JavaDocs to AndroidUtils - Added SourceSetUtils for common utility methods for SourceSets. - Removed common method declarations from AndroidUtils and SourceSetsModelBuilder into SourceSetUtils.
- Loading branch information
1 parent
aca03ac
commit 2cd01ff
Showing
4 changed files
with
100 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
plugin/src/main/java/com/microsoft/java/bs/gradle/plugin/utils/SourceSetUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.microsoft.java.bs.gradle.plugin.utils; | ||
|
||
/** | ||
* Utility class for common source set operations. | ||
*/ | ||
public class SourceSetUtils { | ||
|
||
private SourceSetUtils() { | ||
} | ||
|
||
/** | ||
* Returns the gradle project path without the initial {@code :}. | ||
* | ||
* @param projectPath project path to operate upon | ||
*/ | ||
public static String stripPathPrefix(String projectPath) { | ||
if (projectPath.startsWith(":")) { | ||
return projectPath.substring(1); | ||
} | ||
return projectPath; | ||
} | ||
|
||
/** | ||
* Return a project task name - [project path]:[task]. | ||
* | ||
* @param modulePath path of project module | ||
* @param taskName name of gradle task | ||
*/ | ||
public static String getFullTaskName(String modulePath, String taskName) { | ||
if (taskName == null) { | ||
return null; | ||
} | ||
if (taskName.isEmpty()) { | ||
return taskName; | ||
} | ||
|
||
if (modulePath == null || modulePath.equals(":")) { | ||
// must be prefixed with ":" as taskPaths are reported back like that in progress messages | ||
return ":" + taskName; | ||
} | ||
return modulePath + ":" + taskName; | ||
} | ||
|
||
} |