-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#29] read the version from processed resources
this way the version is actually the version from the plugin's project and not the version of the project to which the plugin is being applied
- Loading branch information
Showing
6 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package apifi | ||
|
||
import groovy.transform.CompileStatic | ||
|
||
@CompileStatic | ||
class VersionLoader { | ||
static final String VERSION_PROPERTIES_PATH = "/version.properties" | ||
|
||
private static String load() { | ||
def stream = VersionLoader.getResourceAsStream(VERSION_PROPERTIES_PATH) | ||
if (stream == null) { | ||
throw new RuntimeException("""\ | ||
Could not load version.properties. | ||
This could happen when plugin jar is deleted | ||
Try Stopping Gradle Daemon (gradle --stop)""".stripIndent()) | ||
} | ||
final Properties versions = new Properties() | ||
versions.load(stream); | ||
|
||
return versions['project.version'] ?: 'unspecified' | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
def apifiVersion = apifi.VersionLoader.load() | ||
|
||
dependencies { | ||
implementation(group: 'com.medly.apifi', name: 'runtime', version: this.getVersion()) | ||
implementation(group: 'com.medly.apifi', name: 'runtime', version: apifiVersion) | ||
} | ||
|
||
tasks.register('apifi', apifi.ApifiCodegen) |
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 @@ | ||
project.version=${projectVersion} |