-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed git properties in code; improve AFSocket.getVersion, selftest
By embedding the actual git commit information and project version into the Java code, we can make debugging a lot easier, especially in environments that don't keep the META-INF files around that we relied upon earlier (e.g., Android). This relies on latest changes in kohlschutter-parent 1.5.5-SNAPSHOT, which is required for building junixsocket.
- Loading branch information
1 parent
a6dcf52
commit b332b9d
Showing
5 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...ocket-common/src/main/java-unresolved-properties/org/newsclub/net/unix/GitProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* junixsocket | ||
* | ||
* Copyright 2009-2023 Christian Kohlschütter | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.newsclub.net.unix; | ||
|
||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Git properties that are populated upon build time. | ||
* | ||
* Also see {@code src/main/unresolved-java/.../GitProperties.java} | ||
* | ||
* @author Christian Kohlschütter | ||
*/ | ||
final class GitProperties { | ||
private static final Map<String, String> MAP = new LinkedHashMap<>(); | ||
|
||
static { | ||
MAP.put("git.build.version", "${git.build.version}"); // junixsocket version | ||
MAP.put("git.commit.id.abbrev", "${git.commit.id.abbrev}"); | ||
MAP.put("git.commit.id.describe", "${git.commit.id.abbrev}"); | ||
MAP.put("git.commit.id.full", "${git.commit.id.full}"); | ||
MAP.put("git.commit.time", "${git.commit.time}"); | ||
MAP.put("git.dirty", "${git.dirty}"); | ||
} | ||
|
||
private GitProperties() { | ||
throw new IllegalStateException("No instances"); | ||
} | ||
|
||
static Map<String, String> getGitProperties() { | ||
return Collections.unmodifiableMap(MAP); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters