use of com.google.cloud.tools.jib.gradle.GradleProjectProperties in project jib by GoogleContainerTools.
the class SyncMapTask method listFilesAndTargets.
/**
* Task Action, lists files and container targets.
*/
@TaskAction
public void listFilesAndTargets() {
Preconditions.checkNotNull(jibExtension);
try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {
GradleProjectProperties projectProperties = GradleProjectProperties.getForProject(getProject(), getLogger(), tempDirectoryProvider, jibExtension.getConfigurationName().get());
GradleRawConfiguration configuration = new GradleRawConfiguration(jibExtension);
// TODO: move these shared checks with SyncMapMojo into plugins-common
if (projectProperties.isWarProject()) {
throw new GradleException("Skaffold sync is currently only available for 'jar' style Jib projects, but the project " + getProject().getName() + " is configured to generate a 'war'");
}
try {
if (!ContainerizingMode.EXPLODED.equals(ContainerizingMode.from(jibExtension.getContainerizingMode()))) {
throw new GradleException("Skaffold sync is currently only available for Jib projects in 'exploded' containerizing mode, but the containerizing mode of " + getProject().getName() + " is '" + jibExtension.getContainerizingMode() + "'");
}
} catch (InvalidContainerizingModeException ex) {
throw new GradleException("Invalid containerizing mode", ex);
}
try {
String syncMapJson = PluginConfigurationProcessor.getSkaffoldSyncMap(configuration, projectProperties, jibExtension.getSkaffold().getSync().getExcludes());
System.out.println();
System.out.println("BEGIN JIB JSON: SYNCMAP/1");
System.out.println(syncMapJson);
} catch (Exception ex) {
throw new GradleException("Failed to generate a Jib file map for sync with Skaffold", ex);
}
}
}
use of com.google.cloud.tools.jib.gradle.GradleProjectProperties in project jib by google.
the class SyncMapTask method listFilesAndTargets.
/**
* Task Action, lists files and container targets.
*/
@TaskAction
public void listFilesAndTargets() {
Preconditions.checkNotNull(jibExtension);
try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {
GradleProjectProperties projectProperties = GradleProjectProperties.getForProject(getProject(), getLogger(), tempDirectoryProvider, jibExtension.getConfigurationName().get());
GradleRawConfiguration configuration = new GradleRawConfiguration(jibExtension);
// TODO: move these shared checks with SyncMapMojo into plugins-common
if (projectProperties.isWarProject()) {
throw new GradleException("Skaffold sync is currently only available for 'jar' style Jib projects, but the project " + getProject().getName() + " is configured to generate a 'war'");
}
try {
if (!ContainerizingMode.EXPLODED.equals(ContainerizingMode.from(jibExtension.getContainerizingMode()))) {
throw new GradleException("Skaffold sync is currently only available for Jib projects in 'exploded' containerizing mode, but the containerizing mode of " + getProject().getName() + " is '" + jibExtension.getContainerizingMode() + "'");
}
} catch (InvalidContainerizingModeException ex) {
throw new GradleException("Invalid containerizing mode", ex);
}
try {
String syncMapJson = PluginConfigurationProcessor.getSkaffoldSyncMap(configuration, projectProperties, jibExtension.getSkaffold().getSync().getExcludes());
System.out.println();
System.out.println("BEGIN JIB JSON: SYNCMAP/1");
System.out.println(syncMapJson);
} catch (Exception ex) {
throw new GradleException("Failed to generate a Jib file map for sync with Skaffold", ex);
}
}
}
Aggregations