S101PluginExtension.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright 2002-2021 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package s101;
  17. import java.io.File;
  18. import org.gradle.api.Project;
  19. import org.gradle.api.provider.Property;
  20. import org.gradle.api.tasks.Input;
  21. import org.gradle.api.tasks.InputDirectory;
  22. public class S101PluginExtension {
  23. private final Property<File> licenseDirectory;
  24. private final Property<File> installationDirectory;
  25. private final Property<File> configurationDirectory;
  26. private final Property<String> label;
  27. @InputDirectory
  28. public Property<File> getLicenseDirectory() {
  29. return this.licenseDirectory;
  30. }
  31. public void setLicenseDirectory(String licenseDirectory) {
  32. this.licenseDirectory.set(new File(licenseDirectory));
  33. }
  34. @InputDirectory
  35. public Property<File> getInstallationDirectory() {
  36. return this.installationDirectory;
  37. }
  38. public void setInstallationDirectory(String installationDirectory) {
  39. this.installationDirectory.set(new File(installationDirectory));
  40. }
  41. @InputDirectory
  42. public Property<File> getConfigurationDirectory() {
  43. return this.configurationDirectory;
  44. }
  45. public void setConfigurationDirectory(String configurationDirectory) {
  46. this.configurationDirectory.set(new File(configurationDirectory));
  47. }
  48. @Input
  49. public Property<String> getLabel() {
  50. return this.label;
  51. }
  52. public void setLabel(String label) {
  53. this.label.set(label);
  54. }
  55. public S101PluginExtension(Project project) {
  56. this.licenseDirectory = project.getObjects().property(File.class)
  57. .convention(new File(System.getProperty("user.home") + "/.Structure101/java"));
  58. this.installationDirectory = project.getObjects().property(File.class)
  59. .convention(new File(project.getBuildDir(), "s101"));
  60. this.configurationDirectory = project.getObjects().property(File.class)
  61. .convention(new File(project.getProjectDir(), "s101"));
  62. this.label = project.getObjects().property(String.class);
  63. if (project.hasProperty("s101.label")) {
  64. setLabel((String) project.findProperty("s101.label"));
  65. }
  66. }
  67. }