Skip to content

Commit

Permalink
Support checking out NiA to directory with or without hypens, central…
Browse files Browse the repository at this point in the history
…ize project detection
  • Loading branch information
tresat committed May 22, 2024
1 parent 5cf96fc commit ad3e19a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void linkDslModelToPlugin(Project project, AndroidApplication dslModel)
});

// TODO: All this configuration should be moved to the NiA project
if (Objects.equals(project.getRootProject().getName(), NiaSupport.NIA_PROJECT_NAME)) {
if (NiaSupport.isNiaProject(project)) {
// ProductFlavors are automatically added by the LIBRARY plugin via NiA support only, ATM, so we
// need to make sure any Android APPLICATION projects have the necessary attributes for project deps to work.
configureContentTypeAttributes(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void linkDslModelToPlugin(Project project, AndroidLibrary dslModel) {
super.linkDslModelToPlugin(project, dslModel, android);

// TODO: All this configuration should be moved to the NiA project
if (Objects.equals(project.getRootProject().getName(), NiaSupport.NIA_PROJECT_NAME)) {
if (NiaSupport.isNiaProject(project)) {
NiaSupport.configureNiaLibrary(project, dslModel);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@
* This class is not meant to be used by other projects.
*/
public final class NiaSupport {
public static final String NIA_PROJECT_NAME = "now-in-android";
public static final String NIA_PROJECT_NAME = "nowinandroid";

private NiaSupport() { /* Not instantiable */ }

public static boolean isNiaProject(Project project) {
return Objects.equals(project.getRootProject().getName().replaceAll("\\\\-", ""), NiaSupport.NIA_PROJECT_NAME);
}

public static void configureNiaLibrary(Project project, AndroidSoftware dslModel) {
LibraryExtension androidLib = project.getExtensions().getByType(LibraryExtension.class);
LibraryAndroidComponentsExtension androidLibComponents = project.getExtensions().getByType(LibraryAndroidComponentsExtension.class);
Expand Down

0 comments on commit ad3e19a

Please sign in to comment.