org.gradle.api.initialization.Settings Java Examples
The following examples show how to use
org.gradle.api.initialization.Settings.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CredentialsPlugin.java From gradle-credentials-plugin with Apache License 2.0 | 6 votes |
@SuppressWarnings("NullableProblems") @Override public void apply(ExtensionAware extensionAware) { // abort if old Gradle version is not supported if (GradleVersion.current().getBaseVersion().compareTo(GradleVersion.version("5.0")) < 0) { throw new IllegalStateException("This version of the credentials plugin is not compatible with Gradle < 5.0"); } // handle plugin application to settings file and project file if (extensionAware instanceof Settings) { Settings settings = (Settings) extensionAware; init(settings.getGradle(), settings, (String loc) -> settings.getSettingsDir().toPath().resolve(loc).toFile(), NOOP); } else if (extensionAware instanceof Project) { Project project = (Project) extensionAware; init(project.getGradle(), project, project::file, (Pair creds) -> addTasks(creds, project.getTasks())); } else { throw new IllegalStateException("The credentials plugin can only be applied to Settings and Project instances"); } }
Example #2
Source File: GcloudBuildCachePlugin.java From curiostack with MIT License | 5 votes |
@Override public void apply(Settings settings) { settings .getBuildCache() .registerBuildCacheService( CloudStorageBuildCache.class, CloudStorageBuildCacheServiceFactory.class); }
Example #3
Source File: AwsS3PluginTest.java From gradle-s3-build-cache with Apache License 2.0 | 5 votes |
@Test public void testApplyPlugin() { Settings settings = mock(Settings.class); BuildCacheConfiguration conf = mock(BuildCacheConfiguration.class); when(settings.getBuildCache()).thenReturn(conf); AwsS3Plugin plugin = new AwsS3Plugin(); plugin.apply(settings); verify(conf).registerBuildCacheService(AwsS3BuildCache.class, AwsS3BuildCacheServiceFactory.class); }
Example #4
Source File: CuriostackPlugin.java From curiostack with MIT License | 5 votes |
@Override public void apply(Settings settings) { var config = CuriostackExtension.createAndAdd(settings); configureRepositories(settings.getBuildscript().getRepositories()); settings.getPlugins().apply(GcloudBuildCachePlugin.class); var buildCache = settings.getBuildCache(); buildCache.getLocal().setEnabled(!System.getenv().containsKey("CI")); buildCache.remote( CloudStorageBuildCache.class, remote -> { remote.setBucket(config.getBuildCacheBucket()); remote.setPush(System.getenv().containsKey("CI_MASTER")); }); try { settings.apply(c -> c.from("project.settings.gradle.kts")); } catch (Throwable t) { // Ignore failure to apply projects, it usually means missing file. System.out.println("Couldn't apply project.settings.gradle.kts, skipping."); } settings .getGradle() .rootProject( project -> { configureRepositories(project.getBuildscript().getRepositories()); project.getPlugins().apply(CuriostackRootPlugin.class); }); }
Example #5
Source File: BuildLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { SettingsInternal settingsInternal = (SettingsInternal) settings; logger.info(String.format("Settings evaluated using %s.", settingsInternal.getSettingsScript().getDisplayName())); }
Example #6
Source File: BuildProgressFilter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { if (settings.getGradle() == gradle) { logger.settingsEvaluated(); } }
Example #7
Source File: BuildAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { }
Example #8
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { buildProfile.setSettingsEvaluated(timeProvider.getCurrentTime()); }
Example #9
Source File: LayoutCommandLineConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(CommandLineParser parser) { parser.option(NO_SEARCH_UPWARDS, "no-search-upward").hasDescription(String.format("Don't search in parent folders for a %s file.", Settings.DEFAULT_SETTINGS_FILE)); parser.option(PROJECT_DIR, "project-dir").hasArgument().hasDescription("Specifies the start directory for Gradle. Defaults to current directory."); parser.option(GRADLE_USER_HOME, "gradle-user-home").hasArgument().hasDescription("Specifies the gradle user home directory."); }
Example #10
Source File: BaseSettings.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public Settings getSettings() { return this; }
Example #11
Source File: BuildLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { SettingsInternal settingsInternal = (SettingsInternal) settings; logger.info(String.format("Settings evaluated using %s.", settingsInternal.getSettingsScript().getDisplayName())); }
Example #12
Source File: BuildProgressFilter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { if (settings.getGradle() == gradle) { logger.settingsEvaluated(); } }
Example #13
Source File: BuildAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { }
Example #14
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { buildProfile.setSettingsEvaluated(timeProvider.getCurrentTime()); }
Example #15
Source File: LayoutCommandLineConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(CommandLineParser parser) { parser.option(NO_SEARCH_UPWARDS, "no-search-upward").hasDescription(String.format("Don't search in parent folders for a %s file.", Settings.DEFAULT_SETTINGS_FILE)); parser.option(PROJECT_DIR, "project-dir").hasArgument().hasDescription("Specifies the start directory for Gradle. Defaults to current directory."); parser.option(GRADLE_USER_HOME, "gradle-user-home").hasArgument().hasDescription("Specifies the gradle user home directory."); }
Example #16
Source File: BaseSettings.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public Settings getSettings() { return this; }
Example #17
Source File: GradleBuildMetricsCollector.java From gradle-metrics-plugin with Apache License 2.0 | 4 votes |
@Override public void settingsEvaluated(Settings settings) { checkNotNull(settings); initializeBuildMetrics(); buildMetrics.setSettingsEvaluated(clock.getCurrentTime()); }
Example #18
Source File: MetricsSettingsPlugin.java From gradle-metrics-plugin with Apache License 2.0 | 4 votes |
@Override public void apply(Settings settings) { Gradle gradle = settings.getGradle(); applyToGradle(gradle); }
Example #19
Source File: CuriostackExtension.java From curiostack with MIT License | 4 votes |
static CuriostackExtension createAndAdd(Settings settings) { return settings.getExtensions().create(NAME, CuriostackExtension.class); }
Example #20
Source File: BaseSettings.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public Settings getSettings() { return this; }
Example #21
Source File: LayoutCommandLineConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(CommandLineParser parser) { parser.option(NO_SEARCH_UPWARDS, "no-search-upward").hasDescription(String.format("Don't search in parent folders for a %s file.", Settings.DEFAULT_SETTINGS_FILE)); parser.option(PROJECT_DIR, "project-dir").hasArgument().hasDescription("Specifies the start directory for Gradle. Defaults to current directory."); parser.option(GRADLE_USER_HOME, "gradle-user-home").hasArgument().hasDescription("Specifies the gradle user home directory."); }
Example #22
Source File: BuildLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { SettingsInternal settingsInternal = (SettingsInternal) settings; logger.info(String.format("Settings evaluated using %s.", settingsInternal.getSettingsScript().getDisplayName())); }
Example #23
Source File: BuildProgressFilter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { if (settings.getGradle() == gradle) { logger.settingsEvaluated(); } }
Example #24
Source File: BuildAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { }
Example #25
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { buildProfile.setSettingsEvaluated(timeProvider.getCurrentTime()); }
Example #26
Source File: LayoutCommandLineConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(CommandLineParser parser) { parser.option(NO_SEARCH_UPWARDS, "no-search-upward").hasDescription(String.format("Don't search in parent folders for a %s file.", Settings.DEFAULT_SETTINGS_FILE)); parser.option(PROJECT_DIR, "project-dir").hasArgument().hasDescription("Specifies the start directory for Gradle. Defaults to current directory."); parser.option(GRADLE_USER_HOME, "gradle-user-home").hasArgument().hasDescription("Specifies the gradle user home directory."); }
Example #27
Source File: BaseSettings.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public Settings getSettings() { return this; }
Example #28
Source File: AwsS3Plugin.java From gradle-s3-build-cache with Apache License 2.0 | 4 votes |
@Override public void apply(Settings settings) { logger.info("Registering S3 build cache"); BuildCacheConfiguration buildCacheConfiguration = settings.getBuildCache(); buildCacheConfiguration.registerBuildCacheService(AwsS3BuildCache.class, AwsS3BuildCacheServiceFactory.class); }
Example #29
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { buildProfile.setSettingsEvaluated(timeProvider.getCurrentTime()); }
Example #30
Source File: BuildAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void settingsEvaluated(Settings settings) { }