51 throw new RuntimeException("Unknown operating system: " + System.getProperty("os.name"));
52 }
53
54 private static String getCPU() {
55 var p = System.getProperty("os.arch").toLowerCase();
56 if (p.startsWith("amd64") || p.startsWith("x86_64") || p.startsWith("x64")) {
57 return "x64";
58 }
59 if (p.startsWith("x86") || p.startsWith("i386")) {
60 return "x86";
61 }
62 if (p.startsWith("sparc")) {
63 return "sparc";
64 }
65 if (p.startsWith("ppc")) {
66 return "ppc";
67 }
68 if (p.startsWith("arm")) {
69 return "arm";
70 }
71
72 throw new RuntimeException("Unknown CPU: " + System.getProperty("os.arch"));
73 }
74
75 @Override
76 public void apply(Project project) {
77 NamedDomainObjectContainer<ImageEnvironment> imageEnvironmentContainer =
78 project.container(ImageEnvironment.class, new NamedDomainObjectFactory<ImageEnvironment>() {
79 public ImageEnvironment create(String name) {
80 return new ImageEnvironment(name, project.getObjects());
81 }
82 });
83 project.getExtensions().add("images", imageEnvironmentContainer);
84
85 var projectPath = project.getPath();
86 var taskNames = new ArrayList<String>();
87 var rootDir = project.getRootDir().toPath().toAbsolutePath();
88 var buildDir = project.getBuildDir().toPath().toAbsolutePath();
89
90 imageEnvironmentContainer.all(new Action<ImageEnvironment>() {
|
51 throw new RuntimeException("Unknown operating system: " + System.getProperty("os.name"));
52 }
53
54 private static String getCPU() {
55 var p = System.getProperty("os.arch").toLowerCase();
56 if (p.startsWith("amd64") || p.startsWith("x86_64") || p.startsWith("x64")) {
57 return "x64";
58 }
59 if (p.startsWith("x86") || p.startsWith("i386")) {
60 return "x86";
61 }
62 if (p.startsWith("sparc")) {
63 return "sparc";
64 }
65 if (p.startsWith("ppc")) {
66 return "ppc";
67 }
68 if (p.startsWith("arm")) {
69 return "arm";
70 }
71 if (p.startsWith("aarch64")) {
72 return "aarch64";
73 }
74
75 throw new RuntimeException("Unknown CPU: " + System.getProperty("os.arch"));
76 }
77
78 @Override
79 public void apply(Project project) {
80 NamedDomainObjectContainer<ImageEnvironment> imageEnvironmentContainer =
81 project.container(ImageEnvironment.class, new NamedDomainObjectFactory<ImageEnvironment>() {
82 public ImageEnvironment create(String name) {
83 return new ImageEnvironment(name, project.getObjects());
84 }
85 });
86 project.getExtensions().add("images", imageEnvironmentContainer);
87
88 var projectPath = project.getPath();
89 var taskNames = new ArrayList<String>();
90 var rootDir = project.getRootDir().toPath().toAbsolutePath();
91 var buildDir = project.getBuildDir().toPath().toAbsolutePath();
92
93 imageEnvironmentContainer.all(new Action<ImageEnvironment>() {
|