Skip to content

Commit 7060cc8

Browse files
committed
Fix #4
1 parent 83f633b commit 7060cc8

File tree

4 files changed

+53
-36
lines changed

4 files changed

+53
-36
lines changed

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Or you can depend on the artifacts from maven central, they should be slightly m
4141
```xml
4242
<dependency>
4343
<groupId>me.bechberger</groupId>
44-
<artifactId>ap-loader</artifactId>
45-
<version>2.9-2-all</version>
44+
<artifactId>ap-loader-all</artifactId>
45+
<version>2.9-3</version>
4646
</dependency>
4747
```
4848

@@ -184,20 +184,28 @@ The converters reside in the `one.converter` package.
184184
```xml
185185
<dependency>
186186
<groupId>me.bechberger</groupId>
187-
<artifactId>ap-loader</artifactId>
188-
<version>version-variant</version>
187+
<artifactId>ap-loader-variant</artifactId>
188+
<version>version</version>
189189
</dependency>
190190
```
191191
192-
### Snapshots
192+
The latest `all` version can be added via:
193193
194-
We currently only release to snapshot, as the API is not stable yet.
194+
```xml
195+
<dependency>
196+
<groupId>me.bechberger</groupId>
197+
<artifactId>ap-loader-all</artifactId>
198+
<version>2.9-3</version>
199+
</dependency>
200+
```
201+
202+
### Snapshots
195203
196204
```xml
197205
<dependency>
198206
<groupId>me.bechberger</groupId>
199-
<artifactId>ap-loader</artifactId>
200-
<version>version-variant-SNAPSHOT</version>
207+
<artifactId>ap-loader-variant</artifactId>
208+
<version>version-SNAPSHOT</version>
201209
</dependency>
202210
```
203211
@@ -206,8 +214,8 @@ For example for the `all` variant of version 2.9:
206214
```xml
207215
<dependency>
208216
<groupId>me.bechberger</groupId>
209-
<artifactId>ap-loader</artifactId>
210-
<version>2.9-all-SNAPSHOT</version>
217+
<artifactId>ap-loader-all</artifactId>
218+
<version>2.9-3-SNAPSHOT</version>
211219
</dependency>
212220
```
213221
@@ -244,11 +252,11 @@ python3 ./bin/releaser.py download 2.9
244252
# build the JAR for the release
245253
# maven might throw warnings, related to the project version setting,
246254
# but the alternative solutions don't work, so we ignore the warning for now
247-
mvn -Dproject.vversion=2.9-macos -Dproject.subrelease=2 -Dproject.platform=macos package assembly:single
255+
mvn -Dproject.vversion=2.9 -Dproject.subrelease=3 -Dproject.platform=macos package assembly:single
248256
# use it
249-
java -jar target/ap-loader-2.9-2-macos-full.jar ...
257+
java -jar target/ap-loader-macos-2.9-3-full.jar ...
250258
# build the all JAR
251-
mvn -Dproject.vversion=2.9 -Dproject.subrelease=2 -Dproject.platform=all package assembly:single
259+
mvn -Dproject.vversion=2.9 -Dproject.subrelease=3 -Dproject.platform=all package assembly:single
252260
```
253261
254262
Development
@@ -293,6 +301,11 @@ And the following for a new async-profiler release:
293301
Changelog
294302
---------
295303
304+
### v3
305+
306+
- Create specific artifacts for each platform fixing previous issues with maven version updates (issue #4, thanks @ginkel for reporting it)
307+
308+
296309
### v2
297310
- Fixed the library version in the pom #3 again
298311
(thanks to @gavlyukovskiy, @dpsoft and @krzysztofslusarski for spotting the bug)

bin/releaser.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from typing import Any, Dict, List, Union, Tuple, Optional
1818
from urllib import request
1919

20-
SUB_VERSION = 2
21-
RELEASE_NOTES = """- Fixed the library version in the pom #3 again (thanks to @gavlyukovskiy, @dpsoft and @krzysztofslusarski for spotting the bug)"""
20+
SUB_VERSION = 3
21+
RELEASE_NOTES = """- Create specific artifacts for each platform fixing previous issues with maven version updates (issue #4, thanks @ginkel for reporting it)"""
2222

2323
HELP = """
2424
Usage:
@@ -49,14 +49,16 @@ def prepare_poms(release: str, platform: str, snapshot: bool = True) -> Tuple[st
4949
""" Prepare the POMs for the given release and platform """
5050
folder = CURRENT_DIR
5151
os.makedirs(folder, exist_ok=True)
52-
suffix = f"-{release}-{platform}{'-SNAPSHOT' if snapshot else ''}"
52+
suffix = f"-{release}{'-SNAPSHOT' if snapshot else ''}"
5353
for pom in ["pom", "pom_all"]:
5454
pom_file = f"{CURRENT_DIR}/{pom}.xml"
5555
dest_pom = f"{folder}/{pom}{suffix}.xml"
5656
with open(pom_file) as f:
5757
pom_content = f.read()
5858
p_suffix = "-SNAPSHOT" if snapshot else ""
59-
pom_content = re.sub(r"<version>.*</version>", f"<version>{release}-{SUB_VERSION}-{platform}{p_suffix}</version>", pom_content, count = 1)
59+
pom_content = re.sub(r"<version>.*</version>", f"<version>{release}-{SUB_VERSION}{p_suffix}</version>", pom_content, count = 1)
60+
pom_content = pom_content.replace("${project.platform}", platform)
61+
pom_content = pom_content.replace("${project.artifactId}", f"ap-loader-{platform}")
6062
pom_content = re.sub(r"<project.vversion>.*</project.vversion>", f"<project.vversion>{release}</project.vversion>", pom_content, count = 1)
6163
pom_content = re.sub(r"<project.subversion>.*</project.subversion>", f"<project.subversion>{SUB_VERSION}</project.subversion>", pom_content, count = 1)
6264
pom_content = re.sub(r"<project.platform>.*</project.platform>", f"<project.platform>{platform}</project.platform>", pom_content, count = 1)
@@ -175,7 +177,7 @@ def download_release(release: str):
175177

176178

177179
def release_target_file(release: str, platform: str):
178-
return f"{CURRENT_DIR}/releases/ap-loader-{release}-{SUB_VERSION}-{platform}.jar"
180+
return f"{CURRENT_DIR}/releases/ap-loader-{platform}-{release}-{SUB_VERSION}.jar"
179181

180182

181183
def build_release(release: str):
@@ -184,15 +186,15 @@ def build_release(release: str):
184186
os.makedirs(release_folder, exist_ok=True)
185187
download_release(release)
186188
for platform in get_release_platforms(release):
187-
release_file = f"ap-loader-{release}-{SUB_VERSION}-{platform}-full.jar"
188-
dest_release_file = f"{release_folder}/ap-loader-{release}-{SUB_VERSION}-{platform}.jar"
189+
release_file = f"ap-loader-{platform}-{release}-{SUB_VERSION}-full.jar"
190+
dest_release_file = f"{release_folder}/ap-loader-{platform}-{release}-{SUB_VERSION}.jar"
189191
print(f"Build release for {platform}")
190-
execute(f"mvn -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform={platform} package assembly:single")
192+
execute(f"mvn -Duser.name='' -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform={platform} package assembly:single")
191193
shutil.copy(f"{CURRENT_DIR}/target/{release_file}", dest_release_file)
192194
all_target = release_target_file(release, "all")
193195
print("Build release for all")
194-
execute(f"mvn -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform=all package assembly:single -f pom_all.xml")
195-
shutil.copy(f"{CURRENT_DIR}/target/ap-loader-{release}-{SUB_VERSION}-all-full.jar", all_target)
196+
execute(f"mvn -Duser.name='' -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform=all package assembly:single -f pom_all.xml")
197+
shutil.copy(f"{CURRENT_DIR}/target/ap-loader-all-{release}-{SUB_VERSION}-full.jar", all_target)
196198

197199

198200
def build_tests(release: str):
@@ -310,7 +312,7 @@ def deploy_maven_platform(release: str, platform: str, snapshot: bool):
310312
print(f"Deploy {release}-{SUB_VERSION} for {platform} to maven")
311313
with PreparedPOMs(release, platform, snapshot) as poms:
312314
pom = poms.pom_all if platform == "all" else poms.pom
313-
cmd = f"mvn -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform={platform} " \
315+
cmd = f"mvn -Duser.name='' -Dproject.vversion={release} -Dproject.subversion={SUB_VERSION} -Dproject.platform={platform} " \
314316
f"-Dproject.suffix='{'-SNAPSHOT' if snapshot else ''}' -f {pom} clean deploy"
315317
try:
316318
subprocess.check_call(cmd, shell=True, cwd=CURRENT_DIR, stdout=subprocess.DEVNULL,
@@ -343,7 +345,7 @@ def deploy_github(release: str):
343345
title = f"Loader for {release} (v{SUB_VERSION}): {get_release(release)['name']}"
344346
prerelease = get_release(release)["prerelease"]
345347
print(f"Deploy {release}-{SUB_VERSION} ({title}) to GitHub")
346-
if not os.path.exists(f"{CURRENT_DIR}/releases/ap-loader-{release}-{SUB_VERSION}-all.jar"):
348+
if not os.path.exists(f"{CURRENT_DIR}/releases/ap-loader-all-{release}-{SUB_VERSION}.jar"):
347349
build_release(release)
348350
with tempfile.TemporaryDirectory() as d:
349351
changelog_file = f"{d}/CHANGELOG.md"
@@ -354,7 +356,7 @@ def deploy_github(release: str):
354356
platform_paths = []
355357
for platform in get_release_platforms(release) + ["all"]:
356358
path = f"{d}/ap-loader-{platform}.jar"
357-
shutil.copy(f"{releases_dir}/ap-loader-{release}-{SUB_VERSION}-{platform}.jar", path)
359+
shutil.copy(f"{releases_dir}/ap-loader-{platform}-{release}-{SUB_VERSION}.jar", path)
358360
platform_paths.append(path)
359361

360362
flags_str = f"-F {changelog_file} -t '{title}' {'--latest' if is_latest else ''}" \

pom.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66
<name>ap-loader</name>
77
<groupId>me.bechberger</groupId>
8-
<artifactId>ap-loader</artifactId>
9-
<version>${project.vversion}-${project.subversion}-${project.platform}${project.suffix}</version>
8+
<artifactId>ap-loader-${project.platform}</artifactId>
9+
<version>${project.vversion}-${project.subversion}-${project.suffix}</version>
1010
<url>https://github.com/jvm-profiling-tools/ap-loader</url>
1111
<licenses>
1212
<license>
@@ -116,19 +116,20 @@
116116
<mainClass>one.profiler.AsyncProfilerLoader</mainClass>
117117
</manifest>
118118
<manifestEntries>
119+
<Built-By>Johannes Bechberger</Built-By>
119120
<Agent-Class>one.profiler.AsyncProfilerLoader</Agent-Class>
120121
<Premain-Class>one.profiler.AsyncProfilerLoader</Premain-Class>
121-
<Specification-Title>ap-loader</Specification-Title>
122+
<Specification-Title>ap-loader-${project.platform}</Specification-Title>
122123
<Specification-Version>${project.version}</Specification-Version>
123-
<Implementation-Title>ap-loader</Implementation-Title>
124+
<Implementation-Title>ap-loader-${project.platform}</Implementation-Title>
124125
<Implementation-Version>${project.version}</Implementation-Version>
125126
<Implementation-Vendor-Id>me.bechberger</Implementation-Vendor-Id>
126127
</manifestEntries>
127128
</archive>
128129
<descriptorRefs>
129130
<descriptorRef>jar-with-dependencies</descriptorRef>
130131
</descriptorRefs>
131-
<finalName>${project.artifactId}-${project.vversion}-${project.subversion}-${project.platform}-full</finalName>
132+
<finalName>${project.artifactId}-${project.vversion}-${project.subversion}-full</finalName>
132133
<appendAssemblyId>false</appendAssemblyId>
133134
</configuration>
134135
</plugin>

pom_all.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66
<name>ap-loader</name>
77
<groupId>me.bechberger</groupId>
8-
<artifactId>ap-loader</artifactId>
9-
<version>${project.vversion}-${project.subversion}-${project.platform}${project.suffix}</version>
8+
<artifactId>ap-loader-${project.platform}</artifactId>
9+
<version>${project.vversion}-${project.subversion}</version>
1010
<url>https://github.com/jvm-profiling-tools/ap-loader</url>
1111
<licenses>
1212
<license>
@@ -116,19 +116,20 @@
116116
<mainClass>one.profiler.AsyncProfilerLoader</mainClass>
117117
</manifest>
118118
<manifestEntries>
119+
<Built-By>Johannes Bechberger</Built-By>
119120
<Agent-Class>one.profiler.AsyncProfilerLoader</Agent-Class>
120121
<Premain-Class>one.profiler.AsyncProfilerLoader</Premain-Class>
121-
<Specification-Title>ap-loader</Specification-Title>
122+
<Specification-Title>ap-loader-${project.platform}</Specification-Title>
122123
<Specification-Version>${project.version}</Specification-Version>
123-
<Implementation-Title>ap-loader</Implementation-Title>
124+
<Implementation-Title>ap-loader-${project.platform}</Implementation-Title>
124125
<Implementation-Version>${project.version}</Implementation-Version>
125126
<Implementation-Vendor-Id>me.bechberger</Implementation-Vendor-Id>
126127
</manifestEntries>
127128
</archive>
128129
<descriptorRefs>
129130
<descriptorRef>jar-with-dependencies</descriptorRef>
130131
</descriptorRefs>
131-
<finalName>${project.artifactId}-${project.vversion}-${project.subversion}-${project.platform}-full</finalName>
132+
<finalName>${project.artifactId}-${project.vversion}-${project.subversion}-full</finalName>
132133
<appendAssemblyId>false</appendAssemblyId>
133134
</configuration>
134135
</plugin>

0 commit comments

Comments
 (0)