-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
140 additions
and
32 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
48 changes: 48 additions & 0 deletions
48
src/main/java/org/gradle/profiler/studio/StudioInstallDirSupplier.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,48 @@ | ||
package org.gradle.profiler.studio; | ||
|
||
import org.gradle.profiler.InvocationSettings; | ||
import org.gradle.profiler.ide.DefaultIdeProvider; | ||
import org.gradle.profiler.ide.Ide; | ||
import org.gradle.profiler.ide.IdeProvider; | ||
import org.gradle.profiler.ide.idea.IDEA; | ||
import org.gradle.profiler.ide.studio.AndroidStudio; | ||
import org.gradle.profiler.studio.invoker.StudioGradleScenarioDefinition.StudioGradleBuildConfiguration; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.function.Supplier; | ||
|
||
public class StudioInstallDirSupplier implements Supplier<Path> { | ||
|
||
private final InvocationSettings invocationSettings; | ||
|
||
private final StudioGradleBuildConfiguration buildConfiguration; | ||
|
||
private final IdeProvider<Ide> ideProvider; | ||
|
||
public StudioInstallDirSupplier(InvocationSettings invocationSettings, StudioGradleBuildConfiguration buildConfiguration) { | ||
this.invocationSettings = invocationSettings; | ||
this.buildConfiguration = buildConfiguration; | ||
this.ideProvider = new DefaultIdeProvider(); | ||
} | ||
|
||
@Override | ||
public Path get() { | ||
File studioInstallDir = invocationSettings.getStudioInstallDir(); | ||
if (studioInstallDir != null) { | ||
return studioInstallDir.toPath(); | ||
} | ||
|
||
Ide ide; | ||
if (buildConfiguration.getIdeType().equals("IC")) { | ||
ide = new IDEA(buildConfiguration.getIdeVersion()); | ||
} else if (buildConfiguration.getIdeType().equals("AI")) { | ||
ide = new AndroidStudio(buildConfiguration.getIdeVersion()); | ||
} else { | ||
throw new IllegalArgumentException("Unknown IDE product was requested"); | ||
} | ||
|
||
return ideProvider.provideIde(ide, Paths.get("/Users/sopivalov/Projects/foo"), Paths.get("/Users/sopivalov/Projects/foo/downloads")).toPath(); | ||
} | ||
} |
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
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