Skip to content

Commit c4be3fe

Browse files
authored
Merge pull request #210358 from Homebrew/nexus-arm
nexus: build with brew `node` and `yarn`
2 parents adbdc4b + dc4b62e commit c4be3fe

File tree

1 file changed

+86
-25
lines changed

1 file changed

+86
-25
lines changed

Formula/n/nexus.rb

Lines changed: 86 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@ class Nexus < Formula
1414
end
1515

1616
bottle do
17-
sha256 cellar: :any_skip_relocation, sonoma: "8382a3070ff6768a2f9946744a34875ab23981068beecb5339e02b0afadab719"
18-
sha256 cellar: :any_skip_relocation, ventura: "a5684351606c7ea7750ce7934fcea0d3e6b64f50fa0d9739c07e33f96288151b"
19-
sha256 cellar: :any_skip_relocation, x86_64_linux: "30c5f8c306c9382151e2ad703e505a6353beba3b09359f8f7b4be440b3ae591a"
17+
rebuild 1
18+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "283afcee917edb48dc89401fbde2f2e2e7ef6f4f3a4b2f0c0aeb1a13977482c9"
19+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "11fc02e55b326e2d714610e13cddc965cf404eb7e9a94d33789676bc03076670"
20+
sha256 cellar: :any_skip_relocation, arm64_ventura: "824cffac4a9810625e41bc140f5656bfaa255851c0b6a475374daf1b5503b906"
21+
sha256 cellar: :any_skip_relocation, sonoma: "03908a16b05b89f03316b1d2113f7f9b0d23e35c8b362fca047af78b0577e806"
22+
sha256 cellar: :any_skip_relocation, ventura: "17e647b341d6e2d8e8d5b55695403320eb099f7d7708b56a349e8ab4d76f5a9e"
23+
sha256 cellar: :any_skip_relocation, x86_64_linux: "c8d153097684ef3d932e1c2ed8c77113a12a1102c9c60f862acbb7ada2b8ef33"
2024
end
2125

2226
depends_on "maven" => :build
27+
depends_on "node" => :build
28+
depends_on "yarn" => :build
2329
depends_on "openjdk@17"
2430

2531
uses_from_macos "unzip" => :build
2632

27-
on_macos do
28-
depends_on arch: :x86_64 # due to node binary fetched by frontend-maven-plugin
29-
end
33+
# Avoid downloading copies of node and yarn
34+
patch :DATA
3035

3136
def install
3237
# Workaround build error: Couldn't find package "@sonatype/nexus-ui-plugin@workspace:*"
@@ -36,42 +41,98 @@ def install
3641
'"@sonatype/nexus-ui-plugin": "workspace:*"',
3742
'"@sonatype/nexus-ui-plugin": "*"'
3843

39-
ENV["JAVA_HOME"] = Language::Java.java_home("17")
44+
java_version = "17"
45+
ENV["JAVA_HOME"] = Language::Java.java_home(java_version)
46+
java_env = Language::Java.overridable_java_home_env(java_version)
47+
java_env.merge!(KARAF_DATA: "${NEXUS_KARAF_DATA:-#{var}/nexus}",
48+
KARAF_LOG: var/"log/nexus",
49+
KARAF_ETC: pkgetc)
50+
51+
with_env(SKIP_YARN_COREPACK_CHECK: "1") do
52+
system "yarn", "install", "--immutable"
53+
system "yarn", "workspaces", "run", "build-all"
54+
end
55+
4056
system "mvn", "install", "-DskipTests", "-Dpublic"
4157
system "unzip", "-o", "-d", "target", "assemblies/nexus-base-template/target/nexus-base-template-#{version}.zip"
4258

