File tree Expand file tree Collapse file tree 6 files changed +119
-12
lines changed
java/net/laprun/sustainability/cli Expand file tree Collapse file tree 6 files changed +119
-12
lines changed Original file line number Diff line number Diff line change 1- name : Native build test
1+ name : Native build
22
33on :
44 workflow_dispatch :
@@ -43,18 +43,14 @@ jobs:
4343
4444 - name : ' Build Native Image'
4545 run : |
46- pushd server
47- mvn -ntp -B --file pom.xml -Pnative package -DskipTests
48- popd
46+ mvn -ntp -B --file pom.xml -Pnative package -DskipTests -pl server,cli
4947
5048 - name : ' Create distribution'
5149 run : |
52- pushd server
53- mvn -ntp -B --file pom.xml -Pdist package -DskipTests
54- popd
50+ mvn -ntp -B --file pom.xml -Pdist package -DskipTests -pl server,cli
5551
5652 - name : ' Upload build artifact'
5753 uses : actions/upload-artifact@v5
5854 with :
5955 name : power-server-${{ runner.os }}-${{ runner.arch }}
60- path : server /target/distributions/*.tar.gz
56+ path : ** /target/distributions/*.tar.gz
Original file line number Diff line number Diff line change @@ -109,15 +109,15 @@ jobs:
109109 - name : ' Set up Java'
110110 uses : actions/setup-java@v5
111111 with :
112- java-version : 17
112+ java-version : 21
113113 distribution : ' temurin'
114114 cache : maven
115115
116116 - name : ' Release with JReleaser'
117117 env :
118118 JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
119119 run : |
120- mvn -ntp -B --file server/ pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release
120+ mvn -ntp -B --file pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release -pl server,cli
121121
122122 - name : ' JReleaser output'
123123 if : always()
Original file line number Diff line number Diff line change 1010 <artifactId >power-server-cli</artifactId >
1111 <name >power-server : cli</name >
1212 <description >A CLI command to measure power consumption of the specified process</description >
13+ <properties >
14+ <distribution .directory>${project.build.directory} /distributions</distribution .directory>
15+ <executable-suffix />
16+ </properties >
1317 <dependencies >
1418 <dependency >
1519 <groupId >net.laprun.sustainability</groupId >
3337 </dependencies >
3438
3539 <build >
40+ <extensions >
41+ <extension >
42+ <groupId >kr.motd.maven</groupId >
43+ <artifactId >os-maven-plugin</artifactId >
44+ <version >${os-maven-plugin.version} </version >
45+ </extension >
46+ </extensions >
3647 <plugins >
3748 <plugin >
3849 <groupId >net.revelc.code.formatter</groupId >
4354 </plugin >
4455 </plugins >
4556 </build >
46-
57+ <profiles >
58+ <profile >
59+ <id >dist</id >
60+ <build >
61+ <plugins >
62+ <plugin >
63+ <artifactId >maven-assembly-plugin</artifactId >
64+ <version >${maven-assembly-plugin.version} </version >
65+ <executions >
66+ <execution >
67+ <id >make-distribution</id >
68+ <phase >package</phase >
69+ <goals >
70+ <goal >single</goal >
71+ </goals >
72+ </execution >
73+ </executions >
74+ <configuration >
75+ <attach >false</attach >
76+ <appendAssemblyId >false</appendAssemblyId >
77+ <finalName >${project.artifactId} -${project.version} -${os.detected.classifier} </finalName >
78+ <outputDirectory >${distribution.directory} </outputDirectory >
79+ <workDirectory >${project.build.directory} /assembly/work</workDirectory >
80+ <descriptors >
81+ <descriptor >src/main/assembly/assembly.xml</descriptor >
82+ </descriptors >
83+ </configuration >
84+ </plugin >
85+ </plugins >
86+ </build >
87+ </profile >
88+ <profile >
89+ <id >dist-windows</id >
90+ <activation >
91+ <os >
92+ <family >windows</family >
93+ </os >
94+ </activation >
95+ <properties >
96+ <executable-suffix >.exe</executable-suffix >
97+ </properties >
98+ </profile >
99+ </profiles >
47100</project >
Original file line number Diff line number Diff line change 1+ <assembly
2+ xmlns =" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd" >
5+ <id >dist</id >
6+ <formats >
7+ <format >tar.gz</format >
8+ </formats >
9+ <files >
10+ <file >
11+ <source >${project.build.directory}/${project.artifactId}-${project.version}-runner${executable-suffix}
12+ </source >
13+ <outputDirectory >./bin</outputDirectory >
14+ <destName >${project.artifactId}${executable-suffix}</destName >
15+ </file >
16+ </files >
17+ </assembly >
Original file line number Diff line number Diff line change 11package net .laprun .sustainability .cli ;
22
3- import java .io .IOException ;
43import java .util .Optional ;
54import java .util .concurrent .TimeUnit ;
65
Original file line number Diff line number Diff line change 340340 </artifact >
341341 </artifacts >
342342 </power-server >
343+ <power-server-cli >
344+ <name >power-server-cli</name >
345+ <stereotype >CLI</stereotype >
346+ <executable >
347+ <name >power</name >
348+ </executable >
349+ <type >BINARY</type >
350+ <brew >
351+ <active >RELEASE</active >
352+ <multiPlatform >true</multiPlatform >
353+ </brew >
354+ <sdkman >
355+ <active >RELEASE</active >
356+ </sdkman >
357+ <artifacts >
358+ <artifact >
359+ <path >{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz</path >
360+ <transform >artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.tar.gz</transform >
361+ <platform >linux-x86_64</platform >
362+ </artifact >
363+ <!-- <artifact>
364+ <path>
365+ {{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip
366+ </path>
367+ <transform>
368+ artifacts/{{distributionName}}-{{projectEffectiveVersion}}-windows-x86_64.zip
369+ </transform>
370+ <platform>windows-x86_64</platform>
371+ </artifact>-->
372+ <artifact >
373+ <path >{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.tar.gz</path >
374+ <transform >artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.tar.gz</transform >
375+ <platform >osx-x86_64</platform >
376+ </artifact >
377+ <artifact >
378+ <path >{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-aarch_64.tar.gz</path >
379+ <transform >
380+ {{artifactsDir}}/{{distributionName}}-{{projectEffectiveVersion}}-osx-aarch_64.tar.gz</transform >
381+ <platform >osx-aarch_64</platform >
382+ </artifact >
383+ </artifacts >
384+ </power-server-cli >
343385 </distributions >
344386 </jreleaser >
345387 </configuration >
You can’t perform that action at this time.
0 commit comments