4359
rm(Dir["target/nexus-base-template-#{version}/bin/*.bat"])
4460
rm_r("target/nexus-base-template-#{version}/bin/contrib")
4561
libexec.install Dir["target/nexus-base-template-#{version}/*"]
46-
47-
env = {
48-
JAVA_HOME: ENV["JAVA_HOME"],
49-
KARAF_DATA: "${NEXUS_KARAF_DATA:-#{var}/nexus}",
50-
KARAF_LOG: "#{var}/log/nexus",
51-
KARAF_ETC: "#{etc}/nexus",
52-
}
53-
54-
(bin/"nexus").write_env_script libexec/"bin/nexus", env
62+
(bin/"nexus").write_env_script libexec/"bin/nexus", java_env
5563
end
5664

5765
def post_install
58-
mkdir_p "#{var}/log/nexus" unless (var/"log/nexus").exist?
59-
mkdir_p "#{var}/nexus" unless (var/"nexus").exist?
60-
mkdir "#{etc}/nexus" unless (etc/"nexus").exist?
66+
(var/"log/nexus").mkpath unless (var/"log/nexus").exist?
67+
(var/"nexus").mkpath unless (var/"nexus").exist?
68+
pkgetc.mkpath unless pkgetc.exist?
6169
end
6270

6371
service do
6472
run [opt_bin/"nexus", "start"]
6573
end
6674

6775
test do
68-
mkdir "data"
69-
fork do
70-
ENV["NEXUS_KARAF_DATA"] = testpath/"data"
71-
exec bin/"nexus", "server"
72-
end
76+
port = free_port
77+
(testpath/"data/etc/nexus.properties").write "application-port=#{port}"
78+
pid = spawn({ "NEXUS_KARAF_DATA" => testpath/"data" }, bin/"nexus", "server")
7379
sleep 50
7480
sleep 50 if OS.mac? && Hardware::CPU.intel?
75-
assert_match "<title>Sonatype Nexus Repository</title>", shell_output("curl --silent --fail http://localhost:8081")
81+
assert_match "<title>Sonatype Nexus Repository</title>", shell_output("curl --silent --fail http://localhost:#{port}")
82+
ensure
83+
Process.kill "TERM", pid
84+
Process.wait pid
7685
end
7786
end
87+
88+
__END__
89+
diff --git a/plugins/nexus-coreui-plugin/pom.xml b/plugins/nexus-coreui-plugin/pom.xml
90+
index 9b8325fd98..2a58a07afe 100644
91+
--- a/plugins/nexus-coreui-plugin/pom.xml
92+
+++ b/plugins/nexus-coreui-plugin/pom.xml
93+
@@ -172,7 +172,7 @@
94+
<artifactId>karaf-maven-plugin</artifactId>
95+
</plugin>
96+
97+
- <plugin>
98+
+ <!--plugin>
99+
<groupId>com.github.eirslett</groupId>
100+
<artifactId>frontend-maven-plugin</artifactId>
101+
102+
@@ -212,12 +212,12 @@
103+
</goals>
104+
<phase>test</phase>
105+
<configuration>
106+
- <arguments>test --reporters=jest-junit --reporters=default</arguments>
107+
+ <arguments>test -reporters=jest-junit -reporters=default</arguments>
108+
<skip>${npm.skipTests}</skip>
109+
</configuration>
110+
</execution>
111+
</executions>
112+
- </plugin>
113+
+ </plugin-->
114+
</plugins>
115+
</build>
116+
117+
diff --git a/pom.xml b/pom.xml
118+
index 6647497628..d99148b421 100644
119+
--- a/pom.xml
120+
+++ b/pom.xml
121+
@@ -877,7 +877,7 @@
122+
</executions>
123+
</plugin>
124+
125+
- <plugin>
126+
+ <!--plugin>
127+
<groupId>com.github.eirslett</groupId>
128+
<artifactId>frontend-maven-plugin</artifactId>
129+
<version>1.11.3</version>
130+
@@ -932,7 +932,7 @@
131+
</configuration>
132+
</execution>
133+
</executions>
134+
- </plugin>
135+
+ </plugin-->
136+
137+
<plugin>
138+
<groupId>com.mycila</groupId>

0 commit comments

Comments
 (0)